]> CyberLeo.Net >> Repos - FreeBSD/FreeBSD.git/blob - contrib/bc/Makefile.in
contrib/bc: merge version 5.1.0 from vendor branch
[FreeBSD/FreeBSD.git] / contrib / bc / Makefile.in
1 #
2 # SPDX-License-Identifier: BSD-2-Clause
3 #
4 # Copyright (c) 2018-2021 Gavin D. Howard and contributors.
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 # * Redistributions of source code must retain the above copyright notice, this
10 #   list of conditions and the following disclaimer.
11 #
12 # * Redistributions in binary form must reproduce the above copyright notice,
13 #   this list of conditions and the following disclaimer in the documentation
14 #   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 # %%WARNING%%
29 #
30 .POSIX:
31
32 SRC = %%SRC%%
33 OBJ = %%OBJ%%
34 GCDA = %%GCDA%%
35 GCNO = %%GCNO%%
36
37 BC_ENABLED_NAME = BC_ENABLED
38 BC_ENABLED = %%BC_ENABLED%%
39 DC_ENABLED_NAME = DC_ENABLED
40 DC_ENABLED = %%DC_ENABLED%%
41
42 HEADERS = include/args.h include/file.h include/lang.h include/lex.h include/num.h include/opt.h include/parse.h include/program.h include/read.h include/status.h include/vector.h include/vm.h
43 BC_HEADERS = include/bc.h
44 DC_HEADERS = include/dc.h
45 HISTORY_HEADERS = include/history.h
46 EXTRA_MATH_HEADERS = include/rand.h
47 LIBRARY_HEADERS = include/bcl.h include/library.h
48
49 GEN_DIR = gen
50 GEN = %%GEN%%
51 GEN_EXEC = $(GEN_DIR)/$(GEN)
52 GEN_C = $(GEN_DIR)/$(GEN).c
53
54 GEN_EMU = %%GEN_EMU%%
55
56 BC_LIB = $(GEN_DIR)/lib.bc
57 BC_LIB_C = $(GEN_DIR)/lib.c
58 BC_LIB_O = %%BC_LIB_O%%
59 BC_LIB_GCDA = $(GEN_DIR)/lib.gcda
60 BC_LIB_GCNO = $(GEN_DIR)/lib.gcno
61
62 BC_LIB2 = $(GEN_DIR)/lib2.bc
63 BC_LIB2_C = $(GEN_DIR)/lib2.c
64 BC_LIB2_O = %%BC_LIB2_O%%
65 BC_LIB2_GCDA = $(GEN_DIR)/lib2.gcda
66 BC_LIB2_GCNO = $(GEN_DIR)/lib2.gcno
67
68 BC_HELP = $(GEN_DIR)/bc_help.txt
69 BC_HELP_C = $(GEN_DIR)/bc_help.c
70 BC_HELP_O = %%BC_HELP_O%%
71 BC_HELP_GCDA = $(GEN_DIR)/bc_help.gcda
72 BC_HELP_GCNO = $(GEN_DIR)/bc_help.gcno
73
74 DC_HELP = $(GEN_DIR)/dc_help.txt
75 DC_HELP_C = $(GEN_DIR)/dc_help.c
76 DC_HELP_O = %%DC_HELP_O%%
77 DC_HELP_GCDA = $(GEN_DIR)/dc_help.gcda
78 DC_HELP_GCNO = $(GEN_DIR)/dc_help.gcno
79
80 BIN = bin
81 LOCALES = locales
82 EXEC_SUFFIX = %%EXECSUFFIX%%
83 EXEC_PREFIX = %%EXECPREFIX%%
84
85 BC = bc
86 DC = dc
87 BC_EXEC = $(BIN)/$(EXEC_PREFIX)$(BC)
88 DC_EXEC = $(BIN)/$(EXEC_PREFIX)$(DC)
89
90 BC_TEST_OUTPUTS = tests/bc_outputs
91 BC_FUZZ_OUTPUTS = tests/fuzzing/bc_outputs1 tests/fuzzing/bc_outputs2 tests/fuzzing/bc_outputs3
92 DC_TEST_OUTPUTS = tests/dc_outputs
93 DC_FUZZ_OUTPUTS = tests/fuzzing/dc_outputs
94
95 LIB = libbcl
96 LIB_NAME = $(LIB).a
97 LIBBC = $(BIN)/$(LIB_NAME)
98 BCL = bcl
99 BCL_TEST = $(BIN)/$(BCL)
100 BCL_TEST_C = tests/$(BCL).c
101
102 MANUALS = manuals
103 BC_MANPAGE_NAME = $(EXEC_PREFIX)$(BC)$(EXEC_SUFFIX).1
104 BC_MANPAGE = $(MANUALS)/$(BC).1
105 BC_MD = $(BC_MANPAGE).md
106 DC_MANPAGE_NAME = $(EXEC_PREFIX)$(DC)$(EXEC_SUFFIX).1
107 DC_MANPAGE = $(MANUALS)/$(DC).1
108 DC_MD = $(DC_MANPAGE).md
109 BCL_MANPAGE_NAME = bcl.3
110 BCL_MANPAGE = $(MANUALS)/$(BCL_MANPAGE_NAME)
111 BCL_MD = $(BCL_MANPAGE).md
112
113 MANPAGE_INSTALL_ARGS = -Dm644
114 BINARY_INSTALL_ARGS = -Dm755
115
116 BCL_HEADER_NAME = bcl.h
117 BCL_HEADER = include/$(BCL_HEADER_NAME)
118
119 %%DESTDIR%%
120 BINDIR = %%BINDIR%%
121 INCLUDEDIR = %%INCLUDEDIR%%
122 LIBDIR = %%LIBDIR%%
123 MAN1DIR = %%MAN1DIR%%
124 MAN3DIR = %%MAN3DIR%%
125 MAIN_EXEC = $(EXEC_PREFIX)$(%%MAIN_EXEC%%)$(EXEC_SUFFIX)
126 EXEC = $(%%EXEC%%)
127 NLSPATH = %%NLSPATH%%
128
129 BC_BUILD_TYPE = %%BUILD_TYPE%%
130
131 BC_ENABLE_LIBRARY = %%LIBRARY%%
132
133 BC_ENABLE_HISTORY = %%HISTORY%%
134 BC_ENABLE_EXTRA_MATH_NAME = BC_ENABLE_EXTRA_MATH
135 BC_ENABLE_EXTRA_MATH = %%EXTRA_MATH%%
136 BC_ENABLE_NLS = %%NLS%%
137 BC_LONG_BIT = %%LONG_BIT%%
138
139 BC_ENABLE_AFL = %%FUZZ%%
140 BC_ENABLE_MEMCHECK = %%MEMCHECK%%
141
142 BC_DEFAULT_BANNER = %%BC_DEFAULT_BANNER%%
143 BC_DEFAULT_SIGINT_RESET = %%BC_DEFAULT_SIGINT_RESET%%
144 DC_DEFAULT_SIGINT_RESET = %%DC_DEFAULT_SIGINT_RESET%%
145 BC_DEFAULT_TTY_MODE = %%BC_DEFAULT_TTY_MODE%%
146 DC_DEFAULT_TTY_MODE = %%DC_DEFAULT_TTY_MODE%%
147 BC_DEFAULT_PROMPT = %%BC_DEFAULT_PROMPT%%
148 DC_DEFAULT_PROMPT = %%DC_DEFAULT_PROMPT%%
149
150 RM = rm
151 MKDIR = mkdir
152
153 SCRIPTS = ./scripts
154
155 MINISTAT = ministat
156 MINISTAT_EXEC = $(SCRIPTS)/$(MINISTAT)
157
158 BITFUNCGEN = bitfuncgen
159 BITFUNCGEN_EXEC = $(SCRIPTS)/$(BITFUNCGEN)
160
161 INSTALL = $(SCRIPTS)/exec-install.sh
162 SAFE_INSTALL = $(SCRIPTS)/safe-install.sh
163 LINK = $(SCRIPTS)/link.sh
164 MANPAGE = $(SCRIPTS)/manpage.sh
165 KARATSUBA = $(SCRIPTS)/karatsuba.py
166 LOCALE_INSTALL = $(SCRIPTS)/locale_install.sh
167 LOCALE_UNINSTALL = $(SCRIPTS)/locale_uninstall.sh
168
169 VALGRIND_ARGS = --error-exitcode=100 --leak-check=full --show-leak-kinds=all --errors-for-leak-kinds=all
170
171 TEST_STARS = ***********************************************************************
172
173 BC_NUM_KARATSUBA_LEN = %%KARATSUBA_LEN%%
174
175 BC_DEFS0 = -DBC_DEFAULT_BANNER=$(BC_DEFAULT_BANNER)
176 BC_DEFS1 = -DBC_DEFAULT_SIGINT_RESET=$(BC_DEFAULT_SIGINT_RESET)
177 BC_DEFS2 = -DBC_DEFAULT_TTY_MODE=$(BC_DEFAULT_TTY_MODE)
178 BC_DEFS3 = -DBC_DEFAULT_PROMPT=$(BC_DEFAULT_PROMPT)
179 BC_DEFS = $(BC_DEFS0) $(BC_DEFS1) $(BC_DEFS2) $(BC_DEFS3)
180 DC_DEFS1 = -DDC_DEFAULT_SIGINT_RESET=$(DC_DEFAULT_SIGINT_RESET)
181 DC_DEFS2 = -DDC_DEFAULT_TTY_MODE=$(DC_DEFAULT_TTY_MODE)
182 DC_DEFS3 = -DDC_DEFAULT_PROMPT=$(DC_DEFAULT_PROMPT)
183 DC_DEFS = $(DC_DEFS1) $(DC_DEFS2) $(DC_DEFS3)
184
185 CPPFLAGS1 = -D$(BC_ENABLED_NAME)=$(BC_ENABLED) -D$(DC_ENABLED_NAME)=$(DC_ENABLED)
186 CPPFLAGS2 = $(CPPFLAGS1) -I./include/ -DBUILD_TYPE=$(BC_BUILD_TYPE) %%LONG_BIT_DEFINE%%
187 CPPFLAGS3 = $(CPPFLAGS2) -DEXECPREFIX=$(EXEC_PREFIX) -DMAINEXEC=$(MAIN_EXEC)
188 CPPFLAGS4 = $(CPPFLAGS3) -D_POSIX_C_SOURCE=200809L -D_XOPEN_SOURCE=700 %%BSD%%
189 CPPFLAGS5 = $(CPPFLAGS4) -DBC_NUM_KARATSUBA_LEN=$(BC_NUM_KARATSUBA_LEN)
190 CPPFLAGS6 = $(CPPFLAGS5) -DBC_ENABLE_NLS=$(BC_ENABLE_NLS)
191 CPPFLAGS7 = $(CPPFLAGS6) -D$(BC_ENABLE_EXTRA_MATH_NAME)=$(BC_ENABLE_EXTRA_MATH)
192 CPPFLAGS8 = $(CPPFLAGS7) -DBC_ENABLE_HISTORY=$(BC_ENABLE_HISTORY) -DBC_ENABLE_LIBRARY=$(BC_ENABLE_LIBRARY)
193 CPPFLAGS = $(CPPFLAGS8) -DBC_ENABLE_MEMCHECK=$(BC_ENABLE_MEMCHECK) -DBC_ENABLE_AFL=$(BC_ENABLE_AFL)
194 CFLAGS = $(CPPFLAGS) $(BC_DEFS) $(DC_DEFS) %%CPPFLAGS%% %%CFLAGS%%
195 LDFLAGS = %%LDFLAGS%%
196
197 HOSTCFLAGS = %%HOSTCFLAGS%%
198
199 CC = %%CC%%
200 HOSTCC = %%HOSTCC%%
201
202 BC_LIB_C_ARGS = bc_lib bc_lib_name $(BC_ENABLED_NAME) 1
203 BC_LIB2_C_ARGS = bc_lib2 bc_lib2_name "$(BC_ENABLED_NAME) && $(BC_ENABLE_EXTRA_MATH_NAME)" 1
204
205 OBJS = $(DC_HELP_O) $(BC_HELP_O) $(BC_LIB_O) $(BC_LIB2_O) $(OBJ)
206
207 all: %%DEFAULT_TARGET%%
208
209 %%DEFAULT_TARGET%%: %%DEFAULT_TARGET_PREREQS%%
210         %%DEFAULT_TARGET_CMD%%
211
212 %%SECOND_TARGET%%: %%SECOND_TARGET_PREREQS%%
213         %%SECOND_TARGET_CMD%%
214
215 $(GEN_EXEC):
216         %%GEN_EXEC_TARGET%%
217
218 $(BC_LIB_C): $(GEN_EXEC) $(BC_LIB)
219         $(GEN_EMU) $(GEN_EXEC) $(BC_LIB) $(BC_LIB_C) $(BC_LIB_C_ARGS)
220
221 $(BC_LIB_O): $(BC_LIB_C)
222         $(CC) $(CFLAGS) -o $@ -c $<
223
224 $(BC_LIB2_C): $(GEN_EXEC) $(BC_LIB2)
225         $(GEN_EMU) $(GEN_EXEC) $(BC_LIB2) $(BC_LIB2_C) $(BC_LIB2_C_ARGS)
226
227 $(BC_LIB2_O): $(BC_LIB2_C)
228         $(CC) $(CFLAGS) -o $@ -c $<
229
230 $(BC_HELP_C): $(GEN_EXEC) $(BC_HELP)
231         $(GEN_EMU) $(GEN_EXEC) $(BC_HELP) $(BC_HELP_C) bc_help "" $(BC_ENABLED_NAME)
232
233 $(BC_HELP_O): $(BC_HELP_C)
234         $(CC) $(CFLAGS) -o $@ -c $<
235
236 $(DC_HELP_C): $(GEN_EXEC) $(DC_HELP)
237         $(GEN_EMU) $(GEN_EXEC) $(DC_HELP) $(DC_HELP_C) dc_help "" $(DC_ENABLED_NAME)
238
239 $(DC_HELP_O): $(DC_HELP_C)
240         $(CC) $(CFLAGS) -o $@ -c $<
241
242 $(BIN):
243         $(MKDIR) -p $(BIN)
244
245 headers: %%HEADERS%%
246
247 $(MINISTAT):
248         $(HOSTCC) $(HOSTCFLAGS) -lm -o $(MINISTAT_EXEC) scripts/ministat.c
249
250 $(BITFUNCGEN):
251         $(HOSTCC) $(HOSTCFLAGS) -lm -o $(BITFUNCGEN_EXEC) scripts/bitfuncgen.c
252
253 help:
254         @printf 'available targets:\n'
255         @printf '\n'
256         @printf '    all (default)   builds %%EXECUTABLES%%\n'
257         @printf '    check           alias for `make test`\n'
258         @printf '    clean           removes all build files\n'
259         @printf '    clean_config    removes all build files as well as the generated Makefile\n'
260         @printf '    clean_tests     removes all build files, the generated Makefile,\n'
261         @printf '                    and generated tests\n'
262         @printf '    install         installs binaries to "%s%s"\n' "$(DESTDIR)" "$(BINDIR)"
263         @printf '                    and (if enabled) manpages to "%s%s"\n' "$(DESTDIR)" "$(MAN1DIR)"
264         @printf '    karatsuba       runs the karatsuba script (requires Python 3)\n'
265         @printf '    karatsuba_test  runs the karatsuba script while running tests\n'
266         @printf '                    (requires Python 3)\n'
267         @printf '    uninstall       uninstalls binaries from "%s%s"\n' "$(DESTDIR)" "$(BINDIR)"
268         @printf '                    and (if enabled) manpages from "%s%s"\n' "$(DESTDIR)" "$(MAN1DIR)"
269         @printf '    test            runs the test suite\n'
270         @printf '    test_bc         runs the bc test suite, if bc has been built\n'
271         @printf '    test_dc         runs the dc test suite, if dc has been built\n'
272         @printf '    time_test       runs the test suite, displaying times for some things\n'
273         @printf '    time_test_bc    runs the bc test suite, displaying times for some things\n'
274         @printf '    time_test_dc    runs the dc test suite, displaying times for some things\n'
275         @printf '    timeconst       runs the test on the Linux timeconst.bc script,\n'
276         @printf '                    if it exists and bc has been built\n'
277         @printf '    valgrind        runs the test suite through valgrind\n'
278         @printf '    valgrind_bc     runs the bc test suite, if bc has been built,\n'
279         @printf '                    through valgrind\n'
280         @printf '    valgrind_dc     runs the dc test suite, if dc has been built,\n'
281         @printf '                    through valgrind\n'
282
283 run_all_tests: bc_all_tests timeconst_all_tests dc_all_tests
284
285 run_all_tests_np: bc_all_tests_np timeconst_all_tests dc_all_tests_np
286
287 bc_all_tests:
288         %%BC_ALL_TESTS%%
289
290 bc_all_tests_np:
291         %%BC_ALL_TESTS_NP%%
292
293 timeconst_all_tests:
294         %%TIMECONST_ALL_TESTS%%
295
296 dc_all_tests:
297         %%DC_ALL_TESTS%%
298
299 dc_all_tests_np:
300         %%DC_ALL_TESTS_NP%%
301
302 history_all_tests:
303         %%HISTORY_TESTS%%
304
305 check: test
306
307 test: %%TESTS%%
308
309 test_bc: test_bc_header test_bc_tests test_bc_scripts test_bc_errors test_bc_stdin test_bc_read test_bc_other
310         @printf '\nAll bc tests passed.\n\n$(TEST_STARS)\n'
311
312 test_bc_tests:%%BC_TESTS%%
313
314 test_bc_scripts:%%BC_SCRIPT_TESTS%%
315
316 test_bc_stdin:
317         @sh tests/stdin.sh bc %%BC_TEST_EXEC%%
318
319 test_bc_read:
320         @sh tests/read.sh bc %%BC_TEST_EXEC%%
321
322 test_bc_errors: test_bc_error_lines%%BC_ERROR_TESTS%%
323
324 test_bc_error_lines:
325         @sh tests/errors.sh bc %%BC_TEST_EXEC%%
326
327 test_bc_other:
328         @sh tests/other.sh bc $(BC_ENABLE_EXTRA_MATH) %%BC_TEST_EXEC%%
329
330 test_bc_header:
331         @printf '$(TEST_STARS)\n\nRunning bc tests...\n\n'
332
333 test_dc: test_dc_header test_dc_tests test_dc_scripts test_dc_errors test_dc_stdin test_dc_read test_dc_other
334         @printf '\nAll dc tests passed.\n\n$(TEST_STARS)\n'
335
336 test_dc_tests:%%DC_TESTS%%
337
338 test_dc_scripts:%%DC_SCRIPT_TESTS%%
339
340 test_dc_stdin:
341         @sh tests/stdin.sh dc %%DC_TEST_EXEC%%
342
343 test_dc_read:
344         @sh tests/read.sh dc %%DC_TEST_EXEC%%
345
346 test_dc_errors: test_dc_error_lines%%DC_ERROR_TESTS%%
347
348 test_dc_error_lines:
349         @sh tests/errors.sh dc %%DC_TEST_EXEC%%
350
351 test_dc_other:
352         @sh tests/other.sh dc $(BC_ENABLE_EXTRA_MATH) %%DC_TEST_EXEC%%
353
354 test_dc_header:
355         @printf '$(TEST_STARS)\n\nRunning dc tests...\n\n'
356
357 timeconst:
358         %%TIMECONST%%
359
360 test_history: test_history_header test_bc_history test_dc_history
361         @printf '\nAll history tests passed.\n\n$(TEST_STARS)\n'
362
363 test_bc_history:%%BC_HISTORY_TEST_PREREQS%%
364
365 test_bc_history_all: test_bc_history0 test_bc_history1 test_bc_history2 test_bc_history3 test_bc_history4 test_bc_history5 test_bc_history6 test_bc_history7 test_bc_history8 test_bc_history9 test_bc_history10 test_bc_history11 test_bc_history12 test_bc_history13 test_bc_history14 test_bc_history15 test_bc_history16 test_bc_history17 test_bc_history18 test_bc_history19 test_bc_history20 test_bc_history21
366
367 test_bc_history_skip:
368         @printf 'No bc history tests to run\n'
369
370 test_bc_history0:
371         @sh tests/history.sh bc 0 %%BC_TEST_EXEC%%
372
373 test_bc_history1:
374         @sh tests/history.sh bc 1 %%BC_TEST_EXEC%%
375
376 test_bc_history2:
377         @sh tests/history.sh bc 2 %%BC_TEST_EXEC%%
378
379 test_bc_history3:
380         @sh tests/history.sh bc 3 %%BC_TEST_EXEC%%
381
382 test_bc_history4:
383         @sh tests/history.sh bc 4 %%BC_TEST_EXEC%%
384
385 test_bc_history5:
386         @sh tests/history.sh bc 5 %%BC_TEST_EXEC%%
387
388 test_bc_history6:
389         @sh tests/history.sh bc 6 %%BC_TEST_EXEC%%
390
391 test_bc_history7:
392         @sh tests/history.sh bc 7 %%BC_TEST_EXEC%%
393
394 test_bc_history8:
395         @sh tests/history.sh bc 8 %%BC_TEST_EXEC%%
396
397 test_bc_history9:
398         @sh tests/history.sh bc 9 %%BC_TEST_EXEC%%
399
400 test_bc_history10:
401         @sh tests/history.sh bc 10 %%BC_TEST_EXEC%%
402
403 test_bc_history11:
404         @sh tests/history.sh bc 11 %%BC_TEST_EXEC%%
405
406 test_bc_history12:
407         @sh tests/history.sh bc 12 %%BC_TEST_EXEC%%
408
409 test_bc_history13:
410         @sh tests/history.sh bc 13 %%BC_TEST_EXEC%%
411
412 test_bc_history14:
413         @sh tests/history.sh bc 14 %%BC_TEST_EXEC%%
414
415 test_bc_history15:
416         @sh tests/history.sh bc 15 %%BC_TEST_EXEC%%
417
418 test_bc_history16:
419         @sh tests/history.sh bc 16 %%BC_TEST_EXEC%%
420
421 test_bc_history17:
422         @sh tests/history.sh bc 17 %%BC_TEST_EXEC%%
423
424 test_bc_history18:
425         @sh tests/history.sh bc 18 %%BC_TEST_EXEC%%
426
427 test_bc_history19:
428         @sh tests/history.sh bc 19 %%BC_TEST_EXEC%%
429
430 test_bc_history20:
431         @sh tests/history.sh bc 20 %%BC_TEST_EXEC%%
432
433 test_bc_history21:
434         @sh tests/history.sh bc 21 %%BC_TEST_EXEC%%
435
436 test_dc_history:%%DC_HISTORY_TEST_PREREQS%%
437
438 test_dc_history_all: test_dc_history0 test_dc_history1 test_dc_history2 test_dc_history3 test_dc_history4 test_dc_history5 test_dc_history6 test_dc_history7 test_dc_history8 test_dc_history9
439
440 test_dc_history_skip:
441         @printf 'No dc history tests to run\n'
442
443 test_dc_history0:
444         @sh tests/history.sh dc 0 %%DC_TEST_EXEC%%
445
446 test_dc_history1:
447         @sh tests/history.sh dc 1 %%DC_TEST_EXEC%%
448
449 test_dc_history2:
450         @sh tests/history.sh dc 2 %%DC_TEST_EXEC%%
451
452 test_dc_history3:
453         @sh tests/history.sh dc 3 %%DC_TEST_EXEC%%
454
455 test_dc_history4:
456         @sh tests/history.sh dc 4 %%DC_TEST_EXEC%%
457
458 test_dc_history5:
459         @sh tests/history.sh dc 5 %%DC_TEST_EXEC%%
460
461 test_dc_history6:
462         @sh tests/history.sh dc 6 %%DC_TEST_EXEC%%
463
464 test_dc_history7:
465         @sh tests/history.sh dc 7 %%DC_TEST_EXEC%%
466
467 test_dc_history8:
468         @sh tests/history.sh dc 8 %%DC_TEST_EXEC%%
469
470 test_dc_history9:
471         @sh tests/history.sh dc 9 %%DC_TEST_EXEC%%
472
473 test_history_header:
474         @printf '$(TEST_STARS)\n\nRunning history tests...\n\n'
475
476 library_test: $(LIBBC)
477         $(CC) $(CFLAGS) $(BCL_TEST_C) $(LIBBC) -o $(BCL_TEST)
478
479 test_library: library_test
480         $(BCL_TEST)
481
482 karatsuba:
483         %%KARATSUBA%%
484
485 karatsuba_test:
486         %%KARATSUBA_TEST%%
487
488 coverage_output:
489         %%COVERAGE_OUTPUT%%
490
491 coverage:%%COVERAGE_PREREQS%%
492
493 manpages:
494         $(MANPAGE) bc
495         $(MANPAGE) dc
496         $(MANPAGE) bcl
497
498 clean_gen:
499         @$(RM) -f $(GEN_EXEC)
500
501 clean:%%CLEAN_PREREQS%%
502         @printf 'Cleaning files...\n'
503         @$(RM) -f src/*.tmp gen/*.tmp
504         @$(RM) -f $(OBJ)
505         @$(RM) -f $(BC_EXEC)
506         @$(RM) -f $(DC_EXEC)
507         @$(RM) -fr $(BIN)
508         @$(RM) -f $(LOCALES)/*.cat
509         @$(RM) -f $(BC_LIB_C) $(BC_LIB_O)
510         @$(RM) -f $(BC_LIB2_C) $(BC_LIB2_O)
511         @$(RM) -f $(BC_HELP_C) $(BC_HELP_O)
512         @$(RM) -f $(DC_HELP_C) $(DC_HELP_O)
513         @$(RM) -fr Debug/ Release/
514
515 clean_benchmarks:
516         @printf 'Cleaning benchmarks...\n'
517         @$(RM) -f $(MINISTAT_EXEC)
518         @$(RM) -f benchmarks/bc/*.txt
519         @$(RM) -f benchmarks/dc/*.txt
520
521 clean_config: clean clean_benchmarks
522         @printf 'Cleaning config...\n'
523         @$(RM) -f Makefile
524         @$(RM) -f $(BC_MD) $(BC_MANPAGE)
525         @$(RM) -f $(DC_MD) $(DC_MANPAGE)
526
527 clean_coverage:
528         @printf 'Cleaning coverage files...\n'
529         @$(RM) -f *.gcov
530         @$(RM) -f *.html
531         @$(RM) -f *.gcda *.gcno
532         @$(RM) -f *.profraw
533         @$(RM) -f $(GCDA) $(GCNO)
534         @$(RM) -f $(BC_GCDA) $(BC_GCNO)
535         @$(RM) -f $(DC_GCDA) $(DC_GCNO)
536         @$(RM) -f $(HISTORY_GCDA) $(HISTORY_GCNO)
537         @$(RM) -f $(RAND_GCDA) $(RAND_GCNO)
538         @$(RM) -f $(BC_LIB_GCDA) $(BC_LIB_GCNO)
539         @$(RM) -f $(BC_LIB2_GCDA) $(BC_LIB2_GCNO)
540         @$(RM) -f $(BC_HELP_GCDA) $(BC_HELP_GCNO)
541         @$(RM) -f $(DC_HELP_GCDA) $(DC_HELP_GCNO)
542
543 clean_tests: clean clean_config clean_coverage
544         @printf 'Cleaning test files...\n'
545         @$(RM) -fr $(BC_TEST_OUTPUTS) $(DC_TEST_OUTPUTS)
546         @$(RM) -fr $(BC_FUZZ_OUTPUTS) $(DC_FUZZ_OUTPUTS)
547         @$(RM) -f tests/bc/parse.txt tests/bc/parse_results.txt
548         @$(RM) -f tests/bc/print.txt tests/bc/print_results.txt
549         @$(RM) -f tests/bc/bessel.txt tests/bc/bessel_results.txt
550         @$(RM) -f tests/bc/strings2.txt tests/bc/strings2_results.txt
551         @$(RM) -f tests/bc/scripts/bessel.txt
552         @$(RM) -f tests/bc/scripts/parse.txt
553         @$(RM) -f tests/bc/scripts/print.txt
554         @$(RM) -f tests/bc/scripts/add.txt
555         @$(RM) -f tests/bc/scripts/divide.txt
556         @$(RM) -f tests/bc/scripts/multiply.txt
557         @$(RM) -f tests/bc/scripts/subtract.txt
558         @$(RM) -f tests/bc/scripts/strings2.txt
559         @$(RM) -f tests/dc/scripts/prime.txt
560         @$(RM) -f .log_*.txt
561         @$(RM) -f .math.txt .results.txt .ops.txt
562         @$(RM) -f .test.txt
563         @$(RM) -f tags .gdbbreakpoints .gdb_history .gdbsetup
564         @$(RM) -f cscope.*
565         @$(RM) -f bc.old
566         @$(RM) -f $(BITFUNCGEN_EXEC)
567
568 install_locales:
569         %%INSTALL_LOCALES%%
570
571 install_bc_manpage:
572         $(SAFE_INSTALL) $(MANPAGE_INSTALL_ARGS) $(BC_MANPAGE) $(DESTDIR)$(MAN1DIR)/$(BC_MANPAGE_NAME)
573
574 install_dc_manpage:
575         $(SAFE_INSTALL) $(MANPAGE_INSTALL_ARGS) $(DC_MANPAGE) $(DESTDIR)$(MAN1DIR)/$(DC_MANPAGE_NAME)
576
577 install_bcl_manpage:
578         $(SAFE_INSTALL) $(MANPAGE_INSTALL_ARGS) $(BCL_MANPAGE) $(DESTDIR)$(MAN3DIR)/$(BCL_MANPAGE_NAME)
579
580 install_bcl_header:
581         $(SAFE_INSTALL) $(MANPAGE_INSTALL_ARGS) $(BCL_HEADER) $(DESTDIR)$(INCLUDEDIR)/$(BCL_HEADER_NAME)
582
583 install_execs:
584         $(INSTALL) $(DESTDIR)$(BINDIR) "$(EXEC_SUFFIX)"
585
586 install_library:
587         $(SAFE_INSTALL) $(BINARY_INSTALL_ARGS) $(LIBBC) $(DESTDIR)$(LIBDIR)/$(LIB_NAME)
588
589 install:%%INSTALL_LOCALES_PREREQS%%%%INSTALL_MAN_PREREQS%%%%INSTALL_PREREQS%%
590
591 uninstall_locales:
592         $(LOCALE_UNINSTALL) $(NLSPATH) $(MAIN_EXEC) $(DESTDIR)
593
594 uninstall_bc_manpage:
595         $(RM) -f $(DESTDIR)$(MAN1DIR)/$(BC_MANPAGE_NAME)
596
597 uninstall_bc:
598         $(RM) -f $(DESTDIR)$(BINDIR)/$(EXEC_PREFIX)$(BC)$(EXEC_SUFFIX)
599
600 uninstall_dc_manpage:
601         $(RM) -f $(DESTDIR)$(MAN1DIR)/$(DC_MANPAGE_NAME)
602
603 uninstall_dc:
604         $(RM) -f $(DESTDIR)$(BINDIR)/$(EXEC_PREFIX)$(DC)$(EXEC_SUFFIX)
605
606 uninstall_library:
607         $(RM) -f $(DESTDIR)$(LIBDIR)/$(LIB_NAME)
608
609 uninstall_bcl_header:
610         $(RM) -f $(DESTDIR)$(INCLUDEDIR)/$(BCL_HEADER_NAME)
611
612 uninstall_bcl_manpage:
613         $(RM) -f $(DESTDIR)$(MAN3DIR)/$(BCL_MANPAGE_NAME)
614
615 uninstall:%%UNINSTALL_LOCALES_PREREQS%%%%UNINSTALL_MAN_PREREQS%%%%UNINSTALL_PREREQS%%