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