1 #
2 # DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
3 #
4 # Copyright 2013 Olaf Wintermann. All rights reserved.
5 #
6 # Redistribution and use in source and binary forms, with or without
7 # modification, are permitted provided that the following conditions are met:
8 #
9 # 1. Redistributions of source code must retain the above copyright
10 # notice, this list of conditions and the following disclaimer.
11 #
12 # 2. Redistributions in binary form must reproduce the above copyright
13 # notice, this list of conditions and the following disclaimer in the
14 # documentation and/or other materials provided with the distribution.
15 #
16 # THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
17 # AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
18 # IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
19 # ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
20 # LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
21 # CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
22 # SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
23 # INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
24 # CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
25 # ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
26 # POSSIBILITY OF SUCH DAMAGE.
27 #
28
29 include ../config.mk
30
31 # list of source files
32 SRC = allocator.c
33 SRC += array_list.c
34 SRC += mempool.c
35 SRC += buffer.c
36 SRC += compare.c
37 SRC += hash_key.c
38 SRC += hash_map.c
39 SRC += iterator.c
40 SRC += linked_list.c
41 SRC += kv_list.c
42 SRC += list.c
43 SRC += map.c
44 SRC += printf.c
45 SRC += string.c
46 SRC += tree.c
47 SRC += streams.c
48 SRC += properties.c
49 SRC += json.c
50
51 OBJ = $(SRC:%.c=../build/ucx/%$(OBJ_EXT))
52
53 UCX_LIB = ../build/$(BUILD_LIB_DIR)/$(LIB_PREFIX)ucx$(LIB_EXT)
54 UCX_SHLIB = ../build/$(BUILD_LIB_DIR)/$(LIB_PREFIX)ucx$(SHLIB_EXT)
55
56 all: $(UCX_LIB) $(UCX_SHLIB)
57
58 $(UCX_LIB): $(OBJ)
59 $(AR) $(ARFLAGS) $@ $(OBJ)
60
61 $(UCX_SHLIB): $(OBJ)
62 $(CC) -o $@ $(LDFLAGS) $(SHLIB_LDFLAGS) $(OBJ)
63
64 ../build/ucx:
65 mkdir -p ../build/ucx
66
67 FORCE:
68
69 ../build/ucx/allocator$(OBJ_EXT): allocator.c cx/allocator.h cx/common.h
70 $(CC) -o $@ $(CFLAGS) $(SHLIB_CFLAGS) -c $<
71
72 ../build/ucx/array_list$(OBJ_EXT): array_list.c cx/array_list.h cx/list.h \
73 cx/common.h cx/collection.h cx/allocator.h cx/iterator.h cx/compare.h \
74 cx/compare.h
75 $(CC) -o $@ $(CFLAGS) $(SHLIB_CFLAGS) -c $<
76
77 ../build/ucx/buffer$(OBJ_EXT): buffer.c cx/buffer.h cx/common.h \
78 cx/allocator.h cx/string.h
79 $(CC) -o $@ $(CFLAGS) $(SHLIB_CFLAGS) -c $<
80
81 ../build/ucx/compare$(OBJ_EXT): compare.c cx/compare.h cx/common.h
82 $(CC) -o $@ $(CFLAGS) $(SHLIB_CFLAGS) -c $<
83
84 ../build/ucx/hash_key$(OBJ_EXT): hash_key.c cx/hash_key.h cx/common.h \
85 cx/string.h cx/allocator.h cx/compare.h
86 $(CC) -o $@ $(CFLAGS) $(SHLIB_CFLAGS) -c $<
87
88 ../build/ucx/hash_map$(OBJ_EXT): hash_map.c cx/hash_map.h cx/map.h \
89 cx/common.h cx/collection.h cx/allocator.h cx/iterator.h cx/compare.h \
90 cx/string.h cx/hash_key.h
91 $(CC) -o $@ $(CFLAGS) $(SHLIB_CFLAGS) -c $<
92
93 ../build/ucx/iterator$(OBJ_EXT): iterator.c cx/iterator.h cx/common.h
94 $(CC) -o $@ $(CFLAGS) $(SHLIB_CFLAGS) -c $<
95
96 ../build/ucx/json$(OBJ_EXT): json.c cx/json.h cx/common.h cx/allocator.h \
97 cx/string.h cx/buffer.h cx/array_list.h cx/list.h cx/collection.h \
98 cx/iterator.h cx/compare.h cx/map.h cx/hash_key.h cx/kv_list.h
99 $(CC) -o $@ $(CFLAGS) $(SHLIB_CFLAGS) -c $<
100
101 ../build/ucx/kv_list$(OBJ_EXT): kv_list.c cx/kv_list.h cx/common.h \
102 cx/list.h cx/collection.h cx/allocator.h cx/iterator.h cx/compare.h \
103 cx/map.h cx/string.h cx/hash_key.h cx/hash_map.h cx/linked_list.h
104 $(CC) -o $@ $(CFLAGS) $(SHLIB_CFLAGS) -c $<
105
106 ../build/ucx/linked_list$(OBJ_EXT): linked_list.c cx/linked_list.h \
107 cx/common.h cx/list.h cx/collection.h cx/allocator.h cx/iterator.h \
108 cx/compare.h cx/compare.h
109 $(CC) -o $@ $(CFLAGS) $(SHLIB_CFLAGS) -c $<
110
111 ../build/ucx/list$(OBJ_EXT): list.c cx/list.h cx/common.h cx/collection.h \
112 cx/allocator.h cx/iterator.h cx/compare.h
113 $(CC) -o $@ $(CFLAGS) $(SHLIB_CFLAGS) -c $<
114
115 ../build/ucx/map$(OBJ_EXT): map.c cx/map.h cx/common.h cx/collection.h \
116 cx/allocator.h cx/iterator.h cx/compare.h cx/string.h cx/hash_key.h \
117 cx/list.h
118 $(CC) -o $@ $(CFLAGS) $(SHLIB_CFLAGS) -c $<
119
120 ../build/ucx/mempool$(OBJ_EXT): mempool.c cx/mempool.h cx/common.h \
121 cx/allocator.h
122 $(CC) -o $@ $(CFLAGS) $(SHLIB_CFLAGS) -c $<
123
124 ../build/ucx/printf$(OBJ_EXT): printf.c cx/printf.h cx/common.h \
125 cx/string.h cx/allocator.h
126 $(CC) -o $@ $(CFLAGS) $(SHLIB_CFLAGS) -c $<
127
128 ../build/ucx/properties$(OBJ_EXT): properties.c cx/properties.h \
129 cx/common.h cx/string.h cx/allocator.h cx/map.h cx/collection.h \
130 cx/iterator.h cx/compare.h cx/hash_key.h cx/buffer.h
131 $(CC) -o $@ $(CFLAGS) $(SHLIB_CFLAGS) -c $<
132
133 ../build/ucx/streams$(OBJ_EXT): streams.c cx/streams.h cx/common.h \
134 cx/allocator.h
135 $(CC) -o $@ $(CFLAGS) $(SHLIB_CFLAGS) -c $<
136
137 ../build/ucx/string$(OBJ_EXT): string.c cx/string.h cx/common.h \
138 cx/allocator.h
139 $(CC) -o $@ $(CFLAGS) $(SHLIB_CFLAGS) -c $<
140
141 ../build/ucx/szmul$(OBJ_EXT): szmul.c cx/common.h
142 $(CC) -o $@ $(CFLAGS) $(SHLIB_CFLAGS) -c $<
143
144 ../build/ucx/tree$(OBJ_EXT): tree.c cx/tree.h cx/common.h cx/collection.h \
145 cx/allocator.h cx/iterator.h cx/compare.h
146 $(CC) -o $@ $(CFLAGS) $(SHLIB_CFLAGS) -c $<
147
148