]> git.xonotic.org Git - xonotic/xonotic.git/blob - Makefile
add an experimental Makefile
[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 .PHONY: all
13 all:
14         ./all compile -r
15
16 .PHONY: clean
17 clean:
18         ./all compile -c
19
20 .PHONY: install-data-git
21 install-data-git: all
22         $(INSTALL) -d $(LIBDIR)/data
23         for p in data/*.pk3dir; do $(ZIP) -r $(LIBDIR)/data/$${p%dir} data/$$p/*; done
24
25 .PHONY: install-data-zip
26 install-data-git: all
27         $(INSTALL) -d $(LIBDIR)/data
28         for p in data/*.pk3; do $(INSTALL) data/$$p $(LIBDIR)/data/$$p; done
29
30 .PHONY: install-data
31 install-data: install-data-$(SUFFIX)
32
33 .PHONY: install-engine-git
34 install-engine-git: all
35         $(INSTALL) -d $(LIBDIR)
36         $(INSTALL) xonotic-linux-glx.sh $(LIBDIR)/xonotic-linux-glx.sh
37         $(INSTALL) xonotic-linux-sdl.sh $(LIBDIR)/xonotic-linux-sdl.sh
38         $(INSTALL) xonotic-linux-dedicated.sh $(LIBDIR)/xonotic-linux-dedicated.sh
39         $(INSTALL) darkplaces/xonotic-sdl $(LIBDIR)/xonotic-$(ARCH)-sdl
40         $(INSTALL) darkplaces/xonotic-glx $(LIBDIR)/xonotic-$(ARCH)-glx
41         $(INSTALL) darkplaces/xonotic-dedicated $(LIBDIR)/xonotic-$(ARCH)-dedicated
42
43 .PHONY: install-engine-zip
44 install-engine-git: all
45         $(INSTALL) -d $(LIBDIR)
46         $(INSTALL) xonotic-linux-glx.sh $(LIBDIR)/xonotic-linux-glx.sh
47         $(INSTALL) xonotic-linux-sdl.sh $(LIBDIR)/xonotic-linux-sdl.sh
48         $(INSTALL) xonotic-linux-dedicated.sh $(LIBDIR)/xonotic-linux-dedicated.sh
49         $(INSTALL) xonotic-$(ARCH)-sdl $(LIBDIR)/xonotic-$(ARCH)-sdl
50         $(INSTALL) xonotic-$(ARCH)-glx $(LIBDIR)/xonotic-$(ARCH)-glx
51         $(INSTALL) xonotic-$(ARCH)-dedicated $(LIBDIR)/xonotic-$(ARCH)-dedicated
52
53 .PHONY: install-engine
54 install-engine: install-engine-$(SUFFIX)
55
56 .PHONY: install-links
57 install-links: all
58         $(INSTALL) -d $(BINDIR)
59         $(LN) -snf $(LIBDIR)/xonotic-$(ARCH)-sdl $(BINDIR)/xonotic-sdl
60         $(LN) -snf $(LIBDIR)/xonotic-$(ARCH)-glx $(BINDIR)/xonotic-glx
61         $(LN) -snf $(LIBDIR)/xonotic-$(ARCH)-dedicated $(BINDIR)/xonotic-dedicated
62
63 .PHONY: install-doc
64 install-doc:
65         $(INSTALL) -d $(DOCDIR)/server
66         $(CP) -R Docs/* $(DOCDIR)/
67         $(CP) -R server/* $(DOCDIR)/server
68
69 .PHONY: install
70 install: install-data install-engine install-links install-doc