From 2320f8bcf06d402501f2a85e42623469715ae579 Mon Sep 17 00:00:00 2001 From: Bart De Schuymer Date: Tue, 16 Mar 2010 13:00:37 +0000 Subject: Create directories if they don't exist (INITDIR and SYSCONFIGDIR are only created if DESTDIR is specified) Based on patch by Peter Volkov --- Makefile | 15 +++++++++------ 1 file changed, 9 insertions(+), 6 deletions(-) (limited to 'Makefile') diff --git a/Makefile b/Makefile index 7e149a1..fc63616 100644 --- a/Makefile +++ b/Makefile @@ -154,11 +154,14 @@ tmp3:=$(shell printf $(PIPE) | sed 's/\//\\\//g') .PHONY: scripts scripts: ebtables-save ebtables.sysv ebtables-config cat ebtables-save | sed 's/__EXEC_PATH__/$(tmp1)/g' > ebtables-save_ + mkdir -p $(DESTDIR)$(BINDIR) install -m 0755 -o root -g root ebtables-save_ $(DESTDIR)$(BINDIR)/ebtables-save cat ebtables.sysv | sed 's/__EXEC_PATH__/$(tmp1)/g' | sed 's/__SYSCONFIG__/$(tmp2)/g' > ebtables.sysv_ - install -m 0755 -o root -g root ebtables.sysv_ $(DESTDIR)$(INITDIR)/ebtables + if [ $(DESTDIR) != "" ]; then mkdir -p $(DESTDIR)$(INITDIR); fi + if test -d $(DESTDIR)$(INITDIR); then install -m 0755 -o root -g root ebtables.sysv_ $(DESTDIR)$(INITDIR)/ebtables; fi cat ebtables-config | sed 's/__SYSCONFIG__/$(tmp2)/g' > ebtables-config_ - install -m 0600 -o root -g root ebtables-config_ $(DESTDIR)$(SYSCONFIGDIR)/ebtables-config + if [ $(DESTDIR) != "" ]; then mkdir -p $(DESTDIR)$(SYSCONFIGDIR); fi + if test -d $(DESTDIR)$(SYSCONFIGDIR); then install -m 0600 -o root -g root ebtables-config_ $(DESTDIR)$(SYSCONFIGDIR)/ebtables-config; fi rm -f ebtables-save_ ebtables.sysv_ ebtables-config_ $(MANDIR)/man8/ebtables.8: ebtables.8 @@ -167,9 +170,9 @@ $(MANDIR)/man8/ebtables.8: ebtables.8 install -m 0644 -o root -g root ebtables.8_ $(DESTDIR)$@ rm -f ebtables.8_ -$(ETHERTYPESFILE): ethertypes - mkdir -p $(DESTDIR)$(@D) - install -m 0644 -o root -g root $< $(DESTDIR)$@ +$(DESTDIR)$(ETHERTYPESFILE): ethertypes + mkdir -p $(@D) + install -m 0644 -o root -g root $< $@ .PHONY: exec exec: ebtables ebtables-restore @@ -178,7 +181,7 @@ exec: ebtables ebtables-restore install -m 0755 -o root -g root ebtables-restore $(DESTDIR)$(BINDIR)/ebtables-restore .PHONY: install -install: $(MANDIR)/man8/ebtables.8 $(ETHERTYPESFILE) exec scripts +install: $(MANDIR)/man8/ebtables.8 $(DESTDIR)$(ETHERTYPESFILE) exec scripts mkdir -p $(DESTDIR)$(LIBDIR) install -m 0755 extensions/*.so $(DESTDIR)$(LIBDIR) install -m 0755 *.so $(DESTDIR)$(LIBDIR) -- cgit v1.2.3