Anonymous avatar Anonymous committed daf9cf8

Add DESTDIR for installation to foreign directory

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)
Tip: Filter by directory path e.g. /media app.js to search for public/media/app.js.
Tip: Use camelCasing e.g. ProjME to search for ProjectModifiedEvent.java.
Tip: Filter by extension type e.g. /repo .js to search for all .js files in the /repo directory.
Tip: Separate your search with spaces e.g. /ssh pom.xml to search for src/ssh/pom.xml.
Tip: Use ↑ and ↓ arrow keys to navigate and return to view the file.
Tip: You can also navigate files with Ctrl+j (next) and Ctrl+k (previous) and view the file with Ctrl+o.
Tip: You can also navigate files with Alt+j (next) and Alt+k (previous) and view the file with Alt+o.