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