]> de.git.xonotic.org Git - xonotic/xonotic.git/blob - Makefile
add desktop files. No idea where they would have to be installed.
[xonotic/xonotic.git] / Makefile
1 DESTDIR ?= 
2 PREFIX ?= /usr/local
3 BINDIR ?= $(PREFIX)/bin
4 LIBDIR ?= $(PREFIX)/lib/xonotic
5 DOCDIR ?= $(PREFIX)/share/doc/xonotic
6 ZIP ?= zip -9
7 INSTALL ?= install
8 ARCH ?= $(shell if [ x"`uname -m`" = x"x86_64" ]; then echo linux64; else echo linux32; fi)
9 LN ?= ln
10 CP ?= cp
11 BINARY ?= yes
12 SUFFIX ?= $(shell if [ -d .git ]; then echo git; elif [ x"$(BINARY)" = x"yes" ]; then echo zip-binary; else echo zip-source; fi)
13 RIJNDAELDETECT_CONFIGURE ?= $(shell if ! [ -f source/d0_blind_id/d0_rijndael.c ]; then echo --disable-rijndael; fi)
14 RIJNDAELDETECT_MAKE_DP ?= $(shell if [ -f source/d0_blind_id/d0_rijndael.c ]; then echo DP_CRYPTO_RIJNDAEL_STATIC_LIBDIR=$(CURDIR)/source/d0_blind_id/.libs; fi)
15
16
17 .PHONY: all
18 all: all-$(SUFFIX)
19
20 .PHONY: all-git
21 all-git:
22         ./all compile -r
23
24 .PHONY: all-zip-binary
25 all-zip-binary:
26         @echo Nothing to do
27
28 .PHONY: all-zip-source
29 all-zip-source:
30         ( cd source/d0_blind_id && ./configure --enable-static --disable-shared $(RIJNDAELDETECT_CONFIGURE) )
31         $(MAKE) -C source/d0_blind_id
32         $(MAKE) -C source/gmqcc
33         $(MAKE) -C source/qcsrc FTEQCC=$(CURDIR)/source/gmqcc/gmqcc
34         $(MAKE) -C source/darkplaces sv-release DP_CRYPTO_STATIC_LIBDIR=$(CURDIR)/source/d0_blind_id/.libs
35         $(MAKE) -C source/darkplaces cl-release DP_CRYPTO_STATIC_LIBDIR=$(CURDIR)/source/d0_blind_id/.libs
36         $(MAKE) -C source/darkplaces sdl-release DP_CRYPTO_STATIC_LIBDIR=$(CURDIR)/source/d0_blind_id/.libs
37
38
39 .PHONY: clean
40 clean: clean-$(SUFFIX)
41
42 .PHONY: clean-git
43 clean-git:
44         ./all clean
45
46 .PHONY: clean-zip
47 clean-zip-binary:
48         @echo Nothing to do
49
50 .PHONY: clean-zip
51 clean-zip-source:
52         -$(MAKE) -C source/d0_blind_id distclean
53         $(MAKE) -C source/gmqcc clean
54         $(MAKE) -C source/qcsrc clean
55         $(MAKE) -C source/darkplaces clean
56
57
58 .PHONY: install-data
59 install-data: install-data-$(SUFFIX)
60
61 .PHONY: install-data-git
62 install-data-git: all-git
63         $(RM) -rf $(DESTDIR)$(LIBDIR)/data
64         $(INSTALL) -d $(DESTDIR)$(LIBDIR)/data
65         for p in data/*.pk3; do $(INSTALL) $$p $(DESTDIR)$(LIBDIR)/$$p || exit 1; done
66         for p in data/*.pk3dir; do ( cd $$p && $(ZIP) -r $(DESTDIR)$(LIBDIR)/$${p%dir} * ) || exit 1; done
67
68 .PHONY: install-data-zip-binary
69 install-data-zip-binary: all-zip-binary
70         $(RM) -rf $(DESTDIR)$(LIBDIR)/data
71         $(INSTALL) -d $(DESTDIR)$(LIBDIR)/data
72         for p in data/*.pk3; do $(INSTALL) $$p $(DESTDIR)$(LIBDIR)/$$p || exit 1; done
73
74 .PHONY: install-data-zip-source
75 install-data-zip-source: all-zip-source
76         $(RM) -rf $(DESTDIR)$(LIBDIR)/data
77         $(INSTALL) -d $(DESTDIR)$(LIBDIR)/data
78         for p in data/*.pk3; do $(INSTALL) $$p $(DESTDIR)$(LIBDIR)/$$p || exit 1; done
79         for p in data/xonotic-*-data*.pk3; do cd source && $(ZIP) $(DESTDIR)$(LIBDIR)/$$p progs.dat menu.dat csprogs.dat; done
80
81
82 .PHONY: install-engine
83 install-engine: install-engine-$(SUFFIX)
84
85 .PHONY: install-engine-git
86 install-engine-git: all-git
87         $(INSTALL) -d $(DESTDIR)$(LIBDIR)
88         $(INSTALL) xonotic-linux-glx.sh $(DESTDIR)$(LIBDIR)/xonotic-linux-glx.sh
89         $(INSTALL) xonotic-linux-sdl.sh $(DESTDIR)$(LIBDIR)/xonotic-linux-sdl.sh
90         $(INSTALL) xonotic-linux-dedicated.sh $(DESTDIR)$(LIBDIR)/xonotic-linux-dedicated.sh
91         $(INSTALL) darkplaces/darkplaces-sdl $(DESTDIR)$(LIBDIR)/xonotic-$(ARCH)-sdl
92         $(INSTALL) darkplaces/darkplaces-glx $(DESTDIR)$(LIBDIR)/xonotic-$(ARCH)-glx
93         $(INSTALL) darkplaces/darkplaces-dedicated $(DESTDIR)$(LIBDIR)/xonotic-$(ARCH)-dedicated
94
95 .PHONY: install-engine-zip-binary
96 install-engine-zip-binary: all-zip-binary
97         $(INSTALL) -d $(DESTDIR)$(LIBDIR)
98         $(INSTALL) xonotic-linux-glx.sh $(DESTDIR)$(LIBDIR)/xonotic-linux-glx.sh
99         $(INSTALL) xonotic-linux-sdl.sh $(DESTDIR)$(LIBDIR)/xonotic-linux-sdl.sh
100         $(INSTALL) xonotic-linux-dedicated.sh $(DESTDIR)$(LIBDIR)/xonotic-linux-dedicated.sh
101         $(INSTALL) xonotic-$(ARCH)-sdl $(DESTDIR)$(LIBDIR)/xonotic-$(ARCH)-sdl
102         $(INSTALL) xonotic-$(ARCH)-glx $(DESTDIR)$(LIBDIR)/xonotic-$(ARCH)-glx
103         $(INSTALL) xonotic-$(ARCH)-dedicated $(DESTDIR)$(LIBDIR)/xonotic-$(ARCH)-dedicated
104
105 .PHONY: install-engine-zip-source
106 install-engine-zip-source: all-zip-source
107         $(INSTALL) -d $(DESTDIR)$(LIBDIR)
108         $(INSTALL) xonotic-linux-glx.sh $(DESTDIR)$(LIBDIR)/xonotic-linux-glx.sh
109         $(INSTALL) xonotic-linux-sdl.sh $(DESTDIR)$(LIBDIR)/xonotic-linux-sdl.sh
110         $(INSTALL) xonotic-linux-dedicated.sh $(DESTDIR)$(LIBDIR)/xonotic-linux-dedicated.sh
111         $(INSTALL) source/darkplaces/darkplaces-sdl $(DESTDIR)$(LIBDIR)/xonotic-$(ARCH)-sdl
112         $(INSTALL) source/darkplaces/darkplaces-glx $(DESTDIR)$(LIBDIR)/xonotic-$(ARCH)-glx
113         $(INSTALL) source/darkplaces/darkplaces-dedicated $(DESTDIR)$(LIBDIR)/xonotic-$(ARCH)-dedicated
114
115
116 .PHONY: install-links
117 install-links:
118         $(INSTALL) -d $(BINDIR)
119         $(LN) -snf $(LIBDIR)/xonotic-linux-sdl.sh $(DESTDIR)$(BINDIR)/xonotic-sdl
120         $(LN) -snf $(LIBDIR)/xonotic-linux-glx.sh $(DESTDIR)$(BINDIR)/xonotic-glx
121         $(LN) -snf $(LIBDIR)/xonotic-linux-dedicated.sh $(DESTDIR)$(BINDIR)/xonotic-dedicated
122
123
124 .PHONY: install-doc
125 install-doc:
126         $(INSTALL) -d $(DESTDIR)$(DOCDIR)/server
127         $(CP) -R Docs/* $(DESTDIR)$(DOCDIR)/
128         $(CP) -R server/* $(DESTDIR)$(DOCDIR)/server
129
130
131 .PHONY: install
132 install: install-data install-engine install-links install-doc