blob: 26129702a0e11dd4036ecbe724b6bf3677a96c0f [file] [log] [blame]
Gavin Howard27fa9cd2018-12-12 02:52:52 -07001#
Zach van Rijn6d2cf3f2020-01-14 22:05:02 +00002# Copyright (c) 2018-2020 Gavin D. Howard and contributors.
Gavin Howard27fa9cd2018-12-12 02:52:52 -07003#
Gavin Howard7345cb92019-04-08 14:13:43 -06004# All rights reserved.
Gavin Howard27fa9cd2018-12-12 02:52:52 -07005#
Gavin Howard7345cb92019-04-08 14:13:43 -06006# 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 Howard27fa9cd2018-12-12 02:52:52 -070027#
Gavin Howardb55ad002018-12-20 16:59:23 -070028# %%WARNING%%
29#
Gavin Howard27fa9cd2018-12-12 02:52:52 -070030.POSIX:
31
Gavin Howarde3ab65d2020-05-13 11:50:06 -060032VERSION = 2.8.0
Gavin Howardd2ec2072019-06-26 22:55:07 -060033
Gavin Howard27fa9cd2018-12-12 02:52:52 -070034SRC = %%SRC%%
35OBJ = %%OBJ%%
36GCDA = %%GCDA%%
37GCNO = %%GCNO%%
38
39BC_SRC = %%BC_SRC%%
40BC_OBJ = %%BC_OBJ%%
41BC_GCDA = %%BC_GCDA%%
42BC_GCNO = %%BC_GCNO%%
43
44DC_SRC = %%DC_SRC%%
45DC_OBJ = %%DC_OBJ%%
46DC_GCDA = %%DC_GCDA%%
47DC_GCNO = %%DC_GCNO%%
48
Gavin Howardbf813392018-12-20 10:49:00 -070049HISTORY_SRC = %%HISTORY_SRC%%
50HISTORY_OBJ = %%HISTORY_OBJ%%
51HISTORY_GCDA = %%HISTORY_GCDA%%
52HISTORY_GCNO = %%HISTORY_GCNO%%
53
Gavin Howard66c6bc92019-10-11 22:31:54 -060054RAND_SRC = %%RAND_SRC%%
55RAND_OBJ = %%RAND_OBJ%%
56RAND_GCDA = %%RAND_GCDA%%
57RAND_GCNO = %%RAND_GCNO%%
58
Gavin Howard27fa9cd2018-12-12 02:52:52 -070059BC_ENABLED_NAME = BC_ENABLED
60BC_ENABLED = %%BC_ENABLED%%
61DC_ENABLED_NAME = DC_ENABLED
62DC_ENABLED = %%DC_ENABLED%%
63
Gavin Howard27fa9cd2018-12-12 02:52:52 -070064GEN_DIR = gen
Gavin Howarda5132242019-04-22 08:34:28 -060065GEN = %%GEN%%
Gavin Howard27fa9cd2018-12-12 02:52:52 -070066GEN_EXEC = $(GEN_DIR)/$(GEN)
67GEN_C = $(GEN_DIR)/$(GEN).c
68
Gavin Howard4dff5452018-12-20 10:06:58 -070069GEN_EMU = %%GEN_EMU%%
70
Gavin Howard27fa9cd2018-12-12 02:52:52 -070071BC_LIB = $(GEN_DIR)/lib.bc
72BC_LIB_C = $(GEN_DIR)/lib.c
Gavin Howarda1cd1222019-01-02 14:40:46 -070073BC_LIB_O = %%BC_LIB_O%%
Gavin Howardaba12e72019-01-07 17:48:27 -070074BC_LIB_GCDA = $(GEN_DIR)/lib.gcda
75BC_LIB_GCNO = $(GEN_DIR)/lib.gcno
Gavin Howard27fa9cd2018-12-12 02:52:52 -070076
Gavin Howard6fcb5042018-12-26 17:44:06 -070077BC_LIB2 = $(GEN_DIR)/lib2.bc
78BC_LIB2_C = $(GEN_DIR)/lib2.c
Gavin Howard9fbeaa82018-12-27 18:13:28 -070079BC_LIB2_O = %%BC_LIB2_O%%
Gavin Howardaba12e72019-01-07 17:48:27 -070080BC_LIB2_GCDA = $(GEN_DIR)/lib2.gcda
81BC_LIB2_GCNO = $(GEN_DIR)/lib2.gcno
Gavin Howard6fcb5042018-12-26 17:44:06 -070082
Gavin Howard27fa9cd2018-12-12 02:52:52 -070083BC_HELP = $(GEN_DIR)/bc_help.txt
84BC_HELP_C = $(GEN_DIR)/bc_help.c
Gavin Howarda1cd1222019-01-02 14:40:46 -070085BC_HELP_O = %%BC_HELP_O%%
Gavin Howardaba12e72019-01-07 17:48:27 -070086BC_HELP_GCDA = $(GEN_DIR)/bc_help.gcda
87BC_HELP_GCNO = $(GEN_DIR)/bc_help.gcno
Gavin Howard27fa9cd2018-12-12 02:52:52 -070088
89DC_HELP = $(GEN_DIR)/dc_help.txt
90DC_HELP_C = $(GEN_DIR)/dc_help.c
Gavin Howarda1cd1222019-01-02 14:40:46 -070091DC_HELP_O = %%DC_HELP_O%%
Gavin Howardaba12e72019-01-07 17:48:27 -070092DC_HELP_GCDA = $(GEN_DIR)/dc_help.gcda
93DC_HELP_GCNO = $(GEN_DIR)/dc_help.gcno
Gavin Howard27fa9cd2018-12-12 02:52:52 -070094
95BIN = bin
Gavin Howardfa08ee42019-02-20 16:40:01 -070096LOCALES = locales
Gavin Howard36ae6292019-04-01 07:30:27 -060097EXEC_SUFFIX = %%EXECSUFFIX%%
98EXEC_PREFIX = %%EXECPREFIX%%
Gavin Howard27fa9cd2018-12-12 02:52:52 -070099
100BC = bc
101DC = dc
Gavin Howard36ae6292019-04-01 07:30:27 -0600102BC_EXEC = $(BIN)/$(EXEC_PREFIX)$(BC)
103DC_EXEC = $(BIN)/$(EXEC_PREFIX)$(DC)
Gavin Howard27fa9cd2018-12-12 02:52:52 -0700104
Gavin Howard471b6c02019-01-17 14:25:07 -0700105MANUALS = manuals
Gavin Howard36ae6292019-04-01 07:30:27 -0600106BC_MANPAGE_NAME = $(EXEC_PREFIX)$(BC)$(EXEC_SUFFIX).1
Gavin Howardecf19bb2019-03-30 13:25:18 -0600107BC_MANPAGE = $(MANUALS)/$(BC).1
Gavin Howard471b6c02019-01-17 14:25:07 -0700108BC_RONN = $(BC_MANPAGE).ronn
Gavin Howard36ae6292019-04-01 07:30:27 -0600109DC_MANPAGE_NAME = $(EXEC_PREFIX)$(DC)$(EXEC_SUFFIX).1
Gavin Howardecf19bb2019-03-30 13:25:18 -0600110DC_MANPAGE = $(MANUALS)/$(DC).1
Gavin Howard471b6c02019-01-17 14:25:07 -0700111DC_RONN = $(DC_MANPAGE).ronn
112
Gavin Howarded9b6c22019-01-23 12:02:43 -0700113MANPAGE_INSTALL_ARGS = -Dm644
114
Gavin Howard9a679742019-04-06 09:44:57 -0600115%%DESTDIR%%
Gavin Howard471b6c02019-01-17 14:25:07 -0700116BINDIR = %%BINDIR%%
117MAN1DIR = %%MAN1DIR%%
Gavin Howardae300262019-04-01 14:03:42 -0600118MAIN_EXEC = $(EXEC_PREFIX)$(%%MAIN_EXEC%%)$(EXEC_SUFFIX)
Gavin Howard50080252019-02-20 15:27:43 -0700119EXEC = $(%%EXEC%%)
Gavin Howardbc021292019-04-09 10:04:01 -0600120NLSPATH = %%NLSPATH%%
Gavin Howard074b38a2019-01-17 11:15:59 -0700121
Gavin Howard27fa9cd2018-12-12 02:52:52 -0700122BC_ENABLE_SIGNALS = %%SIGNALS%%
123BC_ENABLE_HISTORY = %%HISTORY%%
Gavin Howard6fcb5042018-12-26 17:44:06 -0700124BC_ENABLE_EXTRA_MATH_NAME = BC_ENABLE_EXTRA_MATH
125BC_ENABLE_EXTRA_MATH = %%EXTRA_MATH%%
Gavin Howard50080252019-02-20 15:27:43 -0700126BC_ENABLE_NLS = %%NLS%%
Gavin Howard1444c9f2019-06-21 21:16:11 -0600127BC_ENABLE_PROMPT = %%PROMPT%%
Gavin Howard277b5142019-05-10 10:58:57 -0600128BC_LONG_BIT = %%LONG_BIT%%
Gavin Howard27fa9cd2018-12-12 02:52:52 -0700129
Gavin Howardc6547d62018-12-19 12:52:08 -0700130RM = rm
Gavin Howard7ff15ae2018-12-20 10:28:23 -0700131MKDIR = mkdir
132
Gavin Howard27fa9cd2018-12-12 02:52:52 -0700133INSTALL = ./install.sh
Gavin Howard074b38a2019-01-17 11:15:59 -0700134SAFE_INSTALL = ./safe-install.sh
Gavin Howard27fa9cd2018-12-12 02:52:52 -0700135LINK = ./link.sh
Gavin Howard59bd3082019-10-10 21:19:38 -0600136MANPAGE = ./manpage.sh
Gavin Howard27fa9cd2018-12-12 02:52:52 -0700137KARATSUBA = ./karatsuba.py
Gavin Howardf680e352019-04-01 13:28:48 -0600138LOCALE_INSTALL = ./locale_install.sh
139LOCALE_UNINSTALL = ./locale_uninstall.sh
Gavin Howard27fa9cd2018-12-12 02:52:52 -0700140
Gavin Howardbb6aeef2019-02-19 09:24:36 -0700141VALGRIND_ARGS = --error-exitcode=100 --leak-check=full --show-leak-kinds=all --errors-for-leak-kinds=all
Gavin Howard27fa9cd2018-12-12 02:52:52 -0700142
Gavin Howard27fa9cd2018-12-12 02:52:52 -0700143BC_NUM_KARATSUBA_LEN = %%KARATSUBA_LEN%%
144
Gavin Howardb3ba5952019-04-27 06:50:04 -0600145CPPFLAGS1 = -D$(BC_ENABLED_NAME)=$(BC_ENABLED) -D$(DC_ENABLED_NAME)=$(DC_ENABLED)
Gavin Howard51a87e92019-05-14 09:59:50 -0600146CPPFLAGS2 = $(CPPFLAGS1) -I./include/ -DVERSION=$(VERSION) %%LONG_BIT_DEFINE%%
Gavin Howardb3ba5952019-04-27 06:50:04 -0600147CPPFLAGS3 = $(CPPFLAGS2) -DEXECPREFIX=$(EXEC_PREFIX) -DMAINEXEC=$(MAIN_EXEC)
Gavin Howardf0cfa3e2020-05-14 19:09:10 -0600148CPPFLAGS4 = $(CPPFLAGS3) -D_POSIX_C_SOURCE=200809L -D_XOPEN_SOURCE=700
Gavin Howardb3ba5952019-04-27 06:50:04 -0600149CPPFLAGS5 = $(CPPFLAGS4) -DBC_NUM_KARATSUBA_LEN=$(BC_NUM_KARATSUBA_LEN)
Gavin Howard1444c9f2019-06-21 21:16:11 -0600150CPPFLAGS6 = $(CPPFLAGS5) -DBC_ENABLE_NLS=$(BC_ENABLE_NLS) -DBC_ENABLE_PROMPT=$(BC_ENABLE_PROMPT)
Gavin Howardb3ba5952019-04-27 06:50:04 -0600151CPPFLAGS7 = $(CPPFLAGS6) -D$(BC_ENABLE_EXTRA_MATH_NAME)=$(BC_ENABLE_EXTRA_MATH)
Gavin Howard4b9f53d2020-05-15 12:44:37 -0600152CPPFLAGS = $(CPPFLAGS7) -DBC_ENABLE_SIGNALS=$(BC_ENABLE_SIGNALS) -DBC_ENABLE_HISTORY=$(BC_ENABLE_HISTORY)
Gavin Howard586ca592020-04-28 17:14:32 -0600153CFLAGS = $(CPPFLAGS) %%CPPFLAGS%% %%CFLAGS%%
Gavin Howard27fa9cd2018-12-12 02:52:52 -0700154LDFLAGS = %%LDFLAGS%%
155
Gavin Howard593a5182019-01-17 10:22:45 -0700156HOSTCFLAGS = %%HOSTCFLAGS%%
157
Gavin Howard27fa9cd2018-12-12 02:52:52 -0700158CC = %%CC%%
159HOSTCC = %%HOSTCC%%
160
Gavin Howardee013512020-05-15 11:22:36 -0600161BC_LIB_C_ARGS = bc_lib bc.h bc_lib_name $(BC_ENABLED_NAME) 1
162BC_LIB2_C_ARGS = bc_lib2 bc.h bc_lib2_name "$(BC_ENABLED_NAME) && $(BC_ENABLE_EXTRA_MATH_NAME)" 1
163
164OBJS1 = $(OBJ) $(DC_OBJ) $(BC_OBJ) $(HISTORY_OBJ) $(RAND_OBJ) $(BC_HELP_O) $(DC_HELP_O)
165OBJS = $(OBJS1) $(BC_LIB_O) $(BC_LIB2_O) $(BC_LIB3_O)
166OBJ_TARGETS1 = $(DC_HELP_O) $(BC_HELP_O) $(BC_LIB_O) $(BC_LIB2_O) $(BC_LIB3_O)
167OBJ_TARGETS = $(OBJ_TARGETS1) $(BC_OBJ) $(DC_OBJ) $(HISTORY_OBJ) $(RAND_OBJ) $(OBJ)
168
Gavin Howarda7972f92019-03-30 19:58:41 -0600169.c.o:
170 $(CC) $(CFLAGS) -o $@ -c $<
171
Gavin Howardee013512020-05-15 11:22:36 -0600172all: make_bin $(OBJ_TARGETS)
173 $(CC) $(CFLAGS) $(OBJS) $(LDFLAGS) -o $(EXEC)
Gavin Howard27fa9cd2018-12-12 02:52:52 -0700174 %%LINK%%
175
176$(GEN_EXEC):
Gavin Howarda5132242019-04-22 08:34:28 -0600177 %%GEN_EXEC_TARGET%%
Gavin Howard27fa9cd2018-12-12 02:52:52 -0700178
179$(BC_LIB_C): $(GEN_EXEC) $(BC_LIB)
Gavin Howardee013512020-05-15 11:22:36 -0600180 $(GEN_EMU) $(GEN_EXEC) $(BC_LIB) $(BC_LIB_C) $(BC_LIB_C_ARGS)
Gavin Howard27fa9cd2018-12-12 02:52:52 -0700181
Gavin Howard6fcb5042018-12-26 17:44:06 -0700182$(BC_LIB2_C): $(GEN_EXEC) $(BC_LIB2)
Gavin Howardee013512020-05-15 11:22:36 -0600183 $(GEN_EMU) $(GEN_EXEC) $(BC_LIB2) $(BC_LIB2_C) $(BC_LIB2_C_ARGS)
Gavin Howard6fcb5042018-12-26 17:44:06 -0700184
Gavin Howard27fa9cd2018-12-12 02:52:52 -0700185$(BC_HELP_C): $(GEN_EXEC) $(BC_HELP)
Gavin Howard1cbfe242019-01-09 17:13:11 -0700186 $(GEN_EMU) $(GEN_EXEC) $(BC_HELP) $(BC_HELP_C) bc_help bc.h "" $(BC_ENABLED_NAME)
Gavin Howard27fa9cd2018-12-12 02:52:52 -0700187
188$(DC_HELP_C): $(GEN_EXEC) $(DC_HELP)
Gavin Howard1cbfe242019-01-09 17:13:11 -0700189 $(GEN_EMU) $(GEN_EXEC) $(DC_HELP) $(DC_HELP_C) dc_help dc.h "" $(DC_ENABLED_NAME)
Gavin Howard27fa9cd2018-12-12 02:52:52 -0700190
191make_bin:
Gavin Howard7ff15ae2018-12-20 10:28:23 -0700192 $(MKDIR) -p $(BIN)
Gavin Howard27fa9cd2018-12-12 02:52:52 -0700193
194help:
Gavin Howardd15e01d2018-12-19 12:49:02 -0700195 @printf 'available targets:\n'
196 @printf '\n'
197 @printf ' all (default) builds %%EXECUTABLES%%\n'
Gavin Howardc5ab87e2019-05-25 15:17:58 -0600198 @printf ' check alias for `make test`\n'
Gavin Howardd15e01d2018-12-19 12:49:02 -0700199 @printf ' clean removes all build files\n'
Gavin Howarddf68c752019-01-07 17:48:44 -0700200 @printf ' clean_config removes all build files as well as the generated Makefile\n'
Gavin Howard3071ec52020-05-23 19:44:38 -0600201 @printf ' clean_tests removes all build files, the generated Makefile,\n'
Gavin Howard161d4862019-01-23 15:31:09 -0700202 @printf ' and generated tests\n'
Gavin Howard471b6c02019-01-17 14:25:07 -0700203 @printf ' install installs binaries to "%s%s"\n' "$(DESTDIR)" "$(BINDIR)"
Gavin Howardf977d7c2019-01-23 15:29:33 -0700204 @printf ' and (if enabled) manpages to "%s%s"\n' "$(DESTDIR)" "$(MAN1DIR)"
Gavin Howardd15e01d2018-12-19 12:49:02 -0700205 @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 Howard471b6c02019-01-17 14:25:07 -0700208 @printf ' uninstall uninstalls binaries from "%s%s"\n' "$(DESTDIR)" "$(BINDIR)"
Gavin Howardf977d7c2019-01-23 15:29:33 -0700209 @printf ' and (if enabled) manpages from "%s%s"\n' "$(DESTDIR)" "$(MAN1DIR)"
Gavin Howardd15e01d2018-12-19 12:49:02 -0700210 @printf ' test runs the test suite\n'
Gavin Howardd15e01d2018-12-19 12:49:02 -0700211 @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 Howard2fbbf252019-05-10 11:34:24 -0600213 @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 Howardd15e01d2018-12-19 12:49:02 -0700216 @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 Howardd15e01d2018-12-19 12:49:02 -0700219 @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 Howard27fa9cd2018-12-12 02:52:52 -0700223
Gavin Howardc5ab87e2019-05-25 15:17:58 -0600224check: test
225
Gavin Howard6d035502019-02-01 12:23:26 -0700226test: test_bc timeconst test_dc
Gavin Howard3109a592018-12-13 11:34:23 -0700227
228test_bc:
Gavin Howard27fa9cd2018-12-12 02:52:52 -0700229 %%BC_TEST%%
Gavin Howard3109a592018-12-13 11:34:23 -0700230
231test_dc:
Gavin Howard27fa9cd2018-12-12 02:52:52 -0700232 %%DC_TEST%%
233
Gavin Howard2fbbf252019-05-10 11:34:24 -0600234time_test: time_test_bc timeconst time_test_dc
235
236time_test_bc:
237 %%BC_TIME_TEST%%
238
239time_test_dc:
240 %%DC_TIME_TEST%%
241
Gavin Howardc27fccb2018-12-13 13:33:35 -0700242timeconst:
243 %%TIMECONST%%
Gavin Howard27fa9cd2018-12-12 02:52:52 -0700244
Gavin Howardc27fccb2018-12-13 13:33:35 -0700245valgrind: valgrind_bc valgrind_dc
246
247valgrind_bc:
Gavin Howard27fa9cd2018-12-12 02:52:52 -0700248 %%VG_BC_TEST%%
Gavin Howardc27fccb2018-12-13 13:33:35 -0700249
250valgrind_dc:
Gavin Howard27fa9cd2018-12-12 02:52:52 -0700251 %%VG_DC_TEST%%
252
Gavin Howardc27fccb2018-12-13 13:33:35 -0700253karatsuba:
254 %%KARATSUBA%%
Gavin Howard27fa9cd2018-12-12 02:52:52 -0700255
Gavin Howardc27fccb2018-12-13 13:33:35 -0700256karatsuba_test:
257 %%KARATSUBA_TEST%%
Gavin Howard27fa9cd2018-12-12 02:52:52 -0700258
Gavin Howardc27fccb2018-12-13 13:33:35 -0700259coverage:%%COVERAGE_PREREQS%%
260 %%COVERAGE%%
Gavin Howard27fa9cd2018-12-12 02:52:52 -0700261
262version:
Gavin Howard40c1c4a2018-12-27 17:50:02 -0700263 @printf '%s' "$(VERSION)"
Gavin Howard27fa9cd2018-12-12 02:52:52 -0700264
265libcname:
Gavin Howard40c1c4a2018-12-27 17:50:02 -0700266 @printf '%s' "$(BC_LIB_C)"
Gavin Howard27fa9cd2018-12-12 02:52:52 -0700267
Gavin Howard7220b8a2018-12-27 17:49:27 -0700268extra_math:
Gavin Howard77244112018-12-27 17:50:40 -0700269 @printf '%s' "$(BC_ENABLE_EXTRA_MATH)"
Gavin Howard7220b8a2018-12-27 17:49:27 -0700270
Gavin Howard074b38a2019-01-17 11:15:59 -0700271manpages:
Gavin Howard59bd3082019-10-10 21:19:38 -0600272 $(MANPAGE) $(BC_RONN) $(BC_MANPAGE)
273 $(MANPAGE) $(DC_RONN) $(DC_MANPAGE)
Gavin Howard074b38a2019-01-17 11:15:59 -0700274
Gavin Howarda5132242019-04-22 08:34:28 -0600275clean_gen:
276 @$(RM) -f $(GEN_EXEC)
277
278clean:%%CLEAN_PREREQS%%
Gavin Howardff1cc302018-12-27 13:22:36 -0700279 @printf 'Cleaning files...\n'
Gavin Howard103d5bb2018-12-27 13:21:48 -0700280 @$(RM) -f $(OBJ)
281 @$(RM) -f $(BC_OBJ)
282 @$(RM) -f $(DC_OBJ)
283 @$(RM) -f $(HISTORY_OBJ)
Gavin Howard66c6bc92019-10-11 22:31:54 -0600284 @$(RM) -f $(RAND_OBJ)
Gavin Howard103d5bb2018-12-27 13:21:48 -0700285 @$(RM) -f $(BC_EXEC)
286 @$(RM) -f $(DC_EXEC)
287 @$(RM) -fr $(BIN)
Gavin Howard103d5bb2018-12-27 13:21:48 -0700288 @$(RM) -f *.gcov
289 @$(RM) -f *.html
290 @$(RM) -f *.gcda *.gcno
291 @$(RM) -f *.profraw
Gavin Howardfa08ee42019-02-20 16:40:01 -0700292 @$(RM) -f $(LOCALES)/*.cat
Gavin Howardaba12e72019-01-07 17:48:27 -0700293 @$(RM) -f $(BC_LIB_C) $(BC_LIB_O)
Gavin Howardaba12e72019-01-07 17:48:27 -0700294 @$(RM) -f $(BC_LIB2_C) $(BC_LIB2_O)
Gavin Howardaba12e72019-01-07 17:48:27 -0700295 @$(RM) -f $(BC_HELP_C) $(BC_HELP_O)
Gavin Howardaba12e72019-01-07 17:48:27 -0700296 @$(RM) -f $(DC_HELP_C) $(DC_HELP_O)
Gavin Howard27fa9cd2018-12-12 02:52:52 -0700297
Gavin Howard68f4a4e2019-01-07 17:50:15 -0700298clean_config: clean
299 @printf 'Cleaning config...\n'
300 @$(RM) -f Makefile
301
302clean_tests: clean clean_config
Gavin Howardff1cc302018-12-27 13:22:36 -0700303 @printf 'Cleaning test files...\n'
Gavin Howard103d5bb2018-12-27 13:21:48 -0700304 @$(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 Howard5b138532019-04-01 09:28:34 -0600307 @$(RM) -f tests/bc/scripts/bessel.txt
308 @$(RM) -f tests/bc/scripts/parse.txt
309 @$(RM) -f tests/bc/scripts/print.txt
Gavin Howardf9601d32019-05-25 08:17:32 -0600310 @$(RM) -f tests/bc/scripts/add.txt
Gavin Howarddb7b5c82019-05-10 08:35:26 -0600311 @$(RM) -f tests/bc/scripts/divide.txt
Gavin Howard833b3512019-05-15 11:07:04 -0600312 @$(RM) -f tests/bc/scripts/multiply.txt
Gavin Howardf9601d32019-05-25 08:17:32 -0600313 @$(RM) -f tests/bc/scripts/subtract.txt
Gavin Howard7a105ad2019-04-01 09:26:29 -0600314 @$(RM) -f tests/dc/scripts/prime.txt tests/dc/scripts/stream.txt
Gavin Howard1f0aaea2019-02-01 11:57:40 -0700315 @$(RM) -f .log_*.txt
Gavin Howard103d5bb2018-12-27 13:21:48 -0700316 @$(RM) -f .math.txt .results.txt .ops.txt
317 @$(RM) -f .test.txt
Gavin Howardb8f7fb62019-03-16 14:27:24 -0600318 @$(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 Howard66c6bc92019-10-11 22:31:54 -0600322 @$(RM) -f $(RAND_GCDA) $(RAND_GCNO)
Gavin Howardb8f7fb62019-03-16 14:27:24 -0600323 @$(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 Howardd8875912019-10-10 21:14:09 -0600327 @$(RM) -f tags .gdbbreakpoints .gdb_history .gdbsetup
328 @$(RM) -f cscope.*
Gavin Howard27fa9cd2018-12-12 02:52:52 -0700329
Gavin Howard50080252019-02-20 15:27:43 -0700330install_locales:
Gavin Howard08727ac2019-04-17 17:16:42 -0600331 $(LOCALE_INSTALL) $(NLSPATH) $(MAIN_EXEC) $(DESTDIR)
Gavin Howard50080252019-02-20 15:27:43 -0700332
Gavin Howard074b38a2019-01-17 11:15:59 -0700333install_bc_manpage:
Gavin Howarded9b6c22019-01-23 12:02:43 -0700334 $(SAFE_INSTALL) $(MANPAGE_INSTALL_ARGS) $(BC_MANPAGE) $(DESTDIR)$(MAN1DIR)/$(BC_MANPAGE_NAME)
Gavin Howard074b38a2019-01-17 11:15:59 -0700335
336install_dc_manpage:
Gavin Howarded9b6c22019-01-23 12:02:43 -0700337 $(SAFE_INSTALL) $(MANPAGE_INSTALL_ARGS) $(DC_MANPAGE) $(DESTDIR)$(MAN1DIR)/$(DC_MANPAGE_NAME)
Gavin Howard074b38a2019-01-17 11:15:59 -0700338
Gavin Howard50080252019-02-20 15:27:43 -0700339install:%%INSTALL_LOCALES_PREREQS%%%%INSTALL_PREREQS%%
Gavin Howarddbbe3252019-02-18 11:07:22 -0700340 $(INSTALL) $(DESTDIR)$(BINDIR) "$(EXEC_SUFFIX)"
Gavin Howard27fa9cd2018-12-12 02:52:52 -0700341
Gavin Howard50080252019-02-20 15:27:43 -0700342uninstall_locales:
Gavin Howard08727ac2019-04-17 17:16:42 -0600343 $(LOCALE_UNINSTALL) $(NLSPATH) $(MAIN_EXEC) $(DESTDIR)
Gavin Howard50080252019-02-20 15:27:43 -0700344
Gavin Howarded9b6c22019-01-23 12:02:43 -0700345uninstall_bc_manpage:
346 $(RM) -f $(DESTDIR)$(MAN1DIR)/$(BC_MANPAGE_NAME)
347
Gavin Howard98fcceb2019-01-23 12:12:26 -0700348uninstall_bc:
Gavin Howard36ae6292019-04-01 07:30:27 -0600349 $(RM) -f $(DESTDIR)$(BINDIR)/$(EXEC_PREFIX)$(BC)$(EXEC_SUFFIX)
Gavin Howard98fcceb2019-01-23 12:12:26 -0700350
Gavin Howarded9b6c22019-01-23 12:02:43 -0700351uninstall_dc_manpage:
352 $(RM) -f $(DESTDIR)$(MAN1DIR)/$(DC_MANPAGE_NAME)
353
Gavin Howard98fcceb2019-01-23 12:12:26 -0700354uninstall_dc:
Gavin Howard36ae6292019-04-01 07:30:27 -0600355 $(RM) -f $(DESTDIR)$(BINDIR)/$(EXEC_PREFIX)$(DC)$(EXEC_SUFFIX)
Gavin Howard27fa9cd2018-12-12 02:52:52 -0700356
Gavin Howard50080252019-02-20 15:27:43 -0700357uninstall:%%UNINSTALL_LOCALES_PREREQS%%%%UNINSTALL_MAN_PREREQS%%%%UNINSTALL_PREREQS%%