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