]> git.xonotic.org Git - xonotic/netradiant.git/blob - Makefile
Merge commit '5e3961896b9e30ebbc736b542f177054188c05bf' into master-merge
[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: debug, or: extradebug, or: profile, or: native
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 GIT_VERSION := $(shell $(GIT) rev-parse --short HEAD $(STDERR_TO_DEVNULL))
268 ifneq ($(GIT_VERSION),)
269         RADIANT_VERSION := $(RADIANT_VERSION)-git-$(GIT_VERSION)
270         Q3MAP_VERSION := $(Q3MAP_VERSION)-git-$(GIT_VERSION)
271 endif
272
273 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)\""
274 CPPFLAGS += -DGTK_TARGET=2
275
276 .PHONY: all
277 all: \
278         dependencies-check \
279         binaries \
280         install-data \
281         install-dll \
282
283 .PHONY: dependencies-check
284 ifeq ($(findstring $(DEPENDENCIES_CHECK),off),off)
285 dependencies-check:
286         @$(ECHO) dependencies checking disabled, good luck...
287 else
288 dependencies-check:
289         @$(ECHO)
290         @if [ x"$(DEPENDENCIES_CHECK)" = x"verbose" ]; then set -x; exec 3>&2; else exec 3$(FD_TO_DEVNULL); fi; \
291         failed=0; \
292         checkbinary() \
293         { \
294                 $(ECHO_NOLF) "Checking for $$2 ($$1)... "; \
295                 $$2 --help >&3 $(STDERR_TO_STDOUT); \
296                 if [ $$? != 127 ]; then \
297                         $(ECHO) "found."; \
298                 else \
299                         $(ECHO) "not found, please install it or set PATH right!"; \
300                         $(ECHO) "To see the failed commands, set DEPENDENCIES_CHECK=verbose"; \
301                         $(ECHO) "To proceed anyway, set DEPENDENCIES_CHECK=off"; \
302                         failed=1; \
303                 fi; \
304         }; \
305         $(ECHO) checking that the build tools exist; \
306         checkbinary "bash (or another shell)" "$(SH)"; \
307         checkbinary coreutils "$(ECHO)"; \
308         checkbinary coreutils "$(ECHO_NOLF)"; \
309         checkbinary coreutils "$(CAT)"; \
310         checkbinary coreutils "$(MKDIR)"; \
311         checkbinary coreutils "$(CP)"; \
312         checkbinary coreutils "$(CP_R)"; \
313         checkbinary coreutils "$(RM)"; \
314         checkbinary coreutils "$(RM_R)"; \
315         checkbinary coreutils "$(MV)"; \
316         checkbinary coreutils "$(ECHO) test $(TEE_STDERR)"; \
317         checkbinary sed "$(SED)"; \
318         checkbinary findutils "$(FIND)"; \
319         checkbinary diff "$(DIFF)"; \
320         checkbinary gcc "$(CC)"; \
321         checkbinary g++ "$(CXX)"; \
322         checkbinary binutils "$(RANLIB)"; \
323         checkbinary binutils "$(AR)"; \
324         checkbinary pkg-config "$(PKGCONFIG)"; \
325         checkbinary unzip "$(UNZIPPER)"; \
326         checkbinary git-core "$(GIT)"; \
327         checkbinary subversion "$(SVN)"; \
328         checkbinary wget "$(WGET)"; \
329         [ "$(OS)" = "Win32" ] && checkbinary mingw32 "$(WINDRES)"; \
330         [ -n "$(LDD)" ] && checkbinary libc6 "$(LDD)"; \
331         [ -n "$(OTOOL)" ] && checkbinary xcode "$(OTOOL)"; \
332         [ "$$failed" = "0" ] && $(ECHO) All required tools have been found!
333         @$(ECHO)
334         @if [ x"$(DEPENDENCIES_CHECK)" = x"verbose" ]; then set -x; exec 3>&2; else exec 3$(FD_TO_DEVNULL); fi; \
335         failed=0; \
336         checkheader() \
337         { \
338                 $(ECHO_NOLF) "Checking for $$2 ($$1)... "; \
339                 if \
340                         $(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); \
341                 then \
342                         if \
343                                 $(CXX) conftest.o $(LDFLAGS) $(LDFLAGS_COMMON) $$5 $(LIBS_COMMON) $(LIBS) -o conftest >&3 $(STDERR_TO_STDOUT); \
344                         then \
345                                 $(RM) conftest conftest.o conftest.d; \
346                                 $(ECHO) "found and links."; \
347                         else \
348                                 $(RM) conftest.o conftest.d; \
349                                 $(ECHO) "found but does not link, please install it or set PKG_CONFIG_PATH right!"; \
350                                 $(ECHO) "To see the failed commands, set DEPENDENCIES_CHECK=verbose"; \
351                                 $(ECHO) "To proceed anyway, set DEPENDENCIES_CHECK=off"; \
352                                 failed=1; \
353                         fi; \
354                 else \
355                         $(RM) conftest conftest.o conftest.d; \
356                         $(ECHO) "not found, please install it or set PKG_CONFIG_PATH right!"; \
357                         $(ECHO) "To see the failed commands, set DEPENDENCIES_CHECK=verbose"; \
358                         $(ECHO) "To proceed anyway, set DEPENDENCIES_CHECK=off"; \
359                         failed=1; \
360                 fi; \
361         }; \
362         $(ECHO) checking that the dependencies exist; \
363         checkheader libjpeg8-dev jpeglib.h jpeg_set_defaults "$(CPPFLAGS_JPEG)" "$(LIBS_JPEG)"; \
364         checkheader libglib2.0-dev glib.h g_path_is_absolute "$(CPPFLAGS_GLIB)" "$(LIBS_GLIB)"; \
365         checkheader libxml2-dev libxml/xpath.h xmlXPathInit "$(CPPFLAGS_XML)" "$(LIBS_XML)"; \
366         checkheader libpng12-dev png.h png_create_read_struct "$(CPPFLAGS_PNG)" "$(LIBS_PNG)"; \
367         checkheader libwebp-dev webp/decode.h WebPGetInfo "$(CPPFLAGS_WEBP)" "$(LIBS_WEBP)"; \
368         checkheader "mesa-common-dev (or another OpenGL library)" GL/gl.h glClear "$(CPPFLAGS_GL)" "$(LIBS_GL)"; \
369         checkheader libgtk2.0-dev gtk/gtkdialog.h gtk_dialog_run "$(CPPFLAGS_GTK)" "$(LIBS_GTK)"; \
370         checkheader libpango1.0-dev pango/pangoft2.h pango_ft2_font_map_new "$(CPPFLAGS_PANGOFT2)" "$(LIBS_PANGOFT2)"; \
371         checkheader libgtkglext1-dev gtk/gtkglwidget.h gtk_widget_get_gl_context "$(CPPFLAGS_GTKGLEXT)" "$(LIBS_GTKGLEXT)"; \
372         [ "$(OS)" != "Win32" ] && checkheader libc6-dev dlfcn.h dlopen "$(CPPFLAGS_DL)" "$(LIBS_DL)"; \
373         checkheader zlib1g-dev zlib.h zlibVersion "$(CPPFLAGS_ZLIB)" "$(LIBS_ZLIB)"; \
374         [ "$$failed" = "0" ] && $(ECHO) All required libraries have been found!
375         @$(ECHO)
376 endif
377
378 .PHONY: binaries
379 binaries: \
380         binaries-tools \
381         binaries-radiant \
382
383 .PHONY: binaries-radiant-all
384 binaries-radiant: \
385         binaries-radiant-modules \
386         binaries-radiant-plugins \
387         binaries-radiant-core \
388
389 .PHONY: binaries-radiant-modules
390 binaries-radiant-modules: \
391         $(INSTALLDIR)/modules/archivepak.$(DLL) \
392         $(INSTALLDIR)/modules/archivewad.$(DLL) \
393         $(INSTALLDIR)/modules/archivezip.$(DLL) \
394         $(INSTALLDIR)/modules/entity.$(DLL) \
395         $(INSTALLDIR)/modules/image.$(DLL) \
396         $(INSTALLDIR)/modules/imagehl.$(DLL) \
397         $(INSTALLDIR)/modules/imagepng.$(DLL) \
398         $(INSTALLDIR)/modules/imagewebp.$(DLL) \
399         $(INSTALLDIR)/modules/imageq2.$(DLL) \
400         $(INSTALLDIR)/modules/mapq3.$(DLL) \
401         $(INSTALLDIR)/modules/mapxml.$(DLL) \
402         $(INSTALLDIR)/modules/md3model.$(DLL) \
403         $(INSTALLDIR)/modules/model.$(DLL) \
404         $(INSTALLDIR)/modules/shaders.$(DLL) \
405         $(INSTALLDIR)/modules/vfspk3.$(DLL) \
406
407 .PHONY: binaries-radiant-plugins
408 binaries-radiant-plugins: \
409         $(INSTALLDIR)/plugins/bobtoolz.$(DLL) \
410         $(INSTALLDIR)/plugins/brushexport.$(DLL) \
411         $(INSTALLDIR)/plugins/prtview.$(DLL) \
412         $(INSTALLDIR)/plugins/shaderplug.$(DLL) \
413         $(INSTALLDIR)/plugins/sunplug.$(DLL) \
414         $(INSTALLDIR)/plugins/ufoaiplug.$(DLL) \
415
416 .PHONY: binaries-radiant
417 binaries-radiant-core: \
418         $(INSTALLDIR)/radiant.$(EXE) \
419         $(INSTALLDIR)/radiant \
420
421 .PHONY: binaries-tools
422 binaries-tools: \
423         binaries-tools-quake2 \
424         binaries-tools-quake3 \
425
426 .PHONY: binaries-tools-quake2
427 binaries-tools-quake2: \
428         binaries-q2map \
429         binaries-qdata3 \
430         binaries-h2data \
431
432 .PHONY: binaries-q2map
433 binaries-q2map: \
434         $(INSTALLDIR)/q2map.$(EXE) \
435         $(INSTALLDIR)/q2map \
436
437 .PHONY: binaries-qdata3
438 binaries-qdata3: \
439         $(INSTALLDIR)/qdata3.$(EXE) \
440         $(INSTALLDIR)/qdata3 \
441
442 .PHONY: binaries-h2data
443 binaries-h2data: \
444         $(INSTALLDIR)/h2data.$(EXE) \
445         $(INSTALLDIR)/h2data \
446
447 .PHONY: binaries-tools-quake3
448 binaries-tools-quake3: \
449         binaries-q3data \
450         binaries-q3map2 \
451
452 .PHONY: binaries-q3data
453 binaries-q3data: \
454         $(INSTALLDIR)/q3data.$(EXE) \
455         $(INSTALLDIR)/q3data \
456
457 .PHONY: binaries-q3map2
458 binaries-q3map2: \
459         $(INSTALLDIR)/q3map2.$(EXE) \
460         $(INSTALLDIR)/q3map2 \
461
462
463 .PHONY: clean
464 clean:
465         $(RM_R) $(INSTALLDIR_BASE)/
466         $(RM_R) $(DOWNLOADDIR)/
467         $(FIND) . \( -name \*.o -o -name \*.d -o -name \*.$(DLL) -o -name \*.$(A) -o -name \*.$(EXE) \) -exec $(RM) {} \;
468         $(RM) icons/*.rc
469
470 %.$(EXE):
471         file=$@; $(MKDIR) $${file%/*}
472         $(CXX) $^ $(LDFLAGS) $(LDFLAGS_COMMON) $(LDFLAGS_EXTRA) $(LIBS_EXTRA) $(LIBS_COMMON) $(LIBS) -o $@
473         [ -z "$(LDD)" ] || [ -z "`$(LDD) -r $@ $(STDERR_TO_STDOUT) $(STDOUT_TO_DEVNULL) $(TEE_STDERR)`" ] || { $(RM) $@; exit 1; }
474
475 $(INSTALLDIR)/%: $(INSTALLDIR)/%.$(EXE)
476         if $(MAKE_EXE_SYMLINK); then o=$<; $(LN_SNF) $${o##*/} $@; else true; fi
477
478 %.$(A):
479         $(AR) rc $@ $^
480         $(RANLIB) $@
481
482 %.$(DLL):
483         file=$@; $(MKDIR) $${file%/*}
484         $(CXX) $^ $(LDFLAGS) $(LDFLAGS_COMMON) $(LDFLAGS_EXTRA) $(LDFLAGS_DLL) $(LIBS_EXTRA) $(LIBS_COMMON) $(LIBS) -shared -o $@
485         [ -z "$(LDD)" ] || [ -z "`$(LDD) -r $@ $(STDERR_TO_STDOUT) $(STDOUT_TO_DEVNULL) $(TEE_STDERR)`" ] || { $(RM) $@; exit 1; }
486
487 %.rc: %.ico
488         $(ECHO) '1 ICON "$<"' > $@
489
490 ifeq ($(OS),Win32)
491 %.o: %.rc
492         $(WINDRES) $< $@
493 endif
494
495 %.o: %.cpp $(if $(findstring $(DEPEND_ON_MAKEFILE),yes),$(wildcard Makefile*),) | dependencies-check
496         $(CXX) $< $(CFLAGS) $(CXXFLAGS) $(CFLAGS_COMMON) $(CXXFLAGS_COMMON) $(CPPFLAGS_EXTRA) $(CPPFLAGS_COMMON) $(CPPFLAGS) $(TARGET_ARCH) -c -o $@
497
498 %.o: %.c $(if $(findstring $(DEPEND_ON_MAKEFILE),yes),$(wildcard Makefile*),) | dependencies-check
499         $(CC) $< $(CFLAGS) $(CFLAGS_COMMON) $(CPPFLAGS_EXTRA) $(CPPFLAGS_COMMON) $(CPPFLAGS) $(TARGET_ARCH) -c -o $@
500
501 $(INSTALLDIR)/q3map2.$(EXE): LDFLAGS_EXTRA := -Wl,--large-address-aware
502 $(INSTALLDIR)/q3map2.$(EXE): LIBS_EXTRA := $(LIBS_XML) $(LIBS_GLIB) $(LIBS_PNG) $(LIBS_JPEG) $(LIBS_WEBP) $(LIBS_ZLIB)
503 $(INSTALLDIR)/q3map2.$(EXE): CPPFLAGS_EXTRA := $(CPPFLAGS_XML) $(CPPFLAGS_GLIB) $(CPPFLAGS_PNG) $(CPPFLAGS_JPEG) $(CPPFLAGS_WEBP) -Itools/quake3/common -Ilibs -Iinclude
504 $(INSTALLDIR)/q3map2.$(EXE): \
505         tools/quake3/common/cmdlib.o \
506         tools/quake3/common/imagelib.o \
507         tools/quake3/common/inout.o \
508         tools/quake3/common/jpeg.o \
509         tools/quake3/common/md4.o \
510         tools/quake3/common/mutex.o \
511         tools/quake3/common/polylib.o \
512         tools/quake3/common/scriplib.o \
513         tools/quake3/common/threads.o \
514         tools/quake3/common/vfs.o \
515         tools/quake3/common/miniz.o \
516         tools/quake3/q3map2/brush.o \
517         tools/quake3/q3map2/brush_primit.o \
518         tools/quake3/q3map2/bspfile_abstract.o \
519         tools/quake3/q3map2/bspfile_ibsp.o \
520         tools/quake3/q3map2/bspfile_rbsp.o \
521         tools/quake3/q3map2/bsp.o \
522         tools/quake3/q3map2/bsp_analyze.o \
523         tools/quake3/q3map2/bsp_scale.o \
524         tools/quake3/q3map2/bsp_info.o \
525         tools/quake3/q3map2/convert_ase.o \
526         tools/quake3/q3map2/convert_bsp.o \
527         tools/quake3/q3map2/convert_obj.o \
528         tools/quake3/q3map2/convert_map.o \
529         tools/quake3/q3map2/decals.o \
530         tools/quake3/q3map2/exportents.o \
531         tools/quake3/q3map2/facebsp.o \
532         tools/quake3/q3map2/fixaas.o \
533         tools/quake3/q3map2/fog.o \
534         tools/quake3/q3map2/help.o \
535         tools/quake3/q3map2/image.o \
536         tools/quake3/q3map2/leakfile.o \
537         tools/quake3/q3map2/light_bounce.o \
538         tools/quake3/q3map2/lightmaps_ydnar.o \
539         tools/quake3/q3map2/light.o \
540         tools/quake3/q3map2/light_trace.o \
541         tools/quake3/q3map2/light_ydnar.o \
542         tools/quake3/q3map2/main.o \
543         tools/quake3/q3map2/map.o \
544         tools/quake3/q3map2/minimap.o \
545         tools/quake3/q3map2/mesh.o \
546         tools/quake3/q3map2/model.o \
547         tools/quake3/q3map2/patch.o \
548         tools/quake3/q3map2/path_init.o \
549         tools/quake3/q3map2/portals.o \
550         tools/quake3/q3map2/prtfile.o \
551         tools/quake3/q3map2/shaders.o \
552         tools/quake3/q3map2/surface_extra.o \
553         tools/quake3/q3map2/surface_foliage.o \
554         tools/quake3/q3map2/surface_fur.o \
555         tools/quake3/q3map2/surface_meta.o \
556         tools/quake3/q3map2/surface.o \
557         tools/quake3/q3map2/tjunction.o \
558         tools/quake3/q3map2/tree.o \
559         tools/quake3/q3map2/visflow.o \
560         tools/quake3/q3map2/vis.o \
561         tools/quake3/q3map2/writebsp.o \
562         libddslib.$(A) \
563         libetclib.$(A) \
564         libfilematch.$(A) \
565         libl_net.$(A) \
566         libmathlib.$(A) \
567         libpicomodel.$(A) \
568         $(if $(findstring $(OS),Win32),icons/q3map2.o,) \
569
570 libmathlib.$(A): CPPFLAGS_EXTRA := -Ilibs
571 libmathlib.$(A): \
572         libs/mathlib/bbox.o \
573         libs/mathlib/line.o \
574         libs/mathlib/m4x4.o \
575         libs/mathlib/mathlib.o \
576         libs/mathlib/ray.o \
577
578 libl_net.$(A): CPPFLAGS_EXTRA := -Ilibs
579 libl_net.$(A): \
580         libs/l_net/l_net.o \
581         $(if $(findstring $(OS),Win32),libs/l_net/l_net_wins.o,libs/l_net/l_net_berkley.o) \
582
583 libpicomodel.$(A): CPPFLAGS_EXTRA := -Ilibs
584 libpicomodel.$(A): \
585         libs/picomodel/lwo/clip.o \
586         libs/picomodel/lwo/envelope.o \
587         libs/picomodel/lwo/list.o \
588         libs/picomodel/lwo/lwio.o \
589         libs/picomodel/lwo/lwo2.o \
590         libs/picomodel/lwo/lwob.o \
591         libs/picomodel/lwo/pntspols.o \
592         libs/picomodel/lwo/surface.o \
593         libs/picomodel/lwo/vecmath.o \
594         libs/picomodel/lwo/vmap.o \
595         libs/picomodel/picointernal.o \
596         libs/picomodel/picomodel.o \
597         libs/picomodel/picomodules.o \
598         libs/picomodel/pm_3ds.o \
599         libs/picomodel/pm_ase.o \
600         libs/picomodel/pm_fm.o \
601         libs/picomodel/pm_lwo.o \
602         libs/picomodel/pm_md2.o \
603         libs/picomodel/pm_md3.o \
604         libs/picomodel/pm_mdc.o \
605         libs/picomodel/pm_ms3d.o \
606         libs/picomodel/pm_obj.o \
607         libs/picomodel/pm_terrain.o \
608
609 libddslib.$(A): CPPFLAGS_EXTRA := -Ilibs
610 libddslib.$(A): \
611         libs/ddslib/ddslib.o \
612
613 libetclib.$(A): CPPFLAGS_EXTRA := -Ilibs
614 libetclib.$(A): \
615         libs/etclib.o \
616
617 $(INSTALLDIR)/q3data.$(EXE): LIBS_EXTRA := $(LIBS_XML) $(LIBS_GLIB) $(LIBS_ZLIB)
618 $(INSTALLDIR)/q3data.$(EXE): CPPFLAGS_EXTRA := $(CPPFLAGS_XML) $(CPPFLAGS_GLIB) $(CPPFLAGS_ZLIB) -Itools/quake3/common -Ilibs -Iinclude
619 $(INSTALLDIR)/q3data.$(EXE): \
620         tools/quake3/common/aselib.o \
621         tools/quake3/common/bspfile.o \
622         tools/quake3/common/cmdlib.o \
623         tools/quake3/common/imagelib.o \
624         tools/quake3/common/inout.o \
625         tools/quake3/common/md4.o \
626         tools/quake3/common/scriplib.o \
627         tools/quake3/common/trilib.o \
628         tools/quake3/common/vfs.o \
629         tools/quake3/common/miniz.o \
630         tools/quake3/q3data/3dslib.o \
631         tools/quake3/q3data/compress.o \
632         tools/quake3/q3data/images.o \
633         tools/quake3/q3data/md3lib.o \
634         tools/quake3/q3data/models.o \
635         tools/quake3/q3data/p3dlib.o \
636         tools/quake3/q3data/polyset.o \
637         tools/quake3/q3data/q3data.o \
638         tools/quake3/q3data/stripper.o \
639         tools/quake3/q3data/video.o \
640         libfilematch.$(A) \
641         libetclib.$(A) \
642         libl_net.$(A) \
643         libmathlib.$(A) \
644         $(if $(findstring $(OS),Win32),icons/q3data.o,) \
645
646 $(INSTALLDIR)/radiant.$(EXE): LDFLAGS_EXTRA := $(MWINDOWS)
647 $(INSTALLDIR)/radiant.$(EXE): LIBS_EXTRA := $(LIBS_GL) $(LIBS_DL) $(LIBS_XML) $(LIBS_GLIB) $(LIBS_GTK) $(LIBS_GTKGLEXT) $(LIBS_ZLIB) $(LIBS_PANGOFT2)
648 $(INSTALLDIR)/radiant.$(EXE): CPPFLAGS_EXTRA := $(CPPFLAGS_GL) $(CPPFLAGS_DL) $(CPPFLAGS_XML) $(CPPFLAGS_GLIB) $(CPPFLAGS_GTK) $(CPPFLAGS_GTKGLEXT) $(CPPFLAGS_PANGOFT2) -Ilibs -Iinclude
649 $(INSTALLDIR)/radiant.$(EXE): \
650         radiant/autosave.o \
651         radiant/brushmanip.o \
652         radiant/brushmodule.o \
653         radiant/brushnode.o \
654         radiant/brush.o \
655         radiant/brush_primit.o \
656         radiant/brushtokens.o \
657         radiant/brushxml.o \
658         radiant/build.o \
659         radiant/camwindow.o \
660         radiant/clippertool.o \
661         radiant/commands.o \
662         radiant/console.o \
663         radiant/csg.o \
664         radiant/dialog.o \
665         radiant/eclass_def.o \
666         radiant/eclass_doom3.o \
667         radiant/eclass_fgd.o \
668         radiant/eclass.o \
669         radiant/eclass_xml.o \
670         radiant/entityinspector.o \
671         radiant/entitylist.o \
672         radiant/entity.o \
673         radiant/environment.o \
674         radiant/error.o \
675         radiant/feedback.o \
676         radiant/filetypes.o \
677         radiant/filterbar.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/gtktheme.o \
686         radiant/help.o \
687         radiant/image.o \
688         radiant/mainframe.o \
689         radiant/main.o \
690         radiant/map.o \
691         $(if $(findstring $(OS),Win32),radiant/multimon.o,) \
692         radiant/mru.o \
693         radiant/nullmodel.o \
694         radiant/parse.o \
695         radiant/patchdialog.o \
696         radiant/patchmanip.o \
697         radiant/patchmodule.o \
698         radiant/patch.o \
699         radiant/pluginapi.o \
700         radiant/pluginmanager.o \
701         radiant/pluginmenu.o \
702         radiant/plugin.o \
703         radiant/plugintoolbar.o \
704         radiant/points.o \
705         radiant/preferencedictionary.o \
706         radiant/preferences.o \
707         radiant/qe3.o \
708         radiant/qgl.o \
709         radiant/referencecache.o \
710         radiant/renderer.o \
711         radiant/renderstate.o \
712         radiant/scenegraph.o \
713         radiant/selection.o \
714         radiant/select.o \
715         radiant/server.o \
716         radiant/shaders.o \
717         radiant/sockets.o \
718         radiant/stacktrace.o \
719         radiant/surfacedialog.o \
720         radiant/texmanip.o \
721         radiant/textureentry.o \
722         radiant/textures.o \
723         radiant/texwindow.o \
724         radiant/timer.o \
725         radiant/treemodel.o \
726         radiant/undo.o \
727         radiant/url.o \
728         radiant/view.o \
729         radiant/watchbsp.o \
730         radiant/winding.o \
731         radiant/windowobservers.o \
732         radiant/xmlstuff.o \
733         radiant/xywindow.o \
734         libcmdlib.$(A) \
735         libgtkutil.$(A) \
736         libuilib.$(A) \
737         libl_net.$(A) \
738         libmathlib.$(A) \
739         libprofile.$(A) \
740         libxmllib.$(A) \
741         $(if $(findstring $(OS),Win32),icons/radiant.o,) \
742
743 libfilematch.$(A): CPPFLAGS_EXTRA := -Ilibs
744 libfilematch.$(A): \
745         libs/filematch.o \
746
747 libcmdlib.$(A): CPPFLAGS_EXTRA := -Ilibs
748 libcmdlib.$(A): \
749         libs/cmdlib/cmdlib.o \
750
751 libprofile.$(A): CPPFLAGS_EXTRA := -Ilibs -Iinclude
752 libprofile.$(A): \
753         libs/profile/file.o \
754         libs/profile/profile.o \
755
756 libgtkutil.$(A): CPPFLAGS_EXTRA := $(CPPFLAGS_GLIB) $(CPPFLAGS_GTK) $(CPPFLAGS_GTKGLEXT) $(CPPFLAGS_PANGOFT2) -Ilibs -Iinclude
757 libgtkutil.$(A): \
758         libs/gtkutil/accelerator.o \
759         libs/gtkutil/button.o \
760         libs/gtkutil/clipboard.o \
761         libs/gtkutil/cursor.o \
762         libs/gtkutil/dialog.o \
763         libs/gtkutil/entry.o \
764         libs/gtkutil/filechooser.o \
765         libs/gtkutil/frame.o \
766         libs/gtkutil/glfont.o \
767         libs/gtkutil/glwidget.o \
768         libs/gtkutil/image.o \
769         libs/gtkutil/menu.o \
770         libs/gtkutil/messagebox.o \
771         libs/gtkutil/nonmodal.o \
772         libs/gtkutil/paned.o \
773         libs/gtkutil/toolbar.o \
774         libs/gtkutil/widget.o \
775         libs/gtkutil/window.o \
776         libs/gtkutil/xorrectangle.o \
777
778 libuilib.$(A): CPPFLAGS_EXTRA := $(CPPFLAGS_GLIB) $(CPPFLAGS_GTK) $(CPPFLAGS_GTKGLEXT) -Ilibs -Iinclude
779 libuilib.$(A): \
780         libs/uilib/uilib.o \
781
782 libxmllib.$(A): CPPFLAGS_EXTRA := $(CPPFLAGS_XML) $(CPPFLAGS_GLIB) -Ilibs -Iinclude
783 libxmllib.$(A): \
784         libs/xml/xmltextags.o \
785
786 $(INSTALLDIR)/modules/archivezip.$(DLL): LIBS_EXTRA := $(LIBS_ZLIB)
787 $(INSTALLDIR)/modules/archivezip.$(DLL): CPPFLAGS_EXTRA := $(CPPFLAGS_ZLIB) -Ilibs -Iinclude
788 $(INSTALLDIR)/modules/archivezip.$(DLL): \
789         plugins/archivezip/archive.o \
790         plugins/archivezip/plugin.o \
791
792 $(INSTALLDIR)/modules/archivewad.$(DLL): CPPFLAGS_EXTRA := -Ilibs -Iinclude
793 $(INSTALLDIR)/modules/archivewad.$(DLL): \
794         plugins/archivewad/archive.o \
795         plugins/archivewad/plugin.o \
796
797 $(INSTALLDIR)/modules/archivepak.$(DLL): CPPFLAGS_EXTRA := -Ilibs -Iinclude
798 $(INSTALLDIR)/modules/archivepak.$(DLL): \
799         plugins/archivepak/archive.o \
800         plugins/archivepak/plugin.o \
801
802 $(INSTALLDIR)/modules/entity.$(DLL): CPPFLAGS_EXTRA := $(CPPFLAGS_GLIB) -Ilibs -Iinclude
803 $(INSTALLDIR)/modules/entity.$(DLL): \
804         plugins/entity/doom3group.o \
805         plugins/entity/eclassmodel.o \
806         plugins/entity/entity.o \
807         plugins/entity/filters.o \
808         plugins/entity/generic.o \
809         plugins/entity/group.o \
810         plugins/entity/light.o \
811         plugins/entity/miscmodel.o \
812         plugins/entity/plugin.o \
813         plugins/entity/skincache.o \
814         plugins/entity/targetable.o \
815
816 $(INSTALLDIR)/modules/image.$(DLL): LIBS_EXTRA := $(LIBS_JPEG)
817 $(INSTALLDIR)/modules/image.$(DLL): CPPFLAGS_EXTRA := $(CPPFLAGS_JPEG) -Ilibs -Iinclude
818 $(INSTALLDIR)/modules/image.$(DLL): \
819         plugins/image/bmp.o \
820         plugins/image/dds.o \
821         plugins/image/image.o \
822         plugins/image/jpeg.o \
823         plugins/image/ktx.o \
824         plugins/image/pcx.o \
825         plugins/image/tga.o \
826         libddslib.$(A) \
827         libetclib.$(A) \
828
829 $(INSTALLDIR)/modules/imageq2.$(DLL): CPPFLAGS_EXTRA := -Ilibs -Iinclude
830 $(INSTALLDIR)/modules/imageq2.$(DLL): \
831         plugins/imageq2/imageq2.o \
832         plugins/imageq2/wal32.o \
833         plugins/imageq2/wal.o \
834
835 $(INSTALLDIR)/modules/imagehl.$(DLL): CPPFLAGS_EXTRA := -Ilibs -Iinclude
836 $(INSTALLDIR)/modules/imagehl.$(DLL): \
837         plugins/imagehl/hlw.o \
838         plugins/imagehl/imagehl.o \
839         plugins/imagehl/mip.o \
840         plugins/imagehl/sprite.o \
841
842 $(INSTALLDIR)/modules/imagepng.$(DLL): LIBS_EXTRA := $(LIBS_PNG)
843 $(INSTALLDIR)/modules/imagepng.$(DLL): CPPFLAGS_EXTRA := $(CPPFLAGS_PNG) -Ilibs -Iinclude
844 $(INSTALLDIR)/modules/imagepng.$(DLL): \
845         plugins/imagepng/plugin.o \
846
847 $(INSTALLDIR)/modules/imagewebp.$(DLL): LIBS_EXTRA := $(LIBS_WEBP)
848 $(INSTALLDIR)/modules/imagewebp.$(DLL): CPPFLAGS_EXTRA := $(CPPFLAGS_WEBP) -Ilibs -Iinclude
849 $(INSTALLDIR)/modules/imagewebp.$(DLL): \
850         plugins/imagewebp/plugin.o \
851
852 $(INSTALLDIR)/modules/mapq3.$(DLL): CPPFLAGS_EXTRA := $(CPPFLAGS_GLIB) -Ilibs -Iinclude
853 $(INSTALLDIR)/modules/mapq3.$(DLL): \
854         plugins/mapq3/parse.o \
855         plugins/mapq3/plugin.o \
856         plugins/mapq3/write.o \
857
858 $(INSTALLDIR)/modules/mapxml.$(DLL): LIBS_EXTRA := $(LIBS_XML) $(LIBS_GLIB)
859 $(INSTALLDIR)/modules/mapxml.$(DLL): CPPFLAGS_EXTRA := $(CPPFLAGS_XML) $(CPPFLAGS_GLIB) -Ilibs -Iinclude
860 $(INSTALLDIR)/modules/mapxml.$(DLL): \
861         plugins/mapxml/plugin.o \
862         plugins/mapxml/xmlparse.o \
863         plugins/mapxml/xmlwrite.o \
864
865 $(INSTALLDIR)/modules/md3model.$(DLL): CPPFLAGS_EXTRA := -Ilibs -Iinclude
866 $(INSTALLDIR)/modules/md3model.$(DLL): \
867         plugins/md3model/md2.o \
868         plugins/md3model/md3.o \
869         plugins/md3model/md5.o \
870         plugins/md3model/mdc.o \
871         plugins/md3model/mdlimage.o \
872         plugins/md3model/mdl.o \
873         plugins/md3model/plugin.o \
874
875 $(INSTALLDIR)/modules/model.$(DLL): CPPFLAGS_EXTRA := -Ilibs -Iinclude
876 $(INSTALLDIR)/modules/model.$(DLL): \
877         plugins/model/model.o \
878         plugins/model/plugin.o \
879         libpicomodel.$(A) \
880
881 $(INSTALLDIR)/modules/shaders.$(DLL): LIBS_EXTRA := $(LIBS_GLIB)
882 $(INSTALLDIR)/modules/shaders.$(DLL): CPPFLAGS_EXTRA := $(CPPFLAGS_GLIB) -Ilibs -Iinclude
883 $(INSTALLDIR)/modules/shaders.$(DLL): \
884         plugins/shaders/plugin.o \
885         plugins/shaders/shaders.o \
886
887 $(INSTALLDIR)/modules/vfspk3.$(DLL): LIBS_EXTRA := $(LIBS_GLIB)
888 $(INSTALLDIR)/modules/vfspk3.$(DLL): CPPFLAGS_EXTRA := $(CPPFLAGS_GLIB) -Ilibs -Iinclude
889 $(INSTALLDIR)/modules/vfspk3.$(DLL): \
890         plugins/vfspk3/archive.o \
891         plugins/vfspk3/vfs.o \
892         plugins/vfspk3/vfspk3.o \
893         libfilematch.$(A) \
894
895 $(INSTALLDIR)/plugins/bobtoolz.$(DLL): LIBS_EXTRA := $(LIBS_GLIB) $(LIBS_GTK)
896 $(INSTALLDIR)/plugins/bobtoolz.$(DLL): CPPFLAGS_EXTRA := $(CPPFLAGS_GLIB) $(CPPFLAGS_GTK) -Ilibs -Iinclude
897 $(INSTALLDIR)/plugins/bobtoolz.$(DLL): \
898         contrib/bobtoolz/bobToolz-GTK.o \
899         contrib/bobtoolz/bsploader.o \
900         contrib/bobtoolz/cportals.o \
901         contrib/bobtoolz/DBobView.o \
902         contrib/bobtoolz/DBrush.o \
903         contrib/bobtoolz/DEntity.o \
904         contrib/bobtoolz/DEPair.o \
905         contrib/bobtoolz/dialogs/dialogs-gtk.o \
906         contrib/bobtoolz/DMap.o \
907         contrib/bobtoolz/DPatch.o \
908         contrib/bobtoolz/DPlane.o \
909         contrib/bobtoolz/DPoint.o \
910         contrib/bobtoolz/DShape.o \
911         contrib/bobtoolz/DTrainDrawer.o \
912         contrib/bobtoolz/DTreePlanter.o \
913         contrib/bobtoolz/DVisDrawer.o \
914         contrib/bobtoolz/DWinding.o \
915         contrib/bobtoolz/funchandlers-GTK.o \
916         contrib/bobtoolz/lists.o \
917         contrib/bobtoolz/misc.o \
918         contrib/bobtoolz/ScriptParser.o \
919         contrib/bobtoolz/shapes.o \
920         contrib/bobtoolz/visfind.o \
921         libcmdlib.$(A) \
922         libmathlib.$(A) \
923         libprofile.$(A) \
924
925 $(INSTALLDIR)/plugins/brushexport.$(DLL): LIBS_EXTRA := $(LIBS_GLIB) $(LIBS_GTK)
926 $(INSTALLDIR)/plugins/brushexport.$(DLL): CPPFLAGS_EXTRA := $(CPPFLAGS_GLIB) $(CPPFLAGS_GTK) -Ilibs -Iinclude
927 $(INSTALLDIR)/plugins/brushexport.$(DLL): \
928         contrib/brushexport/callbacks.o \
929         contrib/brushexport/export.o \
930         contrib/brushexport/interface.o \
931         contrib/brushexport/plugin.o \
932         contrib/brushexport/support.o \
933
934 $(INSTALLDIR)/plugins/prtview.$(DLL): LIBS_EXTRA := $(LIBS_GLIB) $(LIBS_GTK)
935 $(INSTALLDIR)/plugins/prtview.$(DLL): CPPFLAGS_EXTRA := $(CPPFLAGS_GLIB) $(CPPFLAGS_GTK) -Ilibs -Iinclude
936 $(INSTALLDIR)/plugins/prtview.$(DLL): \
937         contrib/prtview/AboutDialog.o \
938         contrib/prtview/ConfigDialog.o \
939         contrib/prtview/LoadPortalFileDialog.o \
940         contrib/prtview/portals.o \
941         contrib/prtview/prtview.o \
942         libprofile.$(A) \
943
944 $(INSTALLDIR)/plugins/shaderplug.$(DLL): LIBS_EXTRA := $(LIBS_GLIB) $(LIBS_GTK) $(LIBS_XML)
945 $(INSTALLDIR)/plugins/shaderplug.$(DLL): CPPFLAGS_EXTRA := $(CPPFLAGS_GLIB) $(CPPFLAGS_GTK) $(CPPFLAGS_XML) -Ilibs -Iinclude
946 $(INSTALLDIR)/plugins/shaderplug.$(DLL): \
947         contrib/shaderplug/shaderplug.o \
948         libxmllib.$(A) \
949
950 $(INSTALLDIR)/plugins/sunplug.$(DLL): LIBS_EXTRA := $(LIBS_GLIB) $(LIBS_GTK)
951 $(INSTALLDIR)/plugins/sunplug.$(DLL): CPPFLAGS_EXTRA := $(CPPFLAGS_GLIB) $(CPPFLAGS_GTK) -Ilibs -Iinclude
952 $(INSTALLDIR)/plugins/sunplug.$(DLL): \
953         contrib/sunplug/sunplug.o \
954
955 $(INSTALLDIR)/qdata3.$(EXE): LIBS_EXTRA := $(LIBS_XML)
956 $(INSTALLDIR)/qdata3.$(EXE): CPPFLAGS_EXTRA := $(CPPFLAGS_XML) -Itools/quake2/common -Ilibs -Iinclude
957 $(INSTALLDIR)/qdata3.$(EXE): \
958         tools/quake2/common/bspfile.o \
959         tools/quake2/common/cmdlib.o \
960         tools/quake2/common/inout.o \
961         tools/quake2/common/l3dslib.o \
962         tools/quake2/common/lbmlib.o \
963         tools/quake2/common/mathlib.o \
964         tools/quake2/common/md4.o \
965         tools/quake2/common/path_init.o \
966         tools/quake2/common/polylib.o \
967         tools/quake2/common/scriplib.o \
968         tools/quake2/common/threads.o \
969         tools/quake2/common/trilib.o \
970         tools/quake2/qdata/images.o \
971         tools/quake2/qdata/models.o \
972         tools/quake2/qdata/qdata.o \
973         tools/quake2/qdata/sprites.o \
974         tools/quake2/qdata/tables.o \
975         tools/quake2/qdata/video.o \
976         libl_net.$(A) \
977         $(if $(findstring $(OS),Win32),icons/qdata3.o,) \
978
979 $(INSTALLDIR)/q2map.$(EXE): LIBS_EXTRA := $(LIBS_XML)
980 $(INSTALLDIR)/q2map.$(EXE): CPPFLAGS_EXTRA := $(CPPFLAGS_XML) -Itools/quake2/common -Ilibs -Iinclude
981 $(INSTALLDIR)/q2map.$(EXE): \
982         tools/quake2/common/bspfile.o \
983         tools/quake2/common/cmdlib.o \
984         tools/quake2/common/inout.o \
985         tools/quake2/common/l3dslib.o \
986         tools/quake2/common/lbmlib.o \
987         tools/quake2/common/mathlib.o \
988         tools/quake2/common/md4.o \
989         tools/quake2/common/path_init.o \
990         tools/quake2/common/polylib.o \
991         tools/quake2/common/scriplib.o \
992         tools/quake2/common/threads.o \
993         tools/quake2/common/trilib.o \
994         tools/quake2/q2map/brushbsp.o \
995         tools/quake2/q2map/csg.o \
996         tools/quake2/q2map/faces.o \
997         tools/quake2/q2map/flow.o \
998         tools/quake2/q2map/glfile.o \
999         tools/quake2/q2map/leakfile.o \
1000         tools/quake2/q2map/lightmap.o \
1001         tools/quake2/q2map/main.o \
1002         tools/quake2/q2map/map.o \
1003         tools/quake2/q2map/nodraw.o \
1004         tools/quake2/q2map/patches.o \
1005         tools/quake2/q2map/portals.o \
1006         tools/quake2/q2map/prtfile.o \
1007         tools/quake2/q2map/qbsp.o \
1008         tools/quake2/q2map/qrad.o \
1009         tools/quake2/q2map/qvis.o \
1010         tools/quake2/q2map/textures.o \
1011         tools/quake2/q2map/trace.o \
1012         tools/quake2/q2map/tree.o \
1013         tools/quake2/q2map/writebsp.o \
1014         libl_net.$(A) \
1015         $(if $(findstring $(OS),Win32),icons/q2map.o,) \
1016
1017 $(INSTALLDIR)/plugins/ufoaiplug.$(DLL): LIBS_EXTRA := $(LIBS_GLIB) $(LIBS_GTK)
1018 $(INSTALLDIR)/plugins/ufoaiplug.$(DLL): CPPFLAGS_EXTRA := $(CPPFLAGS_GLIB) $(CPPFLAGS_GTK) -Ilibs -Iinclude
1019 $(INSTALLDIR)/plugins/ufoaiplug.$(DLL): \
1020         contrib/ufoaiplug/ufoai_filters.o \
1021         contrib/ufoaiplug/ufoai_gtk.o \
1022         contrib/ufoaiplug/ufoai_level.o \
1023         contrib/ufoaiplug/ufoai.o \
1024
1025 $(INSTALLDIR)/plugins/bkgrnd2d.$(DLL): LIBS_EXTRA := $(LIBS_GLIB) $(LIBS_GTK)
1026 $(INSTALLDIR)/plugins/bkgrnd2d.$(DLL): CPPFLAGS_EXTRA := $(CPPFLAGS_GLIB) $(CPPFLAGS_GTK) -Ilibs -Iinclude
1027 $(INSTALLDIR)/plugins/bkgrnd2d.$(DLL): \
1028         contrib/bkgrnd2d/bkgrnd2d.o \
1029         contrib/bkgrnd2d/dialog.o \
1030         contrib/bkgrnd2d/plugin.o \
1031
1032 $(INSTALLDIR)/h2data.$(EXE): LIBS_EXTRA := $(LIBS_XML)
1033 $(INSTALLDIR)/h2data.$(EXE): CPPFLAGS_EXTRA := $(CPPFLAGS_XML) -Itools/heretic2/common -Itools/heretic2/qcommon -Itools/heretic2/h2data -Itools/quake2/common -Ilibs -Iinclude
1034 $(INSTALLDIR)/h2data.$(EXE): \
1035         tools/heretic2/common/bspfile.o \
1036         tools/heretic2/common/cmdlib.o \
1037         tools/heretic2/common/inout.o \
1038         tools/heretic2/common/l3dslib.o \
1039         tools/heretic2/common/lbmlib.o \
1040         tools/heretic2/common/mathlib.o \
1041         tools/heretic2/common/md4.o \
1042         tools/heretic2/common/path_init.o \
1043         tools/heretic2/common/qfiles.o \
1044         tools/heretic2/common/scriplib.o \
1045         tools/heretic2/common/threads.o \
1046         tools/heretic2/common/token.o \
1047         tools/heretic2/common/trilib.o \
1048         tools/heretic2/qcommon/reference.o \
1049         tools/heretic2/qcommon/resourcemanager.o \
1050         tools/heretic2/qcommon/skeletons.o \
1051         tools/heretic2/h2data/animcomp.o \
1052         tools/heretic2/h2data/book.o \
1053         tools/heretic2/h2data/fmodels.o \
1054         tools/heretic2/h2data/images.o \
1055         tools/heretic2/h2data/jointed.o \
1056         tools/heretic2/h2data/models.o \
1057         tools/heretic2/h2data/pics.o \
1058         tools/heretic2/h2data/qdata.o \
1059         tools/heretic2/h2data/qd_skeletons.o \
1060         tools/heretic2/h2data/sprites.o \
1061         tools/heretic2/h2data/svdcmp.o \
1062         tools/heretic2/h2data/tables.o \
1063         tools/heretic2/h2data/tmix.o \
1064         tools/heretic2/h2data/video.o \
1065         libl_net.$(A) \
1066         $(if $(findstring $(OS),Win32),icons/h2data.o,) \
1067
1068 .PHONY: install-data
1069 install-data: binaries
1070         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
1071         $(ECHO) $(RADIANT_MAJOR_VERSION) > $(INSTALLDIR)/RADIANT_MAJOR
1072         $(ECHO) $(RADIANT_MINOR_VERSION) > $(INSTALLDIR)/RADIANT_MINOR
1073         $(ECHO) $(RADIANT_PATCH_VERSION) > $(INSTALLDIR)/RADIANT_PATCH
1074         $(CP_R) setup/data/tools/* $(INSTALLDIR)/
1075         $(MKDIR) $(INSTALLDIR)/docs
1076         $(CP_R) docs/* $(INSTALLDIR)/docs/
1077
1078 .PHONY: install-dll
1079 ifeq ($(OS),Win32)
1080 install-dll: binaries
1081         MKDIR="$(MKDIR)" CP="$(CP)" CAT="$(CAT)" GTKDIR="$(GTKDIR)" WHICHDLL="$(WHICHDLL)" INSTALLDIR="$(INSTALLDIR)" $(SH) $(DLLINSTALL) 
1082 else
1083 install-dll: binaries
1084         @$(ECHO) No DLL inclusion implemented for this target.
1085 endif
1086
1087 # release building... NOT for general users
1088 # these may use tools not in the list that is checked by the build system
1089 release-src: BUILD_DATE := $(shell date +%Y%m%d)
1090 release-src: INSTALLDIR := netradiant-$(RADIANT_VERSION_NUMBER)-$(BUILD_DATE)
1091 release-src:
1092         $(GIT) archive --format=tar --prefix=$(INSTALLDIR)/ HEAD | bzip2 > ../$(INSTALLDIR).tar.bz2
1093
1094 release-win32: BUILD_DATE := $(shell date +%Y%m%d)
1095 release-win32: INSTALLDIR := netradiant-$(RADIANT_VERSION_NUMBER)-$(BUILD_DATE)
1096 release-win32:
1097         $(MAKE) all INSTALLDIR=$(INSTALLDIR) MAKEFILE_CONF=cross-Makefile.conf RADIANT_ABOUTMSG="Official release build" BUILD=release
1098         7za a -sfx../../../../../../../../../../$(HOME)/7z.sfx ../$(INSTALLDIR)-win32-7z.exe $(INSTALLDIR)/
1099         chmod 644 ../$(INSTALLDIR)-win32-7z.exe # 7zip is evil
1100         $(MAKE) clean INSTALLDIR=$(INSTALLDIR) MAKEFILE_CONF=cross-Makefile.conf RADIANT_ABOUTMSG="Official release build" BUILD=release
1101
1102 release-all:
1103         $(GIT) clean -xdf
1104         $(MAKE) release-src
1105         $(MAKE) release-win32
1106
1107 # load dependency files
1108 -include $(shell find . -name \*.d)