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