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