src/Makefile

Sun, 18 Feb 2024 12:24:04 +0100

author
Mike Becker <universe@uap-core.de>
date
Sun, 18 Feb 2024 12:24:04 +0100
changeset 830
c4dae6fe6d5b
parent 816
425234b05dff
child 833
5c926801f052
permissions
-rw-r--r--

commit complicated stuff before simplifying it

relates to #371

753
24dc84788dee replace most of the build system with uwproj
Mike Becker <universe@uap-core.de>
parents:
diff changeset
1 # Copyright 2023 Mike Becker. All rights reserved.
24dc84788dee replace most of the build system with uwproj
Mike Becker <universe@uap-core.de>
parents:
diff changeset
2 #
24dc84788dee replace most of the build system with uwproj
Mike Becker <universe@uap-core.de>
parents:
diff changeset
3 # Redistribution and use in source and binary forms, with or without
24dc84788dee replace most of the build system with uwproj
Mike Becker <universe@uap-core.de>
parents:
diff changeset
4 # modification, are permitted provided that the following conditions are met:
24dc84788dee replace most of the build system with uwproj
Mike Becker <universe@uap-core.de>
parents:
diff changeset
5 #
24dc84788dee replace most of the build system with uwproj
Mike Becker <universe@uap-core.de>
parents:
diff changeset
6 # 1. Redistributions of source code must retain the above copyright
24dc84788dee replace most of the build system with uwproj
Mike Becker <universe@uap-core.de>
parents:
diff changeset
7 # notice, this list of conditions and the following disclaimer.
24dc84788dee replace most of the build system with uwproj
Mike Becker <universe@uap-core.de>
parents:
diff changeset
8 #
24dc84788dee replace most of the build system with uwproj
Mike Becker <universe@uap-core.de>
parents:
diff changeset
9 # 2. Redistributions in binary form must reproduce the above copyright
24dc84788dee replace most of the build system with uwproj
Mike Becker <universe@uap-core.de>
parents:
diff changeset
10 # notice, this list of conditions and the following disclaimer in the
24dc84788dee replace most of the build system with uwproj
Mike Becker <universe@uap-core.de>
parents:
diff changeset
11 # documentation and/or other materials provided with the distribution.
24dc84788dee replace most of the build system with uwproj
Mike Becker <universe@uap-core.de>
parents:
diff changeset
12 #
24dc84788dee replace most of the build system with uwproj
Mike Becker <universe@uap-core.de>
parents:
diff changeset
13 # THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
24dc84788dee replace most of the build system with uwproj
Mike Becker <universe@uap-core.de>
parents:
diff changeset
14 # AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
24dc84788dee replace most of the build system with uwproj
Mike Becker <universe@uap-core.de>
parents:
diff changeset
15 # IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
24dc84788dee replace most of the build system with uwproj
Mike Becker <universe@uap-core.de>
parents:
diff changeset
16 # DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
24dc84788dee replace most of the build system with uwproj
Mike Becker <universe@uap-core.de>
parents:
diff changeset
17 # FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
24dc84788dee replace most of the build system with uwproj
Mike Becker <universe@uap-core.de>
parents:
diff changeset
18 # DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
24dc84788dee replace most of the build system with uwproj
Mike Becker <universe@uap-core.de>
parents:
diff changeset
19 # SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
24dc84788dee replace most of the build system with uwproj
Mike Becker <universe@uap-core.de>
parents:
diff changeset
20 # CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
24dc84788dee replace most of the build system with uwproj
Mike Becker <universe@uap-core.de>
parents:
diff changeset
21 # OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
24dc84788dee replace most of the build system with uwproj
Mike Becker <universe@uap-core.de>
parents:
diff changeset
22 # OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
24dc84788dee replace most of the build system with uwproj
Mike Becker <universe@uap-core.de>
parents:
diff changeset
23
24dc84788dee replace most of the build system with uwproj
Mike Becker <universe@uap-core.de>
parents:
diff changeset
24 include ../config.mk
24dc84788dee replace most of the build system with uwproj
Mike Becker <universe@uap-core.de>
parents:
diff changeset
25
24dc84788dee replace most of the build system with uwproj
Mike Becker <universe@uap-core.de>
parents:
diff changeset
26 SRC = allocator.c array_list.c buffer.c compare.c hash_key.c hash_map.c \
816
425234b05dff add first basic low level tree functions
Mike Becker <universe@uap-core.de>
parents: 794
diff changeset
27 linked_list.c list.c map.c tree.c mempool.c printf.c string.c utils.c
753
24dc84788dee replace most of the build system with uwproj
Mike Becker <universe@uap-core.de>
parents:
diff changeset
28
24dc84788dee replace most of the build system with uwproj
Mike Becker <universe@uap-core.de>
parents:
diff changeset
29 OBJ_EXT=.o
754
4bc7d966c9db add an uwproj based install target
Mike Becker <universe@uap-core.de>
parents: 753
diff changeset
30 OBJ=$(SRC:%.c=$(build_dir)/%$(OBJ_EXT))
774
4fd4e0c6107a add make target to automatically gather coverage info
Mike Becker <universe@uap-core.de>
parents: 766
diff changeset
31 GCOV=$(SRC:%.c=%.c.gcov)
753
24dc84788dee replace most of the build system with uwproj
Mike Becker <universe@uap-core.de>
parents:
diff changeset
32
754
4bc7d966c9db add an uwproj based install target
Mike Becker <universe@uap-core.de>
parents: 753
diff changeset
33 static: $(build_dir)/libucx_static$(STLIB_EXT)
753
24dc84788dee replace most of the build system with uwproj
Mike Becker <universe@uap-core.de>
parents:
diff changeset
34
754
4bc7d966c9db add an uwproj based install target
Mike Becker <universe@uap-core.de>
parents: 753
diff changeset
35 shared: $(build_dir)/libucx$(SHLIB_EXT)
753
24dc84788dee replace most of the build system with uwproj
Mike Becker <universe@uap-core.de>
parents:
diff changeset
36
774
4fd4e0c6107a add make target to automatically gather coverage info
Mike Becker <universe@uap-core.de>
parents: 766
diff changeset
37 check-coverage: $(GCOV)
4fd4e0c6107a add make target to automatically gather coverage info
Mike Becker <universe@uap-core.de>
parents: 766
diff changeset
38 mv *.gcov "$(build_dir)"
4fd4e0c6107a add make target to automatically gather coverage info
Mike Becker <universe@uap-core.de>
parents: 766
diff changeset
39
4fd4e0c6107a add make target to automatically gather coverage info
Mike Becker <universe@uap-core.de>
parents: 766
diff changeset
40 %.c.gcov: %.c $(build_dir)/%.gcno
794
23c6e3e846a8 improve output of coverage summary
Mike Becker <universe@uap-core.de>
parents: 774
diff changeset
41 @printf '%16s - %s\n' "$<" "`gcov -Ho "$(build_dir)" $< | grep --max-count=1 -i 'lines executed'`"
774
4fd4e0c6107a add make target to automatically gather coverage info
Mike Becker <universe@uap-core.de>
parents: 766
diff changeset
42
4fd4e0c6107a add make target to automatically gather coverage info
Mike Becker <universe@uap-core.de>
parents: 766
diff changeset
43 $(build_dir)/%.gcno:
4fd4e0c6107a add make target to automatically gather coverage info
Mike Becker <universe@uap-core.de>
parents: 766
diff changeset
44 test -f "$@"
4fd4e0c6107a add make target to automatically gather coverage info
Mike Becker <universe@uap-core.de>
parents: 766
diff changeset
45
754
4bc7d966c9db add an uwproj based install target
Mike Becker <universe@uap-core.de>
parents: 753
diff changeset
46 $(build_dir)/libucx_static$(STLIB_EXT): $(OBJ)
753
24dc84788dee replace most of the build system with uwproj
Mike Becker <universe@uap-core.de>
parents:
diff changeset
47 $(AR) $(ARFLAGS) $@ $^
24dc84788dee replace most of the build system with uwproj
Mike Becker <universe@uap-core.de>
parents:
diff changeset
48
754
4bc7d966c9db add an uwproj based install target
Mike Becker <universe@uap-core.de>
parents: 753
diff changeset
49 $(build_dir)/libucx$(SHLIB_EXT): $(OBJ)
753
24dc84788dee replace most of the build system with uwproj
Mike Becker <universe@uap-core.de>
parents:
diff changeset
50 $(CC) $(LDFLAGS) -o $@ $^
24dc84788dee replace most of the build system with uwproj
Mike Becker <universe@uap-core.de>
parents:
diff changeset
51
754
4bc7d966c9db add an uwproj based install target
Mike Becker <universe@uap-core.de>
parents: 753
diff changeset
52 install: $(build_dir)/libucx_static$(STLIB_EXT) $(build_dir)/libucx$(SHLIB_EXT)
765
b5128bb44459 fix usage of COPYALL in Makefiles
Mike Becker <universe@uap-core.de>
parents: 755
diff changeset
53 $(MKDIR) $(libdir) $(includedir)/cx
754
4bc7d966c9db add an uwproj based install target
Mike Becker <universe@uap-core.de>
parents: 753
diff changeset
54 $(RMFILE) $(libdir)/libucx$(SHLIB_EXT).$(LIBVERSION_MAJOR)
4bc7d966c9db add an uwproj based install target
Mike Becker <universe@uap-core.de>
parents: 753
diff changeset
55 $(RMFILE) $(libdir)/libucx$(SHLIB_EXT)
4bc7d966c9db add an uwproj based install target
Mike Becker <universe@uap-core.de>
parents: 753
diff changeset
56 $(COPYFILE) $(build_dir)/libucx_static$(STLIB_EXT) $(libdir)/libucx_static$(STLIB_EXT)
4bc7d966c9db add an uwproj based install target
Mike Becker <universe@uap-core.de>
parents: 753
diff changeset
57 $(COPYFILE) $(build_dir)/libucx$(SHLIB_EXT) $(libdir)/libucx$(SHLIB_EXT).$(LIBVERSION)
765
b5128bb44459 fix usage of COPYALL in Makefiles
Mike Becker <universe@uap-core.de>
parents: 755
diff changeset
58 $(COPYALL) $(src_dir)/src/cx $(includedir)
754
4bc7d966c9db add an uwproj based install target
Mike Becker <universe@uap-core.de>
parents: 753
diff changeset
59 $(SYMLINK) $(libdir)/libucx$(SHLIB_EXT).$(LIBVERSION) $(libdir)/libucx$(SHLIB_EXT).$(LIBVERSION_MAJOR)
4bc7d966c9db add an uwproj based install target
Mike Becker <universe@uap-core.de>
parents: 753
diff changeset
60 $(SYMLINK) $(libdir)/libucx$(SHLIB_EXT).$(LIBVERSION_MAJOR) $(libdir)/libucx$(SHLIB_EXT)
753
24dc84788dee replace most of the build system with uwproj
Mike Becker <universe@uap-core.de>
parents:
diff changeset
61
755
255ee4abf2ec add update-rules script
Mike Becker <universe@uap-core.de>
parents: 754
diff changeset
62 FORCE:
255ee4abf2ec add update-rules script
Mike Becker <universe@uap-core.de>
parents: 754
diff changeset
63
754
4bc7d966c9db add an uwproj based install target
Mike Becker <universe@uap-core.de>
parents: 753
diff changeset
64 $(build_dir)/allocator$(OBJ_EXT): allocator.c cx/allocator.h cx/common.h
755
255ee4abf2ec add update-rules script
Mike Becker <universe@uap-core.de>
parents: 754
diff changeset
65 @echo "Compiling $<"
753
24dc84788dee replace most of the build system with uwproj
Mike Becker <universe@uap-core.de>
parents:
diff changeset
66 $(CC) -o $@ $(CFLAGS) -c $<
24dc84788dee replace most of the build system with uwproj
Mike Becker <universe@uap-core.de>
parents:
diff changeset
67
754
4bc7d966c9db add an uwproj based install target
Mike Becker <universe@uap-core.de>
parents: 753
diff changeset
68 $(build_dir)/array_list$(OBJ_EXT): array_list.c cx/array_list.h cx/list.h \
766
e59b76889f00 bring back UCX test - fixes #341
Mike Becker <universe@uap-core.de>
parents: 765
diff changeset
69 cx/common.h cx/collection.h cx/allocator.h cx/iterator.h cx/compare.h
755
255ee4abf2ec add update-rules script
Mike Becker <universe@uap-core.de>
parents: 754
diff changeset
70 @echo "Compiling $<"
753
24dc84788dee replace most of the build system with uwproj
Mike Becker <universe@uap-core.de>
parents:
diff changeset
71 $(CC) -o $@ $(CFLAGS) -c $<
24dc84788dee replace most of the build system with uwproj
Mike Becker <universe@uap-core.de>
parents:
diff changeset
72
755
255ee4abf2ec add update-rules script
Mike Becker <universe@uap-core.de>
parents: 754
diff changeset
73 $(build_dir)/buffer$(OBJ_EXT): buffer.c cx/buffer.h cx/common.h \
255ee4abf2ec add update-rules script
Mike Becker <universe@uap-core.de>
parents: 754
diff changeset
74 cx/allocator.h cx/utils.h
255ee4abf2ec add update-rules script
Mike Becker <universe@uap-core.de>
parents: 754
diff changeset
75 @echo "Compiling $<"
753
24dc84788dee replace most of the build system with uwproj
Mike Becker <universe@uap-core.de>
parents:
diff changeset
76 $(CC) -o $@ $(CFLAGS) -c $<
24dc84788dee replace most of the build system with uwproj
Mike Becker <universe@uap-core.de>
parents:
diff changeset
77
754
4bc7d966c9db add an uwproj based install target
Mike Becker <universe@uap-core.de>
parents: 753
diff changeset
78 $(build_dir)/compare$(OBJ_EXT): compare.c cx/compare.h cx/common.h
755
255ee4abf2ec add update-rules script
Mike Becker <universe@uap-core.de>
parents: 754
diff changeset
79 @echo "Compiling $<"
753
24dc84788dee replace most of the build system with uwproj
Mike Becker <universe@uap-core.de>
parents:
diff changeset
80 $(CC) -o $@ $(CFLAGS) -c $<
24dc84788dee replace most of the build system with uwproj
Mike Becker <universe@uap-core.de>
parents:
diff changeset
81
754
4bc7d966c9db add an uwproj based install target
Mike Becker <universe@uap-core.de>
parents: 753
diff changeset
82 $(build_dir)/hash_key$(OBJ_EXT): hash_key.c cx/hash_key.h cx/common.h
755
255ee4abf2ec add update-rules script
Mike Becker <universe@uap-core.de>
parents: 754
diff changeset
83 @echo "Compiling $<"
753
24dc84788dee replace most of the build system with uwproj
Mike Becker <universe@uap-core.de>
parents:
diff changeset
84 $(CC) -o $@ $(CFLAGS) -c $<
24dc84788dee replace most of the build system with uwproj
Mike Becker <universe@uap-core.de>
parents:
diff changeset
85
755
255ee4abf2ec add update-rules script
Mike Becker <universe@uap-core.de>
parents: 754
diff changeset
86 $(build_dir)/hash_map$(OBJ_EXT): hash_map.c cx/hash_map.h cx/map.h \
255ee4abf2ec add update-rules script
Mike Becker <universe@uap-core.de>
parents: 754
diff changeset
87 cx/common.h cx/collection.h cx/allocator.h cx/iterator.h cx/string.h \
255ee4abf2ec add update-rules script
Mike Becker <universe@uap-core.de>
parents: 754
diff changeset
88 cx/hash_key.h cx/utils.h
255ee4abf2ec add update-rules script
Mike Becker <universe@uap-core.de>
parents: 754
diff changeset
89 @echo "Compiling $<"
753
24dc84788dee replace most of the build system with uwproj
Mike Becker <universe@uap-core.de>
parents:
diff changeset
90 $(CC) -o $@ $(CFLAGS) -c $<
24dc84788dee replace most of the build system with uwproj
Mike Becker <universe@uap-core.de>
parents:
diff changeset
91
755
255ee4abf2ec add update-rules script
Mike Becker <universe@uap-core.de>
parents: 754
diff changeset
92 $(build_dir)/linked_list$(OBJ_EXT): linked_list.c cx/linked_list.h \
255ee4abf2ec add update-rules script
Mike Becker <universe@uap-core.de>
parents: 754
diff changeset
93 cx/common.h cx/list.h cx/collection.h cx/allocator.h cx/iterator.h \
766
e59b76889f00 bring back UCX test - fixes #341
Mike Becker <universe@uap-core.de>
parents: 765
diff changeset
94 cx/utils.h cx/compare.h
755
255ee4abf2ec add update-rules script
Mike Becker <universe@uap-core.de>
parents: 754
diff changeset
95 @echo "Compiling $<"
753
24dc84788dee replace most of the build system with uwproj
Mike Becker <universe@uap-core.de>
parents:
diff changeset
96 $(CC) -o $@ $(CFLAGS) -c $<
24dc84788dee replace most of the build system with uwproj
Mike Becker <universe@uap-core.de>
parents:
diff changeset
97
754
4bc7d966c9db add an uwproj based install target
Mike Becker <universe@uap-core.de>
parents: 753
diff changeset
98 $(build_dir)/list$(OBJ_EXT): list.c cx/list.h cx/common.h cx/collection.h \
753
24dc84788dee replace most of the build system with uwproj
Mike Becker <universe@uap-core.de>
parents:
diff changeset
99 cx/allocator.h cx/iterator.h
755
255ee4abf2ec add update-rules script
Mike Becker <universe@uap-core.de>
parents: 754
diff changeset
100 @echo "Compiling $<"
753
24dc84788dee replace most of the build system with uwproj
Mike Becker <universe@uap-core.de>
parents:
diff changeset
101 $(CC) -o $@ $(CFLAGS) -c $<
24dc84788dee replace most of the build system with uwproj
Mike Becker <universe@uap-core.de>
parents:
diff changeset
102
754
4bc7d966c9db add an uwproj based install target
Mike Becker <universe@uap-core.de>
parents: 753
diff changeset
103 $(build_dir)/map$(OBJ_EXT): map.c cx/map.h cx/common.h cx/collection.h \
753
24dc84788dee replace most of the build system with uwproj
Mike Becker <universe@uap-core.de>
parents:
diff changeset
104 cx/allocator.h cx/iterator.h cx/string.h cx/hash_key.h
755
255ee4abf2ec add update-rules script
Mike Becker <universe@uap-core.de>
parents: 754
diff changeset
105 @echo "Compiling $<"
753
24dc84788dee replace most of the build system with uwproj
Mike Becker <universe@uap-core.de>
parents:
diff changeset
106 $(CC) -o $@ $(CFLAGS) -c $<
24dc84788dee replace most of the build system with uwproj
Mike Becker <universe@uap-core.de>
parents:
diff changeset
107
755
255ee4abf2ec add update-rules script
Mike Becker <universe@uap-core.de>
parents: 754
diff changeset
108 $(build_dir)/mempool$(OBJ_EXT): mempool.c cx/mempool.h cx/common.h \
255ee4abf2ec add update-rules script
Mike Becker <universe@uap-core.de>
parents: 754
diff changeset
109 cx/allocator.h cx/utils.h
255ee4abf2ec add update-rules script
Mike Becker <universe@uap-core.de>
parents: 754
diff changeset
110 @echo "Compiling $<"
753
24dc84788dee replace most of the build system with uwproj
Mike Becker <universe@uap-core.de>
parents:
diff changeset
111 $(CC) -o $@ $(CFLAGS) -c $<
24dc84788dee replace most of the build system with uwproj
Mike Becker <universe@uap-core.de>
parents:
diff changeset
112
755
255ee4abf2ec add update-rules script
Mike Becker <universe@uap-core.de>
parents: 754
diff changeset
113 $(build_dir)/printf$(OBJ_EXT): printf.c cx/printf.h cx/common.h \
255ee4abf2ec add update-rules script
Mike Becker <universe@uap-core.de>
parents: 754
diff changeset
114 cx/string.h cx/allocator.h
255ee4abf2ec add update-rules script
Mike Becker <universe@uap-core.de>
parents: 754
diff changeset
115 @echo "Compiling $<"
753
24dc84788dee replace most of the build system with uwproj
Mike Becker <universe@uap-core.de>
parents:
diff changeset
116 $(CC) -o $@ $(CFLAGS) -c $<
24dc84788dee replace most of the build system with uwproj
Mike Becker <universe@uap-core.de>
parents:
diff changeset
117
755
255ee4abf2ec add update-rules script
Mike Becker <universe@uap-core.de>
parents: 754
diff changeset
118 $(build_dir)/string$(OBJ_EXT): string.c cx/string.h cx/common.h \
255ee4abf2ec add update-rules script
Mike Becker <universe@uap-core.de>
parents: 754
diff changeset
119 cx/allocator.h cx/utils.h
255ee4abf2ec add update-rules script
Mike Becker <universe@uap-core.de>
parents: 754
diff changeset
120 @echo "Compiling $<"
255ee4abf2ec add update-rules script
Mike Becker <universe@uap-core.de>
parents: 754
diff changeset
121 $(CC) -o $@ $(CFLAGS) -c $<
255ee4abf2ec add update-rules script
Mike Becker <universe@uap-core.de>
parents: 754
diff changeset
122
255ee4abf2ec add update-rules script
Mike Becker <universe@uap-core.de>
parents: 754
diff changeset
123 $(build_dir)/szmul$(OBJ_EXT): szmul.c
255ee4abf2ec add update-rules script
Mike Becker <universe@uap-core.de>
parents: 754
diff changeset
124 @echo "Compiling $<"
753
24dc84788dee replace most of the build system with uwproj
Mike Becker <universe@uap-core.de>
parents:
diff changeset
125 $(CC) -o $@ $(CFLAGS) -c $<
24dc84788dee replace most of the build system with uwproj
Mike Becker <universe@uap-core.de>
parents:
diff changeset
126
816
425234b05dff add first basic low level tree functions
Mike Becker <universe@uap-core.de>
parents: 794
diff changeset
127 $(build_dir)/tree$(OBJ_EXT): tree.c cx/tree.h cx/common.h
425234b05dff add first basic low level tree functions
Mike Becker <universe@uap-core.de>
parents: 794
diff changeset
128 @echo "Compiling $<"
425234b05dff add first basic low level tree functions
Mike Becker <universe@uap-core.de>
parents: 794
diff changeset
129 $(CC) -o $@ $(CFLAGS) -c $<
425234b05dff add first basic low level tree functions
Mike Becker <universe@uap-core.de>
parents: 794
diff changeset
130
754
4bc7d966c9db add an uwproj based install target
Mike Becker <universe@uap-core.de>
parents: 753
diff changeset
131 $(build_dir)/utils$(OBJ_EXT): utils.c cx/utils.h cx/common.h
755
255ee4abf2ec add update-rules script
Mike Becker <universe@uap-core.de>
parents: 754
diff changeset
132 @echo "Compiling $<"
753
24dc84788dee replace most of the build system with uwproj
Mike Becker <universe@uap-core.de>
parents:
diff changeset
133 $(CC) -o $@ $(CFLAGS) -c $<
24dc84788dee replace most of the build system with uwproj
Mike Becker <universe@uap-core.de>
parents:
diff changeset
134

mercurial