-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathMakefile
54 lines (36 loc) · 1.23 KB
/
Makefile
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
CC = gcc
CFLAGS = -Wall -Wextra
ARCHIVE_COBJS = hash-table.o _ht-node.o _ht-table.o hash-table-hasher.o
COBJS = $(ARCHIVE_COBJS)
ARCHIVES = libhash-table.a
LL_ARCHIVE_RAW = liblinked-list.a
LL_ARCHIVE = linked-list/$(LL_ARCHIVE_RAW)
default: all
$(COBJS): %.o: %.c
$(COBJS): linked-list-submodule
hash-table.o: hash-table.h _ht-node.h _ht-table.h
_ht-node.o: hash-table.h _ht-node.h
_ht-table.o: hash-table.h _ht-node.h _ht-table.h
hash-table-hasher.o: hash-table.h _ht-node.h
all: all-objs all-archives
all-objs: $(COBJS)
all-archives: $(ARCHIVES)
libhash-table.a: $(ARCHIVE_COBJS) $(LL_ARCHIVE)
cp $(LL_ARCHIVE) $@
$(AR) r $@ $(ARCHIVE_COBJS)
clean-objs:
$(RM) $(COBJS)
clean-archives:
$(RM) $(ARCHIVES)
clean: clean-objs clean-archives
$(MAKE) -C linked-list/ RM="$(RM)" clean
debug: CPPFLAGS += -DDEBUG
debug: CFLAGS += -g
debug: all-objs all-archives
$(LL_ARCHIVE): linked-list-submodule
$(MAKE) -C linked-list/ CC="$(CC)" CFLAGS="$(CFLAGS)" CPPFLAGS="$(CPPFLAGS)" LDFLAGS="$(LDFLAGS)" $(LL_ARCHIVE_RAW)
linked-list-submodule: | linked-list/linked-list.h
linked-list/linked-list.h:
git submodule init
git submodule update
.PHONY: all all-objs all-archives clean-objs clean-archives clean default debug linked-list-submodule