make: add INSTALL_STRIP option variable
Add $(INSTALL_STRIP), which allows passing stripping options to $(INSTALL). For this to work, installing executables must be split to installing compiled binaries and scripts portions, since $(INSTALL_STRIP) is only meaningful to the former. Users can set this variable depending on their system. For example, Linux users can use `-s --strip-program=strip`, while FreeBSD users can simply set to `-s` and choose strip program with $STRIPBIN. [original outline by Đoàn Trần Công Danh] Signed-off-by: Đoàn Trần Công Danh <congdanhqx@gmail.com> Helped-by: Junio C Hamano <gitster@pobox.com> Signed-off-by: Bagas Sanjaya <bagasdotme@gmail.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
Bagas Sanjaya committed
Sep 5, 2021 at 12:17 UTC
3231f410090491a6a8fa1b110d1518c6a5786bad
1 file changed
+12
-3
Makefile
+12
-3
@@ -465,6 +465,9 @@ all::
465
# the global variable _wpgmptr containing the absolute path of the current
466
# executable (this is the case on Windows).
467
#
468
+# INSTALL_STRIP can be set to "-s" to strip binaries during installation,
469
+# if your $(INSTALL) command supports the option.
470
+#
471
# Define GENERATE_COMPILATION_DATABASE to "yes" to generate JSON compilation
472
# database entries during compilation if your compiler supports it, using the
473
# `-MJ` flag. The JSON entries will be placed in the `compile_commands/`
@@ -3004,7 +3007,8 @@ mergetools_instdir = $(prefix)/$(mergetoolsdir)
3007
endif
3008
mergetools_instdir_SQ = $(subst ','\'',$(mergetools_instdir))
3009
3007
-install_bindir_programs := $(patsubst %,%$X,$(BINDIR_PROGRAMS_NEED_X)) $(BINDIR_PROGRAMS_NO_X)
3010
+install_bindir_xprograms := $(patsubst %,%$X,$(BINDIR_PROGRAMS_NEED_X))
3011
+install_bindir_programs := $(install_bindir_xprograms) $(BINDIR_PROGRAMS_NO_X)
3012
3013
.PHONY: profile-install profile-fast-install
3014
profile-install: profile
@@ -3013,12 +3017,17 @@ profile-install: profile
3017
profile-fast-install: profile-fast
3018
$(MAKE) install
3019
3020
+INSTALL_STRIP =
3021
+
3022
install: all
3023
$(INSTALL) -d -m 755 '$(DESTDIR_SQ)$(bindir_SQ)'
3024
$(INSTALL) -d -m 755 '$(DESTDIR_SQ)$(gitexec_instdir_SQ)'
3019
- $(INSTALL) $(ALL_PROGRAMS) '$(DESTDIR_SQ)$(gitexec_instdir_SQ)'
3025
+ $(INSTALL) $(INSTALL_STRIP) $(PROGRAMS) '$(DESTDIR_SQ)$(gitexec_instdir_SQ)'
3026
+ $(INSTALL) $(SCRIPTS) '$(DESTDIR_SQ)$(gitexec_instdir_SQ)'
3027
$(INSTALL) -m 644 $(SCRIPT_LIB) '$(DESTDIR_SQ)$(gitexec_instdir_SQ)'
3021
- $(INSTALL) $(install_bindir_programs) '$(DESTDIR_SQ)$(bindir_SQ)'
3028
+ $(INSTALL) $(INSTALL_STRIP) $(install_bindir_xprograms) '$(DESTDIR_SQ)$(bindir_SQ)'
3029
+ $(INSTALL) $(BINDIR_PROGRAMS_NO_X) '$(DESTDIR_SQ)$(bindir_SQ)'
3030
+
3031
ifdef MSVC
3032
# We DO NOT install the individual foo.o.pdb files because they
3033
# have already been rolled up into the exe's pdb file.