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