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