]> git.ozlabs.org Git - ccan/blob - Makefile-ccan
order: Scalar comparison functions
[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         argcheck \
12         array_size \
13         asearch \
14         bitmap \
15         build_assert \
16         cast \
17         check_type \
18         compiler \
19         container_of \
20         darray \
21         endian \
22         minmax \
23         objset \
24         short_types \
25         structeq \
26         tcon \
27         tlist \
28         typesafe_cb \
29         version
30
31 # No external dependencies, with C code:
32 MODS_WITH_SRC := antithread \
33         antithread/alloc \
34         asort \
35         asprintf \
36         autodata \
37         avl \
38         base64 \
39         bdelta \
40         block_pool \
41         breakpoint \
42         btree \
43         bytestring \
44         ccan_tokenizer \
45         cdump \
46         charset \
47         ciniparser \
48         crc \
49         crcsync \
50         cpuid \
51         crypto/sha256 \
52         crypto/shachain \
53         daemonize \
54         daemon_with_notify \
55         dgraph \
56         eratosthenes \
57         err \
58         failtest \
59         foreach \
60         grab_file \
61         hash \
62         heap \
63         htable \
64         idtree \
65         ilog \
66         invbloom \
67         io \
68         isaac \
69         iscsi \
70         jacobson_karels \
71         jmap \
72         json \
73         jset \
74         lbalance \
75         likely \
76         list \
77         lqueue \
78         lstack \
79         md4 \
80         mem \
81         net \
82         nfs \
83         noerr \
84         ntdb \
85         ogg_to_pcm \
86         opt \
87         ptrint \
88         ptr_valid \
89         pushpull \
90         rbtree \
91         rbuf \
92         read_write_all \
93         rfc822 \
94         siphash \
95         sparse_bsearch \
96         str \
97         str/hex \
98         stringbuilder \
99         stringmap \
100         strmap \
101         strset \
102         take \
103         tal \
104         tal/grab_file \
105         tal/link \
106         tal/path \
107         tal/stack \
108         tal/str \
109         tal/talloc \
110         talloc \
111         tally \
112         tap \
113         time \
114         timer \
115         ttxml \
116         wwviaudio
117
118 MODS:=$(MODS_WITH_SRC) $(MODS_NO_SRC)
119
120 default: libccan.a
121
122 # Automatic dependency generation: makes ccan/*/*.d files.
123 DEPGEN=-MD
124 -include ccan/*/*.d
125
126 # Anything with C files needs building; dir leaves / on, sort uniquifies
127 DIRS=$(patsubst %/, %, $(sort $(foreach m, $(filter-out $(MODS_EXCLUDE), $(MODS_WITH_SRC)), $(dir $(wildcard ccan/$m/*.c)))))
128
129 # Generate everyone's separate Makefiles.
130 -include $(foreach dir, $(DIRS), $(dir)-Makefile)
131
132 ccan/%-Makefile:
133         @echo $@: $(wildcard ccan/$*/*.[ch]) ccan/$*/_info > $@
134         @echo ccan/$*.o: $(patsubst %.c, %.o, $(wildcard ccan/$*/*.c)) >> $@
135
136 # We compile all the ccan/foo/*.o files together into ccan/foo.o
137 OBJFILES=$(DIRS:=.o)
138
139 # We create all the .o files and link them together.
140 $(OBJFILES): %.o:
141         $(LD) -r -o $@ $^
142
143 libccan.a: $(OBJFILES)
144         $(AR) r $@ $(OBJFILES)