]> git.xonotic.org Git - xonotic/xonotic.git/blob - Makefile
Merge branch 'master' of git://de.git.xonotic.org/xonotic/xonotic
[xonotic/xonotic.git] / Makefile
1 PREFIX ?= /usr/local
2 BINDIR ?= $(PREFIX)/bin
3 LIBDIR ?= $(PREFIX)/lib/xonotic
4 DOCDIR ?= $(PREFIX)/share/doc/xonotic
5 ZIP ?= zip -9
6 INSTALL ?= install
7 ARCH ?= $(shell if [ x"`uname -m`" = x"x86_64" ]; then echo linux64; else echo linux32; fi)
8 LN ?= ln
9 SUFFIX ?= $(shell if [ -d .git ]; then echo git; else echo zip; fi)
10 CP ?= cp
11
12
13 .PHONY: all
14 all: all-$(SUFFIX)
15
16 .PHONY: all-git
17 all-git:
18         ./all compile -r
19
20 .PHONY: all-zip
21 all-zip:
22         @echo Sorry, this is not implemented yet
23         @false
24
25
26 .PHONY: clean
27 clean: clean-$(SUFFIX)
28
29 .PHONY: clean-git
30 clean-git:
31         ./all clean
32
33 .PHONY: clean-zip
34 clean-zip:
35         @echo Sorry, this is not implemented yet
36         @false
37
38
39 .PHONY: install-data
40 install-data: install-data-$(SUFFIX)
41
42 .PHONY: install-data-git
43 install-data-git:
44         $(RM) -rf $(LIBDIR)/data
45         $(INSTALL) -d $(LIBDIR)/data
46         for p in data/*.pk3; do $(INSTALL) $$p $(LIBDIR)/$$p || exit 1; done
47         for p in data/*.pk3dir; do ( cd $$p; $(ZIP) -r $(LIBDIR)/$${p%dir} * ) || exit 1; done
48
49 .PHONY: install-data-zip
50 install-data-zip:
51         $(RM) -rf $(LIBDIR)/data
52         $(INSTALL) -d $(LIBDIR)/data
53         for p in data/*.pk3; do $(INSTALL) $$p $(LIBDIR)/$$p || exit 1; done
54
55
56 .PHONY: install-engine
57 install-engine: install-engine-$(SUFFIX)
58
59 .PHONY: install-engine-git
60 install-engine-git:
61         $(INSTALL) -d $(LIBDIR)
62         $(INSTALL) xonotic-linux-glx.sh $(LIBDIR)/xonotic-linux-glx.sh
63         $(INSTALL) xonotic-linux-sdl.sh $(LIBDIR)/xonotic-linux-sdl.sh
64         $(INSTALL) xonotic-linux-dedicated.sh $(LIBDIR)/xonotic-linux-dedicated.sh
65         $(INSTALL) darkplaces/darkplaces-sdl $(LIBDIR)/xonotic-$(ARCH)-sdl
66         $(INSTALL) darkplaces/darkplaces-glx $(LIBDIR)/xonotic-$(ARCH)-glx
67         $(INSTALL) darkplaces/darkplaces-dedicated $(LIBDIR)/xonotic-$(ARCH)-dedicated
68
69 .PHONY: install-engine-zip
70 install-engine-zip:
71         $(INSTALL) -d $(LIBDIR)
72         $(INSTALL) xonotic-linux-glx.sh $(LIBDIR)/xonotic-linux-glx.sh
73         $(INSTALL) xonotic-linux-sdl.sh $(LIBDIR)/xonotic-linux-sdl.sh
74         $(INSTALL) xonotic-linux-dedicated.sh $(LIBDIR)/xonotic-linux-dedicated.sh
75         $(INSTALL) xonotic-$(ARCH)-sdl $(LIBDIR)/xonotic-$(ARCH)-sdl
76         $(INSTALL) xonotic-$(ARCH)-glx $(LIBDIR)/xonotic-$(ARCH)-glx
77         $(INSTALL) xonotic-$(ARCH)-dedicated $(LIBDIR)/xonotic-$(ARCH)-dedicated
78
79
80 .PHONY: install-links
81 install-links:
82         $(INSTALL) -d $(BINDIR)
83         $(LN) -snf $(LIBDIR)/xonotic-$(ARCH)-sdl $(BINDIR)/xonotic-sdl
84         $(LN) -snf $(LIBDIR)/xonotic-$(ARCH)-glx $(BINDIR)/xonotic-glx
85         $(LN) -snf $(LIBDIR)/xonotic-$(ARCH)-dedicated $(BINDIR)/xonotic-dedicated
86
87
88 .PHONY: install-doc
89 install-doc:
90         $(INSTALL) -d $(DOCDIR)/server
91         $(CP) -R Docs/* $(DOCDIR)/
92         $(CP) -R server/* $(DOCDIR)/server
93
94
95 .PHONY: install
96 install: install-data install-engine install-links install-doc