Merge branch 'msys2thread' into 'master'
[xonotic/netradiant.git] / Makefile
1 MAKEFILE_CONF      ?= Makefile.conf
2 -include $(MAKEFILE_CONF)
3
4 ## CONFIGURATION SETTINGS
5 # user customizable stuf
6 # you may override this in Makefile.conf or the environment
7 BUILD              ?= debug
8 # or: release, or: extradebug, or: profile
9 OS                 ?= $(shell uname)
10 # or: Linux, Win32, Darwin
11 LDFLAGS            ?=
12 CFLAGS             ?=
13 CXXFLAGS           ?=
14 CPPFLAGS           ?=
15 LIBS               ?=
16 RADIANT_ABOUTMSG   ?= Custom build
17
18 # warning: this directory may NOT contain any files other than the ones written by this Makefile!
19 # NEVER SET THIS TO A SYSTEM WIDE "bin" DIRECTORY!
20 INSTALLDIR         ?= install
21 DOWNLOADDIR        ?= build/download
22
23 CC                 ?= gcc
24 CXX                ?= g++
25 RANLIB             ?= ranlib
26 AR                 ?= ar
27 LDD                ?= ldd # nothing on Win32
28 OTOOL              ?= # only used on OS X
29 WINDRES            ?= windres # only used on Win32
30
31 PKGCONFIG          ?= pkg-config
32 PKG_CONFIG_PATH    ?=
33
34 SH                 ?= $(SHELL)
35 ECHO               ?= echo
36 ECHO_NOLF          ?= echo -n
37 CAT                ?= cat
38 MKDIR              ?= mkdir -p
39 CP                 ?= cp
40 CP_R               ?= $(CP) -r --preserve=timestamps
41 LN                 ?= ln
42 LN_SNF             ?= $(LN) -snf
43 RM                 ?= rm
44 RM_R               ?= $(RM) -r
45 TEE_STDERR         ?= | tee /dev/stderr
46 TR                 ?= tr
47 FIND               ?= find
48 DIFF               ?= diff
49 SED                ?= sed
50 GIT                ?= git
51 SVN                ?= svn
52 WGET               ?= wget
53 MV                 ?= mv
54 UNZIPPER           ?= unzip
55
56 FD_TO_DEVNULL      ?= >/dev/null
57 STDOUT_TO_DEVNULL  ?= 1$(FD_TO_DEVNULL)
58 STDERR_TO_DEVNULL  ?= 2$(FD_TO_DEVNULL)
59 STDERR_TO_STDOUT   ?= 2>&1
60 TO_DEVNULL         ?= $(STDOUT_TO_DEVNULL) $(STDERR_TO_STDOUT)
61
62 CPPFLAGS_GLIB      ?= $(shell PKG_CONFIG_PATH=$(PKG_CONFIG_PATH) $(PKGCONFIG) glib-2.0 --cflags $(STDERR_TO_DEVNULL))
63 LIBS_GLIB          ?= $(shell PKG_CONFIG_PATH=$(PKG_CONFIG_PATH) $(PKGCONFIG) glib-2.0 --libs-only-L $(STDERR_TO_DEVNULL)) \
64                       $(shell PKG_CONFIG_PATH=$(PKG_CONFIG_PATH) $(PKGCONFIG) glib-2.0 --libs-only-l $(STDERR_TO_DEVNULL))
65 CPPFLAGS_XML       ?= $(shell PKG_CONFIG_PATH=$(PKG_CONFIG_PATH) $(PKGCONFIG) libxml-2.0 --cflags $(STDERR_TO_DEVNULL))
66 LIBS_XML           ?= $(shell PKG_CONFIG_PATH=$(PKG_CONFIG_PATH) $(PKGCONFIG) libxml-2.0 --libs-only-L $(STDERR_TO_DEVNULL)) \
67                       $(shell PKG_CONFIG_PATH=$(PKG_CONFIG_PATH) $(PKGCONFIG) libxml-2.0 --libs-only-l $(STDERR_TO_DEVNULL))
68 CPPFLAGS_PNG       ?= $(shell PKG_CONFIG_PATH=$(PKG_CONFIG_PATH) $(PKGCONFIG) libpng --cflags $(STDERR_TO_DEVNULL))
69 LIBS_PNG           ?= $(shell PKG_CONFIG_PATH=$(PKG_CONFIG_PATH) $(PKGCONFIG) libpng --libs-only-L $(STDERR_TO_DEVNULL)) \
70                       $(shell PKG_CONFIG_PATH=$(PKG_CONFIG_PATH) $(PKGCONFIG) libpng --libs-only-l $(STDERR_TO_DEVNULL))
71 CPPFLAGS_WEBP      ?= $(shell PKG_CONFIG_PATH=$(PKG_CONFIG_PATH) $(PKGCONFIG) libwebp --cflags $(STDERR_TO_DEVNULL))
72 LIBS_WEBP          ?= $(shell PKG_CONFIG_PATH=$(PKG_CONFIG_PATH) $(PKGCONFIG) libwebp --libs-only-L $(STDERR_TO_DEVNULL)) \
73                       $(shell PKG_CONFIG_PATH=$(PKG_CONFIG_PATH) $(PKGCONFIG) libwebp --libs-only-l $(STDERR_TO_DEVNULL))
74 CPPFLAGS_GTK       ?= $(shell PKG_CONFIG_PATH=$(PKG_CONFIG_PATH) $(PKGCONFIG) gtk+-2.0 --cflags $(STDERR_TO_DEVNULL))
75 LIBS_GTK           ?= $(shell PKG_CONFIG_PATH=$(PKG_CONFIG_PATH) $(PKGCONFIG) gtk+-2.0 --libs-only-L $(STDERR_TO_DEVNULL)) \
76                       $(shell PKG_CONFIG_PATH=$(PKG_CONFIG_PATH) $(PKGCONFIG) gtk+-2.0 --libs-only-l $(STDERR_TO_DEVNULL))
77 CPPFLAGS_PANGOFT2  ?= $(shell PKG_CONFIG_PATH=$(PKG_CONFIG_PATH) $(PKGCONFIG) pangoft2 --cflags $(STDERR_TO_DEVNULL))
78 LIBS_PANGOFT2      ?= $(shell PKG_CONFIG_PATH=$(PKG_CONFIG_PATH) $(PKGCONFIG) pangoft2 --libs-only-L $(STDERR_TO_DEVNULL)) \
79                       $(shell PKG_CONFIG_PATH=$(PKG_CONFIG_PATH) $(PKGCONFIG) pangoft2 --libs-only-l $(STDERR_TO_DEVNULL))
80 CPPFLAGS_GTKGLEXT  ?= $(shell PKG_CONFIG_PATH=$(PKG_CONFIG_PATH) $(PKGCONFIG) gtkglext-1.0 --cflags $(STDERR_TO_DEVNULL))
81 LIBS_GTKGLEXT      ?= $(shell PKG_CONFIG_PATH=$(PKG_CONFIG_PATH) $(PKGCONFIG) gtkglext-1.0 --libs-only-L $(STDERR_TO_DEVNULL)) \
82                       $(shell PKG_CONFIG_PATH=$(PKG_CONFIG_PATH) $(PKGCONFIG) gtkglext-1.0 --libs-only-l $(STDERR_TO_DEVNULL))
83 CPPFLAGS_GL        ?=
84 LIBS_GL            ?= -lGL # -lopengl32 on Win32
85 CPPFLAGS_DL        ?=
86 LIBS_DL            ?= -ldl # nothing on Win32
87 CPPFLAGS_ZLIB      ?=
88 LIBS_ZLIB          ?= -lz -lminizip
89 CPPFLAGS_JPEG      ?=
90 LIBS_JPEG          ?= -ljpeg
91 DEPEND_ON_MAKEFILE ?= yes
92 DOWNLOAD_GAMEPACKS ?= yes
93 # set to no to disable gamepack, set to all to even download undistributable gamepacks
94
95 # Support CHECK_DEPENDENCIES with DOWNLOAD_GAMEPACKS semantics
96 ifneq ($(CHECK_DEPENDENCIES),)
97 DEPENDENCIES_CHECK = $(patsubst yes,quiet,$(patsubst no,off,$(CHECK_DEPENDENCIES)))
98 else
99 DEPENDENCIES_CHECK ?= quiet
100 # or: off, verbose
101 endif
102
103 # these are used on Win32 only
104 GTKDIR             ?= $(shell PKG_CONFIG_PATH=$(PKG_CONFIG_PATH) $(PKGCONFIG) gtk+-2.0 --variable=prefix $(STDERR_TO_DEVNULL))
105 WHICHDLL           ?= which
106 DLLINSTALL         ?= install-dlls.sh
107
108 # alias mingw32 OSes
109 ifeq ($(OS),MINGW32_NT-6.0)
110         OS = Win32
111 endif
112 ifeq ($(OS),Windows_NT)
113         OS = Win32
114 endif
115
116 CFLAGS_COMMON = -MMD -W -Wall -Wcast-align -Wcast-qual -Wno-unused-parameter -fno-strict-aliasing
117 CPPFLAGS_COMMON =
118 LDFLAGS_COMMON =
119 LIBS_COMMON =
120 CXXFLAGS_COMMON = -std=c++11 -Wno-non-virtual-dtor -Wreorder -fno-exceptions -fno-rtti
121
122 ifeq ($(BUILD),debug)
123 ifeq ($(findstring $(CFLAGS),-g),)
124         CFLAGS_COMMON += -g
125         # only add -g if no -g flag is in $(CFLAGS)
126 endif
127 ifeq ($(findstring $(CFLAGS),-O),)
128         CFLAGS_COMMON += -O
129         # only add -O if no -O flag is in $(CFLAGS)
130 endif
131         CPPFLAGS_COMMON +=
132         LDFLAGS_COMMON +=
133 else
134
135 ifeq ($(BUILD),extradebug)
136 ifeq ($(findstring $(CFLAGS),-g),)
137         CFLAGS_COMMON += -g3
138         # only add -g3 if no -g flag is in $(CFLAGS)
139 endif
140         CPPFLAGS_COMMON += -D_DEBUG
141         LDFLAGS_COMMON +=
142 else
143
144 ifeq ($(BUILD),profile)
145 ifeq ($(findstring $(CFLAGS),-g),)
146         CFLAGS_COMMON += -g
147         # only add -g if no -g flag is in $(CFLAGS)
148 endif
149 ifeq ($(findstring $(CFLAGS),-O),)
150         CFLAGS_COMMON += -O
151         # only add -O if no -O flag is in $(CFLAGS)
152 endif
153         CFLAGS_COMMON += -pg
154         CPPFLAGS_COMMON +=
155         LDFLAGS_COMMON += -pg
156 else
157
158 ifeq ($(BUILD),release)
159 ifeq ($(findstring $(CFLAGS),-O),)
160         CFLAGS_COMMON += -O3
161         # only add -O3 if no -O flag is in $(CFLAGS)
162 endif
163         CPPFLAGS_COMMON +=
164         LDFLAGS_COMMON += -s
165 else
166
167 ifeq ($(BUILD),native)
168 ifeq ($(findstring $(CFLAGS),-O),)
169         CFLAGS_COMMON += -O3
170         # only add -O3 if no -O flag is in $(CFLAGS)
171 endif
172         CFLAGS_COMMON += -march=native -mtune=native
173         CPPFLAGS_COMMON +=
174         LDFLAGS_COMMON += -s
175 else
176
177 $(error Unsupported build type: $(BUILD))
178 endif
179 endif
180 endif
181 endif
182 endif
183
184 INSTALLDIR_BASE := $(INSTALLDIR)
185
186 MAKE_EXE_SYMLINK = false
187
188 ifeq ($(OS),Linux)
189         CPPFLAGS_COMMON += -DPOSIX -DXWINDOWS
190         CFLAGS_COMMON += -fPIC
191         LDFLAGS_DLL = -fPIC -ldl
192         LIBS_COMMON = -lpthread
193         EXE ?= $(shell uname -m)
194         MAKE_EXE_SYMLINK = true
195         A = a
196         DLL = so
197         MWINDOWS =
198 else
199
200 ifeq ($(OS),Win32)
201         CPPFLAGS_COMMON += -DWIN32 -D_WIN32 -D_inline=inline
202         CFLAGS_COMMON += -mms-bitfields
203         LDFLAGS_DLL = -Wl,--add-stdcall-alias
204         LIBS_COMMON = -lws2_32 -luser32 -lgdi32 -lole32
205         EXE ?= exe
206         A = a
207         DLL = dll
208         MWINDOWS = -mwindows
209
210         # workaround: we have no "ldd" for Win32, so...
211         LDD =
212         # workaround: OpenGL library for Win32 is called opengl32.dll
213         LIBS_GL = -lopengl32
214         # workaround: no -ldl on Win32
215         LIBS_DL = 
216 else
217
218 ifeq ($(OS),Darwin)
219         CPPFLAGS_COMMON += -DPOSIX -DXWINDOWS
220         CFLAGS_COMMON += -fPIC
221         CXXFLAGS_COMMON += -fno-exceptions -fno-rtti
222         MACLIBDIR ?= /opt/local/lib
223         CPPFLAGS_COMMON += -I$(MACLIBDIR)/../include -I/usr/X11R6/include
224         LDFLAGS_COMMON += -L$(MACLIBDIR) -L/usr/X11R6/lib
225         LDFLAGS_DLL += -dynamiclib -ldl
226         EXE ?= $(shell uname -m)
227         MAKE_EXE_SYMLINK = true
228         A = a
229         DLL = dylib
230         MWINDOWS =
231         # workaround for weird prints
232         ECHO_NOLF = /bin/echo -n
233
234         # workaround: http://developer.apple.com/qa/qa2007/qa1567.html
235         LIBS_GL += -lX11 -dylib_file /System/Library/Frameworks/OpenGL.framework/Versions/A/Libraries/libGL.dylib:/System/Library/Frameworks/OpenGL.framework/Versions/A/Libraries/libGL.dylib
236         LIBS_GTKGLEXT += -lX11 -dylib_file /System/Library/Frameworks/OpenGL.framework/Versions/A/Libraries/libGL.dylib:/System/Library/Frameworks/OpenGL.framework/Versions/A/Libraries/libGL.dylib
237         # workaround: we have no "ldd" for OS X, so...
238         LDD =
239         OTOOL = otool
240 else
241
242 $(error Unsupported build OS: $(OS))
243 endif
244 endif
245 endif
246
247 # VERSION!
248 RADIANT_MAJOR_VERSION = 1
249 RADIANT_MINOR_VERSION = 5
250 RADIANT_PATCH_VERSION = 0
251 RADIANT_VERSION_NUMBER = $(RADIANT_MAJOR_VERSION).$(RADIANT_MINOR_VERSION).$(RADIANT_PATCH_VERSION)
252 RADIANT_VERSION = $(RADIANT_VERSION_NUMBER)n
253 Q3MAP_VERSION = 2.5.17n
254
255 # Executable extension
256 RADIANT_EXECUTABLE := $(EXE)
257
258 GIT_VERSION := $(shell $(GIT) rev-parse --short HEAD $(STDERR_TO_DEVNULL))
259 ifneq ($(GIT_VERSION),)
260         RADIANT_VERSION := $(RADIANT_VERSION)-git-$(GIT_VERSION)
261         Q3MAP_VERSION := $(Q3MAP_VERSION)-git-$(GIT_VERSION)
262 endif
263
264 CPPFLAGS += -DRADIANT_VERSION="\"$(RADIANT_VERSION)\"" -DRADIANT_MAJOR_VERSION="\"$(RADIANT_MAJOR_VERSION)\"" -DRADIANT_MINOR_VERSION="\"$(RADIANT_MINOR_VERSION)\"" -DRADIANT_PATCH_VERSION="\"$(RADIANT_PATCH_VERSION)\"" -DRADIANT_ABOUTMSG="\"$(RADIANT_ABOUTMSG)\"" -DQ3MAP_VERSION="\"$(Q3MAP_VERSION)\"" -DRADIANT_EXECUTABLE="\"$(RADIANT_EXECUTABLE)\""
265 CPPFLAGS += -DGTK_TARGET=2
266
267 .PHONY: all
268 all: \
269         dependencies-check \
270         binaries \
271         install-data \
272         install-dll \
273
274 .PHONY: dependencies-check
275 ifeq ($(findstring $(DEPENDENCIES_CHECK),off),off)
276 dependencies-check:
277         @$(ECHO) dependencies checking disabled, good luck...
278 else
279 dependencies-check:
280         @$(ECHO)
281         @if [ x"$(DEPENDENCIES_CHECK)" = x"verbose" ]; then set -x; exec 3>&2; else exec 3$(FD_TO_DEVNULL); fi; \
282         failed=0; \
283         checkbinary() \
284         { \
285                 $(ECHO_NOLF) "Checking for $$2 ($$1)... "; \
286                 $$2 --help >&3 $(STDERR_TO_STDOUT); \
287                 if [ $$? != 127 ]; then \
288                         $(ECHO) "found."; \
289                 else \
290                         $(ECHO) "not found, please install it or set PATH right!"; \
291                         $(ECHO) "To see the failed commands, set DEPENDENCIES_CHECK=verbose"; \
292                         $(ECHO) "To proceed anyway, set DEPENDENCIES_CHECK=off"; \
293                         failed=1; \
294                 fi; \
295         }; \
296         $(ECHO) checking that the build tools exist; \
297         checkbinary "bash (or another shell)" "$(SH)"; \
298         checkbinary coreutils "$(ECHO)"; \
299         checkbinary coreutils "$(ECHO_NOLF)"; \
300         checkbinary coreutils "$(CAT)"; \
301         checkbinary coreutils "$(MKDIR)"; \
302         checkbinary coreutils "$(CP)"; \
303         checkbinary coreutils "$(CP_R)"; \
304         checkbinary coreutils "$(RM)"; \
305         checkbinary coreutils "$(RM_R)"; \
306         checkbinary coreutils "$(MV)"; \
307         checkbinary coreutils "$(ECHO) test $(TEE_STDERR)"; \
308         checkbinary sed "$(SED)"; \
309         checkbinary findutils "$(FIND)"; \
310         checkbinary diff "$(DIFF)"; \
311         checkbinary gcc "$(CC)"; \
312         checkbinary g++ "$(CXX)"; \
313         checkbinary binutils "$(RANLIB)"; \
314         checkbinary binutils "$(AR)"; \
315         checkbinary pkg-config "$(PKGCONFIG)"; \
316         checkbinary unzip "$(UNZIPPER)"; \
317         checkbinary git-core "$(GIT)"; \
318         checkbinary subversion "$(SVN)"; \
319         checkbinary wget "$(WGET)"; \
320         [ "$(OS)" = "Win32" ] && checkbinary mingw32 "$(WINDRES)"; \
321         [ -n "$(LDD)" ] && checkbinary libc6 "$(LDD)"; \
322         [ -n "$(OTOOL)" ] && checkbinary xcode "$(OTOOL)"; \
323         [ "$$failed" = "0" ] && $(ECHO) All required tools have been found!
324         @$(ECHO)
325         @if [ x"$(DEPENDENCIES_CHECK)" = x"verbose" ]; then set -x; exec 3>&2; else exec 3$(FD_TO_DEVNULL); fi; \
326         failed=0; \
327         checkheader() \
328         { \
329                 $(ECHO_NOLF) "Checking for $$2 ($$1)... "; \
330                 if \
331                         $(CXX) conftest.cpp $(CFLAGS) $(CXXFLAGS) $(CFLAGS_COMMON) $(CXXFLAGS_COMMON) $(CPPFLAGS) $(CPPFLAGS_COMMON) $$4 -DCONFTEST_HEADER="<$$2>" -DCONFTEST_SYMBOL="$$3" $(TARGET_ARCH) $(LDFLAGS) -c -o conftest.o >&3 $(STDERR_TO_STDOUT); \
332                 then \
333                         if \
334                                 $(CXX) conftest.o $(LDFLAGS) $(LDFLAGS_COMMON) $$5 $(LIBS_COMMON) $(LIBS) -o conftest >&3 $(STDERR_TO_STDOUT); \
335                         then \
336                                 $(RM) conftest conftest.o conftest.d; \
337                                 $(ECHO) "found and links."; \
338                         else \
339                                 $(RM) conftest.o conftest.d; \
340                                 $(ECHO) "found but does not link, please install it or set PKG_CONFIG_PATH right!"; \
341                                 $(ECHO) "To see the failed commands, set DEPENDENCIES_CHECK=verbose"; \
342                                 $(ECHO) "To proceed anyway, set DEPENDENCIES_CHECK=off"; \
343                                 failed=1; \
344                         fi; \
345                 else \
346                         $(RM) conftest conftest.o conftest.d; \
347                         $(ECHO) "not found, please install it or set PKG_CONFIG_PATH right!"; \
348                         $(ECHO) "To see the failed commands, set DEPENDENCIES_CHECK=verbose"; \
349                         $(ECHO) "To proceed anyway, set DEPENDENCIES_CHECK=off"; \
350                         failed=1; \
351                 fi; \
352         }; \
353         $(ECHO) checking that the dependencies exist; \
354         checkheader libjpeg8-dev jpeglib.h jpeg_set_defaults "$(CPPFLAGS_JPEG)" "$(LIBS_JPEG)"; \
355         checkheader libglib2.0-dev glib.h g_path_is_absolute "$(CPPFLAGS_GLIB)" "$(LIBS_GLIB)"; \
356         checkheader libxml2-dev libxml/xpath.h xmlXPathInit "$(CPPFLAGS_XML)" "$(LIBS_XML)"; \
357         checkheader libpng12-dev png.h png_create_read_struct "$(CPPFLAGS_PNG)" "$(LIBS_PNG)"; \
358         checkheader libwebp-dev webp/decode.h WebPGetInfo "$(CPPFLAGS_WEBP)" "$(LIBS_WEBP)"; \
359         checkheader "mesa-common-dev (or another OpenGL library)" GL/gl.h glClear "$(CPPFLAGS_GL)" "$(LIBS_GL)"; \
360         checkheader libgtk2.0-dev gtk/gtkdialog.h gtk_dialog_run "$(CPPFLAGS_GTK)" "$(LIBS_GTK)"; \
361         checkheader libpango1.0-dev pango/pangoft2.h pango_ft2_font_map_new "$(CPPFLAGS_PANGOFT2)" "$(LIBS_PANGOFT2)"; \
362         checkheader libgtkglext1-dev gtk/gtkglwidget.h gtk_widget_get_gl_context "$(CPPFLAGS_GTKGLEXT)" "$(LIBS_GTKGLEXT)"; \
363         [ "$(OS)" != "Win32" ] && checkheader libc6-dev dlfcn.h dlopen "$(CPPFLAGS_DL)" "$(LIBS_DL)"; \
364         checkheader zlib1g-dev zlib.h zlibVersion "$(CPPFLAGS_ZLIB)" "$(LIBS_ZLIB)"; \
365         [ "$$failed" = "0" ] && $(ECHO) All required libraries have been found!
366         @$(ECHO)
367 endif
368
369 .PHONY: binaries
370 binaries: \
371         binaries-tools \
372         binaries-radiant \
373
374 .PHONY: binaries-radiant-all
375 binaries-radiant: \
376         binaries-radiant-modules \
377         binaries-radiant-plugins \
378         binaries-radiant-core \
379
380 .PHONY: binaries-radiant-modules
381 binaries-radiant-modules: \
382         $(INSTALLDIR)/modules/archivepak.$(DLL) \
383         $(INSTALLDIR)/modules/archivewad.$(DLL) \
384         $(INSTALLDIR)/modules/archivezip.$(DLL) \
385         $(INSTALLDIR)/modules/entity.$(DLL) \
386         $(INSTALLDIR)/modules/image.$(DLL) \
387         $(INSTALLDIR)/modules/imagehl.$(DLL) \
388         $(INSTALLDIR)/modules/imagepng.$(DLL) \
389         $(INSTALLDIR)/modules/imagewebp.$(DLL) \
390         $(INSTALLDIR)/modules/imageq2.$(DLL) \
391         $(INSTALLDIR)/modules/mapq3.$(DLL) \
392         $(INSTALLDIR)/modules/mapxml.$(DLL) \
393         $(INSTALLDIR)/modules/md3model.$(DLL) \
394         $(INSTALLDIR)/modules/model.$(DLL) \
395         $(INSTALLDIR)/modules/shaders.$(DLL) \
396         $(INSTALLDIR)/modules/vfspk3.$(DLL) \
397
398 .PHONY: binaries-radiant-plugins
399 binaries-radiant-plugins: \
400         $(INSTALLDIR)/plugins/bobtoolz.$(DLL) \
401         $(INSTALLDIR)/plugins/brushexport.$(DLL) \
402         $(INSTALLDIR)/plugins/prtview.$(DLL) \
403         $(INSTALLDIR)/plugins/shaderplug.$(DLL) \
404         $(INSTALLDIR)/plugins/sunplug.$(DLL) \
405         $(INSTALLDIR)/plugins/ufoaiplug.$(DLL) \
406
407 .PHONY: binaries-radiant
408 binaries-radiant-core: \
409         $(INSTALLDIR)/radiant.$(EXE) \
410         $(INSTALLDIR)/radiant \
411
412 .PHONY: binaries-tools
413 binaries-tools: \
414         binaries-tools-quake2 \
415         binaries-tools-quake3 \
416
417 .PHONY: binaries-tools-quake2
418 binaries-tools-quake2: \
419         binaries-q2map \
420         binaries-qdata3 \
421         binaries-h2data \
422
423 .PHONY: binaries-q2map
424 binaries-q2map: \
425         $(INSTALLDIR)/q2map.$(EXE) \
426         $(INSTALLDIR)/q2map \
427
428 .PHONY: binaries-qdata3
429 binaries-qdata3: \
430         $(INSTALLDIR)/qdata3.$(EXE) \
431         $(INSTALLDIR)/qdata3 \
432
433 .PHONY: binaries-h2data
434 binaries-h2data: \
435         $(INSTALLDIR)/heretic2/h2data.$(EXE) \
436         $(INSTALLDIR)/heretic2/h2data \
437
438 .PHONY: binaries-tools-quake3
439 binaries-tools-quake3: \
440         binaries-q3data \
441         binaries-q3map2 \
442
443 .PHONY: binaries-q3data
444 binaries-q3data: \
445         $(INSTALLDIR)/q3data.$(EXE) \
446         $(INSTALLDIR)/q3data \
447
448 .PHONY: binaries-q3map2
449 binaries-q3map2: \
450         $(INSTALLDIR)/q3map2.$(EXE) \
451         $(INSTALLDIR)/q3map2 \
452
453
454 .PHONY: clean
455 clean:
456         $(RM_R) $(INSTALLDIR_BASE)/
457         $(RM_R) $(DOWNLOADDIR)/
458         $(FIND) . \( -name \*.o -o -name \*.d -o -name \*.$(DLL) -o -name \*.$(A) -o -name \*.$(EXE) \) -exec $(RM) {} \;
459         $(RM) icons/*.rc
460
461 %.$(EXE):
462         file=$@; $(MKDIR) $${file%/*}
463         $(CXX) $^ $(LDFLAGS) $(LDFLAGS_COMMON) $(LDFLAGS_EXTRA) $(LIBS_EXTRA) $(LIBS_COMMON) $(LIBS) -o $@
464         [ -z "$(LDD)" ] || [ -z "`$(LDD) -r $@ $(STDERR_TO_STDOUT) $(STDOUT_TO_DEVNULL) $(TEE_STDERR)`" ] || { $(RM) $@; exit 1; }
465
466 $(INSTALLDIR)/%: $(INSTALLDIR)/%.$(EXE)
467         if $(MAKE_EXE_SYMLINK); then o=$<; $(LN_SNF) $${o##*/} $@; else true; fi
468
469 %.$(A):
470         $(AR) rc $@ $^
471         $(RANLIB) $@
472
473 %.$(DLL):
474         file=$@; $(MKDIR) $${file%/*}
475         $(CXX) $^ $(LDFLAGS) $(LDFLAGS_COMMON) $(LDFLAGS_EXTRA) $(LDFLAGS_DLL) $(LIBS_EXTRA) $(LIBS_COMMON) $(LIBS) -shared -o $@
476         [ -z "$(LDD)" ] || [ -z "`$(LDD) -r $@ $(STDERR_TO_STDOUT) $(STDOUT_TO_DEVNULL) $(TEE_STDERR)`" ] || { $(RM) $@; exit 1; }
477
478 %.rc: %.ico
479         $(ECHO) '1 ICON "$<"' > $@
480
481 ifeq ($(OS),Win32)
482 %.o: %.rc
483         $(WINDRES) $< $@
484 endif
485
486 %.o: %.cpp $(if $(findstring $(DEPEND_ON_MAKEFILE),yes),$(wildcard Makefile*),) | dependencies-check
487         $(CXX) $< $(CFLAGS) $(CXXFLAGS) $(CFLAGS_COMMON) $(CXXFLAGS_COMMON) $(CPPFLAGS_EXTRA) $(CPPFLAGS_COMMON) $(CPPFLAGS) $(TARGET_ARCH) -c -o $@
488
489 %.o: %.c $(if $(findstring $(DEPEND_ON_MAKEFILE),yes),$(wildcard Makefile*),) | dependencies-check
490         $(CC) $< $(CFLAGS) $(CFLAGS_COMMON) $(CPPFLAGS_EXTRA) $(CPPFLAGS_COMMON) $(CPPFLAGS) $(TARGET_ARCH) -c -o $@
491
492
493 $(INSTALLDIR)/q3map2.$(EXE): LIBS_EXTRA := $(LIBS_XML) $(LIBS_GLIB) $(LIBS_PNG) $(LIBS_JPEG) $(LIBS_WEBP) $(LIBS_ZLIB)
494 $(INSTALLDIR)/q3map2.$(EXE): CPPFLAGS_EXTRA := $(CPPFLAGS_XML) $(CPPFLAGS_GLIB) $(CPPFLAGS_PNG) $(CPPFLAGS_JPEG) $(CPPFLAGS_WEBP) -Itools/quake3/common -Ilibs -Iinclude
495 $(INSTALLDIR)/q3map2.$(EXE): \
496         tools/quake3/common/cmdlib.o \
497         tools/quake3/common/imagelib.o \
498         tools/quake3/common/inout.o \
499         tools/quake3/common/jpeg.o \
500         tools/quake3/common/md4.o \
501         tools/quake3/common/mutex.o \
502         tools/quake3/common/polylib.o \
503         tools/quake3/common/scriplib.o \
504         tools/quake3/common/threads.o \
505         tools/quake3/common/vfs.o \
506         tools/quake3/q3map2/brush.o \
507         tools/quake3/q3map2/brush_primit.o \
508         tools/quake3/q3map2/bspfile_abstract.o \
509         tools/quake3/q3map2/bspfile_ibsp.o \
510         tools/quake3/q3map2/bspfile_rbsp.o \
511         tools/quake3/q3map2/bsp.o \
512         tools/quake3/q3map2/bsp_analyze.o \
513         tools/quake3/q3map2/bsp_scale.o \
514         tools/quake3/q3map2/bsp_info.o \
515         tools/quake3/q3map2/convert_ase.o \
516         tools/quake3/q3map2/convert_bsp.o \
517         tools/quake3/q3map2/convert_obj.o \
518         tools/quake3/q3map2/convert_map.o \
519         tools/quake3/q3map2/decals.o \
520         tools/quake3/q3map2/exportents.o \
521         tools/quake3/q3map2/facebsp.o \
522         tools/quake3/q3map2/fixaas.o \
523         tools/quake3/q3map2/fog.o \
524         tools/quake3/q3map2/help.o \
525         tools/quake3/q3map2/image.o \
526         tools/quake3/q3map2/leakfile.o \
527         tools/quake3/q3map2/light_bounce.o \
528         tools/quake3/q3map2/lightmaps_ydnar.o \
529         tools/quake3/q3map2/light.o \
530         tools/quake3/q3map2/light_trace.o \
531         tools/quake3/q3map2/light_ydnar.o \
532         tools/quake3/q3map2/main.o \
533         tools/quake3/q3map2/map.o \
534         tools/quake3/q3map2/minimap.o \
535         tools/quake3/q3map2/mesh.o \
536         tools/quake3/q3map2/model.o \
537         tools/quake3/q3map2/patch.o \
538         tools/quake3/q3map2/path_init.o \
539         tools/quake3/q3map2/portals.o \
540         tools/quake3/q3map2/prtfile.o \
541         tools/quake3/q3map2/shaders.o \
542         tools/quake3/q3map2/surface_extra.o \
543         tools/quake3/q3map2/surface_foliage.o \
544         tools/quake3/q3map2/surface_fur.o \
545         tools/quake3/q3map2/surface_meta.o \
546         tools/quake3/q3map2/surface.o \
547         tools/quake3/q3map2/tjunction.o \
548         tools/quake3/q3map2/tree.o \
549         tools/quake3/q3map2/visflow.o \
550         tools/quake3/q3map2/vis.o \
551         tools/quake3/q3map2/writebsp.o \
552         libddslib.$(A) \
553         libetclib.$(A) \
554         libfilematch.$(A) \
555         libl_net.$(A) \
556         libmathlib.$(A) \
557         libpicomodel.$(A) \
558         $(if $(findstring $(OS),Win32),icons/q3map2.o,) \
559
560 libmathlib.$(A): CPPFLAGS_EXTRA := -Ilibs
561 libmathlib.$(A): \
562         libs/mathlib/bbox.o \
563         libs/mathlib/line.o \
564         libs/mathlib/m4x4.o \
565         libs/mathlib/mathlib.o \
566         libs/mathlib/ray.o \
567
568 libl_net.$(A): CPPFLAGS_EXTRA := -Ilibs
569 libl_net.$(A): \
570         libs/l_net/l_net.o \
571         $(if $(findstring $(OS),Win32),libs/l_net/l_net_wins.o,libs/l_net/l_net_berkley.o) \
572
573 libpicomodel.$(A): CPPFLAGS_EXTRA := -Ilibs
574 libpicomodel.$(A): \
575         libs/picomodel/lwo/clip.o \
576         libs/picomodel/lwo/envelope.o \
577         libs/picomodel/lwo/list.o \
578         libs/picomodel/lwo/lwio.o \
579         libs/picomodel/lwo/lwo2.o \
580         libs/picomodel/lwo/lwob.o \
581         libs/picomodel/lwo/pntspols.o \
582         libs/picomodel/lwo/surface.o \
583         libs/picomodel/lwo/vecmath.o \
584         libs/picomodel/lwo/vmap.o \
585         libs/picomodel/picointernal.o \
586         libs/picomodel/picomodel.o \
587         libs/picomodel/picomodules.o \
588         libs/picomodel/pm_3ds.o \
589         libs/picomodel/pm_ase.o \
590         libs/picomodel/pm_fm.o \
591         libs/picomodel/pm_lwo.o \
592         libs/picomodel/pm_md2.o \
593         libs/picomodel/pm_md3.o \
594         libs/picomodel/pm_mdc.o \
595         libs/picomodel/pm_ms3d.o \
596         libs/picomodel/pm_obj.o \
597         libs/picomodel/pm_terrain.o \
598
599 libddslib.$(A): CPPFLAGS_EXTRA := -Ilibs
600 libddslib.$(A): \
601         libs/ddslib/ddslib.o \
602
603 libetclib.$(A): CPPFLAGS_EXTRA := -Ilibs
604 libetclib.$(A): \
605         libs/etclib.o \
606
607 $(INSTALLDIR)/q3data.$(EXE): LIBS_EXTRA := $(LIBS_XML) $(LIBS_GLIB) $(LIBS_ZLIB)
608 $(INSTALLDIR)/q3data.$(EXE): CPPFLAGS_EXTRA := $(CPPFLAGS_XML) $(CPPFLAGS_GLIB) $(CPPFLAGS_ZLIB) -Itools/quake3/common -Ilibs -Iinclude
609 $(INSTALLDIR)/q3data.$(EXE): \
610         tools/quake3/common/aselib.o \
611         tools/quake3/common/bspfile.o \
612         tools/quake3/common/cmdlib.o \
613         tools/quake3/common/imagelib.o \
614         tools/quake3/common/inout.o \
615         tools/quake3/common/md4.o \
616         tools/quake3/common/scriplib.o \
617         tools/quake3/common/trilib.o \
618         tools/quake3/common/vfs.o \
619         tools/quake3/q3data/3dslib.o \
620         tools/quake3/q3data/compress.o \
621         tools/quake3/q3data/images.o \
622         tools/quake3/q3data/md3lib.o \
623         tools/quake3/q3data/models.o \
624         tools/quake3/q3data/p3dlib.o \
625         tools/quake3/q3data/polyset.o \
626         tools/quake3/q3data/q3data.o \
627         tools/quake3/q3data/stripper.o \
628         tools/quake3/q3data/video.o \
629         libfilematch.$(A) \
630         libetclib.$(A) \
631         libl_net.$(A) \
632         libmathlib.$(A) \
633         $(if $(findstring $(OS),Win32),icons/q3data.o,) \
634
635 $(INSTALLDIR)/radiant.$(EXE): LDFLAGS_EXTRA := $(MWINDOWS)
636 $(INSTALLDIR)/radiant.$(EXE): LIBS_EXTRA := $(LIBS_GL) $(LIBS_DL) $(LIBS_XML) $(LIBS_GLIB) $(LIBS_GTK) $(LIBS_GTKGLEXT) $(LIBS_ZLIB) $(LIBS_PANGOFT2)
637 $(INSTALLDIR)/radiant.$(EXE): CPPFLAGS_EXTRA := $(CPPFLAGS_GL) $(CPPFLAGS_DL) $(CPPFLAGS_XML) $(CPPFLAGS_GLIB) $(CPPFLAGS_GTK) $(CPPFLAGS_GTKGLEXT) $(CPPFLAGS_PANGOFT2) -Ilibs -Iinclude
638 $(INSTALLDIR)/radiant.$(EXE): \
639         radiant/autosave.o \
640         radiant/brushmanip.o \
641         radiant/brushmodule.o \
642         radiant/brushnode.o \
643         radiant/brush.o \
644         radiant/brush_primit.o \
645         radiant/brushtokens.o \
646         radiant/brushxml.o \
647         radiant/build.o \
648         radiant/camwindow.o \
649         radiant/clippertool.o \
650         radiant/commands.o \
651         radiant/console.o \
652         radiant/csg.o \
653         radiant/dialog.o \
654         radiant/eclass_def.o \
655         radiant/eclass_doom3.o \
656         radiant/eclass_fgd.o \
657         radiant/eclass.o \
658         radiant/eclass_xml.o \
659         radiant/entityinspector.o \
660         radiant/entitylist.o \
661         radiant/entity.o \
662         radiant/environment.o \
663         radiant/error.o \
664         radiant/feedback.o \
665         radiant/filetypes.o \
666         radiant/filters.o \
667         radiant/findtexturedialog.o \
668         radiant/glwidget.o \
669         radiant/grid.o \
670         radiant/groupdialog.o \
671         radiant/gtkdlgs.o \
672         radiant/gtkmisc.o \
673         radiant/help.o \
674         radiant/image.o \
675         radiant/mainframe.o \
676         radiant/main.o \
677         radiant/map.o \
678         $(if $(findstring $(OS),Win32),radiant/multimon.o,) \
679         radiant/mru.o \
680         radiant/nullmodel.o \
681         radiant/parse.o \
682         radiant/patchdialog.o \
683         radiant/patchmanip.o \
684         radiant/patchmodule.o \
685         radiant/patch.o \
686         radiant/pluginapi.o \
687         radiant/pluginmanager.o \
688         radiant/pluginmenu.o \
689         radiant/plugin.o \
690         radiant/plugintoolbar.o \
691         radiant/points.o \
692         radiant/preferencedictionary.o \
693         radiant/preferences.o \
694         radiant/qe3.o \
695         radiant/qgl.o \
696         radiant/referencecache.o \
697         radiant/renderer.o \
698         radiant/renderstate.o \
699         radiant/scenegraph.o \
700         radiant/selection.o \
701         radiant/select.o \
702         radiant/server.o \
703         radiant/shaders.o \
704         radiant/sockets.o \
705         radiant/stacktrace.o \
706         radiant/surfacedialog.o \
707         radiant/texmanip.o \
708         radiant/textureentry.o \
709         radiant/textures.o \
710         radiant/texwindow.o \
711         radiant/timer.o \
712         radiant/treemodel.o \
713         radiant/undo.o \
714         radiant/url.o \
715         radiant/view.o \
716         radiant/watchbsp.o \
717         radiant/winding.o \
718         radiant/windowobservers.o \
719         radiant/xmlstuff.o \
720         radiant/xywindow.o \
721         libcmdlib.$(A) \
722         libgtkutil.$(A) \
723         libuilib.$(A) \
724         libl_net.$(A) \
725         libmathlib.$(A) \
726         libprofile.$(A) \
727         libxmllib.$(A) \
728         $(if $(findstring $(OS),Win32),icons/radiant.o,) \
729
730 libfilematch.$(A): CPPFLAGS_EXTRA := -Ilibs
731 libfilematch.$(A): \
732         libs/filematch.o \
733
734 libcmdlib.$(A): CPPFLAGS_EXTRA := -Ilibs
735 libcmdlib.$(A): \
736         libs/cmdlib/cmdlib.o \
737
738 libprofile.$(A): CPPFLAGS_EXTRA := -Ilibs -Iinclude
739 libprofile.$(A): \
740         libs/profile/file.o \
741         libs/profile/profile.o \
742
743 libgtkutil.$(A): CPPFLAGS_EXTRA := $(CPPFLAGS_GLIB) $(CPPFLAGS_GTK) $(CPPFLAGS_GTKGLEXT) $(CPPFLAGS_PANGOFT2) -Ilibs -Iinclude
744 libgtkutil.$(A): \
745         libs/gtkutil/accelerator.o \
746         libs/gtkutil/button.o \
747         libs/gtkutil/clipboard.o \
748         libs/gtkutil/cursor.o \
749         libs/gtkutil/dialog.o \
750         libs/gtkutil/entry.o \
751         libs/gtkutil/filechooser.o \
752         libs/gtkutil/frame.o \
753         libs/gtkutil/glfont.o \
754         libs/gtkutil/glwidget.o \
755         libs/gtkutil/image.o \
756         libs/gtkutil/menu.o \
757         libs/gtkutil/messagebox.o \
758         libs/gtkutil/nonmodal.o \
759         libs/gtkutil/paned.o \
760         libs/gtkutil/toolbar.o \
761         libs/gtkutil/widget.o \
762         libs/gtkutil/window.o \
763         libs/gtkutil/xorrectangle.o \
764
765 libuilib.$(A): CPPFLAGS_EXTRA := $(CPPFLAGS_GLIB) $(CPPFLAGS_GTK) $(CPPFLAGS_GTKGLEXT) -Ilibs -Iinclude
766 libuilib.$(A): \
767         libs/uilib/uilib.o \
768
769 libxmllib.$(A): CPPFLAGS_EXTRA := $(CPPFLAGS_XML) $(CPPFLAGS_GLIB) -Ilibs -Iinclude
770 libxmllib.$(A): \
771         libs/xml/xmltextags.o \
772
773 $(INSTALLDIR)/modules/archivezip.$(DLL): LIBS_EXTRA := $(LIBS_ZLIB)
774 $(INSTALLDIR)/modules/archivezip.$(DLL): CPPFLAGS_EXTRA := $(CPPFLAGS_ZLIB) -Ilibs -Iinclude
775 $(INSTALLDIR)/modules/archivezip.$(DLL): \
776         plugins/archivezip/archive.o \
777         plugins/archivezip/plugin.o \
778
779 $(INSTALLDIR)/modules/archivewad.$(DLL): CPPFLAGS_EXTRA := -Ilibs -Iinclude
780 $(INSTALLDIR)/modules/archivewad.$(DLL): \
781         plugins/archivewad/archive.o \
782         plugins/archivewad/plugin.o \
783
784 $(INSTALLDIR)/modules/archivepak.$(DLL): CPPFLAGS_EXTRA := -Ilibs -Iinclude
785 $(INSTALLDIR)/modules/archivepak.$(DLL): \
786         plugins/archivepak/archive.o \
787         plugins/archivepak/plugin.o \
788
789 $(INSTALLDIR)/modules/entity.$(DLL): CPPFLAGS_EXTRA := $(CPPFLAGS_GLIB) -Ilibs -Iinclude
790 $(INSTALLDIR)/modules/entity.$(DLL): \
791         plugins/entity/doom3group.o \
792         plugins/entity/eclassmodel.o \
793         plugins/entity/entity.o \
794         plugins/entity/filters.o \
795         plugins/entity/generic.o \
796         plugins/entity/group.o \
797         plugins/entity/light.o \
798         plugins/entity/miscmodel.o \
799         plugins/entity/plugin.o \
800         plugins/entity/skincache.o \
801         plugins/entity/targetable.o \
802
803 $(INSTALLDIR)/modules/image.$(DLL): LIBS_EXTRA := $(LIBS_JPEG)
804 $(INSTALLDIR)/modules/image.$(DLL): CPPFLAGS_EXTRA := $(CPPFLAGS_JPEG) -Ilibs -Iinclude
805 $(INSTALLDIR)/modules/image.$(DLL): \
806         plugins/image/bmp.o \
807         plugins/image/dds.o \
808         plugins/image/image.o \
809         plugins/image/jpeg.o \
810         plugins/image/ktx.o \
811         plugins/image/pcx.o \
812         plugins/image/tga.o \
813         libddslib.$(A) \
814         libetclib.$(A) \
815
816 $(INSTALLDIR)/modules/imageq2.$(DLL): CPPFLAGS_EXTRA := -Ilibs -Iinclude
817 $(INSTALLDIR)/modules/imageq2.$(DLL): \
818         plugins/imageq2/imageq2.o \
819         plugins/imageq2/wal32.o \
820         plugins/imageq2/wal.o \
821
822 $(INSTALLDIR)/modules/imagehl.$(DLL): CPPFLAGS_EXTRA := -Ilibs -Iinclude
823 $(INSTALLDIR)/modules/imagehl.$(DLL): \
824         plugins/imagehl/hlw.o \
825         plugins/imagehl/imagehl.o \
826         plugins/imagehl/mip.o \
827         plugins/imagehl/sprite.o \
828
829 $(INSTALLDIR)/modules/imagepng.$(DLL): LIBS_EXTRA := $(LIBS_PNG)
830 $(INSTALLDIR)/modules/imagepng.$(DLL): CPPFLAGS_EXTRA := $(CPPFLAGS_PNG) -Ilibs -Iinclude
831 $(INSTALLDIR)/modules/imagepng.$(DLL): \
832         plugins/imagepng/plugin.o \
833
834 $(INSTALLDIR)/modules/imagewebp.$(DLL): LIBS_EXTRA := $(LIBS_WEBP)
835 $(INSTALLDIR)/modules/imagewebp.$(DLL): CPPFLAGS_EXTRA := $(CPPFLAGS_WEBP) -Ilibs -Iinclude
836 $(INSTALLDIR)/modules/imagewebp.$(DLL): \
837         plugins/imagewebp/plugin.o \
838
839 $(INSTALLDIR)/modules/mapq3.$(DLL): CPPFLAGS_EXTRA := $(CPPFLAGS_GLIB) -Ilibs -Iinclude
840 $(INSTALLDIR)/modules/mapq3.$(DLL): \
841         plugins/mapq3/parse.o \
842         plugins/mapq3/plugin.o \
843         plugins/mapq3/write.o \
844
845 $(INSTALLDIR)/modules/mapxml.$(DLL): LIBS_EXTRA := $(LIBS_XML) $(LIBS_GLIB)
846 $(INSTALLDIR)/modules/mapxml.$(DLL): CPPFLAGS_EXTRA := $(CPPFLAGS_XML) $(CPPFLAGS_GLIB) -Ilibs -Iinclude
847 $(INSTALLDIR)/modules/mapxml.$(DLL): \
848         plugins/mapxml/plugin.o \
849         plugins/mapxml/xmlparse.o \
850         plugins/mapxml/xmlwrite.o \
851
852 $(INSTALLDIR)/modules/md3model.$(DLL): CPPFLAGS_EXTRA := -Ilibs -Iinclude
853 $(INSTALLDIR)/modules/md3model.$(DLL): \
854         plugins/md3model/md2.o \
855         plugins/md3model/md3.o \
856         plugins/md3model/md5.o \
857         plugins/md3model/mdc.o \
858         plugins/md3model/mdlimage.o \
859         plugins/md3model/mdl.o \
860         plugins/md3model/plugin.o \
861
862 $(INSTALLDIR)/modules/model.$(DLL): CPPFLAGS_EXTRA := -Ilibs -Iinclude
863 $(INSTALLDIR)/modules/model.$(DLL): \
864         plugins/model/model.o \
865         plugins/model/plugin.o \
866         libpicomodel.$(A) \
867
868 $(INSTALLDIR)/modules/shaders.$(DLL): LIBS_EXTRA := $(LIBS_GLIB)
869 $(INSTALLDIR)/modules/shaders.$(DLL): CPPFLAGS_EXTRA := $(CPPFLAGS_GLIB) -Ilibs -Iinclude
870 $(INSTALLDIR)/modules/shaders.$(DLL): \
871         plugins/shaders/plugin.o \
872         plugins/shaders/shaders.o \
873
874 $(INSTALLDIR)/modules/vfspk3.$(DLL): LIBS_EXTRA := $(LIBS_GLIB)
875 $(INSTALLDIR)/modules/vfspk3.$(DLL): CPPFLAGS_EXTRA := $(CPPFLAGS_GLIB) -Ilibs -Iinclude
876 $(INSTALLDIR)/modules/vfspk3.$(DLL): \
877         plugins/vfspk3/archive.o \
878         plugins/vfspk3/vfs.o \
879         plugins/vfspk3/vfspk3.o \
880         libfilematch.$(A) \
881
882 $(INSTALLDIR)/plugins/bobtoolz.$(DLL): LIBS_EXTRA := $(LIBS_GLIB) $(LIBS_GTK)
883 $(INSTALLDIR)/plugins/bobtoolz.$(DLL): CPPFLAGS_EXTRA := $(CPPFLAGS_GLIB) $(CPPFLAGS_GTK) -Ilibs -Iinclude
884 $(INSTALLDIR)/plugins/bobtoolz.$(DLL): \
885         contrib/bobtoolz/bobToolz-GTK.o \
886         contrib/bobtoolz/bsploader.o \
887         contrib/bobtoolz/cportals.o \
888         contrib/bobtoolz/DBobView.o \
889         contrib/bobtoolz/DBrush.o \
890         contrib/bobtoolz/DEntity.o \
891         contrib/bobtoolz/DEPair.o \
892         contrib/bobtoolz/dialogs/dialogs-gtk.o \
893         contrib/bobtoolz/DMap.o \
894         contrib/bobtoolz/DPatch.o \
895         contrib/bobtoolz/DPlane.o \
896         contrib/bobtoolz/DPoint.o \
897         contrib/bobtoolz/DShape.o \
898         contrib/bobtoolz/DTrainDrawer.o \
899         contrib/bobtoolz/DTreePlanter.o \
900         contrib/bobtoolz/DVisDrawer.o \
901         contrib/bobtoolz/DWinding.o \
902         contrib/bobtoolz/funchandlers-GTK.o \
903         contrib/bobtoolz/lists.o \
904         contrib/bobtoolz/misc.o \
905         contrib/bobtoolz/ScriptParser.o \
906         contrib/bobtoolz/shapes.o \
907         contrib/bobtoolz/visfind.o \
908         libcmdlib.$(A) \
909         libmathlib.$(A) \
910         libprofile.$(A) \
911
912 $(INSTALLDIR)/plugins/brushexport.$(DLL): LIBS_EXTRA := $(LIBS_GLIB) $(LIBS_GTK)
913 $(INSTALLDIR)/plugins/brushexport.$(DLL): CPPFLAGS_EXTRA := $(CPPFLAGS_GLIB) $(CPPFLAGS_GTK) -Ilibs -Iinclude
914 $(INSTALLDIR)/plugins/brushexport.$(DLL): \
915         contrib/brushexport/callbacks.o \
916         contrib/brushexport/export.o \
917         contrib/brushexport/interface.o \
918         contrib/brushexport/plugin.o \
919         contrib/brushexport/support.o \
920
921 $(INSTALLDIR)/plugins/prtview.$(DLL): LIBS_EXTRA := $(LIBS_GLIB) $(LIBS_GTK)
922 $(INSTALLDIR)/plugins/prtview.$(DLL): CPPFLAGS_EXTRA := $(CPPFLAGS_GLIB) $(CPPFLAGS_GTK) -Ilibs -Iinclude
923 $(INSTALLDIR)/plugins/prtview.$(DLL): \
924         contrib/prtview/AboutDialog.o \
925         contrib/prtview/ConfigDialog.o \
926         contrib/prtview/LoadPortalFileDialog.o \
927         contrib/prtview/portals.o \
928         contrib/prtview/prtview.o \
929         libprofile.$(A) \
930
931 $(INSTALLDIR)/plugins/shaderplug.$(DLL): LIBS_EXTRA := $(LIBS_GLIB) $(LIBS_GTK) $(LIBS_XML)
932 $(INSTALLDIR)/plugins/shaderplug.$(DLL): CPPFLAGS_EXTRA := $(CPPFLAGS_GLIB) $(CPPFLAGS_GTK) $(CPPFLAGS_XML) -Ilibs -Iinclude
933 $(INSTALLDIR)/plugins/shaderplug.$(DLL): \
934         contrib/shaderplug/shaderplug.o \
935         libxmllib.$(A) \
936
937 $(INSTALLDIR)/plugins/sunplug.$(DLL): LIBS_EXTRA := $(LIBS_GLIB) $(LIBS_GTK)
938 $(INSTALLDIR)/plugins/sunplug.$(DLL): CPPFLAGS_EXTRA := $(CPPFLAGS_GLIB) $(CPPFLAGS_GTK) -Ilibs -Iinclude
939 $(INSTALLDIR)/plugins/sunplug.$(DLL): \
940         contrib/sunplug/sunplug.o \
941
942 $(INSTALLDIR)/qdata3.$(EXE): LIBS_EXTRA := $(LIBS_XML)
943 $(INSTALLDIR)/qdata3.$(EXE): CPPFLAGS_EXTRA := $(CPPFLAGS_XML) -Itools/quake2/common -Ilibs -Iinclude
944 $(INSTALLDIR)/qdata3.$(EXE): \
945         tools/quake2/common/bspfile.o \
946         tools/quake2/common/cmdlib.o \
947         tools/quake2/common/inout.o \
948         tools/quake2/common/l3dslib.o \
949         tools/quake2/common/lbmlib.o \
950         tools/quake2/common/mathlib.o \
951         tools/quake2/common/md4.o \
952         tools/quake2/common/path_init.o \
953         tools/quake2/common/polylib.o \
954         tools/quake2/common/scriplib.o \
955         tools/quake2/common/threads.o \
956         tools/quake2/common/trilib.o \
957         tools/quake2/qdata/images.o \
958         tools/quake2/qdata/models.o \
959         tools/quake2/qdata/qdata.o \
960         tools/quake2/qdata/sprites.o \
961         tools/quake2/qdata/tables.o \
962         tools/quake2/qdata/video.o \
963         libl_net.$(A) \
964         $(if $(findstring $(OS),Win32),icons/qdata3.o,) \
965
966 $(INSTALLDIR)/q2map.$(EXE): LIBS_EXTRA := $(LIBS_XML)
967 $(INSTALLDIR)/q2map.$(EXE): CPPFLAGS_EXTRA := $(CPPFLAGS_XML) -Itools/quake2/common -Ilibs -Iinclude
968 $(INSTALLDIR)/q2map.$(EXE): \
969         tools/quake2/common/bspfile.o \
970         tools/quake2/common/cmdlib.o \
971         tools/quake2/common/inout.o \
972         tools/quake2/common/l3dslib.o \
973         tools/quake2/common/lbmlib.o \
974         tools/quake2/common/mathlib.o \
975         tools/quake2/common/md4.o \
976         tools/quake2/common/path_init.o \
977         tools/quake2/common/polylib.o \
978         tools/quake2/common/scriplib.o \
979         tools/quake2/common/threads.o \
980         tools/quake2/common/trilib.o \
981         tools/quake2/q2map/brushbsp.o \
982         tools/quake2/q2map/csg.o \
983         tools/quake2/q2map/faces.o \
984         tools/quake2/q2map/flow.o \
985         tools/quake2/q2map/glfile.o \
986         tools/quake2/q2map/leakfile.o \
987         tools/quake2/q2map/lightmap.o \
988         tools/quake2/q2map/main.o \
989         tools/quake2/q2map/map.o \
990         tools/quake2/q2map/nodraw.o \
991         tools/quake2/q2map/patches.o \
992         tools/quake2/q2map/portals.o \
993         tools/quake2/q2map/prtfile.o \
994         tools/quake2/q2map/qbsp.o \
995         tools/quake2/q2map/qrad.o \
996         tools/quake2/q2map/qvis.o \
997         tools/quake2/q2map/textures.o \
998         tools/quake2/q2map/trace.o \
999         tools/quake2/q2map/tree.o \
1000         tools/quake2/q2map/writebsp.o \
1001         libl_net.$(A) \
1002         $(if $(findstring $(OS),Win32),icons/q2map.o,) \
1003
1004 $(INSTALLDIR)/plugins/ufoaiplug.$(DLL): LIBS_EXTRA := $(LIBS_GLIB) $(LIBS_GTK)
1005 $(INSTALLDIR)/plugins/ufoaiplug.$(DLL): CPPFLAGS_EXTRA := $(CPPFLAGS_GLIB) $(CPPFLAGS_GTK) -Ilibs -Iinclude
1006 $(INSTALLDIR)/plugins/ufoaiplug.$(DLL): \
1007         contrib/ufoaiplug/ufoai_filters.o \
1008         contrib/ufoaiplug/ufoai_gtk.o \
1009         contrib/ufoaiplug/ufoai_level.o \
1010         contrib/ufoaiplug/ufoai.o \
1011
1012 $(INSTALLDIR)/plugins/bkgrnd2d.$(DLL): LIBS_EXTRA := $(LIBS_GLIB) $(LIBS_GTK)
1013 $(INSTALLDIR)/plugins/bkgrnd2d.$(DLL): CPPFLAGS_EXTRA := $(CPPFLAGS_GLIB) $(CPPFLAGS_GTK) -Ilibs -Iinclude
1014 $(INSTALLDIR)/plugins/bkgrnd2d.$(DLL): \
1015         contrib/bkgrnd2d/bkgrnd2d.o \
1016         contrib/bkgrnd2d/dialog.o \
1017         contrib/bkgrnd2d/plugin.o \
1018
1019 $(INSTALLDIR)/heretic2/h2data.$(EXE): LIBS_EXTRA := $(LIBS_XML)
1020 $(INSTALLDIR)/heretic2/h2data.$(EXE): CPPFLAGS_EXTRA := $(CPPFLAGS_XML) -Itools/quake2/qdata_heretic2/common -Itools/quake2/qdata_heretic2/qcommon -Itools/quake2/qdata_heretic2 -Itools/quake2/common -Ilibs -Iinclude
1021 $(INSTALLDIR)/heretic2/h2data.$(EXE): \
1022         tools/quake2/qdata_heretic2/common/bspfile.o \
1023         tools/quake2/qdata_heretic2/common/cmdlib.o \
1024         tools/quake2/qdata_heretic2/common/inout.o \
1025         tools/quake2/qdata_heretic2/common/l3dslib.o \
1026         tools/quake2/qdata_heretic2/common/lbmlib.o \
1027         tools/quake2/qdata_heretic2/common/mathlib.o \
1028         tools/quake2/qdata_heretic2/common/md4.o \
1029         tools/quake2/qdata_heretic2/common/path_init.o \
1030         tools/quake2/qdata_heretic2/common/qfiles.o \
1031         tools/quake2/qdata_heretic2/common/scriplib.o \
1032         tools/quake2/qdata_heretic2/common/threads.o \
1033         tools/quake2/qdata_heretic2/common/token.o \
1034         tools/quake2/qdata_heretic2/common/trilib.o \
1035         tools/quake2/qdata_heretic2/qcommon/reference.o \
1036         tools/quake2/qdata_heretic2/qcommon/resourcemanager.o \
1037         tools/quake2/qdata_heretic2/qcommon/skeletons.o \
1038         tools/quake2/qdata_heretic2/animcomp.o \
1039         tools/quake2/qdata_heretic2/book.o \
1040         tools/quake2/qdata_heretic2/fmodels.o \
1041         tools/quake2/qdata_heretic2/images.o \
1042         tools/quake2/qdata_heretic2/jointed.o \
1043         tools/quake2/qdata_heretic2/models.o \
1044         tools/quake2/qdata_heretic2/pics.o \
1045         tools/quake2/qdata_heretic2/qdata.o \
1046         tools/quake2/qdata_heretic2/qd_skeletons.o \
1047         tools/quake2/qdata_heretic2/sprites.o \
1048         tools/quake2/qdata_heretic2/svdcmp.o \
1049         tools/quake2/qdata_heretic2/tables.o \
1050         tools/quake2/qdata_heretic2/tmix.o \
1051         tools/quake2/qdata_heretic2/video.o \
1052         libl_net.$(A) \
1053         $(if $(findstring $(OS),Win32),icons/h2data.o,) \
1054
1055 .PHONY: install-data
1056 install-data: binaries
1057         $(MKDIR) $(INSTALLDIR)/games
1058         DOWNLOAD_GAMEPACKS="$(DOWNLOAD_GAMEPACKS)" DOWNLOADDIR="$(DOWNLOADDIR)" INSTALLDIR="$(INSTALLDIR)" GIT="$(GIT)" SVN="$(SVN)" WGET="$(WGET)" RM_R="$(RM_R)" MV="$(MV)" UNZIPPER="$(UNZIPPER)" ECHO="$(ECHO)" SH="$(SH)" CP="$(CP)" CP_R="$(CP_R)" $(SH) gamepack-manager
1059         $(ECHO) $(RADIANT_MAJOR_VERSION) > $(INSTALLDIR)/RADIANT_MAJOR
1060         $(ECHO) $(RADIANT_MINOR_VERSION) > $(INSTALLDIR)/RADIANT_MINOR
1061         $(ECHO) $(RADIANT_PATCH_VERSION) > $(INSTALLDIR)/RADIANT_PATCH
1062         $(CP_R) setup/data/tools/* $(INSTALLDIR)/
1063         $(MKDIR) $(INSTALLDIR)/docs
1064         $(CP_R) docs/* $(INSTALLDIR)/docs/
1065
1066 .PHONY: install-dll
1067 ifeq ($(OS),Win32)
1068 install-dll: binaries
1069         MKDIR="$(MKDIR)" CP="$(CP)" CAT="$(CAT)" GTKDIR="$(GTKDIR)" WHICHDLL="$(WHICHDLL)" INSTALLDIR="$(INSTALLDIR)" $(SH) $(DLLINSTALL) 
1070 else
1071 install-dll: binaries
1072         @$(ECHO) No DLL inclusion implemented for this target.
1073 endif
1074
1075 # release building... NOT for general users
1076 # these may use tools not in the list that is checked by the build system
1077 release-src: BUILD_DATE := $(shell date +%Y%m%d)
1078 release-src: INSTALLDIR := netradiant-$(RADIANT_VERSION_NUMBER)-$(BUILD_DATE)
1079 release-src:
1080         $(GIT) archive --format=tar --prefix=$(INSTALLDIR)/ HEAD | bzip2 > ../$(INSTALLDIR).tar.bz2
1081
1082 release-win32: BUILD_DATE := $(shell date +%Y%m%d)
1083 release-win32: INSTALLDIR := netradiant-$(RADIANT_VERSION_NUMBER)-$(BUILD_DATE)
1084 release-win32:
1085         $(MAKE) all INSTALLDIR=$(INSTALLDIR) MAKEFILE_CONF=cross-Makefile.conf RADIANT_ABOUTMSG="Official release build" BUILD=release
1086         7za a -sfx../../../../../../../../../../$(HOME)/7z.sfx ../$(INSTALLDIR)-win32-7z.exe $(INSTALLDIR)/
1087         chmod 644 ../$(INSTALLDIR)-win32-7z.exe # 7zip is evil
1088         $(MAKE) clean INSTALLDIR=$(INSTALLDIR) MAKEFILE_CONF=cross-Makefile.conf RADIANT_ABOUTMSG="Official release build" BUILD=release
1089
1090 release-all:
1091         $(GIT) clean -xdf
1092         $(MAKE) release-src
1093         $(MAKE) release-win32
1094
1095 # load dependency files
1096 -include $(shell find . -name \*.d)