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