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