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