also support DESTDIR
authorRudolf Polzer <divverent@alientrap.org>
Sat, 21 Apr 2012 13:52:28 +0000 (15:52 +0200)
committerRudolf Polzer <divverent@alientrap.org>
Sat, 21 Apr 2012 13:52:28 +0000 (15:52 +0200)
Makefile

index 02d20ae9d3921cefea0f9a4301090e271e15029d..69484068643d042a9beebac5763a0932928e0e49 100644 (file)
--- a/Makefile
+++ b/Makefile
@@ -1,3 +1,4 @@
+DESTDIR ?= 
 PREFIX ?= /usr/local
 BINDIR ?= $(PREFIX)/bin
 LIBDIR ?= $(PREFIX)/lib/xonotic
@@ -59,23 +60,23 @@ install-data: install-data-$(SUFFIX)
 
 .PHONY: install-data-git
 install-data-git: all-git
-       $(RM) -rf $(LIBDIR)/data
-       $(INSTALL) -d $(LIBDIR)/data
-       for p in data/*.pk3; do $(INSTALL) $$p $(LIBDIR)/$$p || exit 1; done
-       for p in data/*.pk3dir; do ( cd $$p; $(ZIP) -r $(LIBDIR)/$${p%dir} * ) || exit 1; done
+       $(RM) -rf $(DESTDIR)$(LIBDIR)/data
+       $(INSTALL) -d $(DESTDIR)$(LIBDIR)/data
+       for p in data/*.pk3; do $(INSTALL) $$p $(DESTDIR)$(LIBDIR)/$$p || exit 1; done
+       for p in data/*.pk3dir; do ( cd $$p; $(ZIP) -r $(DESTDIR)$(LIBDIR)/$${p%dir} * ) || exit 1; done
 
 .PHONY: install-data-zip-binary
 install-data-zip-binary: all-zip-binary
-       $(RM) -rf $(LIBDIR)/data
-       $(INSTALL) -d $(LIBDIR)/data
-       for p in data/*.pk3; do $(INSTALL) $$p $(LIBDIR)/$$p || exit 1; done
+       $(RM) -rf $(DESTDIR)$(LIBDIR)/data
+       $(INSTALL) -d $(DESTDIR)$(LIBDIR)/data
+       for p in data/*.pk3; do $(INSTALL) $$p $(DESTDIR)$(LIBDIR)/$$p || exit 1; done
 
 .PHONY: install-data-zip-source
 install-data-zip-source: all-zip-source
-       $(RM) -rf $(LIBDIR)/data
-       $(INSTALL) -d $(LIBDIR)/data
-       for p in data/*.pk3; do $(INSTALL) $$p $(LIBDIR)/$$p || exit 1; done
-       for p in data/xonotic-*-data*.pk3; do cd source; $(ZIP) $(LIBDIR)/$$p progs.dat menu.dat csprogs.dat; done
+       $(RM) -rf $(DESTDIR)$(LIBDIR)/data
+       $(INSTALL) -d $(DESTDIR)$(LIBDIR)/data
+       for p in data/*.pk3; do $(INSTALL) $$p $(DESTDIR)$(LIBDIR)/$$p || exit 1; done
+       for p in data/xonotic-*-data*.pk3; do cd source; $(ZIP) $(DESTDIR)$(LIBDIR)/$$p progs.dat menu.dat csprogs.dat; done
 
 
 .PHONY: install-engine
@@ -83,48 +84,48 @@ install-engine: install-engine-$(SUFFIX)
 
 .PHONY: install-engine-git
 install-engine-git: all-git
-       $(INSTALL) -d $(LIBDIR)
-       $(INSTALL) xonotic-linux-glx.sh $(LIBDIR)/xonotic-linux-glx.sh
-       $(INSTALL) xonotic-linux-sdl.sh $(LIBDIR)/xonotic-linux-sdl.sh
-       $(INSTALL) xonotic-linux-dedicated.sh $(LIBDIR)/xonotic-linux-dedicated.sh
-       $(INSTALL) darkplaces/darkplaces-sdl $(LIBDIR)/xonotic-$(ARCH)-sdl
-       $(INSTALL) darkplaces/darkplaces-glx $(LIBDIR)/xonotic-$(ARCH)-glx
-       $(INSTALL) darkplaces/darkplaces-dedicated $(LIBDIR)/xonotic-$(ARCH)-dedicated
+       $(INSTALL) -d $(DESTDIR)$(LIBDIR)
+       $(INSTALL) xonotic-linux-glx.sh $(DESTDIR)$(LIBDIR)/xonotic-linux-glx.sh
+       $(INSTALL) xonotic-linux-sdl.sh $(DESTDIR)$(LIBDIR)/xonotic-linux-sdl.sh
+       $(INSTALL) xonotic-linux-dedicated.sh $(DESTDIR)$(LIBDIR)/xonotic-linux-dedicated.sh
+       $(INSTALL) darkplaces/darkplaces-sdl $(DESTDIR)$(LIBDIR)/xonotic-$(ARCH)-sdl
+       $(INSTALL) darkplaces/darkplaces-glx $(DESTDIR)$(LIBDIR)/xonotic-$(ARCH)-glx
+       $(INSTALL) darkplaces/darkplaces-dedicated $(DESTDIR)$(LIBDIR)/xonotic-$(ARCH)-dedicated
 
 .PHONY: install-engine-zip-binary
 install-engine-zip-binary: all-zip-binary
-       $(INSTALL) -d $(LIBDIR)
-       $(INSTALL) xonotic-linux-glx.sh $(LIBDIR)/xonotic-linux-glx.sh
-       $(INSTALL) xonotic-linux-sdl.sh $(LIBDIR)/xonotic-linux-sdl.sh
-       $(INSTALL) xonotic-linux-dedicated.sh $(LIBDIR)/xonotic-linux-dedicated.sh
-       $(INSTALL) xonotic-$(ARCH)-sdl $(LIBDIR)/xonotic-$(ARCH)-sdl
-       $(INSTALL) xonotic-$(ARCH)-glx $(LIBDIR)/xonotic-$(ARCH)-glx
-       $(INSTALL) xonotic-$(ARCH)-dedicated $(LIBDIR)/xonotic-$(ARCH)-dedicated
+       $(INSTALL) -d $(DESTDIR)$(LIBDIR)
+       $(INSTALL) xonotic-linux-glx.sh $(DESTDIR)$(LIBDIR)/xonotic-linux-glx.sh
+       $(INSTALL) xonotic-linux-sdl.sh $(DESTDIR)$(LIBDIR)/xonotic-linux-sdl.sh
+       $(INSTALL) xonotic-linux-dedicated.sh $(DESTDIR)$(LIBDIR)/xonotic-linux-dedicated.sh
+       $(INSTALL) xonotic-$(ARCH)-sdl $(DESTDIR)$(LIBDIR)/xonotic-$(ARCH)-sdl
+       $(INSTALL) xonotic-$(ARCH)-glx $(DESTDIR)$(LIBDIR)/xonotic-$(ARCH)-glx
+       $(INSTALL) xonotic-$(ARCH)-dedicated $(DESTDIR)$(LIBDIR)/xonotic-$(ARCH)-dedicated
 
 .PHONY: install-engine-zip-source
 install-engine-zip-source: all-zip-source
-       $(INSTALL) -d $(LIBDIR)
-       $(INSTALL) xonotic-linux-glx.sh $(LIBDIR)/xonotic-linux-glx.sh
-       $(INSTALL) xonotic-linux-sdl.sh $(LIBDIR)/xonotic-linux-sdl.sh
-       $(INSTALL) xonotic-linux-dedicated.sh $(LIBDIR)/xonotic-linux-dedicated.sh
-       $(INSTALL) source/darkplaces/darkplaces-sdl $(LIBDIR)/xonotic-$(ARCH)-sdl
-       $(INSTALL) source/darkplaces/darkplaces-glx $(LIBDIR)/xonotic-$(ARCH)-glx
-       $(INSTALL) source/darkplaces/darkplaces-dedicated $(LIBDIR)/xonotic-$(ARCH)-dedicated
+       $(INSTALL) -d $(DESTDIR)$(LIBDIR)
+       $(INSTALL) xonotic-linux-glx.sh $(DESTDIR)$(LIBDIR)/xonotic-linux-glx.sh
+       $(INSTALL) xonotic-linux-sdl.sh $(DESTDIR)$(LIBDIR)/xonotic-linux-sdl.sh
+       $(INSTALL) xonotic-linux-dedicated.sh $(DESTDIR)$(LIBDIR)/xonotic-linux-dedicated.sh
+       $(INSTALL) source/darkplaces/darkplaces-sdl $(DESTDIR)$(LIBDIR)/xonotic-$(ARCH)-sdl
+       $(INSTALL) source/darkplaces/darkplaces-glx $(DESTDIR)$(LIBDIR)/xonotic-$(ARCH)-glx
+       $(INSTALL) source/darkplaces/darkplaces-dedicated $(DESTDIR)$(LIBDIR)/xonotic-$(ARCH)-dedicated
 
 
 .PHONY: install-links
 install-links:
        $(INSTALL) -d $(BINDIR)
-       $(LN) -snf $(LIBDIR)/xonotic-linux-sdl.sh $(BINDIR)/xonotic-sdl
-       $(LN) -snf $(LIBDIR)/xonotic-linux-glx.sh $(BINDIR)/xonotic-glx
-       $(LN) -snf $(LIBDIR)/xonotic-linux-dedicated.sh $(BINDIR)/xonotic-dedicated
+       $(LN) -snf $(LIBDIR)/xonotic-linux-sdl.sh $(DESTDIR)$(BINDIR)/xonotic-sdl
+       $(LN) -snf $(LIBDIR)/xonotic-linux-glx.sh $(DESTDIR)$(BINDIR)/xonotic-glx
+       $(LN) -snf $(LIBDIR)/xonotic-linux-dedicated.sh $(DESTDIR)$(BINDIR)/xonotic-dedicated
 
 
 .PHONY: install-doc
 install-doc:
-       $(INSTALL) -d $(DOCDIR)/server
-       $(CP) -R Docs/* $(DOCDIR)/
-       $(CP) -R server/* $(DOCDIR)/server
+       $(INSTALL) -d $(DESTDIR)$(DOCDIR)/server
+       $(CP) -R Docs/* $(DESTDIR)$(DOCDIR)/
+       $(CP) -R server/* $(DESTDIR)$(DOCDIR)/server
 
 
 .PHONY: install