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