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