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