Commits

Keith E Smith  committed daf9cf8

Add DESTDIR for installation to foreign directory

  • Participants
  • Parent commits 9b7bc56

Comments (0)

Files changed (1)

 version := $(shell awk '/define version/{print $$3}' netplug.spec)
 
+DESTDIR ?=
+
 prefix ?=
 bindir ?= $(prefix)/sbin
 etcdir ?= $(prefix)/etc/netplug
 	$(CC) $(LDFLAGS) -o $@ $^
 
 install:
-	install -d $(install_opts) -m 755 $(bindir) $(etcdir) $(scriptdir) \
-		$(initdir) $(mandir)/man8
-	install $(install_opts) -m 755 netplugd $(bindir)
-	install $(install_opts) -m 644 etc/netplugd.conf $(etcdir)
-	install $(install_opts) -m 755 scripts/netplug $(scriptdir)
-	install $(install_opts) -m 755 scripts/rc.netplugd $(initdir)/netplugd
-	install $(install_opts) -m 444 man/man8/netplugd.8 $(mandir)/man8
+	install -d $(install_opts) -m 755 \
+		$(DESTDIR)/$(bindir) \
+		$(DESTDIR)/$(etcdir) \
+		$(DESTDIR)/$(scriptdir) \
+		$(DESTDIR)/$(initdir) \
+		$(DESTDIR)/$(mandir)/man8
+	install $(install_opts) -m 755 netplugd $(DESTDIR)/$(bindir)
+	install $(install_opts) -m 644 etc/netplugd.conf $(DESTDIR)/$(etcdir)
+	install $(install_opts) -m 755 scripts/netplug $(DESTDIR)/$(scriptdir)
+	install $(install_opts) -m 755 scripts/rc.netplugd $(DESTDIR)/$(initdir)/netplugd
+	install $(install_opts) -m 444 man/man8/netplugd.8 $(DESTDIR)/$(mandir)/man8
 
 hg_root := $(shell hg root)
 tar_root := netplug-$(version)