timers: implementation of lazily-ordered timers.
[ccan] / Makefile-ccan
1 # Example makefile which makes a "libccan.a" of everything under ccan/.
2 # For simple projects you could just do:
3 #       SRCFILES += $(wildcard ccan/*/*.c)
4
5 #CCAN_CFLAGS=-g -O3 -Wall -Wstrict-prototypes -Wold-style-definition -Wmissing-prototypes -Wmissing-declarations -Wpointer-arith -Wwrite-strings -Wundef -DCCAN_STR_DEBUG=1
6 CCAN_CFLAGS=-g3 -ggdb -Wall -Wstrict-prototypes -Wold-style-definition -Wmissing-prototypes -Wmissing-declarations -Wpointer-arith -Wwrite-strings -Wundef -DCCAN_STR_DEBUG=1
7 CFLAGS = $(CCAN_CFLAGS) -I. $(DEPGEN)
8
9 # Modules which are just a header:
10 MODS_NO_SRC := alignof \
11         array_size \
12         asearch \
13         build_assert \
14         bytestring \
15         cast \
16         check_type \
17         compiler \
18         container_of \
19         darray \
20         endian \
21         objset \
22         short_types \
23         tcon \
24         tlist \
25         typesafe_cb \
26         version
27
28 # No external dependencies, with C code:
29 MODS_WITH_SRC := antithread \
30         antithread/alloc \
31         asort \
32         asprintf \
33         autodata \
34         avl \
35         bdelta \
36         block_pool \
37         btree \
38         ccan_tokenizer \
39         charset \
40         ciniparser \
41         crc \
42         crcsync \
43         daemonize \
44         daemon_with_notify \
45         dgraph \
46         err \
47         failtest \
48         foreach \
49         grab_file \
50         hash \
51         htable \
52         idtree \
53         ilog \
54         isaac \
55         iscsi \
56         jmap \
57         json \
58         jset \
59         lbalance \
60         likely \
61         list \
62         md4 \
63         net \
64         nfs \
65         noerr \
66         ogg_to_pcm \
67         opt \
68         ptr_valid \
69         rbtree \
70         rbuf \
71         read_write_all \
72         rfc822 \
73         siphash \
74         sparse_bsearch \
75         str \
76         stringmap \
77         strmap \
78         strset \
79         str_talloc \
80         take \
81         tal \
82         tal/link \
83         tal/path \
84         tal/str \
85         tal/talloc \
86         talloc \
87         talloc_link \
88         tally \
89         tap \
90         time \
91         timer \
92         ttxml \
93         wwviaudio
94
95 MODS:=$(MODS_WITH_SRC) $(MODS_NO_SRC)
96
97 default: libccan.a
98
99 # Automatic dependency generation: makes ccan/*/*.d files.
100 DEPGEN=-MD
101 -include ccan/*/*.d
102
103 # Anything with C files needs building; dir leaves / on, sort uniquifies
104 DIRS=$(patsubst %/, %, $(sort $(foreach m, $(filter-out $(MODS_EXCLUDE), $(MODS_WITH_SRC)), $(dir $(wildcard ccan/$m/*.c)))))
105
106 # Generate everyone's separate Makefiles.
107 -include $(foreach dir, $(DIRS), $(dir)-Makefile)
108
109 ccan/%-Makefile:
110         @echo $@: $(wildcard ccan/$*/*.[ch]) ccan/$*/_info > $@
111         @echo ccan/$*.o: $(patsubst %.c, %.o, $(wildcard ccan/$*/*.c)) >> $@
112
113 # We compile all the ccan/foo/*.o files together into ccan/foo.o
114 OBJFILES=$(DIRS:=.o)
115
116 # We create all the .o files and link them together.
117 $(OBJFILES): %.o:
118         $(LD) -r -o $@ $^
119
120 libccan.a: $(OBJFILES)
121         $(AR) r $@ $(OBJFILES)