Browse Source

add -p switch to `install` commands in GNU makefiles

This fixes #340

[skip ci]

(cherry picked from commit fc6eb3ecf07e1cceb5ce85907db8191877704570)
Steffen Jaeckel 7 years ago
parent
commit
4800543664
2 changed files with 11 additions and 11 deletions
  1. 2 2
      makefile.shared
  2. 9 9
      makefile_include.mk

+ 2 - 2
makefile.shared

@@ -64,8 +64,8 @@ $(foreach demo, $(strip $(DEMOS)), $(eval $(call DEMO_template,$(demo))))
 
 install: $(call print-help,install,Installs the library + headers + pkg-config file) .common_install
 	sed -e 's,^prefix=.*,prefix=$(PREFIX),' -e 's,^Version:.*,Version: $(VERSION_PC),' libtomcrypt.pc.in > libtomcrypt.pc
-	install -d $(DESTDIR)$(LIBPATH)/pkgconfig
-	install -m 644 libtomcrypt.pc $(DESTDIR)$(LIBPATH)/pkgconfig/
+	install -p -d $(DESTDIR)$(LIBPATH)/pkgconfig
+	install -p -m 644 libtomcrypt.pc $(DESTDIR)$(LIBPATH)/pkgconfig/
 
 install_bins: $(call print-help,install_bins,Installs the useful demos ($(USEFUL_DEMOS))) .common_install_bins
 

+ 9 - 9
makefile_include.mk

@@ -394,23 +394,23 @@ install_all: $(call print-help,install_all,Install everything - library bins doc
 INSTALL_OPTS ?= -m 644
 
 .common_install: $(LIBNAME)
-	install -d $(DESTDIR)$(INCPATH)
-	install -d $(DESTDIR)$(LIBPATH)
-	$(INSTALL_CMD) $(INSTALL_OPTS) $(LIBNAME) $(DESTDIR)$(LIBPATH)/$(LIBNAME)
-	install -m 644 $(HEADERS) $(DESTDIR)$(INCPATH)
+	install -p -d $(DESTDIR)$(INCPATH)
+	install -p -d $(DESTDIR)$(LIBPATH)
+	$(INSTALL_CMD) -p $(INSTALL_OPTS) $(LIBNAME) $(DESTDIR)$(LIBPATH)/$(LIBNAME)
+	install -p -m 644 $(HEADERS) $(DESTDIR)$(INCPATH)
 
 $(DESTDIR)$(BINPATH):
-	install -d $(DESTDIR)$(BINPATH)
+	install -p -d $(DESTDIR)$(BINPATH)
 
 .common_install_bins: $(USEFUL_DEMOS) $(DESTDIR)$(BINPATH)
-	$(INSTALL_CMD) -m 775 $(USEFUL_DEMOS) $(DESTDIR)$(BINPATH)
+	$(INSTALL_CMD) -p -m 775 $(USEFUL_DEMOS) $(DESTDIR)$(BINPATH)
 
 install_docs: $(call print-help,install_docs,Installs the Developer Manual) doc/crypt.pdf
-	install -d $(DESTDIR)$(DATAPATH)
-	install -m 644 doc/crypt.pdf $(DESTDIR)$(DATAPATH)
+	install -p -d $(DESTDIR)$(DATAPATH)
+	install -p -m 644 doc/crypt.pdf $(DESTDIR)$(DATAPATH)
 
 install_test: $(call print-help,install_test,Installs the self-test binary) test $(DESTDIR)$(BINPATH)
-	$(INSTALL_CMD) -m 775 $< $(DESTDIR)$(BINPATH)
+	$(INSTALL_CMD) -p -m 775 $< $(DESTDIR)$(BINPATH)
 
 install_hooks: $(call print-help,install_hooks,Installs the git hooks)
 	for s in `ls hooks/`; do ln -s ../../hooks/$$s .git/hooks/$$s; done