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