]> mj.ucw.cz Git - libucw.git/blob - lib/Makefile
0967f003992f5c009591ef3c2325959d0831b9bf
[libucw.git] / lib / Makefile
1 # Makefile for the UCW Library (c) 1997--2006 Martin Mares <mj@ucw.cz>
2
3 DIRS+=lib
4
5 ifdef CONFIG_UCW_DBTOOL
6 PROGS+=$(o)/lib/db-tool
7 endif
8
9 LIBUCW_MODS= \
10         threads \
11         alloc alloc_str realloc mempool mempool-str mempool-fmt \
12         mmap pagecache partmap hashfunc \
13         lists slists simple-lists sorter bitsig \
14         log log-file proctitle \
15         conf-alloc conf-dump conf-input conf-intr conf-journal conf-parse conf-section \
16         ipaccess \
17         profile \
18         fastbuf ff-binary ff-string ff-printf ff-utf8 \
19         fb-file carefulio fb-mem fb-temp fb-mmap fb-limfd fb-buffer fb-grow fb-atomic \
20         str_ctype str_upper str_lower unicode-utf8 stkstring \
21         wildmatch wordsplit ctmatch patimatch patmatch regex \
22         prime primetable random timer randomkey \
23         bit-ffs bit-fls \
24         db \
25         url \
26         mainloop exitstatus runcmd sighandler \
27         lizard lizard-safe adler32 \
28         md5 md5hex \
29         base64 base224 \
30         sync \
31         qache \
32         string \
33         bbuf
34
35 LIBUCW_INCLUDES= \
36         lib.h config.h threads.h math.h \
37         mempool.h pagecache.h \
38         sorter.h arraysort.h \
39         lists.h clists.h \
40         unaligned.h prefetch.h \
41         bbuf.h gbuf.h bitarray.h bitsig.h \
42         hashfunc.h hashtable.h \
43         heap.h binheap.h binheap-node.h \
44         redblack.h \
45         conf.h getopt.h ipaccess.h \
46         profile.h \
47         fastbuf.h lfs.h ff-utf8.h \
48         chartype.h unicode.h stkstring.h \
49         wildmatch.h patmatch.h \
50         db.h \
51         url.h \
52         mainloop.h \
53         lizard.h \
54         md5.h \
55         base64.h base224.h \
56         qache.h \
57         kmp.h kmp-search.h
58
59 ifdef CONFIG_UCW_THREADS
60 # Some modules require threading
61 LIBS+=-lpthread
62 LIBUCW_MODS+=threads-conf workqueue
63 LIBUCW_INCLUDES+=workqueue.h
64 endif
65
66 ifdef CONFIG_OWN_REGEX
67 include $(s)/lib/regex/Makefile
68 endif
69
70 LIBUCW=$(o)/lib/libucw.$(LS)
71 LIBUCW_MOD_PATHS=$(addprefix $(o)/lib/,$(LIBUCW_MODS))
72
73 $(o)/lib/libucw.a: $(addsuffix .o,$(LIBUCW_MOD_PATHS))
74 $(o)/lib/libucw.so: $(addsuffix .oo,$(LIBUCW_MOD_PATHS))
75
76 $(o)/lib/hashfunc.o $(o)/lib/hashfunc.oo: CFLAGS += -funroll-loops
77 $(o)/lib/lizard.o: CFLAGS += $(COPT2) -funroll-loops
78
79 $(o)/lib/db-test: $(o)/lib/db-test.o $(LIBUCW)
80 $(o)/lib/db-tool: $(o)/lib/db-tool.o $(LIBUCW)
81 $(o)/lib/conf-test: $(o)/lib/conf-test.o $(LIBUCW)
82 $(o)/lib/sort-test: $(o)/lib/sort-test.o $(LIBUCW)
83 $(o)/lib/lfs-test: $(o)/lib/lfs-test.o $(LIBUCW)
84 $(o)/lib/hash-test: $(o)/lib/hash-test.o $(LIBUCW)
85 $(o)/lib/str-test: $(o)/lib/str-test.o $(LIBUCW)
86 $(o)/lib/asort-test: $(o)/lib/asort-test.o $(LIBUCW)
87 $(o)/lib/redblack-test: $(o)/lib/redblack-test.o $(LIBUCW)
88 $(o)/lib/binheap-test: $(o)/lib/binheap-test.o $(LIBUCW)
89 $(o)/lib/lizard-test: $(o)/lib/lizard-test.o $(LIBUCW)
90 $(o)/lib/kmp-test: $(o)/lib/kmp-test.o $(LIBUCW) $(LIBCHARSET)
91 $(o)/lib/ipaccess-test: $(o)/lib/ipaccess-test.o $(LIBUCW)
92
93 TESTS+=$(addprefix $(o)/lib/,regex.test unicode-utf8.test hash-test.test mempool.test stkstring.test slists.test kmp-test.test bbuf.test)
94 $(o)/lib/regex.test: $(o)/lib/regex-t
95 $(o)/lib/unicode-utf8.test: $(o)/lib/unicode-utf8-t
96 $(o)/lib/hash-test.test: $(o)/lib/hash-test
97 $(o)/lib/mempool.test: $(o)/lib/mempool-fmt-t $(o)/lib/mempool-str-t
98 $(o)/lib/stkstring.test: $(o)/lib/stkstring-t
99 $(o)/lib/bitops.test: $(o)/lib/bit-ffs-t $(o)/lib/bit-fls-t
100 $(o)/lib/slists.test: $(o)/lib/slists-t
101 $(o)/lib/kmp-test.test: $(o)/lib/kmp-test
102 $(o)/lib/bbuf.test: $(o)/lib/bbuf-t
103
104 INCLUDES+=$(o)/lib/.include-stamp
105 $(o)/lib/.include-stamp: $(addprefix $(s)/lib/,$(LIBUCW_INCLUDES))
106         $(s)/build/install-includes $(s)/lib run/include/lib $(?F)
107         $(s)/build/install-includes $(o)/lib run/include/lib autoconf.h
108         touch $(o)/lib/.include-stamp
109
110 ifdef CONFIG_UCW_PERL
111 include $(s)/lib/perl/Makefile
112 endif
113
114 ifdef CONFIG_UCW_SHELL_UTILS
115 include $(s)/lib/shell/Makefile
116 endif