move debug to extradbeug, add a "debug" build config that's less debuggy (just -g...
[divverent/netradiant.git] / Makefile
1 -include Makefile.conf
2
3 ## CONFIGURATION SETTINGS
4 # user customizable stuf
5 # you may override this in Makefile.conf or the environment
6 BUILD              ?= debug
7 # or: release
8 OS                 ?= $(shell uname)
9 # or: Linux, Win32, Darwin
10 LDFLAGS            ?=
11 CFLAGS             ?=
12 CXXFLAGS           ?=
13 CPPFLAGS           ?=
14 LIBS               ?=
15 RADIANT_ABOUTMSG   ?= Custom build
16
17 CC                 ?= gcc
18 CXX                ?= g++
19 RANLIB             ?= ranlib
20 AR                 ?= ar
21 LDD                ?= ldd # nothing on Win32
22
23 PKGCONFIG          ?= pkg-config
24 PKG_CONFIG_PATH    ?=
25
26 SH                 ?= $(SHELL)
27 ECHO               ?= echo
28 ECHO_NOLF          ?= echo -n
29 CAT                ?= cat
30 MKDIR              ?= mkdir -p
31 CP                 ?= cp
32 CP_R               ?= $(CP) -r
33 RM                 ?= rm
34 RM_R               ?= $(RM) -r
35 TEE_STDERR         ?= | tee /dev/stderr
36 FIND               ?= find
37 DIFF               ?= diff
38
39 STDOUT_TO_DEVNULL  ?= >/dev/null
40 STDERR_TO_DEVNULL  ?= 2>/dev/null
41 STDERR_TO_STDOUT   ?= 2>&1
42 TO_DEVNULL         ?= $(STDOUT_TO_DEVNULL) $(STDERR_TO_STDOUT)
43
44 CPPFLAGS_GLIB      ?= $(shell PKG_CONFIG_PATH=$(PKG_CONFIG_PATH) $(PKGCONFIG) glib-2.0 --cflags $(STDERR_TO_DEVNULL))
45 LIBS_GLIB          ?= $(shell PKG_CONFIG_PATH=$(PKG_CONFIG_PATH) $(PKGCONFIG) glib-2.0 --libs-only-L $(STDERR_TO_DEVNULL)) \
46                       $(shell PKG_CONFIG_PATH=$(PKG_CONFIG_PATH) $(PKGCONFIG) glib-2.0 --libs-only-l $(STDERR_TO_DEVNULL))
47 CPPFLAGS_XML       ?= $(shell PKG_CONFIG_PATH=$(PKG_CONFIG_PATH) $(PKGCONFIG) libxml-2.0 --cflags $(STDERR_TO_DEVNULL))
48 LIBS_XML           ?= $(shell PKG_CONFIG_PATH=$(PKG_CONFIG_PATH) $(PKGCONFIG) libxml-2.0 --libs-only-L $(STDERR_TO_DEVNULL)) \
49                       $(shell PKG_CONFIG_PATH=$(PKG_CONFIG_PATH) $(PKGCONFIG) libxml-2.0 --libs-only-l $(STDERR_TO_DEVNULL))
50 CPPFLAGS_PNG       ?= $(shell PKG_CONFIG_PATH=$(PKG_CONFIG_PATH) $(PKGCONFIG) libpng --cflags $(STDERR_TO_DEVNULL))
51 LIBS_PNG           ?= $(shell PKG_CONFIG_PATH=$(PKG_CONFIG_PATH) $(PKGCONFIG) libpng --libs-only-L $(STDERR_TO_DEVNULL)) \
52                       $(shell PKG_CONFIG_PATH=$(PKG_CONFIG_PATH) $(PKGCONFIG) libpng --libs-only-l $(STDERR_TO_DEVNULL))
53 CPPFLAGS_GTK       ?= $(shell PKG_CONFIG_PATH=$(PKG_CONFIG_PATH) $(PKGCONFIG) gtk+-2.0 --cflags $(STDERR_TO_DEVNULL))
54 LIBS_GTK           ?= $(shell PKG_CONFIG_PATH=$(PKG_CONFIG_PATH) $(PKGCONFIG) gtk+-2.0 --libs-only-L $(STDERR_TO_DEVNULL)) \
55                       $(shell PKG_CONFIG_PATH=$(PKG_CONFIG_PATH) $(PKGCONFIG) gtk+-2.0 --libs-only-l $(STDERR_TO_DEVNULL))
56 CPPFLAGS_GTKGLEXT  ?= $(shell PKG_CONFIG_PATH=$(PKG_CONFIG_PATH) $(PKGCONFIG) gtkglext-1.0 --cflags $(STDERR_TO_DEVNULL))
57 LIBS_GTKGLEXT      ?= $(shell PKG_CONFIG_PATH=$(PKG_CONFIG_PATH) $(PKGCONFIG) gtkglext-1.0 --libs-only-L $(STDERR_TO_DEVNULL)) \
58                       $(shell PKG_CONFIG_PATH=$(PKG_CONFIG_PATH) $(PKGCONFIG) gtkglext-1.0 --libs-only-l $(STDERR_TO_DEVNULL))
59 CPPFLAGS_GL        ?=
60 LIBS_GL            ?= -lGL # -lopengl32 on Win32
61 CPPFLAGS_DL        ?=
62 LIBS_DL            ?= -ldl # nothing on Win32
63 CPPFLAGS_ZLIB      ?=
64 LIBS_ZLIB          ?= -lz
65 DEPEND_ON_MAKEFILE ?= yes
66 DEPENDENCIES_CHECK ?= quiet
67 # or: off, verbose
68
69 # these are used on Win32 only
70 GTKDIR             ?= $(shell PKG_CONFIG_PATH=$(PKG_CONFIG_PATH) $(PKGCONFIG) gtk+-2.0 --variable=prefix $(STDERR_TO_DEVNULL))
71 WHICHDLL           ?= which
72
73 # alias mingw32 OSes
74 ifeq ($(OS),MINGW32_NT-6.0)
75         OS = Win32
76 endif
77
78 CFLAGS_COMMON = -MMD -W -Wall -Wcast-align -Wcast-qual -Wno-unused-parameter
79 CPPFLAGS_COMMON =
80 LDFLAGS_COMMON =
81 LIBS_COMMON =
82 CXXFLAGS_COMMON = -Wno-non-virtual-dtor -Wreorder -fno-exceptions -fno-rtti
83
84 ifeq ($(BUILD),debug)
85 ifeq ($(findstring $(CFLAGS),-g),)
86         CFLAGS_COMMON += -g
87         # only add -g if no -g flag is in $(CFLAGS)
88 endif
89 ifeq ($(findstring $(CFLAGS),-O),)
90         CFLAGS_COMMON += -O
91         # only add -O if no -O flag is in $(CFLAGS)
92 endif
93         CPPFLAGS_COMMON +=
94         LDFLAGS_COMMON +=
95 else ifeq ($(BUILD),extradebug)
96 ifeq ($(findstring $(CFLAGS),-g),)
97         CFLAGS_COMMON += -g3
98         # only add -g3 if no -g flag is in $(CFLAGS)
99 endif
100         CPPFLAGS_COMMON += -D_DEBUG
101         LDFLAGS_COMMON +=
102 else ifeq ($(BUILD),release)
103 ifeq ($(findstring $(CFLAGS),-O),)
104         CFLAGS_COMMON += -O3
105         # only add -O3 if no -O flag is in $(CFLAGS)
106         # to allow overriding the optimizations
107 endif
108         CPPFLAGS_COMMON +=
109         LDFLAGS_COMMON += -s
110 else
111 $(error Unsupported build type: $(BUILD))
112 endif
113
114 ifeq ($(OS),Linux)
115         CPPFLAGS_COMMON += -DPOSIX -DXWINDOWS -D_LINUX
116         CFLAGS_COMMON += -fPIC
117         LDFLAGS_DLL = -fPIC -ldl
118         LIBS_COMMON = -lpthread
119         EXE = x86
120         A = a
121         DLL = so
122         MWINDOWS =
123 else ifeq ($(OS),Win32)
124         CPPFLAGS_COMMON += -DWIN32 -D_WIN32 -D_inline=inline
125         CFLAGS_COMMON += -mms-bitfields
126         LDFLAGS_DLL = --dll -Wl,--add-stdcall-alias
127         LIBS_COMMON = -lws2_32 -luser32 -lgdi32
128         EXE = exe
129         A = a
130         DLL = dll
131         MWINDOWS = -mwindows
132
133         # workaround: we have no "ldd" for Win32, so...
134         LDD =
135         # workaround: OpenGL library for Win32 is called opengl32.dll
136         LIBS_GL = -lopengl32
137         # workaround: no -ldl on Win32
138         LIBS_DL = 
139 #else ifeq ($(OS),Darwin)
140 #       EXE = ppc
141 else
142 $(error Unsupported build OS: $(OS))
143 endif
144
145 # VERSION!
146 RADIANT_VERSION = 1.5.0-div0
147 RADIANT_MAJOR_VERSION = 5
148 RADIANT_MINOR_VERSION = 0
149 CPPFLAGS += -DRADIANT_VERSION="\"$(RADIANT_VERSION)\"" -DRADIANT_MAJOR_VERSION="\"$(RADIANT_MAJOR_VERSION)\"" -DRADIANT_MINOR_VERSION="\"$(RADIANT_MINOR_VERSION)\"" -DRADIANT_ABOUTMSG="\"$(RADIANT_ABOUTMSG)\""
150
151 .PHONY: all
152 all: \
153         dependencies-check \
154         binaries \
155         install-data \
156         install-dll \
157
158 .PHONY: dependencies-check
159 ifeq ($(findstring $(DEPENDENCIES_CHECK),off),off)
160 dependencies-check:
161         @$(ECHO) dependencies checking disabled, good luck...
162 else
163 dependencies-check:
164         @$(ECHO)
165         @if [ x"$(DEPENDENCIES_CHECK)" = x"verbose" ]; then set -x; fi; \
166         checkbinary() \
167         { \
168                 $(ECHO_NOLF) "Checking for $$2 ($$1)... "; \
169                 $$2 --help $(TO_DEVNULL); \
170                 if [ $$? != 127 ]; then \
171                         $(ECHO) "found."; \
172                 else \
173                         $(ECHO) "not found, please install it or set PATH right!"; \
174                         $(ECHO) "To see the failed commands, set DEPENDENCIES_CHECK=verbose"; \
175                         $(ECHO) "To proceed anyway, set DEPENDENCIES_CHECK=off"; \
176                         exit 1; \
177                 fi; \
178         }; \
179         $(ECHO) checking that the build tools exist; \
180         checkbinary "bash (or another shell)" "$(SH)"; \
181         checkbinary coreutils "$(ECHO)"; \
182         checkbinary coreutils "$(ECHO_NOLF)"; \
183         checkbinary coreutils "$(CAT)"; \
184         checkbinary coreutils "$(MKDIR)"; \
185         checkbinary coreutils "$(CP)"; \
186         checkbinary coreutils "$(CP_R)"; \
187         checkbinary coreutils "$(RM)"; \
188         checkbinary coreutils "$(RM_R)"; \
189         checkbinary coreutils "$(ECHO) test $(TEE_STDERR)"; \
190         checkbinary findutils "$(FIND)"; \
191         checkbinary diff "$(DIFF)"; \
192         checkbinary gcc "$(CC)"; \
193         checkbinary g++ "$(CXX)"; \
194         checkbinary binutils "$(RANLIB)"; \
195         checkbinary binutils "$(AR)"; \
196         [ "$(OS)" != "Win32" ] && checkbinary libc6 "$(LDD)"; \
197         $(ECHO) All required tools have been found!
198         @$(ECHO)
199         @if [ x"$(DEPENDENCIES_CHECK)" = x"verbose" ]; then set -x; fi; \
200         checkheader() \
201         { \
202                 $(ECHO_NOLF) "Checking for $$2 ($$1)... "; \
203                 if \
204                         $(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 $(TO_DEVNULL) && \
205                         $(CXX) conftest.o $(LDFLAGS) $(LDFLAGS_COMMON) $$5 $(LIBS_COMMON) $(LIBS) -o conftest $(TO_DEVNULL); \
206                 then \
207                         $(RM) conftest conftest.o conftest.d; \
208                         $(ECHO) "found."; \
209                 else \
210                         $(RM) conftest conftest.o conftest.d; \
211                         $(ECHO) "not found, please install it or set PKG_CONFIG_PATH right!"; \
212                         $(ECHO) "To see the failed commands, set DEPENDENCIES_CHECK=verbose"; \
213                         $(ECHO) "To proceed anyway, set DEPENDENCIES_CHECK=off"; \
214                         exit 1; \
215                 fi; \
216         }; \
217         $(ECHO) checking that the dependencies exist; \
218         checkheader libglib2.0-dev glib/gutils.h g_path_is_absolute "$(CPPFLAGS_GLIB)" "$(LIBS_GLIB)"; \
219         checkheader libxml2-dev libxml/xpath.h xmlXPathInit "$(CPPFLAGS_XML)" "$(LIBS_XML)"; \
220         checkheader libpng12-dev png.h png_create_read_struct "$(CPPFLAGS_PNG)" "$(LIBS_PNG)"; \
221         checkheader "mesa-common-dev (or another OpenGL library)" GL/gl.h glClear "$(CPPFLAGS_GL)" "$(LIBS_GL)"; \
222         checkheader libgtk2.0-dev gtk/gtkdialog.h gtk_dialog_run "$(CPPFLAGS_GTK)" "$(LIBS_GTK)"; \
223         checkheader libgtkglext1-dev gtk/gtkglwidget.h gtk_widget_get_gl_context "$(CPPFLAGS_GTKGLEXT)" "$(LIBS_GTKGLEXT)"; \
224         [ "$(OS)" != "Win32" ] && checkheader libc6-dev dlfcn.h dlopen "$(CPPFLAGS_DL)" "$(LIBS_DL)"; \
225         checkheader zlib1g-dev zlib.h zlibVersion "$(CPPFLAGS_ZLIB)" "$(LIBS_ZLIB)"; \
226         $(ECHO) All required libraries have been found!
227         @$(ECHO)
228 endif
229
230 .PHONY: binaries
231 binaries: \
232         install/heretic2/h2data.$(EXE) \
233         install/modules/archivepak.$(DLL) \
234         install/modules/archivewad.$(DLL) \
235         install/modules/archivezip.$(DLL) \
236         install/modules/entity.$(DLL) \
237         install/modules/image.$(DLL) \
238         install/modules/imagehl.$(DLL) \
239         install/modules/imagepng.$(DLL) \
240         install/modules/imageq2.$(DLL) \
241         install/modules/mapq3.$(DLL) \
242         install/modules/mapxml.$(DLL) \
243         install/modules/md3model.$(DLL) \
244         install/modules/model.$(DLL) \
245         install/modules/shaders.$(DLL) \
246         install/modules/vfspk3.$(DLL) \
247         install/plugins/bobtoolz.$(DLL) \
248         install/plugins/brushexport.$(DLL) \
249         install/plugins/prtview.$(DLL) \
250         install/plugins/shaderplug.$(DLL) \
251         install/plugins/sunplug.$(DLL) \
252         install/plugins/ufoaiplug.$(DLL) \
253         install/q2map.$(EXE) \
254         install/q3data.$(EXE) \
255         install/q3map2.$(EXE) \
256         install/qdata3.$(EXE) \
257         install/radiant.$(EXE) \
258
259 .PHONY: clean
260 clean:
261         $(RM_R) install/
262         $(FIND) . \( -name \*.o -o -name \*.d -o -name \*.$(DLL) -o -name \*.$(A) -o -name \*.$(EXE) \) -exec $(RM) {} \;
263
264 %.$(EXE):
265         file=$@; $(MKDIR) $${file%/*}
266         $(CXX) $^ $(LDFLAGS) $(LDFLAGS_COMMON) $(LDFLAGS_EXTRA) $(LIBS_EXTRA) $(LIBS_COMMON) $(LIBS) -o $@
267         [ -z "$(LDD)" ] || [ -z "`$(LDD) -r $@ $(STDERR_TO_STDOUT) $(STDOUT_TO_DEVNULL) $(TEE_STDERR)`" ] || { $(RM) $@; exit 1; }
268
269 %.$(A):
270         $(AR) rc $@ $^
271         $(RANLIB) $@
272
273 %.$(DLL):
274         file=$@; $(MKDIR) $${file%/*}
275         $(CXX) $^ $(LDFLAGS) $(LDFLAGS_COMMON) $(LDFLAGS_EXTRA) $(LDFLAGS_DLL) $(LIBS_EXTRA) $(LIBS_COMMON) $(LIBS) -shared -o $@
276         [ -z "$(LDD)" ] || [ -z "`$(LDD) -r $@ $(STDERR_TO_STDOUT) $(STDOUT_TO_DEVNULL) $(TEE_STDERR)`" ] || { $(RM) $@; exit 1; }
277
278 %.o: %.cpp $(if $(findstring $(DEPEND_ON_MAKEFILE),yes),$(wildcard Makefile*),)
279         $(CXX) $< $(CFLAGS) $(CXXFLAGS) $(CFLAGS_COMMON) $(CXXFLAGS_COMMON) $(CPPFLAGS) $(CPPFLAGS_COMMON) $(CPPFLAGS_EXTRA) $(TARGET_ARCH) -c -o $@
280
281 %.o: %.c $(if $(findstring $(DEPEND_ON_MAKEFILE),yes),$(wildcard Makefile*),)
282         $(CC) $< $(CFLAGS) $(CFLAGS_COMMON) $(CPPFLAGS) $(CPPFLAGS_COMMON) $(CPPFLAGS_EXTRA) $(TARGET_ARCH) -c -o $@
283
284 install/q3map2.$(EXE): LIBS_EXTRA := $(LIBS_XML) $(LIBS_GLIB) $(LIBS_PNG)
285 install/q3map2.$(EXE): CPPFLAGS_EXTRA := $(CPPFLAGS_XML) $(CPPFLAGS_GLIB) $(CPPFLAGS_PNG) -Itools/quake3/common -Ilibs -Iinclude
286 install/q3map2.$(EXE): \
287         tools/quake3/common/cmdlib.o \
288         tools/quake3/common/imagelib.o \
289         tools/quake3/common/inout.o \
290         tools/quake3/common/md4.o \
291         tools/quake3/common/mutex.o \
292         tools/quake3/common/polylib.o \
293         tools/quake3/common/scriplib.o \
294         tools/quake3/common/threads.o \
295         tools/quake3/common/unzip.o \
296         tools/quake3/common/vfs.o \
297         tools/quake3/q3map2/brush.o \
298         tools/quake3/q3map2/brush_primit.o \
299         tools/quake3/q3map2/bspfile_abstract.o \
300         tools/quake3/q3map2/bspfile_ibsp.o \
301         tools/quake3/q3map2/bspfile_rbsp.o \
302         tools/quake3/q3map2/bsp.o \
303         tools/quake3/q3map2/convert_ase.o \
304         tools/quake3/q3map2/convert_map.o \
305         tools/quake3/q3map2/decals.o \
306         tools/quake3/q3map2/facebsp.o \
307         tools/quake3/q3map2/fog.o \
308         tools/quake3/q3map2/image.o \
309         tools/quake3/q3map2/leakfile.o \
310         tools/quake3/q3map2/light_bounce.o \
311         tools/quake3/q3map2/lightmaps_ydnar.o \
312         tools/quake3/q3map2/light.o \
313         tools/quake3/q3map2/light_trace.o \
314         tools/quake3/q3map2/light_ydnar.o \
315         tools/quake3/q3map2/main.o \
316         tools/quake3/q3map2/map.o \
317         tools/quake3/q3map2/mesh.o \
318         tools/quake3/q3map2/model.o \
319         tools/quake3/q3map2/patch.o \
320         tools/quake3/q3map2/path_init.o \
321         tools/quake3/q3map2/portals.o \
322         tools/quake3/q3map2/prtfile.o \
323         tools/quake3/q3map2/shaders.o \
324         tools/quake3/q3map2/surface_extra.o \
325         tools/quake3/q3map2/surface_foliage.o \
326         tools/quake3/q3map2/surface_fur.o \
327         tools/quake3/q3map2/surface_meta.o \
328         tools/quake3/q3map2/surface.o \
329         tools/quake3/q3map2/tjunction.o \
330         tools/quake3/q3map2/tree.o \
331         tools/quake3/q3map2/visflow.o \
332         tools/quake3/q3map2/vis.o \
333         tools/quake3/q3map2/writebsp.o \
334         libddslib.$(A) \
335         libjpeg6.$(A) \
336         libl_net.$(A) \
337         libmathlib.$(A) \
338         libpicomodel.$(A) \
339
340 libmathlib.$(A): CPPFLAGS_EXTRA := -Ilibs
341 libmathlib.$(A): \
342         libs/mathlib/bbox.o \
343         libs/mathlib/line.o \
344         libs/mathlib/m4x4.o \
345         libs/mathlib/mathlib.o \
346         libs/mathlib/ray.o \
347
348 libl_net.$(A): CPPFLAGS_EXTRA := -Ilibs
349 libl_net.$(A): \
350         libs/l_net/l_net.o \
351         $(if $(findstring $(OS),Win32),libs/l_net/l_net_wins.o,libs/l_net/l_net_berkley.o) \
352
353 libjpeg6.$(A): CPPFLAGS_EXTRA := -Ilibs/jpeg6 -Ilibs
354 libjpeg6.$(A): \
355         libs/jpeg6/jcomapi.o \
356         libs/jpeg6/jdapimin.o \
357         libs/jpeg6/jdapistd.o \
358         libs/jpeg6/jdatasrc.o \
359         libs/jpeg6/jdcoefct.o \
360         libs/jpeg6/jdcolor.o \
361         libs/jpeg6/jddctmgr.o \
362         libs/jpeg6/jdhuff.o \
363         libs/jpeg6/jdinput.o \
364         libs/jpeg6/jdmainct.o \
365         libs/jpeg6/jdmarker.o \
366         libs/jpeg6/jdmaster.o \
367         libs/jpeg6/jdpostct.o \
368         libs/jpeg6/jdsample.o \
369         libs/jpeg6/jdtrans.o \
370         libs/jpeg6/jerror.o \
371         libs/jpeg6/jfdctflt.o \
372         libs/jpeg6/jidctflt.o \
373         libs/jpeg6/jmemmgr.o \
374         libs/jpeg6/jmemnobs.o \
375         libs/jpeg6/jpgload.o \
376         libs/jpeg6/jutils.o \
377
378 libpicomodel.$(A): CPPFLAGS_EXTRA := -Ilibs
379 libpicomodel.$(A): \
380         libs/picomodel/lwo/clip.o \
381         libs/picomodel/lwo/envelope.o \
382         libs/picomodel/lwo/list.o \
383         libs/picomodel/lwo/lwio.o \
384         libs/picomodel/lwo/lwo2.o \
385         libs/picomodel/lwo/lwob.o \
386         libs/picomodel/lwo/pntspols.o \
387         libs/picomodel/lwo/surface.o \
388         libs/picomodel/lwo/vecmath.o \
389         libs/picomodel/lwo/vmap.o \
390         libs/picomodel/picointernal.o \
391         libs/picomodel/picomodel.o \
392         libs/picomodel/picomodules.o \
393         libs/picomodel/pm_3ds.o \
394         libs/picomodel/pm_ase.o \
395         libs/picomodel/pm_fm.o \
396         libs/picomodel/pm_lwo.o \
397         libs/picomodel/pm_md2.o \
398         libs/picomodel/pm_md3.o \
399         libs/picomodel/pm_mdc.o \
400         libs/picomodel/pm_ms3d.o \
401         libs/picomodel/pm_obj.o \
402         libs/picomodel/pm_terrain.o \
403
404 libddslib.$(A): CPPFLAGS_EXTRA := -Ilibs
405 libddslib.$(A): \
406         libs/ddslib/ddslib.o \
407
408 install/q3data.$(EXE): LIBS_EXTRA := $(LIBS_XML) $(LIBS_GLIB)
409 install/q3data.$(EXE): CPPFLAGS_EXTRA := $(CPPFLAGS_XML) $(CPPFLAGS_GLIB) -Itools/quake3/common -Ilibs -Iinclude
410 install/q3data.$(EXE): \
411         tools/quake3/common/aselib.o \
412         tools/quake3/common/bspfile.o \
413         tools/quake3/common/cmdlib.o \
414         tools/quake3/common/imagelib.o \
415         tools/quake3/common/inout.o \
416         tools/quake3/common/md4.o \
417         tools/quake3/common/scriplib.o \
418         tools/quake3/common/trilib.o \
419         tools/quake3/common/unzip.o \
420         tools/quake3/common/vfs.o \
421         tools/quake3/q3data/3dslib.o \
422         tools/quake3/q3data/compress.o \
423         tools/quake3/q3data/images.o \
424         tools/quake3/q3data/md3lib.o \
425         tools/quake3/q3data/models.o \
426         tools/quake3/q3data/p3dlib.o \
427         tools/quake3/q3data/polyset.o \
428         tools/quake3/q3data/q3data.o \
429         tools/quake3/q3data/stripper.o \
430         tools/quake3/q3data/video.o \
431         libl_net.$(A) \
432         libmathlib.$(A) \
433
434 install/radiant.$(EXE): LDFLAGS_EXTRA := $(MWINDOWS)
435 install/radiant.$(EXE): LIBS_EXTRA := $(LIBS_GL) $(LIBS_DL) $(LIBS_XML) $(LIBS_GLIB) $(LIBS_GTK) $(LIBS_GTKGLEXT)
436 install/radiant.$(EXE): CPPFLAGS_EXTRA := $(CPPFLAGS_GL) $(CPPFLAGS_DL) $(CPPFLAGS_XML) $(CPPFLAGS_GLIB) $(CPPFLAGS_GTK) $(CPPFLAGS_GTKGLEXT) -Ilibs -Iinclude
437 install/radiant.$(EXE): \
438         radiant/autosave.o \
439         radiant/brushmanip.o \
440         radiant/brushmodule.o \
441         radiant/brushnode.o \
442         radiant/brush.o \
443         radiant/brush_primit.o \
444         radiant/brushtokens.o \
445         radiant/brushxml.o \
446         radiant/build.o \
447         radiant/camwindow.o \
448         radiant/clippertool.o \
449         radiant/commands.o \
450         radiant/console.o \
451         radiant/csg.o \
452         radiant/dialog.o \
453         radiant/eclass_def.o \
454         radiant/eclass_doom3.o \
455         radiant/eclass_fgd.o \
456         radiant/eclass.o \
457         radiant/eclass_xml.o \
458         radiant/entityinspector.o \
459         radiant/entitylist.o \
460         radiant/entity.o \
461         radiant/environment.o \
462         radiant/error.o \
463         radiant/feedback.o \
464         radiant/filetypes.o \
465         radiant/filters.o \
466         radiant/findtexturedialog.o \
467         radiant/glwidget.o \
468         radiant/grid.o \
469         radiant/groupdialog.o \
470         radiant/gtkdlgs.o \
471         radiant/gtkmisc.o \
472         radiant/help.o \
473         radiant/image.o \
474         radiant/mainframe.o \
475         radiant/main.o \
476         radiant/map.o \
477         $(if $(findstring $(OS),Win32),radiant/multimon.o,) \
478         radiant/mru.o \
479         radiant/nullmodel.o \
480         radiant/parse.o \
481         radiant/patchdialog.o \
482         radiant/patchmanip.o \
483         radiant/patchmodule.o \
484         radiant/patch.o \
485         radiant/pluginapi.o \
486         radiant/pluginmanager.o \
487         radiant/pluginmenu.o \
488         radiant/plugin.o \
489         radiant/plugintoolbar.o \
490         radiant/points.o \
491         radiant/preferencedictionary.o \
492         radiant/preferences.o \
493         radiant/qe3.o \
494         radiant/qgl.o \
495         radiant/referencecache.o \
496         radiant/renderer.o \
497         radiant/renderstate.o \
498         radiant/scenegraph.o \
499         radiant/selection.o \
500         radiant/select.o \
501         radiant/server.o \
502         radiant/shaders.o \
503         radiant/sockets.o \
504         radiant/stacktrace.o \
505         radiant/surfacedialog.o \
506         radiant/texmanip.o \
507         radiant/textures.o \
508         radiant/texwindow.o \
509         radiant/timer.o \
510         radiant/treemodel.o \
511         radiant/undo.o \
512         radiant/url.o \
513         radiant/view.o \
514         radiant/watchbsp.o \
515         radiant/winding.o \
516         radiant/windowobservers.o \
517         radiant/xmlstuff.o \
518         radiant/xywindow.o \
519         libcmdlib.$(A) \
520         libgtkutil.$(A) \
521         libl_net.$(A) \
522         libmathlib.$(A) \
523         libprofile.$(A) \
524         libxmllib.$(A) \
525
526 libcmdlib.$(A): CPPFLAGS_EXTRA := -Ilibs
527 libcmdlib.$(A): \
528         libs/cmdlib/cmdlib.o \
529
530 libprofile.$(A): CPPFLAGS_EXTRA := -Ilibs -Iinclude
531 libprofile.$(A): \
532         libs/profile/file.o \
533         libs/profile/profile.o \
534
535 libgtkutil.$(A): CPPFLAGS_EXTRA := $(CPPFLAGS_GLIB) $(CPPFLAGS_GTK) $(CPPFLAGS_GTKGLEXT) -Ilibs -Iinclude
536 libgtkutil.$(A): \
537         libs/gtkutil/accelerator.o \
538         libs/gtkutil/button.o \
539         libs/gtkutil/clipboard.o \
540         libs/gtkutil/closure.o \
541         libs/gtkutil/container.o \
542         libs/gtkutil/cursor.o \
543         libs/gtkutil/dialog.o \
544         libs/gtkutil/entry.o \
545         libs/gtkutil/filechooser.o \
546         libs/gtkutil/frame.o \
547         libs/gtkutil/glfont.o \
548         libs/gtkutil/glwidget.o \
549         libs/gtkutil/idledraw.o \
550         libs/gtkutil/image.o \
551         libs/gtkutil/menu.o \
552         libs/gtkutil/messagebox.o \
553         libs/gtkutil/nonmodal.o \
554         libs/gtkutil/paned.o \
555         libs/gtkutil/pointer.o \
556         libs/gtkutil/toolbar.o \
557         libs/gtkutil/widget.o \
558         libs/gtkutil/window.o \
559         libs/gtkutil/xorrectangle.o \
560
561 libxmllib.$(A): CPPFLAGS_EXTRA := $(CPPFLAGS_XML) $(CPPFLAGS_GLIB) -Ilibs -Iinclude
562 libxmllib.$(A): \
563         libs/xml/ixml.o \
564         libs/xml/xmlelement.o \
565         libs/xml/xmlparser.o \
566         libs/xml/xmltextags.o \
567         libs/xml/xmlwriter.o \
568
569 install/modules/archivezip.$(DLL): LIBS_EXTRA := $(LIBS_ZLIB)
570 install/modules/archivezip.$(DLL): CPPFLAGS_EXTRA := $(CPPFLAGS_ZLIB) -Ilibs -Iinclude
571 install/modules/archivezip.$(DLL): \
572         plugins/archivezip/archive.o \
573         plugins/archivezip/pkzip.o \
574         plugins/archivezip/plugin.o \
575         plugins/archivezip/zlibstream.o \
576
577 install/modules/archivewad.$(DLL): CPPFLAGS_EXTRA := -Ilibs -Iinclude
578 install/modules/archivewad.$(DLL): \
579         plugins/archivewad/archive.o \
580         plugins/archivewad/plugin.o \
581         plugins/archivewad/wad.o \
582
583 install/modules/archivepak.$(DLL): CPPFLAGS_EXTRA := -Ilibs -Iinclude
584 install/modules/archivepak.$(DLL): \
585         plugins/archivepak/archive.o \
586         plugins/archivepak/pak.o \
587         plugins/archivepak/plugin.o \
588
589 install/modules/entity.$(DLL): CPPFLAGS_EXTRA := -Ilibs -Iinclude
590 install/modules/entity.$(DLL): \
591         plugins/entity/angle.o \
592         plugins/entity/angles.o \
593         plugins/entity/colour.o \
594         plugins/entity/doom3group.o \
595         plugins/entity/eclassmodel.o \
596         plugins/entity/entity.o \
597         plugins/entity/filters.o \
598         plugins/entity/generic.o \
599         plugins/entity/group.o \
600         plugins/entity/light.o \
601         plugins/entity/miscmodel.o \
602         plugins/entity/model.o \
603         plugins/entity/modelskinkey.o \
604         plugins/entity/namedentity.o \
605         plugins/entity/origin.o \
606         plugins/entity/plugin.o \
607         plugins/entity/rotation.o \
608         plugins/entity/scale.o \
609         plugins/entity/skincache.o \
610         plugins/entity/targetable.o \
611
612 install/modules/image.$(DLL): CPPFLAGS_EXTRA := -Ilibs -Iinclude
613 install/modules/image.$(DLL): \
614         plugins/image/bmp.o \
615         plugins/image/dds.o \
616         plugins/image/image.o \
617         plugins/image/jpeg.o \
618         plugins/image/pcx.o \
619         plugins/image/tga.o \
620         libddslib.$(A) \
621         libjpeg6.$(A) \
622
623 install/modules/imageq2.$(DLL): CPPFLAGS_EXTRA := -Ilibs -Iinclude
624 install/modules/imageq2.$(DLL): \
625         plugins/imageq2/imageq2.o \
626         plugins/imageq2/wal32.o \
627         plugins/imageq2/wal.o \
628
629 install/modules/imagehl.$(DLL): CPPFLAGS_EXTRA := -Ilibs -Iinclude
630 install/modules/imagehl.$(DLL): \
631         plugins/imagehl/hlw.o \
632         plugins/imagehl/imagehl.o \
633         plugins/imagehl/mip.o \
634         plugins/imagehl/sprite.o \
635
636 install/modules/imagepng.$(DLL): LIBS_EXTRA := $(LIBS_PNG)
637 install/modules/imagepng.$(DLL): CPPFLAGS_EXTRA := $(CPPFLAGS_PNG) -Ilibs -Iinclude
638 install/modules/imagepng.$(DLL): \
639         plugins/imagepng/plugin.o \
640
641 install/modules/mapq3.$(DLL): CPPFLAGS_EXTRA := -Ilibs -Iinclude
642 install/modules/mapq3.$(DLL): \
643         plugins/mapq3/parse.o \
644         plugins/mapq3/plugin.o \
645         plugins/mapq3/write.o \
646
647 install/modules/mapxml.$(DLL): LIBS_EXTRA := $(LIBS_XML) $(LIBS_GLIB)
648 install/modules/mapxml.$(DLL): CPPFLAGS_EXTRA := $(CPPFLAGS_XML) $(CPPFLAGS_GLIB) -Ilibs -Iinclude
649 install/modules/mapxml.$(DLL): \
650         plugins/mapxml/plugin.o \
651         plugins/mapxml/xmlparse.o \
652         plugins/mapxml/xmlwrite.o \
653
654 install/modules/md3model.$(DLL): CPPFLAGS_EXTRA := -Ilibs -Iinclude
655 install/modules/md3model.$(DLL): \
656         plugins/md3model/md2.o \
657         plugins/md3model/md3.o \
658         plugins/md3model/md5.o \
659         plugins/md3model/mdc.o \
660         plugins/md3model/mdlimage.o \
661         plugins/md3model/mdl.o \
662         plugins/md3model/plugin.o \
663
664 install/modules/model.$(DLL): CPPFLAGS_EXTRA := -Ilibs -Iinclude
665 install/modules/model.$(DLL): \
666         plugins/model/model.o \
667         plugins/model/plugin.o \
668         libpicomodel.$(A) \
669
670 install/modules/shaders.$(DLL): LIBS_EXTRA := $(LIBS_GLIB)
671 install/modules/shaders.$(DLL): CPPFLAGS_EXTRA := $(CPPFLAGS_GLIB) -Ilibs -Iinclude
672 install/modules/shaders.$(DLL): \
673         plugins/shaders/plugin.o \
674         plugins/shaders/shaders.o \
675
676 install/modules/vfspk3.$(DLL): LIBS_EXTRA := $(LIBS_GLIB)
677 install/modules/vfspk3.$(DLL): CPPFLAGS_EXTRA := $(CPPFLAGS_GLIB) -Ilibs -Iinclude
678 install/modules/vfspk3.$(DLL): \
679         plugins/vfspk3/archive.o \
680         plugins/vfspk3/vfs.o \
681         plugins/vfspk3/vfspk3.o \
682
683 install/plugins/bobtoolz.$(DLL): LIBS_EXTRA := $(LIBS_GLIB) $(LIBS_GTK)
684 install/plugins/bobtoolz.$(DLL): CPPFLAGS_EXTRA := $(CPPFLAGS_GLIB) $(CPPFLAGS_GTK) -Ilibs -Iinclude
685 install/plugins/bobtoolz.$(DLL): \
686         contrib/bobtoolz/bobToolz-GTK.o \
687         contrib/bobtoolz/bsploader.o \
688         contrib/bobtoolz/cportals.o \
689         contrib/bobtoolz/DBobView.o \
690         contrib/bobtoolz/DBrush.o \
691         contrib/bobtoolz/DEntity.o \
692         contrib/bobtoolz/DEPair.o \
693         contrib/bobtoolz/dialogs/dialogs-gtk.o \
694         contrib/bobtoolz/DMap.o \
695         contrib/bobtoolz/DPatch.o \
696         contrib/bobtoolz/DPlane.o \
697         contrib/bobtoolz/DPoint.o \
698         contrib/bobtoolz/DShape.o \
699         contrib/bobtoolz/DTrainDrawer.o \
700         contrib/bobtoolz/DTreePlanter.o \
701         contrib/bobtoolz/DVisDrawer.o \
702         contrib/bobtoolz/DWinding.o \
703         contrib/bobtoolz/funchandlers-GTK.o \
704         contrib/bobtoolz/lists.o \
705         contrib/bobtoolz/misc.o \
706         contrib/bobtoolz/ScriptParser.o \
707         contrib/bobtoolz/shapes.o \
708         contrib/bobtoolz/visfind.o \
709         libcmdlib.$(A) \
710         libmathlib.$(A) \
711         libprofile.$(A) \
712
713 install/plugins/brushexport.$(DLL): LIBS_EXTRA := $(LIBS_GLIB) $(LIBS_GTK)
714 install/plugins/brushexport.$(DLL): CPPFLAGS_EXTRA := $(CPPFLAGS_GLIB) $(CPPFLAGS_GTK) -Ilibs -Iinclude
715 install/plugins/brushexport.$(DLL): \
716         contrib/brushexport/callbacks.o \
717         contrib/brushexport/export.o \
718         contrib/brushexport/interface.o \
719         contrib/brushexport/plugin.o \
720         contrib/brushexport/support.o \
721
722 install/plugins/prtview.$(DLL): LIBS_EXTRA := $(LIBS_GLIB) $(LIBS_GTK)
723 install/plugins/prtview.$(DLL): CPPFLAGS_EXTRA := $(CPPFLAGS_GLIB) $(CPPFLAGS_GTK) -Ilibs -Iinclude
724 install/plugins/prtview.$(DLL): \
725         contrib/prtview/AboutDialog.o \
726         contrib/prtview/ConfigDialog.o \
727         contrib/prtview/LoadPortalFileDialog.o \
728         contrib/prtview/portals.o \
729         contrib/prtview/prtview.o \
730         libprofile.$(A) \
731
732 install/plugins/shaderplug.$(DLL): LIBS_EXTRA := $(LIBS_GLIB) $(LIBS_GTK) $(LIBS_XML)
733 install/plugins/shaderplug.$(DLL): CPPFLAGS_EXTRA := $(CPPFLAGS_GLIB) $(CPPFLAGS_GTK) $(CPPFLAGS_XML) -Ilibs -Iinclude
734 install/plugins/shaderplug.$(DLL): \
735         contrib/shaderplug/shaderplug.o \
736         libxmllib.$(A) \
737
738 install/plugins/sunplug.$(DLL): LIBS_EXTRA := $(LIBS_GLIB) $(LIBS_GTK)
739 install/plugins/sunplug.$(DLL): CPPFLAGS_EXTRA := $(CPPFLAGS_GLIB) $(CPPFLAGS_GTK) -Ilibs -Iinclude
740 install/plugins/sunplug.$(DLL): \
741         contrib/sunplug/sunplug.o \
742
743 install/qdata3.$(EXE): LIBS_EXTRA := $(LIBS_XML)
744 install/qdata3.$(EXE): CPPFLAGS_EXTRA := $(CPPFLAGS_XML) -Itools/quake2/common -Ilibs -Iinclude
745 install/qdata3.$(EXE): \
746         tools/quake2/common/bspfile.o \
747         tools/quake2/common/cmdlib.o \
748         tools/quake2/common/inout.o \
749         tools/quake2/common/l3dslib.o \
750         tools/quake2/common/lbmlib.o \
751         tools/quake2/common/mathlib.o \
752         tools/quake2/common/md4.o \
753         tools/quake2/common/path_init.o \
754         tools/quake2/common/polylib.o \
755         tools/quake2/common/scriplib.o \
756         tools/quake2/common/threads.o \
757         tools/quake2/common/trilib.o \
758         tools/quake2/qdata/images.o \
759         tools/quake2/qdata/models.o \
760         tools/quake2/qdata/qdata.o \
761         tools/quake2/qdata/sprites.o \
762         tools/quake2/qdata/tables.o \
763         tools/quake2/qdata/video.o \
764         libl_net.$(A) \
765
766 install/q2map.$(EXE): LIBS_EXTRA := $(LIBS_XML)
767 install/q2map.$(EXE): CPPFLAGS_EXTRA := $(CPPFLAGS_XML) -Itools/quake2/common -Ilibs -Iinclude
768 install/q2map.$(EXE): \
769         tools/quake2/common/bspfile.o \
770         tools/quake2/common/cmdlib.o \
771         tools/quake2/common/inout.o \
772         tools/quake2/common/l3dslib.o \
773         tools/quake2/common/lbmlib.o \
774         tools/quake2/common/mathlib.o \
775         tools/quake2/common/md4.o \
776         tools/quake2/common/path_init.o \
777         tools/quake2/common/polylib.o \
778         tools/quake2/common/scriplib.o \
779         tools/quake2/common/threads.o \
780         tools/quake2/common/trilib.o \
781         tools/quake2/q2map/brushbsp.o \
782         tools/quake2/q2map/csg.o \
783         tools/quake2/q2map/faces.o \
784         tools/quake2/q2map/flow.o \
785         tools/quake2/q2map/glfile.o \
786         tools/quake2/q2map/leakfile.o \
787         tools/quake2/q2map/lightmap.o \
788         tools/quake2/q2map/main.o \
789         tools/quake2/q2map/map.o \
790         tools/quake2/q2map/nodraw.o \
791         tools/quake2/q2map/patches.o \
792         tools/quake2/q2map/portals.o \
793         tools/quake2/q2map/prtfile.o \
794         tools/quake2/q2map/qbsp.o \
795         tools/quake2/q2map/qrad.o \
796         tools/quake2/q2map/qvis.o \
797         tools/quake2/q2map/textures.o \
798         tools/quake2/q2map/trace.o \
799         tools/quake2/q2map/tree.o \
800         tools/quake2/q2map/writebsp.o \
801         libl_net.$(A) \
802
803 install/plugins/ufoaiplug.$(DLL): LIBS_EXTRA := $(LIBS_GLIB) $(LIBS_GTK)
804 install/plugins/ufoaiplug.$(DLL): CPPFLAGS_EXTRA := $(CPPFLAGS_GLIB) $(CPPFLAGS_GTK) -Ilibs -Iinclude
805 install/plugins/ufoaiplug.$(DLL): \
806         contrib/ufoaiplug/ufoai_filters.o \
807         contrib/ufoaiplug/ufoai_gtk.o \
808         contrib/ufoaiplug/ufoai_level.o \
809         contrib/ufoaiplug/ufoai.o \
810
811 #install/plugins/bkgrnd2d.$(DLL): LIBS_EXTRA := $(LIBS_GLIB) $(LIBS_GTK)
812 #install/plugins/bkgrnd2d.$(DLL): CPPFLAGS_EXTRA := $(CPPFLAGS_GLIB) $(CPPFLAGS_GTK) -Ilibs -Iinclude
813 #install/plugins/bkgrnd2d.$(DLL): \
814 #       contrib/bkgrnd2d/bkgrnd2d.o \
815 #       contrib/bkgrnd2d/dialog.o \
816 #       contrib/bkgrnd2d/plugin.o \
817
818 install/heretic2/h2data.$(EXE): LIBS_EXTRA := $(LIBS_XML)
819 install/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
820 install/heretic2/h2data.$(EXE): \
821         tools/quake2/qdata_heretic2/common/bspfile.o \
822         tools/quake2/qdata_heretic2/common/cmdlib.o \
823         tools/quake2/qdata_heretic2/common/inout.o \
824         tools/quake2/qdata_heretic2/common/l3dslib.o \
825         tools/quake2/qdata_heretic2/common/lbmlib.o \
826         tools/quake2/qdata_heretic2/common/mathlib.o \
827         tools/quake2/qdata_heretic2/common/md4.o \
828         tools/quake2/qdata_heretic2/common/path_init.o \
829         tools/quake2/qdata_heretic2/common/qfiles.o \
830         tools/quake2/qdata_heretic2/common/scriplib.o \
831         tools/quake2/qdata_heretic2/common/threads.o \
832         tools/quake2/qdata_heretic2/common/token.o \
833         tools/quake2/qdata_heretic2/common/trilib.o \
834         tools/quake2/qdata_heretic2/qcommon/reference.o \
835         tools/quake2/qdata_heretic2/qcommon/resourcemanager.o \
836         tools/quake2/qdata_heretic2/qcommon/skeletons.o \
837         tools/quake2/qdata_heretic2/animcomp.o \
838         tools/quake2/qdata_heretic2/book.o \
839         tools/quake2/qdata_heretic2/fmodels.o \
840         tools/quake2/qdata_heretic2/images.o \
841         tools/quake2/qdata_heretic2/jointed.o \
842         tools/quake2/qdata_heretic2/models.o \
843         tools/quake2/qdata_heretic2/pics.o \
844         tools/quake2/qdata_heretic2/qdata.o \
845         tools/quake2/qdata_heretic2/qd_skeletons.o \
846         tools/quake2/qdata_heretic2/sprites.o \
847         tools/quake2/qdata_heretic2/svdcmp.o \
848         tools/quake2/qdata_heretic2/tables.o \
849         tools/quake2/qdata_heretic2/tmix.o \
850         tools/quake2/qdata_heretic2/video.o \
851         libl_net.$(A) \
852
853 .PHONY: install-data
854 install-data: binaries
855         $(MKDIR) install/games
856         $(FIND) install/ -name .svn -exec $(RM_R) {} \; -prune
857         set -ex; \
858         for GAME in games/*; do \
859                 if [ -d "$$GAME/tools" ]; then \
860                         GAME=$$GAME/tools; \
861                 fi; \
862                 for GAMEFILE in $$GAME/games/*.game; do \
863                         $(CP) "$$GAMEFILE" install/games/; \
864                 done; \
865                 for GAMEDIR in $$GAME/*.game; do \
866                         $(CP_R) "$$GAMEDIR" install/; \
867                 done; \
868         done
869         $(ECHO) $(RADIANT_MINOR_VERSION) > install/RADIANT_MINOR
870         $(ECHO) $(RADIANT_MAJOR_VERSION) > install/RADIANT_MAJOR
871         $(CP_R) setup/data/tools/* install/
872         $(FIND) install/ -name .svn -exec $(RM_R) {} \; -prune
873
874 .PHONY: install-dll
875 ifeq ($(OS),Win32)
876 install-dll: binaries
877         MKDIR="$(MKDIR)" CP="$(CP)" CAT="$(CAT)" GTKDIR="$(GTKDIR)" WHICHDLL="$(WHICHDLL)" $(SH) install-dlls.sh
878 else
879 install-dll: binaries
880         @$(ECHO) No DLL inclusion implemented for this target.
881 endif
882
883 -include $(shell find . -name \*.d)