summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBart De Schuymer <bdschuym@pandora.be>2010-03-16 13:00:37 +0000
committerBart De Schuymer <bdschuym@pandora.be>2010-03-16 13:00:37 +0000
commit2320f8bcf06d402501f2a85e42623469715ae579 (patch)
treee40de8cd80ff3986edc96dadc31c21712af9c7f1
parentf9ebb5e01562d9972c4f533311e9d5f5a531c5c9 (diff)
downloadebtables-2320f8bcf06d402501f2a85e42623469715ae579.tar.gz
ebtables-2320f8bcf06d402501f2a85e42623469715ae579.tar.bz2
ebtables-2320f8bcf06d402501f2a85e42623469715ae579.zip
Create directories if they don't exist (INITDIR and SYSCONFIGDIR are only created if DESTDIR is specified)
Based on patch by Peter Volkov
-rw-r--r--Makefile15
1 files changed, 9 insertions, 6 deletions
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)