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