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