Debian Codegraph @

tools/Makefile

raw ◀ ▶
3 Debian patches touch this file
1 #
2 # Copyright 2015, International Business Machines
3 #
4 # Licensed under the Apache License, Version 2.0 (the "License");
5 # you may not use this file except in compliance with the License.
6 # You may obtain a copy of the License at
7 #
8 # http://www.apache.org/licenses/LICENSE-2.0
9 #
10 # Unless required by applicable law or agreed to in writing, software
11 # distributed under the License is distributed on an "AS IS" BASIS,
12 # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 # See the License for the specific language governing permissions and
14 # limitations under the License.
15 #
16
17 include ../config.mk
18
19 DESTDIR ?= /usr
20 libs = ../lib/libDDCB.a ../lib/libzHW.a ../lib/libcard.a
•21 LDLIBS += $(libs) -pthread -lrt
22
23 ifeq ($(BUILD_AGZIP_TOOLS),1)
24 LDLIBS += -ljson-c
25 endif
26
27 genwqe_peek_objs = force_cpu.o
28 genwqe_poke_objs = force_cpu.o
29 genwqe_memcopy_objs = force_cpu.o
30 genwqe_cksum_objs = force_cpu.o
31 genwqe_echo_objs = force_cpu.o
32 genwqe_vpdupdate_objs = genwqe_vpd_common.o
33 genwqe_vpdconv_objs = genwqe_vpd_common.o
34
35 genwqe_memcopy_libs = -lz
36 genwqe_cksum_libs = -lz
•37 genwqe_gzip_libs = -L../lib -lzADC -ldl # dynamically link our libz
38 genwqe_gunzip_libs = -L../lib -lzADC -ldl # dynamically link our libz
39 zlib_mt_perf_libs = -L../lib -lzADC -ldl # dynamically link our libz
40 gzFile_test_libs = -L../lib -lzADC -ldl # dynamically link our libz
41
42 projs = genwqe_update genwqe_gzip genwqe_gunzip zlib_mt_perf genwqe_memcopy \
43 genwqe_echo genwqe_peek genwqe_poke genwqe_cksum genwqe_vpdconv \
44 genwqe_vpdupdate genwqe_csv2vpd genwqe_ffdc gzFile_test
45
46 ifdef WITH_LIBCXL
47 # genwqe_maint is only used with CAPI support.
48 projs += genwqe_maint genwqe_loadtree
49
50 ifeq ($(BUILD_AGZIP_TOOLS),1)
51 projs += agzipd ag_uptime
52 endif
53
54 CAPI_INSTALL=capi_install
55
56 # If we are bundling, we need to link statically. Otherwise, go dynamic.
57 ifeq ($(BUNDLE_LIBCXL),1)
58 LDLIBS += $(libcxl_a)
59 else
60 LDLIBS += -lcxl
61 endif # !CONFIG_LIBCXL_PATH
62
63 endif # WITH_LIBCXL
64
65 all: $(projs)
66
67 $(projs): $(libs)
68
69 objs = force_cpu.o genwqe_vpd_common.o $(projs:=.o)
70
71 test_scripts = genwqe_mt_perf genwqe_test_gz
72
73 manpages = $(projs:=.1.gz) $(test_scripts:=.1.gz)
74
75 manpages: all $(manpages)
76
77 genwqe_gunzip.o: genwqe_gzip.c
78 $(CC) -c $< $(CPPFLAGS) $(CFLAGS) -o $@
79
80 ### Deactivate existing implicit rule
81 %: %.c
82 %: %.sh
83
84 ### Generic rule to build a tool
85 %: %.o
86 $(CC) $(LDFLAGS) [email protected] $($(@)_objs) $($(@)_libs) $(LDLIBS) -o $@
87
88 %.o: %.c $(libs)
89 $(CC) -c $(CPPFLAGS) $(CFLAGS) $< -o $@
90
91 ### Setting LD_LIBRARY_PATH helps to try tools with dynamic linkage
92 %.1: %
93 LD_LIBRARY_PATH=../lib $(HELP2MAN) -N --output=$@ \
94 --help-option='-h' --version-option='-V' \
95 --name "IBM Hardware Accelerator Tool." ./$<
96
97 %.1.gz: %.1
98 gzip --best -c $< > $@
99
100 #
101 # Tools for card maintenance
102 #
103 install_release_tools: all
104 @mkdir -p $(DESTDIR)/bin
105 cp -uv genwqe_peek genwqe_poke genwqe_memcopy genwqe_echo \
106 genwqe_update \
107 $(DESTDIR)/bin
108
109 #
110 # Example tools and testcases
111 # gzip and gunzip go into special directory, since they should not be
112 # in regular path to be mixed up with distro version of those tools.
113 # Nevertheless we need them to accelerate tar for example with our
114 # hardware accelerated version of gzip/gunzip.
115 #
116 install_gzip_tools: all
117 install -D -m 755 genwqe_gzip -T $(DESTDIR)/bin/genwqe_gzip
118 install -D -m 755 genwqe_gunzip -T $(DESTDIR)/bin/genwqe_gunzip
119 install -D -m 755 zlib_mt_perf -T $(DESTDIR)/bin/zlib_mt_perf
120 install -D -m 755 genwqe_mt_perf -T $(DESTDIR)/bin/genwqe_mt_perf
121 install -D -m 755 genwqe_test_gz -T $(DESTDIR)/bin/genwqe_test_gz
122
123 uninstall_gzip_tools:
124 $(RM) $(DESTDIR)/bin/genwqe_gzip \
125 $(DESTDIR)/bin/genwqe_gunzip \
126 $(DESTDIR)/bin/zlib_mt_perf \
127 $(DESTDIR)/bin/genwqe_mt_perf \
128 $(DESTDIR)/bin/genwqe_test_gz
129
130 install_manpages: $(manpages)
131 @mkdir -p $(MAN_INSTALL_PATH)
132 cp -uv $(manpages) $(MAN_INSTALL_PATH)
133
134 install_release_manpages: $(manpages)
135 @mkdir -p $(MAN_INSTALL_PATH)
136
137 cp -uv genwqe_memcopy.1 genwqe_echo.1 genwqe_update.1 \
138 $(DESTDIR)/man/man1
139 cp -uv genwqe_memcopy.1 genwqe_echo.1 genwqe_update.1 \
140 $(MAN_INSTALL_PATH)
141
142 uninstall_manpages:
143 @for f in $(manpages) ; do \
144 echo "removing $(DESTDIR)/man/man1/$$f ..."; \
145 $(RM) $(DESTDIR)/man/man1/$$f; \
146 done
147
148 capi_install: genwqe_maint
149 install -D -m 755 genwqe_maint -T $(DESTDIR)/bin/genwqe_maint
150 install -D -m 755 genwqe_loadtree -T $(DESTDIR)/bin/genwqe_loadtree
151
152 install: install_gzip_tools install_manpages $(CAPI_INSTALL)
153 @mkdir -p $(DESTDIR)/bin
154 install -D genwqe_update -T $(DESTDIR)/bin/genwqe_update
155 install -D -m 755 genwqe_memcopy -T $(DESTDIR)/bin/genwqe_memcopy
156 install -D -m 755 genwqe_echo -T $(DESTDIR)/bin/genwqe_echo
157 install -D -m 755 genwqe_peek -T $(DESTDIR)/bin/genwqe_peek
158 install -D -m 755 genwqe_poke -T $(DESTDIR)/bin/genwqe_poke
159 install -D -m 755 genwqe_cksum -T $(DESTDIR)/bin/genwqe_cksum
160 install -D -m 755 genwqe_vpdconv -T $(DESTDIR)/bin/genwqe_vpdconv
161 install -D -m 755 genwqe_vpdupdate -T $(DESTDIR)/bin/genwqe_vpdupdate
162 install -D -m 755 genwqe_csv2vpd -T $(DESTDIR)/bin/genwqe_csv2vpd
163 install -D -m 755 genwqe_ffdc -T $(DESTDIR)/bin/genwqe_ffdc
164
165 uninstall: uninstall_gzip_tools uninstall_manpages
166 @for f in $(projs) ; do \
167 echo "removing $(DESTDIR)/bin/$$f ..."; \
168 $(RM) $(DESTDIR)/bin/$$f; \
169 done
170
171 clean distclean:
172 $(RM) $(objs) $(projs) $(manpages)
173
•174 .SECONDEXPANSION:
175 $(projs): $$($$@_objs)