Debian Codegraph @

tools/Makefile

raw ◀ ▶
Source reconstructed at patch state 2 of 3 — not the installed (fully patched) source.
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 genwqe_memcopy: force_cpu.o
68 genwqe_vpdconv genwqe_vpdupdate: genwqe_vpd_common.o
69
70 $(projs): $(libs)
71
72 objs = force_cpu.o genwqe_vpd_common.o $(projs:=.o)
73
74 test_scripts = genwqe_mt_perf genwqe_test_gz
75
76 manpages = $(projs:=.1.gz) $(test_scripts:=.1.gz)
77
78 manpages: all $(manpages)
79
80 genwqe_gunzip.o: genwqe_gzip.c
81 $(CC) -c $< $(CPPFLAGS) $(CFLAGS) -o $@
82
83 ### Deactivate existing implicit rule
84 %: %.c
85 %: %.sh
86
87 ### Generic rule to build a tool
88 %: %.o
89 $(CC) $(LDFLAGS) [email protected] $($(@)_objs) $($(@)_libs) $(LDLIBS) -o $@
90
91 %.o: %.c $(libs)
92 $(CC) -c $(CPPFLAGS) $(CFLAGS) $< -o $@
93
94 ### Setting LD_LIBRARY_PATH helps to try tools with dynamic linkage
95 %.1: %
96 LD_LIBRARY_PATH=../lib $(HELP2MAN) -N --output=$@ \
97 --help-option='-h' --version-option='-V' \
98 --name "IBM Hardware Accelerator Tool." ./$<
99
100 %.1.gz: %.1
101 gzip --best -c $< > $@
102
103 #
104 # Tools for card maintenance
105 #
106 install_release_tools: all
107 @mkdir -p $(DESTDIR)/bin
108 cp -uv genwqe_peek genwqe_poke genwqe_memcopy genwqe_echo \
109 genwqe_update \
110 $(DESTDIR)/bin
111
112 #
113 # Example tools and testcases
114 # gzip and gunzip go into special directory, since they should not be
115 # in regular path to be mixed up with distro version of those tools.
116 # Nevertheless we need them to accelerate tar for example with our
117 # hardware accelerated version of gzip/gunzip.
118 #
119 install_gzip_tools: all
120 install -D -m 755 genwqe_gzip -T $(DESTDIR)/bin/genwqe_gzip
121 install -D -m 755 genwqe_gunzip -T $(DESTDIR)/bin/genwqe_gunzip
122 install -D -m 755 zlib_mt_perf -T $(DESTDIR)/bin/zlib_mt_perf
123 install -D -m 755 genwqe_mt_perf -T $(DESTDIR)/bin/genwqe_mt_perf
124 install -D -m 755 genwqe_test_gz -T $(DESTDIR)/bin/genwqe_test_gz
125
126 uninstall_gzip_tools:
127 $(RM) $(DESTDIR)/bin/genwqe_gzip \
128 $(DESTDIR)/bin/genwqe_gunzip \
129 $(DESTDIR)/bin/zlib_mt_perf \
130 $(DESTDIR)/bin/genwqe_mt_perf \
131 $(DESTDIR)/bin/genwqe_test_gz
132
133 install_manpages: $(manpages)
134 @mkdir -p $(MAN_INSTALL_PATH)
135 cp -uv $(manpages) $(MAN_INSTALL_PATH)
136
137 install_release_manpages: $(manpages)
138 @mkdir -p $(MAN_INSTALL_PATH)
139
140 cp -uv genwqe_memcopy.1 genwqe_echo.1 genwqe_update.1 \
141 $(DESTDIR)/man/man1
142 cp -uv genwqe_memcopy.1 genwqe_echo.1 genwqe_update.1 \
143 $(MAN_INSTALL_PATH)
144
145 uninstall_manpages:
146 @for f in $(manpages) ; do \
147 echo "removing $(DESTDIR)/man/man1/$$f ..."; \
148 $(RM) $(DESTDIR)/man/man1/$$f; \
149 done
150
151 capi_install: genwqe_maint
152 install -D -m 755 genwqe_maint -T $(DESTDIR)/bin/genwqe_maint
153 install -D -m 755 genwqe_loadtree -T $(DESTDIR)/bin/genwqe_loadtree
154
155 install: install_gzip_tools install_manpages $(CAPI_INSTALL)
156 @mkdir -p $(DESTDIR)/bin
157 install -D genwqe_update -T $(DESTDIR)/bin/genwqe_update
158 install -D -m 755 genwqe_memcopy -T $(DESTDIR)/bin/genwqe_memcopy
159 install -D -m 755 genwqe_echo -T $(DESTDIR)/bin/genwqe_echo
160 install -D -m 755 genwqe_peek -T $(DESTDIR)/bin/genwqe_peek
161 install -D -m 755 genwqe_poke -T $(DESTDIR)/bin/genwqe_poke
162 install -D -m 755 genwqe_cksum -T $(DESTDIR)/bin/genwqe_cksum
163 install -D -m 755 genwqe_vpdconv -T $(DESTDIR)/bin/genwqe_vpdconv
164 install -D -m 755 genwqe_vpdupdate -T $(DESTDIR)/bin/genwqe_vpdupdate
165 install -D -m 755 genwqe_csv2vpd -T $(DESTDIR)/bin/genwqe_csv2vpd
166 install -D -m 755 genwqe_ffdc -T $(DESTDIR)/bin/genwqe_ffdc
167
168 uninstall: uninstall_gzip_tools uninstall_manpages
169 @for f in $(projs) ; do \
170 echo "removing $(DESTDIR)/bin/$$f ..."; \
171 $(RM) $(DESTDIR)/bin/$$f; \
172 done
173
174 clean distclean:
175 $(RM) $(objs) $(projs) $(manpages)
176