]> mj.ucw.cz Git - libucw.git/blob - lib/Makefile
4177f51ee5c506e5185d76d97db37ae3d18c01e4
[libucw.git] / lib / Makefile
1 # Makefile for the UCW Library (c) 1997--2008 Martin Mares <mj@ucw.cz>
2
3 DIRS+=lib
4 LIBUCW=$(o)/lib/libucw.pc
5
6 ifdef CONFIG_UCW_DBTOOL
7 PROGS+=$(o)/lib/db-tool
8 endif
9
10 PROGS+=$(o)/lib/basecode
11
12 LIBUCW_MODS= \
13         threads \
14         alloc alloc_str realloc bigalloc mempool mempool-str mempool-fmt eltpool \
15         mmap pagecache partmap hashfunc \
16         lists slists simple-lists bitsig \
17         log log-file proctitle \
18         conf-alloc conf-dump conf-input conf-intr conf-journal conf-parse conf-section \
19         ipaccess \
20         profile \
21         fastbuf ff-binary ff-string ff-printf ff-unicode \
22         fb-file carefulio fb-mem fb-temp fb-mmap fb-limfd fb-buffer fb-grow fb-pool fb-atomic fb-param fb-socket \
23         char-cat char-upper char-lower unicode stkstring \
24         wildmatch ctmatch regex \
25         prime primetable random timer randomkey \
26         bit-ffs bit-fls \
27         db \
28         url \
29         mainloop exitstatus runcmd sighandler \
30         lizard lizard-safe adler32 \
31         md5 sha1 sha1-hmac \
32         base64 base224 \
33         sync \
34         qache \
35         string str-esc str-split str-match str-imatch str-hex \
36         bbuf \
37         getopt
38
39 LIBUCW_INCLUDES= \
40         lib.h config.h threads.h \
41         mempool.h pagecache.h \
42         arraysort.h \
43         lists.h clists.h slists.h simple-lists.h \
44         string.h stkstring.h unicode.h chartype.h regex.h \
45         wildmatch.h \
46         unaligned.h prefetch.h \
47         bbuf.h gbuf.h bitarray.h bitsig.h \
48         hashfunc.h hashtable.h \
49         heap.h binheap.h binheap-node.h \
50         redblack.h \
51         binsearch.h \
52         bitops.h \
53         conf.h getopt.h ipaccess.h \
54         profile.h \
55         fastbuf.h lfs.h ff-unicode.h ff-binary.h \
56         db.h \
57         url.h \
58         mainloop.h \
59         lizard.h \
60         md5.h \
61         base64.h base224.h \
62         qache.h \
63         kmp.h kmp-search.h binsearch.h \
64         partmap.h
65
66 ifdef CONFIG_UCW_THREADS
67 # Some modules require threading
68 LIBUCW_MODS+=threads-conf workqueue asio fb-direct
69 LIBUCW_INCLUDES+=workqueue.h semaphore.h asio.h
70 endif
71
72 ifdef CONFIG_OWN_GETOPT
73 include $(s)/lib/getopt/Makefile
74 endif
75
76 include $(s)/lib/sorter/Makefile
77
78 LIBUCW_MOD_PATHS=$(addprefix $(o)/lib/,$(LIBUCW_MODS))
79
80 $(o)/lib/libucw.a: $(addsuffix .o,$(LIBUCW_MOD_PATHS))
81 $(o)/lib/libucw.so: $(addsuffix .oo,$(LIBUCW_MOD_PATHS))
82
83 $(o)/lib/hashfunc.o $(o)/lib/hashfunc.oo: CFLAGS += -funroll-loops
84 $(o)/lib/lizard.o: CFLAGS += $(COPT2) -funroll-loops
85
86 $(o)/lib/db-test: $(o)/lib/db-test.o $(LIBUCW)
87 $(o)/lib/db-tool: $(o)/lib/db-tool.o $(LIBUCW)
88 $(o)/lib/conf-test: $(o)/lib/conf-test.o $(LIBUCW)
89 $(o)/lib/lfs-test: $(o)/lib/lfs-test.o $(LIBUCW)
90 $(o)/lib/hash-test: $(o)/lib/hash-test.o $(LIBUCW)
91 $(o)/lib/hashfunc-test: $(o)/lib/hashfunc-test.o $(LIBUCW)
92 $(o)/lib/asort-test: $(o)/lib/asort-test.o $(LIBUCW)
93 $(o)/lib/redblack-test: $(o)/lib/redblack-test.o $(LIBUCW)
94 $(o)/lib/binheap-test: $(o)/lib/binheap-test.o $(LIBUCW)
95 $(o)/lib/lizard-test: $(o)/lib/lizard-test.o $(LIBUCW)
96 $(o)/lib/kmp-test: $(o)/lib/kmp-test.o $(LIBUCW) $(LIBCHARSET)
97 $(o)/lib/ipaccess-test: $(o)/lib/ipaccess-test.o $(LIBUCW)
98 $(o)/lib/trie-test: $(o)/lib/trie-test.o $(LIBUCW)
99 $(o)/lib/basecode: $(o)/lib/basecode.o $(LIBUCW)
100
101 TESTS+=$(addprefix $(o)/lib/,regex.test unicode.test hash-test.test mempool.test stkstring.test \
102     slists.test kmp-test.test bbuf.test getopt.test fastbuf.test ff-unicode.test eltpool.test \
103     fb-socket.test trie-test.test string.test sha1.test asort-test.test binheap-test.test \
104     redblack-test.test basecode.test)
105
106 $(o)/lib/regex.test: $(o)/lib/regex-t
107 $(o)/lib/unicode.test: $(o)/lib/unicode-t
108 $(o)/lib/hash-test.test: $(o)/lib/hash-test
109 $(o)/lib/mempool.test: $(o)/lib/mempool-t $(o)/lib/mempool-fmt-t $(o)/lib/mempool-str-t
110 $(o)/lib/stkstring.test: $(o)/lib/stkstring-t
111 $(o)/lib/bitops.test: $(o)/lib/bit-ffs-t $(o)/lib/bit-fls-t
112 $(o)/lib/slists.test: $(o)/lib/slists-t
113 $(o)/lib/kmp-test.test: $(o)/lib/kmp-test
114 $(o)/lib/bbuf.test: $(o)/lib/bbuf-t
115 $(o)/lib/getopt.test: $(o)/lib/getopt-t
116 $(o)/lib/fastbuf.test: $(o)/lib/fb-file-t $(o)/lib/fb-grow-t $(o)/lib/fb-pool-t
117 $(o)/lib/ff-unicode.test: $(o)/lib/ff-unicode-t
118 $(o)/lib/eltpool.test: $(o)/lib/eltpool-t
119 $(o)/lib/fb-socket.test: $(o)/lib/fb-socket-t
120 $(o)/lib/string.test: $(o)/lib/str-hex-t $(o)/lib/str-esc-t
121 $(o)/lib/sha1.test: $(o)/lib/sha1-t $(o)/lib/sha1-hmac-t
122 $(o)/lib/trie-test.test: $(o)/lib/trie-test
123 $(o)/lib/asort-test.test: $(o)/lib/asort-test
124 $(o)/lib/binheap-test.test: $(o)/lib/binheap-test
125 $(o)/lib/redblack-test.test: $(o)/lib/redblack-test
126 $(o)/lib/basecode.test: $(o)/lib/basecode
127
128 ifdef CONFIG_UCW_THREADS
129 TESTS+=$(addprefix $(o)/lib/,asio.test)
130 $(o)/lib/asio.test: $(o)/lib/asio-t
131 endif
132
133 API_LIBS+=libucw
134 API_INCLUDES+=$(o)/lib/.include-stamp
135 $(o)/lib/.include-stamp: $(addprefix $(s)/lib/,$(LIBUCW_INCLUDES)) obj/autoconf.h
136         $(Q)$(s)/build/install-includes $(<D) run/include/lib $(LIBUCW_INCLUDES)
137         $(Q)$(s)/build/install-includes obj run/include/lib autoconf.h
138         $(Q)touch $@
139 run/lib/pkgconfig/libucw.pc: $(o)/lib/libucw.pc
140
141 ifdef CONFIG_UCW_PERL
142 include $(s)/lib/perl/Makefile
143 endif
144
145 ifdef CONFIG_UCW_SHELL_UTILS
146 include $(s)/lib/shell/Makefile
147 endif