diff options
author | Jack Lloyd <[email protected]> | 2017-11-29 12:18:48 -0500 |
---|---|---|
committer | Jack Lloyd <[email protected]> | 2017-11-29 15:52:36 -0500 |
commit | 9dd419140c06724fa9347e916fcc9d864f2fcf58 (patch) | |
tree | 7a4c698fcd014a66aa560135cd120549c1c9876c /src/build-data/makefile | |
parent | 934f904f5e1ea6280eb294cc72bbc525eac53250 (diff) |
Add a script to handle `make clean` target
This removes a lot of logic that cannot be shared between the
nmake (Windows environment) and gnumake (Unix env) makefiles.
Also it cleans up inconsistencies, eg nmake's make distclean did not
remove amalgamation files, but gnumake version did.
Diffstat (limited to 'src/build-data/makefile')
-rw-r--r-- | src/build-data/makefile/gmake.in | 52 | ||||
-rw-r--r-- | src/build-data/makefile/gmake_commands.in | 5 | ||||
-rw-r--r-- | src/build-data/makefile/header.in | 40 | ||||
-rw-r--r-- | src/build-data/makefile/nmake.in | 58 |
4 files changed, 44 insertions, 111 deletions
diff --git a/src/build-data/makefile/gmake.in b/src/build-data/makefile/gmake.in index c8e7017e5..15e0277e6 100644 --- a/src/build-data/makefile/gmake.in +++ b/src/build-data/makefile/gmake.in @@ -1,41 +1,17 @@ %{header_in} -%{gmake_commands_in} - -# Executable targets -CLI = %{out_dir}/botan%{program_suffix} -TEST = %{out_dir}/botan-test%{program_suffix} +COPY = cp +LN = ln -fs # Library targets -LIB_BASENAME = %{lib_prefix}%{libname} +LIB_BASENAME = %{lib_basename} STATIC_LIB = %{out_dir}/$(LIB_BASENAME).%{static_suffix} LIBRARIES = $(STATIC_LIB) -# File Lists -INCLUDE_DIR = %{botan_include_dir} - -LIBOBJS = %{lib_objs} - -CLIOBJS = %{cli_objs} - -TESTOBJS = %{test_objs} - -# First make target. Will be used by default -all: libs cli tests - -# Build Commands -%{lib_build_cmds} - -%{cli_build_cmds} - -%{test_build_cmds} - # Link Commands %{gmake_dso_in} libs: $(LIBRARIES) -cli: $(CLI) -tests: $(TEST) $(CLI): $(LIBRARIES) $(CLIOBJS) $(CLI_LINK_CMD) $(LDFLAGS) $(CLIOBJS) $(CLI_LINKS_TO) -o $(CLI) @@ -46,7 +22,6 @@ $(TEST): $(LIBRARIES) $(TESTOBJS) $(TEST_POST_LINK_CMD) $(STATIC_LIB): $(LIBOBJS) - $(RM) $(STATIC_LIB) $(AR) %{ar_options} $(STATIC_LIB) $(LIBOBJS) # Fake targets @@ -56,26 +31,5 @@ $(STATIC_LIB): $(LIBOBJS) %{gmake_fuzzers_in} -SPHINX_CONFIG = %{sphinx_config_dir} -SPHINX_OPTS = -b html - -clean: - -$(RM) %{libobj_dir}/* - -$(RM) %{testobj_dir}/* - -$(RM) %{cliobj_dir}/* - -$(RM) $(SONAME_ABI) $(SONAME_BASE) - -$(RM) $(LIBRARIES) $(CLI) $(TEST) - -distclean: clean - $(RM) Makefile - $(RM_R) %{build_dir} - $(RM) botan_all.cpp botan_all.h - valgrind: valgrind --log-file=botan.%%p.log -v --track-origins=yes --leak-check=full --show-reachable=yes ./botan-test - -docs: -%{build_doc_commands} - -install: $(CLI) docs - $(PYTHON_EXE) $(SCRIPTS_DIR)/install.py --prefix=%{prefix} --build-dir="%{build_dir}" --bindir=%{bindir} --libdir=%{libdir} --docdir=%{docdir} --includedir=%{includedir} diff --git a/src/build-data/makefile/gmake_commands.in b/src/build-data/makefile/gmake_commands.in deleted file mode 100644 index 3d492ae51..000000000 --- a/src/build-data/makefile/gmake_commands.in +++ /dev/null @@ -1,5 +0,0 @@ -# Program aliases -COPY = cp -LN = ln -fs -RM = @rm -f -RM_R = @rm -rf diff --git a/src/build-data/makefile/header.in b/src/build-data/makefile/header.in index de31c8a0b..946960053 100644 --- a/src/build-data/makefile/header.in +++ b/src/build-data/makefile/header.in @@ -29,3 +29,43 @@ INSTALLED_LIB_DIR = %{prefix}/%{libdir} CLI_POST_LINK_CMD = %{cli_post_link_cmd} TEST_POST_LINK_CMD = %{test_post_link_cmd} + +# Executable targets +CLI = %{cli_exe} +TEST = %{test_exe} + +# The primary target +all: libs cli tests + +cli: $(CLI) +tests: $(TEST) + +# Object Files +LIBOBJS = %{lib_objs} + +CLIOBJS = %{cli_objs} + +TESTOBJS = %{test_objs} + +# Build Commands +%{lib_build_cmds} + +%{cli_build_cmds} + +%{test_build_cmds} + +# Misc targets +SPHINX_CONFIG = %{sphinx_config_dir} +SPHINX_OPTS = -b html + +docs: +%{build_doc_commands} + +clean: + $(PYTHON_EXE) $(SCRIPTS_DIR)/cleanup.py --build-dir="%{build_dir}" + +distclean: + $(PYTHON_EXE) $(SCRIPTS_DIR)/cleanup.py --build-dir="%{build_dir}" --distclean + +install: $(CLI) docs + $(PYTHON_EXE) $(SCRIPTS_DIR)/install.py --prefix=%{prefix} --build-dir="%{build_dir}" --bindir=%{bindir} --libdir=%{libdir} --docdir=%{docdir} --includedir=%{includedir} diff --git a/src/build-data/makefile/nmake.in b/src/build-data/makefile/nmake.in index eba3a774d..c44fd33aa 100644 --- a/src/build-data/makefile/nmake.in +++ b/src/build-data/makefile/nmake.in @@ -3,19 +3,12 @@ ### Aliases for Common Programs COPY = copy -RM = @del /Q -RM_R = $(RM) /S -RMDIR = @rmdir - -# Executable targets -CLI = %{out_dir}\botan-cli%{program_suffix} -TEST = %{out_dir}\botan-test%{program_suffix} # Library targets # # LIB_FILENAME is always the .lib file, that is either a static lib or a # by-product of the DLL creation used to link the DLL into applications -LIB_BASENAME = %{libname} +LIB_BASENAME = %{lib_basename} LIB_FILENAME = %{out_dir}\$(LIB_BASENAME).lib !If "$(SO_OBJ_FLAGS)" == "" @@ -27,24 +20,6 @@ SO_FILENAME = %{out_dir}\$(LIB_BASENAME).dll LIBRARIES = $(SO_FILENAME) !Endif - -# File Lists -LIBOBJS = %{lib_objs} - -CLIOBJS = %{cli_objs} - -TESTOBJS = %{test_objs} - -# First make target. Will be used by default -all: libs cli tests - -# Build Commands -%{lib_build_cmds} - -%{cli_build_cmds} - -%{test_build_cmds} - # Link Commands $(CLI): $(LIBRARIES) $(CLIOBJS) $(CLI_LINK_CMD) /OUT:$@ $(CLIOBJS) $(LIB_FILENAME) $(CLI_LINKS_TO) @@ -55,8 +30,6 @@ $(TEST): $(LIBRARIES) $(TESTOBJS) $(TEST_POST_LINK_CMD) libs: $(LIBRARIES) -cli: $(CLI) -tests: $(TEST) !If "$(SO_OBJ_FLAGS)" == "" # static lib @@ -68,32 +41,3 @@ $(LIB_FILENAME): $(LIBOBJS) $(SO_FILENAME): $(LIBOBJS) $(LIB_LINK_CMD) /OUT:$@ $(LIBOBJS) $(LIB_LINKS_TO) !Endif - -# Fake Targets - -SPHINX_CONFIG = %{sphinx_config_dir} -SPHINX_OPTS = -b html - -docs: -%{build_doc_commands} - -clean: - -$(RM) %{libobj_dir}\* - -$(RM) %{cliobj_dir}\* - -$(RM) %{testobj_dir}\* - -$(RM) %{out_dir}\*.manifest - -$(RM) %{out_dir}\*.exp - -$(RM) %{out_dir}\*.dll - -$(RM) $(LIBRARIES) $(CLI) $(TEST) - -distclean: clean - $(RM_R) %{build_dir} - $(RMDIR) %{build_dir}\include\botan\internal - $(RMDIR) %{build_dir}\include\botan - $(RMDIR) %{build_dir}\include - $(RMDIR) %{build_dir}\lib %{build_dir}\tests - $(RMDIR) %{build_dir} - $(RM) Makefile $(LIB_BASENAME).* $(CLI).* - -install: $(CLI) docs - $(PYTHON_EXE) $(SCRIPTS_DIR)\install.py --prefix=%{prefix} --build-dir="%{build_dir}" --bindir=%{bindir} --libdir=%{libdir} --docdir=%{docdir} --includedir=%{includedir} |