]> git.ozlabs.org Git - ccan/blob - Makefile-ccan
pipecmd: fix -Wextra complaint about empty body.
[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 CFLAGS_FORCE_C_SOURCE = -x c
9
10 MODS := a_star \
11         aga \
12         agar \
13         alignof \
14         altstack \
15         antithread \
16         antithread/alloc \
17         argcheck \
18         array_size \
19         asearch \
20         asort \
21         asprintf \
22         autodata \
23         avl \
24         base64 \
25         bdelta \
26         bitmap \
27         block_pool \
28         breakpoint \
29         btree \
30         build_assert \
31         bytestring \
32         cast \
33         ccan_tokenizer \
34         cdump \
35         charset \
36         check_type \
37         ciniparser \
38         compiler \
39         container_of \
40         cppmagic \
41         cpuid \
42         crc \
43         crcsync \
44         crypto/ripemd160 \
45         crypto/sha256 \
46         crypto/sha512 \
47         crypto/shachain \
48         crypto/siphash24 \
49         daemonize \
50         daemon_with_notify \
51         darray \
52         deque \
53         dgraph \
54         endian \
55         eratosthenes \
56         err \
57         failtest \
58         foreach \
59         generator \
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         jset \
73         json \
74         lbalance \
75         likely \
76         list \
77         lpq \
78         lqueue \
79         lstack \
80         md4 \
81         mem \
82         minmax \
83         net \
84         nfs \
85         noerr \
86         ntdb \
87         objset \
88         ogg_to_pcm \
89         opt \
90         order \
91         permutation \
92         pipecmd \
93         pr_log \
94         ptrint \
95         ptr_valid \
96         pushpull \
97         rbtree \
98         rbuf \
99         read_write_all \
100         rfc822 \
101         rszshm \
102         short_types \
103         siphash \
104         sparse_bsearch \
105         str \
106         str/hex \
107         strgrp \
108         stringbuilder \
109         stringmap \
110         strmap \
111         strset \
112         structeq \
113         take \
114         tal \
115         tal/grab_file \
116         tal/link \
117         tal/path \
118         tal/stack \
119         tal/str \
120         tal/talloc \
121         talloc \
122         tally \
123         tap \
124         tcon \
125         time \
126         timer \
127         tlist \
128         tlist2 \
129         ttxml \
130         typesafe_cb \
131         version \
132         wwviaudio \
133         xstring
134
135 # Anything with C files needs building; dir leaves / on, sort uniquifies
136 MODS_WITH_SRC = $(patsubst ccan/%/, %, $(sort $(foreach m, $(MODS), $(dir $(wildcard ccan/$m/*.c)))))
137
138 default: libccan.a
139
140 # Automatic dependency generation: makes ccan/*/*.d files.
141 DEPGEN=-MMD
142 -include $(foreach m, $(MODS), ccan/$(m)/*.d)
143
144 DIRS=$(patsubst %, ccan/%, $(filter-out $(MODS_EXCLUDE), $(MODS_WITH_SRC)))
145
146 # Generate everyone's separate Makefiles.
147 -include $(foreach dir, $(DIRS), $(dir)-Makefile)
148
149 ccan/%-Makefile:
150         @echo $@: $(wildcard ccan/$*/*.[ch]) ccan/$*/_info > $@
151         @echo ccan/$*.o: $(patsubst %.c, %.o, $(wildcard ccan/$*/*.c)) >> $@
152
153 # We compile all the ccan/foo/*.o files together into ccan/foo.o
154 OBJFILES=$(DIRS:=.o)
155
156 # We create all the .o files and link them together.
157 $(OBJFILES): %.o:
158         $(LD) -r -o $@ $^
159
160 libccan.a: $(OBJFILES)
161         $(AR) r $@ $(OBJFILES)