1 # Copyright 2023 Mike Becker. All rights reserved.
2 #
3 # Redistribution and use in source and binary forms, with or without
4 # modification, are permitted provided that the following conditions are met:
5 #
6 # 1. Redistributions of source code must retain the above copyright
7 # notice, this list of conditions and the following disclaimer.
8 #
9 # 2. Redistributions in binary form must reproduce the above copyright
10 # notice, this list of conditions and the following disclaimer in the
11 # documentation and/or other materials provided with the distribution.
12 #
13 # THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
14 # AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
15 # IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
16 # DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
17 # FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
18 # DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
19 # SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
20 # CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
21 # OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
22 # OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
23
24 include config.mk
25
26 dist: FORCE
27 $(MKDIR) $(dist_dir)/libucx/
28 $(COPYALL) CHANGELOG configure COPYING Doxyfile Makefile README \
29 uaplogo.png make msvc src tests $(dist_dir)/libucx/
30 @cd $(dist_dir) && tar -czf ucx-$(VERSION).tar.gz -Hustar libucx
31 @echo "[ Dist created: $(dist_dir)/ucx-$(VERSION).tar.gz ]"
32
33 compile: static shared
34
35 $(build_dir):
36 $(MKDIR) $@/
37
38 clean: FORCE
39 $(RMDIR) $(dist_dir)
40
41 shared: $(build_dir) FORCE
42 @cd src && $(MAKE) OBJ_EXT=.shared.o \
43 CFLAGS="$(CFLAGS) $(SHLIB_CFLAGS)" \
44 LDFLAGS="$(LDFLAGS) $(SHLIB_LDFLAGS)" \
45 shared
46
47 static: $(build_dir) FORCE
48 @cd src && $(MAKE) static
49
50 check: test-compile FORCE
51 $(RMFILE) $(build_dir)/*.gcda
52 $(RMFILE) $(build_dir)/tests/*.gcda
53 $(build_dir)/tests/ucxtest
54
55 test-compile: compile FORCE
56 cd tests && $(MAKE)
57
58 check-cxx: CXX-AVAILABLE clean test-compile-cxx FORCE
59 $(build_dir)/tests/ucxtest
60
61 test-compile-cxx: static FORCE
62 cd tests && $(MAKE) CC=$(CXX) CFLAGS="$(CFLAGS) $(CXXFLAGS)"
63
64 CXX-AVAILABLE:
65 test -n "$(WITH_CXX_TEST)"
66
67 docs: $(build_dir) FORCE
68 @(test "$(WITH_API_DOCS)" = "yes" && cd $(root_dir) && $(DOXYGEN) ) \
69 || echo "[ Generation of API Docs disabled - skipped ]"
70
71 update-rules: FORCE
72 make/update-rules.sh src
73 make/update-rules.sh tests '$$(TEST_DIR)' '-I../src'
74
75 FORCE:
76