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