Gavin Howard | 27fa9cd | 2018-12-12 02:52:52 -0700 | [diff] [blame] | 1 | # |
Zach van Rijn | 6d2cf3f | 2020-01-14 22:05:02 +0000 | [diff] [blame] | 2 | # Copyright (c) 2018-2020 Gavin D. Howard and contributors. |
Gavin Howard | 27fa9cd | 2018-12-12 02:52:52 -0700 | [diff] [blame] | 3 | # |
Gavin Howard | 7345cb9 | 2019-04-08 14:13:43 -0600 | [diff] [blame] | 4 | # All rights reserved. |
Gavin Howard | 27fa9cd | 2018-12-12 02:52:52 -0700 | [diff] [blame] | 5 | # |
Gavin Howard | 7345cb9 | 2019-04-08 14:13:43 -0600 | [diff] [blame] | 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. |
Gavin Howard | 27fa9cd | 2018-12-12 02:52:52 -0700 | [diff] [blame] | 27 | # |
Gavin Howard | b55ad00 | 2018-12-20 16:59:23 -0700 | [diff] [blame] | 28 | # %%WARNING%% |
| 29 | # |
Gavin Howard | 27fa9cd | 2018-12-12 02:52:52 -0700 | [diff] [blame] | 30 | .POSIX: |
| 31 | |
Gavin Howard | e3ab65d | 2020-05-13 11:50:06 -0600 | [diff] [blame] | 32 | VERSION = 2.8.0 |
Gavin Howard | d2ec207 | 2019-06-26 22:55:07 -0600 | [diff] [blame] | 33 | |
Gavin Howard | 27fa9cd | 2018-12-12 02:52:52 -0700 | [diff] [blame] | 34 | SRC = %%SRC%% |
| 35 | OBJ = %%OBJ%% |
| 36 | GCDA = %%GCDA%% |
| 37 | GCNO = %%GCNO%% |
| 38 | |
| 39 | BC_SRC = %%BC_SRC%% |
| 40 | BC_OBJ = %%BC_OBJ%% |
| 41 | BC_GCDA = %%BC_GCDA%% |
| 42 | BC_GCNO = %%BC_GCNO%% |
| 43 | |
| 44 | DC_SRC = %%DC_SRC%% |
| 45 | DC_OBJ = %%DC_OBJ%% |
| 46 | DC_GCDA = %%DC_GCDA%% |
| 47 | DC_GCNO = %%DC_GCNO%% |
| 48 | |
Gavin Howard | bf81339 | 2018-12-20 10:49:00 -0700 | [diff] [blame] | 49 | HISTORY_SRC = %%HISTORY_SRC%% |
| 50 | HISTORY_OBJ = %%HISTORY_OBJ%% |
| 51 | HISTORY_GCDA = %%HISTORY_GCDA%% |
| 52 | HISTORY_GCNO = %%HISTORY_GCNO%% |
| 53 | |
Gavin Howard | 66c6bc9 | 2019-10-11 22:31:54 -0600 | [diff] [blame] | 54 | RAND_SRC = %%RAND_SRC%% |
| 55 | RAND_OBJ = %%RAND_OBJ%% |
| 56 | RAND_GCDA = %%RAND_GCDA%% |
| 57 | RAND_GCNO = %%RAND_GCNO%% |
| 58 | |
Gavin Howard | 27fa9cd | 2018-12-12 02:52:52 -0700 | [diff] [blame] | 59 | BC_ENABLED_NAME = BC_ENABLED |
| 60 | BC_ENABLED = %%BC_ENABLED%% |
| 61 | DC_ENABLED_NAME = DC_ENABLED |
| 62 | DC_ENABLED = %%DC_ENABLED%% |
| 63 | |
Gavin Howard | 27fa9cd | 2018-12-12 02:52:52 -0700 | [diff] [blame] | 64 | GEN_DIR = gen |
Gavin Howard | a513224 | 2019-04-22 08:34:28 -0600 | [diff] [blame] | 65 | GEN = %%GEN%% |
Gavin Howard | 27fa9cd | 2018-12-12 02:52:52 -0700 | [diff] [blame] | 66 | GEN_EXEC = $(GEN_DIR)/$(GEN) |
| 67 | GEN_C = $(GEN_DIR)/$(GEN).c |
| 68 | |
Gavin Howard | 4dff545 | 2018-12-20 10:06:58 -0700 | [diff] [blame] | 69 | GEN_EMU = %%GEN_EMU%% |
| 70 | |
Gavin Howard | 27fa9cd | 2018-12-12 02:52:52 -0700 | [diff] [blame] | 71 | BC_LIB = $(GEN_DIR)/lib.bc |
| 72 | BC_LIB_C = $(GEN_DIR)/lib.c |
Gavin Howard | a1cd122 | 2019-01-02 14:40:46 -0700 | [diff] [blame] | 73 | BC_LIB_O = %%BC_LIB_O%% |
Gavin Howard | aba12e7 | 2019-01-07 17:48:27 -0700 | [diff] [blame] | 74 | BC_LIB_GCDA = $(GEN_DIR)/lib.gcda |
| 75 | BC_LIB_GCNO = $(GEN_DIR)/lib.gcno |
Gavin Howard | 27fa9cd | 2018-12-12 02:52:52 -0700 | [diff] [blame] | 76 | |
Gavin Howard | 6fcb504 | 2018-12-26 17:44:06 -0700 | [diff] [blame] | 77 | BC_LIB2 = $(GEN_DIR)/lib2.bc |
| 78 | BC_LIB2_C = $(GEN_DIR)/lib2.c |
Gavin Howard | 9fbeaa8 | 2018-12-27 18:13:28 -0700 | [diff] [blame] | 79 | BC_LIB2_O = %%BC_LIB2_O%% |
Gavin Howard | aba12e7 | 2019-01-07 17:48:27 -0700 | [diff] [blame] | 80 | BC_LIB2_GCDA = $(GEN_DIR)/lib2.gcda |
| 81 | BC_LIB2_GCNO = $(GEN_DIR)/lib2.gcno |
Gavin Howard | 6fcb504 | 2018-12-26 17:44:06 -0700 | [diff] [blame] | 82 | |
Gavin Howard | 27fa9cd | 2018-12-12 02:52:52 -0700 | [diff] [blame] | 83 | BC_HELP = $(GEN_DIR)/bc_help.txt |
| 84 | BC_HELP_C = $(GEN_DIR)/bc_help.c |
Gavin Howard | a1cd122 | 2019-01-02 14:40:46 -0700 | [diff] [blame] | 85 | BC_HELP_O = %%BC_HELP_O%% |
Gavin Howard | aba12e7 | 2019-01-07 17:48:27 -0700 | [diff] [blame] | 86 | BC_HELP_GCDA = $(GEN_DIR)/bc_help.gcda |
| 87 | BC_HELP_GCNO = $(GEN_DIR)/bc_help.gcno |
Gavin Howard | 27fa9cd | 2018-12-12 02:52:52 -0700 | [diff] [blame] | 88 | |
| 89 | DC_HELP = $(GEN_DIR)/dc_help.txt |
| 90 | DC_HELP_C = $(GEN_DIR)/dc_help.c |
Gavin Howard | a1cd122 | 2019-01-02 14:40:46 -0700 | [diff] [blame] | 91 | DC_HELP_O = %%DC_HELP_O%% |
Gavin Howard | aba12e7 | 2019-01-07 17:48:27 -0700 | [diff] [blame] | 92 | DC_HELP_GCDA = $(GEN_DIR)/dc_help.gcda |
| 93 | DC_HELP_GCNO = $(GEN_DIR)/dc_help.gcno |
Gavin Howard | 27fa9cd | 2018-12-12 02:52:52 -0700 | [diff] [blame] | 94 | |
| 95 | BIN = bin |
Gavin Howard | fa08ee4 | 2019-02-20 16:40:01 -0700 | [diff] [blame] | 96 | LOCALES = locales |
Gavin Howard | 36ae629 | 2019-04-01 07:30:27 -0600 | [diff] [blame] | 97 | EXEC_SUFFIX = %%EXECSUFFIX%% |
| 98 | EXEC_PREFIX = %%EXECPREFIX%% |
Gavin Howard | 27fa9cd | 2018-12-12 02:52:52 -0700 | [diff] [blame] | 99 | |
| 100 | BC = bc |
| 101 | DC = dc |
Gavin Howard | 36ae629 | 2019-04-01 07:30:27 -0600 | [diff] [blame] | 102 | BC_EXEC = $(BIN)/$(EXEC_PREFIX)$(BC) |
| 103 | DC_EXEC = $(BIN)/$(EXEC_PREFIX)$(DC) |
Gavin Howard | 27fa9cd | 2018-12-12 02:52:52 -0700 | [diff] [blame] | 104 | |
Gavin Howard | 471b6c0 | 2019-01-17 14:25:07 -0700 | [diff] [blame] | 105 | MANUALS = manuals |
Gavin Howard | 36ae629 | 2019-04-01 07:30:27 -0600 | [diff] [blame] | 106 | BC_MANPAGE_NAME = $(EXEC_PREFIX)$(BC)$(EXEC_SUFFIX).1 |
Gavin Howard | ecf19bb | 2019-03-30 13:25:18 -0600 | [diff] [blame] | 107 | BC_MANPAGE = $(MANUALS)/$(BC).1 |
Gavin Howard | 471b6c0 | 2019-01-17 14:25:07 -0700 | [diff] [blame] | 108 | BC_RONN = $(BC_MANPAGE).ronn |
Gavin Howard | 36ae629 | 2019-04-01 07:30:27 -0600 | [diff] [blame] | 109 | DC_MANPAGE_NAME = $(EXEC_PREFIX)$(DC)$(EXEC_SUFFIX).1 |
Gavin Howard | ecf19bb | 2019-03-30 13:25:18 -0600 | [diff] [blame] | 110 | DC_MANPAGE = $(MANUALS)/$(DC).1 |
Gavin Howard | 471b6c0 | 2019-01-17 14:25:07 -0700 | [diff] [blame] | 111 | DC_RONN = $(DC_MANPAGE).ronn |
| 112 | |
Gavin Howard | ed9b6c2 | 2019-01-23 12:02:43 -0700 | [diff] [blame] | 113 | MANPAGE_INSTALL_ARGS = -Dm644 |
| 114 | |
Gavin Howard | 9a67974 | 2019-04-06 09:44:57 -0600 | [diff] [blame] | 115 | %%DESTDIR%% |
Gavin Howard | 471b6c0 | 2019-01-17 14:25:07 -0700 | [diff] [blame] | 116 | BINDIR = %%BINDIR%% |
| 117 | MAN1DIR = %%MAN1DIR%% |
Gavin Howard | ae30026 | 2019-04-01 14:03:42 -0600 | [diff] [blame] | 118 | MAIN_EXEC = $(EXEC_PREFIX)$(%%MAIN_EXEC%%)$(EXEC_SUFFIX) |
Gavin Howard | 5008025 | 2019-02-20 15:27:43 -0700 | [diff] [blame] | 119 | EXEC = $(%%EXEC%%) |
Gavin Howard | bc02129 | 2019-04-09 10:04:01 -0600 | [diff] [blame] | 120 | NLSPATH = %%NLSPATH%% |
Gavin Howard | 074b38a | 2019-01-17 11:15:59 -0700 | [diff] [blame] | 121 | |
Gavin Howard | 27fa9cd | 2018-12-12 02:52:52 -0700 | [diff] [blame] | 122 | BC_ENABLE_SIGNALS = %%SIGNALS%% |
| 123 | BC_ENABLE_HISTORY = %%HISTORY%% |
Gavin Howard | 6fcb504 | 2018-12-26 17:44:06 -0700 | [diff] [blame] | 124 | BC_ENABLE_EXTRA_MATH_NAME = BC_ENABLE_EXTRA_MATH |
| 125 | BC_ENABLE_EXTRA_MATH = %%EXTRA_MATH%% |
Gavin Howard | 5008025 | 2019-02-20 15:27:43 -0700 | [diff] [blame] | 126 | BC_ENABLE_NLS = %%NLS%% |
Gavin Howard | 1444c9f | 2019-06-21 21:16:11 -0600 | [diff] [blame] | 127 | BC_ENABLE_PROMPT = %%PROMPT%% |
Gavin Howard | 277b514 | 2019-05-10 10:58:57 -0600 | [diff] [blame] | 128 | BC_LONG_BIT = %%LONG_BIT%% |
Gavin Howard | 27fa9cd | 2018-12-12 02:52:52 -0700 | [diff] [blame] | 129 | |
Gavin Howard | c6547d6 | 2018-12-19 12:52:08 -0700 | [diff] [blame] | 130 | RM = rm |
Gavin Howard | 7ff15ae | 2018-12-20 10:28:23 -0700 | [diff] [blame] | 131 | MKDIR = mkdir |
| 132 | |
Gavin Howard | 27fa9cd | 2018-12-12 02:52:52 -0700 | [diff] [blame] | 133 | INSTALL = ./install.sh |
Gavin Howard | 074b38a | 2019-01-17 11:15:59 -0700 | [diff] [blame] | 134 | SAFE_INSTALL = ./safe-install.sh |
Gavin Howard | 27fa9cd | 2018-12-12 02:52:52 -0700 | [diff] [blame] | 135 | LINK = ./link.sh |
Gavin Howard | 59bd308 | 2019-10-10 21:19:38 -0600 | [diff] [blame] | 136 | MANPAGE = ./manpage.sh |
Gavin Howard | 27fa9cd | 2018-12-12 02:52:52 -0700 | [diff] [blame] | 137 | KARATSUBA = ./karatsuba.py |
Gavin Howard | f680e35 | 2019-04-01 13:28:48 -0600 | [diff] [blame] | 138 | LOCALE_INSTALL = ./locale_install.sh |
| 139 | LOCALE_UNINSTALL = ./locale_uninstall.sh |
Gavin Howard | 27fa9cd | 2018-12-12 02:52:52 -0700 | [diff] [blame] | 140 | |
Gavin Howard | bb6aeef | 2019-02-19 09:24:36 -0700 | [diff] [blame] | 141 | VALGRIND_ARGS = --error-exitcode=100 --leak-check=full --show-leak-kinds=all --errors-for-leak-kinds=all |
Gavin Howard | 27fa9cd | 2018-12-12 02:52:52 -0700 | [diff] [blame] | 142 | |
Gavin Howard | 27fa9cd | 2018-12-12 02:52:52 -0700 | [diff] [blame] | 143 | BC_NUM_KARATSUBA_LEN = %%KARATSUBA_LEN%% |
| 144 | |
Gavin Howard | b3ba595 | 2019-04-27 06:50:04 -0600 | [diff] [blame] | 145 | CPPFLAGS1 = -D$(BC_ENABLED_NAME)=$(BC_ENABLED) -D$(DC_ENABLED_NAME)=$(DC_ENABLED) |
Gavin Howard | 51a87e9 | 2019-05-14 09:59:50 -0600 | [diff] [blame] | 146 | CPPFLAGS2 = $(CPPFLAGS1) -I./include/ -DVERSION=$(VERSION) %%LONG_BIT_DEFINE%% |
Gavin Howard | b3ba595 | 2019-04-27 06:50:04 -0600 | [diff] [blame] | 147 | CPPFLAGS3 = $(CPPFLAGS2) -DEXECPREFIX=$(EXEC_PREFIX) -DMAINEXEC=$(MAIN_EXEC) |
Gavin Howard | f0cfa3e | 2020-05-14 19:09:10 -0600 | [diff] [blame] | 148 | CPPFLAGS4 = $(CPPFLAGS3) -D_POSIX_C_SOURCE=200809L -D_XOPEN_SOURCE=700 |
Gavin Howard | b3ba595 | 2019-04-27 06:50:04 -0600 | [diff] [blame] | 149 | CPPFLAGS5 = $(CPPFLAGS4) -DBC_NUM_KARATSUBA_LEN=$(BC_NUM_KARATSUBA_LEN) |
Gavin Howard | 1444c9f | 2019-06-21 21:16:11 -0600 | [diff] [blame] | 150 | CPPFLAGS6 = $(CPPFLAGS5) -DBC_ENABLE_NLS=$(BC_ENABLE_NLS) -DBC_ENABLE_PROMPT=$(BC_ENABLE_PROMPT) |
Gavin Howard | b3ba595 | 2019-04-27 06:50:04 -0600 | [diff] [blame] | 151 | CPPFLAGS7 = $(CPPFLAGS6) -D$(BC_ENABLE_EXTRA_MATH_NAME)=$(BC_ENABLE_EXTRA_MATH) |
Gavin Howard | 4b9f53d | 2020-05-15 12:44:37 -0600 | [diff] [blame] | 152 | CPPFLAGS = $(CPPFLAGS7) -DBC_ENABLE_SIGNALS=$(BC_ENABLE_SIGNALS) -DBC_ENABLE_HISTORY=$(BC_ENABLE_HISTORY) |
Gavin Howard | 586ca59 | 2020-04-28 17:14:32 -0600 | [diff] [blame] | 153 | CFLAGS = $(CPPFLAGS) %%CPPFLAGS%% %%CFLAGS%% |
Gavin Howard | 27fa9cd | 2018-12-12 02:52:52 -0700 | [diff] [blame] | 154 | LDFLAGS = %%LDFLAGS%% |
| 155 | |
Gavin Howard | 593a518 | 2019-01-17 10:22:45 -0700 | [diff] [blame] | 156 | HOSTCFLAGS = %%HOSTCFLAGS%% |
| 157 | |
Gavin Howard | 27fa9cd | 2018-12-12 02:52:52 -0700 | [diff] [blame] | 158 | CC = %%CC%% |
| 159 | HOSTCC = %%HOSTCC%% |
| 160 | |
Gavin Howard | ee01351 | 2020-05-15 11:22:36 -0600 | [diff] [blame] | 161 | BC_LIB_C_ARGS = bc_lib bc.h bc_lib_name $(BC_ENABLED_NAME) 1 |
| 162 | BC_LIB2_C_ARGS = bc_lib2 bc.h bc_lib2_name "$(BC_ENABLED_NAME) && $(BC_ENABLE_EXTRA_MATH_NAME)" 1 |
| 163 | |
| 164 | OBJS1 = $(OBJ) $(DC_OBJ) $(BC_OBJ) $(HISTORY_OBJ) $(RAND_OBJ) $(BC_HELP_O) $(DC_HELP_O) |
| 165 | OBJS = $(OBJS1) $(BC_LIB_O) $(BC_LIB2_O) $(BC_LIB3_O) |
| 166 | OBJ_TARGETS1 = $(DC_HELP_O) $(BC_HELP_O) $(BC_LIB_O) $(BC_LIB2_O) $(BC_LIB3_O) |
| 167 | OBJ_TARGETS = $(OBJ_TARGETS1) $(BC_OBJ) $(DC_OBJ) $(HISTORY_OBJ) $(RAND_OBJ) $(OBJ) |
| 168 | |
Gavin Howard | a7972f9 | 2019-03-30 19:58:41 -0600 | [diff] [blame] | 169 | .c.o: |
| 170 | $(CC) $(CFLAGS) -o $@ -c $< |
| 171 | |
Gavin Howard | ee01351 | 2020-05-15 11:22:36 -0600 | [diff] [blame] | 172 | all: make_bin $(OBJ_TARGETS) |
| 173 | $(CC) $(CFLAGS) $(OBJS) $(LDFLAGS) -o $(EXEC) |
Gavin Howard | 27fa9cd | 2018-12-12 02:52:52 -0700 | [diff] [blame] | 174 | %%LINK%% |
| 175 | |
| 176 | $(GEN_EXEC): |
Gavin Howard | a513224 | 2019-04-22 08:34:28 -0600 | [diff] [blame] | 177 | %%GEN_EXEC_TARGET%% |
Gavin Howard | 27fa9cd | 2018-12-12 02:52:52 -0700 | [diff] [blame] | 178 | |
| 179 | $(BC_LIB_C): $(GEN_EXEC) $(BC_LIB) |
Gavin Howard | ee01351 | 2020-05-15 11:22:36 -0600 | [diff] [blame] | 180 | $(GEN_EMU) $(GEN_EXEC) $(BC_LIB) $(BC_LIB_C) $(BC_LIB_C_ARGS) |
Gavin Howard | 27fa9cd | 2018-12-12 02:52:52 -0700 | [diff] [blame] | 181 | |
Gavin Howard | 6fcb504 | 2018-12-26 17:44:06 -0700 | [diff] [blame] | 182 | $(BC_LIB2_C): $(GEN_EXEC) $(BC_LIB2) |
Gavin Howard | ee01351 | 2020-05-15 11:22:36 -0600 | [diff] [blame] | 183 | $(GEN_EMU) $(GEN_EXEC) $(BC_LIB2) $(BC_LIB2_C) $(BC_LIB2_C_ARGS) |
Gavin Howard | 6fcb504 | 2018-12-26 17:44:06 -0700 | [diff] [blame] | 184 | |
Gavin Howard | 27fa9cd | 2018-12-12 02:52:52 -0700 | [diff] [blame] | 185 | $(BC_HELP_C): $(GEN_EXEC) $(BC_HELP) |
Gavin Howard | 1cbfe24 | 2019-01-09 17:13:11 -0700 | [diff] [blame] | 186 | $(GEN_EMU) $(GEN_EXEC) $(BC_HELP) $(BC_HELP_C) bc_help bc.h "" $(BC_ENABLED_NAME) |
Gavin Howard | 27fa9cd | 2018-12-12 02:52:52 -0700 | [diff] [blame] | 187 | |
| 188 | $(DC_HELP_C): $(GEN_EXEC) $(DC_HELP) |
Gavin Howard | 1cbfe24 | 2019-01-09 17:13:11 -0700 | [diff] [blame] | 189 | $(GEN_EMU) $(GEN_EXEC) $(DC_HELP) $(DC_HELP_C) dc_help dc.h "" $(DC_ENABLED_NAME) |
Gavin Howard | 27fa9cd | 2018-12-12 02:52:52 -0700 | [diff] [blame] | 190 | |
| 191 | make_bin: |
Gavin Howard | 7ff15ae | 2018-12-20 10:28:23 -0700 | [diff] [blame] | 192 | $(MKDIR) -p $(BIN) |
Gavin Howard | 27fa9cd | 2018-12-12 02:52:52 -0700 | [diff] [blame] | 193 | |
| 194 | help: |
Gavin Howard | d15e01d | 2018-12-19 12:49:02 -0700 | [diff] [blame] | 195 | @printf 'available targets:\n' |
| 196 | @printf '\n' |
| 197 | @printf ' all (default) builds %%EXECUTABLES%%\n' |
Gavin Howard | c5ab87e | 2019-05-25 15:17:58 -0600 | [diff] [blame] | 198 | @printf ' check alias for `make test`\n' |
Gavin Howard | d15e01d | 2018-12-19 12:49:02 -0700 | [diff] [blame] | 199 | @printf ' clean removes all build files\n' |
Gavin Howard | df68c75 | 2019-01-07 17:48:44 -0700 | [diff] [blame] | 200 | @printf ' clean_config removes all build files as well as the generated Makefile\n' |
Gavin Howard | 3071ec5 | 2020-05-23 19:44:38 -0600 | [diff] [blame^] | 201 | @printf ' clean_tests removes all build files, the generated Makefile,\n' |
Gavin Howard | 161d486 | 2019-01-23 15:31:09 -0700 | [diff] [blame] | 202 | @printf ' and generated tests\n' |
Gavin Howard | 471b6c0 | 2019-01-17 14:25:07 -0700 | [diff] [blame] | 203 | @printf ' install installs binaries to "%s%s"\n' "$(DESTDIR)" "$(BINDIR)" |
Gavin Howard | f977d7c | 2019-01-23 15:29:33 -0700 | [diff] [blame] | 204 | @printf ' and (if enabled) manpages to "%s%s"\n' "$(DESTDIR)" "$(MAN1DIR)" |
Gavin Howard | d15e01d | 2018-12-19 12:49:02 -0700 | [diff] [blame] | 205 | @printf ' karatsuba runs the karatsuba script (requires Python 3)\n' |
| 206 | @printf ' karatsuba_test runs the karatsuba script while running tests\n' |
| 207 | @printf ' (requires Python 3)\n' |
Gavin Howard | 471b6c0 | 2019-01-17 14:25:07 -0700 | [diff] [blame] | 208 | @printf ' uninstall uninstalls binaries from "%s%s"\n' "$(DESTDIR)" "$(BINDIR)" |
Gavin Howard | f977d7c | 2019-01-23 15:29:33 -0700 | [diff] [blame] | 209 | @printf ' and (if enabled) manpages from "%s%s"\n' "$(DESTDIR)" "$(MAN1DIR)" |
Gavin Howard | d15e01d | 2018-12-19 12:49:02 -0700 | [diff] [blame] | 210 | @printf ' test runs the test suite\n' |
Gavin Howard | d15e01d | 2018-12-19 12:49:02 -0700 | [diff] [blame] | 211 | @printf ' test_bc runs the bc test suite, if bc has been built\n' |
| 212 | @printf ' test_dc runs the dc test suite, if dc has been built\n' |
Gavin Howard | 2fbbf25 | 2019-05-10 11:34:24 -0600 | [diff] [blame] | 213 | @printf ' time_test runs the test suite, displaying times for some things\n' |
| 214 | @printf ' time_test_bc runs the bc test suite, displaying times for some things\n' |
| 215 | @printf ' time_test_dc runs the dc test suite, displaying times for some things\n' |
Gavin Howard | d15e01d | 2018-12-19 12:49:02 -0700 | [diff] [blame] | 216 | @printf ' timeconst runs the test on the Linux timeconst.bc script,\n' |
| 217 | @printf ' if it exists and bc has been built\n' |
| 218 | @printf ' valgrind runs the test suite through valgrind\n' |
Gavin Howard | d15e01d | 2018-12-19 12:49:02 -0700 | [diff] [blame] | 219 | @printf ' valgrind_bc runs the bc test suite, if bc has been built,\n' |
| 220 | @printf ' through valgrind\n' |
| 221 | @printf ' valgrind_dc runs the dc test suite, if dc has been built,\n' |
| 222 | @printf ' through valgrind\n' |
Gavin Howard | 27fa9cd | 2018-12-12 02:52:52 -0700 | [diff] [blame] | 223 | |
Gavin Howard | c5ab87e | 2019-05-25 15:17:58 -0600 | [diff] [blame] | 224 | check: test |
| 225 | |
Gavin Howard | 6d03550 | 2019-02-01 12:23:26 -0700 | [diff] [blame] | 226 | test: test_bc timeconst test_dc |
Gavin Howard | 3109a59 | 2018-12-13 11:34:23 -0700 | [diff] [blame] | 227 | |
| 228 | test_bc: |
Gavin Howard | 27fa9cd | 2018-12-12 02:52:52 -0700 | [diff] [blame] | 229 | %%BC_TEST%% |
Gavin Howard | 3109a59 | 2018-12-13 11:34:23 -0700 | [diff] [blame] | 230 | |
| 231 | test_dc: |
Gavin Howard | 27fa9cd | 2018-12-12 02:52:52 -0700 | [diff] [blame] | 232 | %%DC_TEST%% |
| 233 | |
Gavin Howard | 2fbbf25 | 2019-05-10 11:34:24 -0600 | [diff] [blame] | 234 | time_test: time_test_bc timeconst time_test_dc |
| 235 | |
| 236 | time_test_bc: |
| 237 | %%BC_TIME_TEST%% |
| 238 | |
| 239 | time_test_dc: |
| 240 | %%DC_TIME_TEST%% |
| 241 | |
Gavin Howard | c27fccb | 2018-12-13 13:33:35 -0700 | [diff] [blame] | 242 | timeconst: |
| 243 | %%TIMECONST%% |
Gavin Howard | 27fa9cd | 2018-12-12 02:52:52 -0700 | [diff] [blame] | 244 | |
Gavin Howard | c27fccb | 2018-12-13 13:33:35 -0700 | [diff] [blame] | 245 | valgrind: valgrind_bc valgrind_dc |
| 246 | |
| 247 | valgrind_bc: |
Gavin Howard | 27fa9cd | 2018-12-12 02:52:52 -0700 | [diff] [blame] | 248 | %%VG_BC_TEST%% |
Gavin Howard | c27fccb | 2018-12-13 13:33:35 -0700 | [diff] [blame] | 249 | |
| 250 | valgrind_dc: |
Gavin Howard | 27fa9cd | 2018-12-12 02:52:52 -0700 | [diff] [blame] | 251 | %%VG_DC_TEST%% |
| 252 | |
Gavin Howard | c27fccb | 2018-12-13 13:33:35 -0700 | [diff] [blame] | 253 | karatsuba: |
| 254 | %%KARATSUBA%% |
Gavin Howard | 27fa9cd | 2018-12-12 02:52:52 -0700 | [diff] [blame] | 255 | |
Gavin Howard | c27fccb | 2018-12-13 13:33:35 -0700 | [diff] [blame] | 256 | karatsuba_test: |
| 257 | %%KARATSUBA_TEST%% |
Gavin Howard | 27fa9cd | 2018-12-12 02:52:52 -0700 | [diff] [blame] | 258 | |
Gavin Howard | c27fccb | 2018-12-13 13:33:35 -0700 | [diff] [blame] | 259 | coverage:%%COVERAGE_PREREQS%% |
| 260 | %%COVERAGE%% |
Gavin Howard | 27fa9cd | 2018-12-12 02:52:52 -0700 | [diff] [blame] | 261 | |
| 262 | version: |
Gavin Howard | 40c1c4a | 2018-12-27 17:50:02 -0700 | [diff] [blame] | 263 | @printf '%s' "$(VERSION)" |
Gavin Howard | 27fa9cd | 2018-12-12 02:52:52 -0700 | [diff] [blame] | 264 | |
| 265 | libcname: |
Gavin Howard | 40c1c4a | 2018-12-27 17:50:02 -0700 | [diff] [blame] | 266 | @printf '%s' "$(BC_LIB_C)" |
Gavin Howard | 27fa9cd | 2018-12-12 02:52:52 -0700 | [diff] [blame] | 267 | |
Gavin Howard | 7220b8a | 2018-12-27 17:49:27 -0700 | [diff] [blame] | 268 | extra_math: |
Gavin Howard | 7724411 | 2018-12-27 17:50:40 -0700 | [diff] [blame] | 269 | @printf '%s' "$(BC_ENABLE_EXTRA_MATH)" |
Gavin Howard | 7220b8a | 2018-12-27 17:49:27 -0700 | [diff] [blame] | 270 | |
Gavin Howard | 074b38a | 2019-01-17 11:15:59 -0700 | [diff] [blame] | 271 | manpages: |
Gavin Howard | 59bd308 | 2019-10-10 21:19:38 -0600 | [diff] [blame] | 272 | $(MANPAGE) $(BC_RONN) $(BC_MANPAGE) |
| 273 | $(MANPAGE) $(DC_RONN) $(DC_MANPAGE) |
Gavin Howard | 074b38a | 2019-01-17 11:15:59 -0700 | [diff] [blame] | 274 | |
Gavin Howard | a513224 | 2019-04-22 08:34:28 -0600 | [diff] [blame] | 275 | clean_gen: |
| 276 | @$(RM) -f $(GEN_EXEC) |
| 277 | |
| 278 | clean:%%CLEAN_PREREQS%% |
Gavin Howard | ff1cc30 | 2018-12-27 13:22:36 -0700 | [diff] [blame] | 279 | @printf 'Cleaning files...\n' |
Gavin Howard | 103d5bb | 2018-12-27 13:21:48 -0700 | [diff] [blame] | 280 | @$(RM) -f $(OBJ) |
| 281 | @$(RM) -f $(BC_OBJ) |
| 282 | @$(RM) -f $(DC_OBJ) |
| 283 | @$(RM) -f $(HISTORY_OBJ) |
Gavin Howard | 66c6bc9 | 2019-10-11 22:31:54 -0600 | [diff] [blame] | 284 | @$(RM) -f $(RAND_OBJ) |
Gavin Howard | 103d5bb | 2018-12-27 13:21:48 -0700 | [diff] [blame] | 285 | @$(RM) -f $(BC_EXEC) |
| 286 | @$(RM) -f $(DC_EXEC) |
| 287 | @$(RM) -fr $(BIN) |
Gavin Howard | 103d5bb | 2018-12-27 13:21:48 -0700 | [diff] [blame] | 288 | @$(RM) -f *.gcov |
| 289 | @$(RM) -f *.html |
| 290 | @$(RM) -f *.gcda *.gcno |
| 291 | @$(RM) -f *.profraw |
Gavin Howard | fa08ee4 | 2019-02-20 16:40:01 -0700 | [diff] [blame] | 292 | @$(RM) -f $(LOCALES)/*.cat |
Gavin Howard | aba12e7 | 2019-01-07 17:48:27 -0700 | [diff] [blame] | 293 | @$(RM) -f $(BC_LIB_C) $(BC_LIB_O) |
Gavin Howard | aba12e7 | 2019-01-07 17:48:27 -0700 | [diff] [blame] | 294 | @$(RM) -f $(BC_LIB2_C) $(BC_LIB2_O) |
Gavin Howard | aba12e7 | 2019-01-07 17:48:27 -0700 | [diff] [blame] | 295 | @$(RM) -f $(BC_HELP_C) $(BC_HELP_O) |
Gavin Howard | aba12e7 | 2019-01-07 17:48:27 -0700 | [diff] [blame] | 296 | @$(RM) -f $(DC_HELP_C) $(DC_HELP_O) |
Gavin Howard | 27fa9cd | 2018-12-12 02:52:52 -0700 | [diff] [blame] | 297 | |
Gavin Howard | 68f4a4e | 2019-01-07 17:50:15 -0700 | [diff] [blame] | 298 | clean_config: clean |
| 299 | @printf 'Cleaning config...\n' |
| 300 | @$(RM) -f Makefile |
| 301 | |
| 302 | clean_tests: clean clean_config |
Gavin Howard | ff1cc30 | 2018-12-27 13:22:36 -0700 | [diff] [blame] | 303 | @printf 'Cleaning test files...\n' |
Gavin Howard | 103d5bb | 2018-12-27 13:21:48 -0700 | [diff] [blame] | 304 | @$(RM) -f tests/bc/parse.txt tests/bc/parse_results.txt |
| 305 | @$(RM) -f tests/bc/print.txt tests/bc/print_results.txt |
| 306 | @$(RM) -f tests/bc/bessel.txt tests/bc/bessel_results.txt |
Gavin Howard | 5b13853 | 2019-04-01 09:28:34 -0600 | [diff] [blame] | 307 | @$(RM) -f tests/bc/scripts/bessel.txt |
| 308 | @$(RM) -f tests/bc/scripts/parse.txt |
| 309 | @$(RM) -f tests/bc/scripts/print.txt |
Gavin Howard | f9601d3 | 2019-05-25 08:17:32 -0600 | [diff] [blame] | 310 | @$(RM) -f tests/bc/scripts/add.txt |
Gavin Howard | db7b5c8 | 2019-05-10 08:35:26 -0600 | [diff] [blame] | 311 | @$(RM) -f tests/bc/scripts/divide.txt |
Gavin Howard | 833b351 | 2019-05-15 11:07:04 -0600 | [diff] [blame] | 312 | @$(RM) -f tests/bc/scripts/multiply.txt |
Gavin Howard | f9601d3 | 2019-05-25 08:17:32 -0600 | [diff] [blame] | 313 | @$(RM) -f tests/bc/scripts/subtract.txt |
Gavin Howard | 7a105ad | 2019-04-01 09:26:29 -0600 | [diff] [blame] | 314 | @$(RM) -f tests/dc/scripts/prime.txt tests/dc/scripts/stream.txt |
Gavin Howard | 1f0aaea | 2019-02-01 11:57:40 -0700 | [diff] [blame] | 315 | @$(RM) -f .log_*.txt |
Gavin Howard | 103d5bb | 2018-12-27 13:21:48 -0700 | [diff] [blame] | 316 | @$(RM) -f .math.txt .results.txt .ops.txt |
| 317 | @$(RM) -f .test.txt |
Gavin Howard | b8f7fb6 | 2019-03-16 14:27:24 -0600 | [diff] [blame] | 318 | @$(RM) -f $(GCDA) $(GCNO) |
| 319 | @$(RM) -f $(BC_GCDA) $(BC_GCNO) |
| 320 | @$(RM) -f $(DC_GCDA) $(DC_GCNO) |
| 321 | @$(RM) -f $(HISTORY_GCDA) $(HISTORY_GCNO) |
Gavin Howard | 66c6bc9 | 2019-10-11 22:31:54 -0600 | [diff] [blame] | 322 | @$(RM) -f $(RAND_GCDA) $(RAND_GCNO) |
Gavin Howard | b8f7fb6 | 2019-03-16 14:27:24 -0600 | [diff] [blame] | 323 | @$(RM) -f $(BC_LIB_GCDA) $(BC_LIB_GCNO) |
| 324 | @$(RM) -f $(BC_LIB2_GCDA) $(BC_LIB2_GCNO) |
| 325 | @$(RM) -f $(BC_HELP_GCDA) $(BC_HELP_GCNO) |
| 326 | @$(RM) -f $(DC_HELP_GCDA) $(DC_HELP_GCNO) |
Gavin Howard | d887591 | 2019-10-10 21:14:09 -0600 | [diff] [blame] | 327 | @$(RM) -f tags .gdbbreakpoints .gdb_history .gdbsetup |
| 328 | @$(RM) -f cscope.* |
Gavin Howard | 27fa9cd | 2018-12-12 02:52:52 -0700 | [diff] [blame] | 329 | |
Gavin Howard | 5008025 | 2019-02-20 15:27:43 -0700 | [diff] [blame] | 330 | install_locales: |
Gavin Howard | 08727ac | 2019-04-17 17:16:42 -0600 | [diff] [blame] | 331 | $(LOCALE_INSTALL) $(NLSPATH) $(MAIN_EXEC) $(DESTDIR) |
Gavin Howard | 5008025 | 2019-02-20 15:27:43 -0700 | [diff] [blame] | 332 | |
Gavin Howard | 074b38a | 2019-01-17 11:15:59 -0700 | [diff] [blame] | 333 | install_bc_manpage: |
Gavin Howard | ed9b6c2 | 2019-01-23 12:02:43 -0700 | [diff] [blame] | 334 | $(SAFE_INSTALL) $(MANPAGE_INSTALL_ARGS) $(BC_MANPAGE) $(DESTDIR)$(MAN1DIR)/$(BC_MANPAGE_NAME) |
Gavin Howard | 074b38a | 2019-01-17 11:15:59 -0700 | [diff] [blame] | 335 | |
| 336 | install_dc_manpage: |
Gavin Howard | ed9b6c2 | 2019-01-23 12:02:43 -0700 | [diff] [blame] | 337 | $(SAFE_INSTALL) $(MANPAGE_INSTALL_ARGS) $(DC_MANPAGE) $(DESTDIR)$(MAN1DIR)/$(DC_MANPAGE_NAME) |
Gavin Howard | 074b38a | 2019-01-17 11:15:59 -0700 | [diff] [blame] | 338 | |
Gavin Howard | 5008025 | 2019-02-20 15:27:43 -0700 | [diff] [blame] | 339 | install:%%INSTALL_LOCALES_PREREQS%%%%INSTALL_PREREQS%% |
Gavin Howard | dbbe325 | 2019-02-18 11:07:22 -0700 | [diff] [blame] | 340 | $(INSTALL) $(DESTDIR)$(BINDIR) "$(EXEC_SUFFIX)" |
Gavin Howard | 27fa9cd | 2018-12-12 02:52:52 -0700 | [diff] [blame] | 341 | |
Gavin Howard | 5008025 | 2019-02-20 15:27:43 -0700 | [diff] [blame] | 342 | uninstall_locales: |
Gavin Howard | 08727ac | 2019-04-17 17:16:42 -0600 | [diff] [blame] | 343 | $(LOCALE_UNINSTALL) $(NLSPATH) $(MAIN_EXEC) $(DESTDIR) |
Gavin Howard | 5008025 | 2019-02-20 15:27:43 -0700 | [diff] [blame] | 344 | |
Gavin Howard | ed9b6c2 | 2019-01-23 12:02:43 -0700 | [diff] [blame] | 345 | uninstall_bc_manpage: |
| 346 | $(RM) -f $(DESTDIR)$(MAN1DIR)/$(BC_MANPAGE_NAME) |
| 347 | |
Gavin Howard | 98fcceb | 2019-01-23 12:12:26 -0700 | [diff] [blame] | 348 | uninstall_bc: |
Gavin Howard | 36ae629 | 2019-04-01 07:30:27 -0600 | [diff] [blame] | 349 | $(RM) -f $(DESTDIR)$(BINDIR)/$(EXEC_PREFIX)$(BC)$(EXEC_SUFFIX) |
Gavin Howard | 98fcceb | 2019-01-23 12:12:26 -0700 | [diff] [blame] | 350 | |
Gavin Howard | ed9b6c2 | 2019-01-23 12:02:43 -0700 | [diff] [blame] | 351 | uninstall_dc_manpage: |
| 352 | $(RM) -f $(DESTDIR)$(MAN1DIR)/$(DC_MANPAGE_NAME) |
| 353 | |
Gavin Howard | 98fcceb | 2019-01-23 12:12:26 -0700 | [diff] [blame] | 354 | uninstall_dc: |
Gavin Howard | 36ae629 | 2019-04-01 07:30:27 -0600 | [diff] [blame] | 355 | $(RM) -f $(DESTDIR)$(BINDIR)/$(EXEC_PREFIX)$(DC)$(EXEC_SUFFIX) |
Gavin Howard | 27fa9cd | 2018-12-12 02:52:52 -0700 | [diff] [blame] | 356 | |
Gavin Howard | 5008025 | 2019-02-20 15:27:43 -0700 | [diff] [blame] | 357 | uninstall:%%UNINSTALL_LOCALES_PREREQS%%%%UNINSTALL_MAN_PREREQS%%%%UNINSTALL_PREREQS%% |