add entity and image plugins
[xonotic/netradiant.git] / Makefile
1 CFLAGS = -W -Wall -Wcast-align -Wcast-qual -Wno-unused-parameter -g3 -fPIC
2 CXXFLAGS = $(CFLAGS) -Wno-non-virtual-dtor -Wreorder -fno-exceptions -fno-rtti
3 CPPFLAGS_COMMON = -DPOSIX -DXWINDOWS -D_DEBUG -D_LINUX
4 LDFLAGS_COMMON = 
5 LDFLAGS_DLL = -fPIC -Wl,-fini,fini_stub -static-libgcc -ldl
6
7 EXE = x86
8 A = a
9 DLL = so
10 NETAPI = berkley
11
12 FIND ?= find
13 RANLIB ?= ranlib
14 AR ?= ar
15
16 CPPFLAGS_GLIB = `pkg-config glib-2.0 --cflags`
17 LDFLAGS_GLIB = `pkg-config glib-2.0 --libs`
18
19 CPPFLAGS_XML = `xml2-config --cflags`
20 LDFLAGS_XML = `xml2-config --libs`
21
22 CPPFLAGS_PNG = `libpng-config --cflags`
23 LDFLAGS_PNG = `libpng-config --libs`
24
25 CPPFLAGS_GTK = `pkg-config gtk+-2.0 --cflags`
26 LDFLAGS_GTK = `pkg-config gtk+-2.0 --libs`
27
28 CPPFLAGS_GTKGLEXT = `pkg-config gtkglext-1.0 --cflags`
29 LDFLAGS_GTKGLEXT = `pkg-config gtkglext-1.0 --libs`
30
31 # from qe3.cpp: const char* const EXECUTABLE_TYPE = 
32 # from qe3.cpp: #if defined(__linux__) || defined (__FreeBSD__)
33 # from qe3.cpp: "x86"
34 # from qe3.cpp: #elif defined(__APPLE__)
35 # from qe3.cpp: "ppc"
36 # from qe3.cpp: #elif defined(WIN32)
37 # from qe3.cpp: "exe"
38 # from qe3.cpp: #else
39 # from qe3.cpp: #error "unknown platform"
40 # from qe3.cpp: #endif
41 # from qe3.cpp: ;
42
43 .PHONY: all
44 all: \
45         install/q3map2.$(EXE) \
46         install/q3data.$(EXE) \
47         install/radiant.$(EXE) \
48         install/modules/archivezip.$(DLL) \
49         install/modules/entity.$(DLL) \
50         install/modules/image.$(DLL) \
51
52 .PHONY: clean
53 clean:
54         $(FIND) . \( -name \*.o -o -name \*.$(SO) -o -name \*.$(A) -o -name \*.$(EXE) \) -exec $(RM) {} \;
55
56 %.$(EXE):
57         $(CXX) -o $@ $^ $(LDFLAGS) $(LIBS)
58
59 %.$(A):
60         $(AR) rc $@ $^
61         $(RANLIB) $@
62
63 %.$(DLL):
64         $(CXX) -shared -o $@ $^ $(LDFLAGS) $(LDFLAGS_DLL) $(LIBS)
65
66 install/q3map2.$(EXE): LIBS := -lmhash
67 install/q3map2.$(EXE): CPPFLAGS := $(CPPFLAGS_COMMON) $(CPPFLAGS_XML) $(CPPFLAGS_GLIB) $(CPPFLAGS_PNG) -Itools/quake3/common -Ilibs -Iinclude
68 install/q3map2.$(EXE): LDFLAGS := $(LDFLAGS_COMMON) $(LDFLAGS_XML) $(LDFLAGS_GLIB) $(LDFLAGS_PNG) 
69 install/q3map2.$(EXE): \
70         tools/quake3/common/cmdlib.o \
71         tools/quake3/common/imagelib.o \
72         tools/quake3/common/inout.o \
73         tools/quake3/common/mutex.o \
74         tools/quake3/common/polylib.o \
75         tools/quake3/common/scriplib.o \
76         tools/quake3/common/threads.o \
77         tools/quake3/common/unzip.o \
78         tools/quake3/common/vfs.o \
79         tools/quake3/q3map2/brush.o \
80         tools/quake3/q3map2/brush_primit.o \
81         tools/quake3/q3map2/bspfile_abstract.o \
82         tools/quake3/q3map2/bspfile_ibsp.o \
83         tools/quake3/q3map2/bspfile_rbsp.o \
84         tools/quake3/q3map2/bsp.o \
85         tools/quake3/q3map2/convert_ase.o \
86         tools/quake3/q3map2/convert_map.o \
87         tools/quake3/q3map2/decals.o \
88         tools/quake3/q3map2/facebsp.o \
89         tools/quake3/q3map2/fog.o \
90         tools/quake3/q3map2/image.o \
91         tools/quake3/q3map2/leakfile.o \
92         tools/quake3/q3map2/light_bounce.o \
93         tools/quake3/q3map2/lightmaps_ydnar.o \
94         tools/quake3/q3map2/light.o \
95         tools/quake3/q3map2/light_trace.o \
96         tools/quake3/q3map2/light_ydnar.o \
97         tools/quake3/q3map2/main.o \
98         tools/quake3/q3map2/map.o \
99         tools/quake3/q3map2/mesh.o \
100         tools/quake3/q3map2/model.o \
101         tools/quake3/q3map2/patch.o \
102         tools/quake3/q3map2/path_init.o \
103         tools/quake3/q3map2/portals.o \
104         tools/quake3/q3map2/prtfile.o \
105         tools/quake3/q3map2/shaders.o \
106         tools/quake3/q3map2/surface_extra.o \
107         tools/quake3/q3map2/surface_foliage.o \
108         tools/quake3/q3map2/surface_fur.o \
109         tools/quake3/q3map2/surface_meta.o \
110         tools/quake3/q3map2/surface.o \
111         tools/quake3/q3map2/tjunction.o \
112         tools/quake3/q3map2/tree.o \
113         tools/quake3/q3map2/visflow.o \
114         tools/quake3/q3map2/vis.o \
115         tools/quake3/q3map2/writebsp.o \
116         libmathlib.$(A) \
117         libl_net.$(A) \
118         libjpeg6.$(A) \
119         libpicomodel.$(A) \
120         libddslib.$(A) \
121
122 libmathlib.$(A): CPPFLAGS := $(CPPFLAGS_COMMON) -Ilibs
123 libmathlib.$(A): \
124         libs/mathlib/mathlib.o \
125         libs/mathlib/bbox.o \
126         libs/mathlib/line.o \
127         libs/mathlib/m4x4.o \
128         libs/mathlib/ray.o \
129
130 libl_net.$(A): CPPFLAGS := $(CPPFLAGS_COMMON) -Ilibs
131 libl_net.$(A): \
132         libs/l_net/l_net.o \
133         libs/l_net/l_net_$(NETAPI).o \
134
135 libjpeg6.$(A): CPPFLAGS := $(CPPFLAGS_COMMON) -Ilibs/jpeg6 -Ilibs
136 libjpeg6.$(A): \
137         libs/jpeg6/jcomapi.o \
138         libs/jpeg6/jdcoefct.o \
139         libs/jpeg6/jdinput.o \
140         libs/jpeg6/jdpostct.o \
141         libs/jpeg6/jfdctflt.o \
142         libs/jpeg6/jpgload.o \
143         libs/jpeg6/jdapimin.o \
144         libs/jpeg6/jdcolor.o \
145         libs/jpeg6/jdmainct.o \
146         libs/jpeg6/jdsample.o \
147         libs/jpeg6/jidctflt.o \
148         libs/jpeg6/jutils.o \
149         libs/jpeg6/jdapistd.o \
150         libs/jpeg6/jddctmgr.o \
151         libs/jpeg6/jdmarker.o \
152         libs/jpeg6/jdtrans.o \
153         libs/jpeg6/jmemmgr.o \
154         libs/jpeg6/jdatasrc.o \
155         libs/jpeg6/jdhuff.o \
156         libs/jpeg6/jdmaster.o \
157         libs/jpeg6/jerror.o \
158         libs/jpeg6/jmemnobs.o \
159
160 libpicomodel.$(A): CPPFLAGS := $(CPPFLAGS_COMMON) -Ilibs
161 libpicomodel.$(A): \
162         libs/picomodel/picointernal.o \
163         libs/picomodel/picomodel.o \
164         libs/picomodel/picomodules.o \
165         libs/picomodel/pm_3ds.o \
166         libs/picomodel/pm_ase.o \
167         libs/picomodel/pm_md3.o \
168         libs/picomodel/pm_obj.o \
169         libs/picomodel/pm_ms3d.o \
170         libs/picomodel/pm_mdc.o \
171         libs/picomodel/pm_fm.o \
172         libs/picomodel/pm_md2.o \
173         libs/picomodel/pm_lwo.o \
174         libs/picomodel/pm_terrain.o \
175         libs/picomodel/lwo/clip.o \
176         libs/picomodel/lwo/envelope.o \
177         libs/picomodel/lwo/list.o \
178         libs/picomodel/lwo/lwio.o \
179         libs/picomodel/lwo/lwo2.o \
180         libs/picomodel/lwo/lwob.o \
181         libs/picomodel/lwo/pntspols.o \
182         libs/picomodel/lwo/surface.o \
183         libs/picomodel/lwo/vecmath.o \
184         libs/picomodel/lwo/vmap.o \
185
186 libddslib.$(A): CPPFLAGS := $(CPPFLAGS_COMMON) -Ilibs
187 libddslib.$(A): \
188         libs/ddslib/ddslib.o \
189
190 install/q3data.$(EXE): LIBS := -lmhash
191 install/q3data.$(EXE): CPPFLAGS := $(CPPFLAGS_COMMON) $(CPPFLAGS_XML) $(CPPFLAGS_GLIB) -Itools/quake3/common -Ilibs -Iinclude
192 install/q3data.$(EXE): LDFLAGS := $(LDFLAGS_COMMON) $(LDFLAGS_XML) $(LDFLAGS_GLIB)
193 install/q3data.$(EXE): \
194         tools/quake3/common/aselib.o \
195         tools/quake3/common/bspfile.o \
196         tools/quake3/common/cmdlib.o \
197         tools/quake3/common/imagelib.o \
198         tools/quake3/common/inout.o \
199         tools/quake3/common/md4.o \
200         tools/quake3/common/scriplib.o \
201         tools/quake3/common/trilib.o \
202         tools/quake3/common/unzip.o \
203         tools/quake3/common/vfs.o \
204         tools/quake3/q3data/3dslib.o \
205         tools/quake3/q3data/compress.o \
206         tools/quake3/q3data/images.o \
207         tools/quake3/q3data/md3lib.o \
208         tools/quake3/q3data/models.o \
209         tools/quake3/q3data/p3dlib.o \
210         tools/quake3/q3data/polyset.o \
211         tools/quake3/q3data/q3data.o \
212         tools/quake3/q3data/stripper.o \
213         tools/quake3/q3data/video.o \
214         libmathlib.$(A) \
215         libl_net.$(A) \
216
217 install/radiant.$(EXE): LIBS := -lmhash -ldl -lGL -static-libgcc 
218 install/radiant.$(EXE): CPPFLAGS := $(CPPFLAGS_COMMON) $(CPPFLAGS_XML) $(CPPFLAGS_GLIB) $(CPPFLAGS_GTK) $(CPPFLAGS_GTKGLEXT) -Ilibs -Iinclude
219 install/radiant.$(EXE): LDFLAGS := -fPIC -Wl,-fini,fini_stub $(LDFLAGS_COMMON) $(LDFLAGS_XML) $(LDFLAGS_GLIB) $(LDFLAGS_GTK) $(LDFLAGS_GTKGLEXT)
220 install/radiant.$(EXE): \
221         radiant/autosave.o \
222         radiant/brush.o \
223         radiant/brushmanip.o \
224         radiant/brushmodule.o \
225         radiant/brushnode.o \
226         radiant/brushtokens.o \
227         radiant/brushxml.o \
228         radiant/brush_primit.o \
229         radiant/build.o \
230         radiant/camwindow.o \
231         radiant/clippertool.o \
232         radiant/commands.o \
233         radiant/console.o \
234         radiant/csg.o \
235         radiant/dialog.o \
236         radiant/eclass.o \
237         radiant/eclass_def.o \
238         radiant/eclass_doom3.o \
239         radiant/eclass_fgd.o \
240         radiant/eclass_xml.o \
241         radiant/entity.o \
242         radiant/entityinspector.o \
243         radiant/entitylist.o \
244         radiant/environment.o \
245         radiant/error.o \
246         radiant/feedback.o \
247         radiant/filetypes.o \
248         radiant/filters.o \
249         radiant/findtexturedialog.o \
250         radiant/glwidget.o \
251         radiant/grid.o \
252         radiant/groupdialog.o \
253         radiant/gtkdlgs.o \
254         radiant/gtkmisc.o \
255         radiant/help.o \
256         radiant/image.o \
257         radiant/main.o \
258         radiant/mainframe.o \
259         radiant/map.o \
260         radiant/mru.o \
261         radiant/nullmodel.o \
262         radiant/parse.o \
263         radiant/patch.o \
264         radiant/patchdialog.o \
265         radiant/patchmanip.o \
266         radiant/patchmodule.o \
267         radiant/plugin.o \
268         radiant/pluginapi.o \
269         radiant/pluginmanager.o \
270         radiant/pluginmenu.o \
271         radiant/plugintoolbar.o \
272         radiant/points.o \
273         radiant/preferencedictionary.o \
274         radiant/preferences.o \
275         radiant/qe3.o \
276         radiant/qgl.o \
277         radiant/referencecache.o \
278         radiant/renderer.o \
279         radiant/renderstate.o \
280         radiant/scenegraph.o \
281         radiant/stacktrace.o \
282         radiant/select.o \
283         radiant/selection.o \
284         radiant/server.o \
285         radiant/shaders.o \
286         radiant/sockets.o \
287         radiant/surfacedialog.o \
288         radiant/texmanip.o \
289         radiant/textures.o \
290         radiant/texwindow.o \
291         radiant/timer.o \
292         radiant/treemodel.o \
293         radiant/undo.o \
294         radiant/url.o \
295         radiant/view.o \
296         radiant/watchbsp.o \
297         radiant/winding.o \
298         radiant/windowobservers.o \
299         radiant/xmlstuff.o \
300         radiant/xywindow.o \
301         libmathlib.$(A) \
302         libcmdlib.$(A) \
303         libl_net.$(A) \
304         libprofile.$(A) \
305         libgtkutil.$(A) \
306         libxmllib.$(A) \
307
308 libcmdlib.$(A): CPPFLAGS := $(CPPFLAGS_COMMON) -Ilibs
309 libcmdlib.$(A): \
310         libs/cmdlib/cmdlib.o \
311
312 libprofile.$(A): CPPFLAGS := $(CPPFLAGS_COMMON) -Ilibs -Iinclude
313 libprofile.$(A): \
314         libs/profile/profile.o \
315         libs/profile/file.o \
316
317 libgtkutil.$(A): CPPFLAGS := $(CPPFLAGS_COMMON) $(CPPFLAGS_GLIB) $(CPPFLAGS_GTK) $(CPPFLAGS_GTKGLEXT) -Ilibs -Iinclude
318 libgtkutil.$(A): \
319         libs/gtkutil/accelerator.o \
320         libs/gtkutil/button.o \
321         libs/gtkutil/clipboard.o \
322         libs/gtkutil/closure.o \
323         libs/gtkutil/container.o \
324         libs/gtkutil/cursor.o \
325         libs/gtkutil/dialog.o \
326         libs/gtkutil/entry.o \
327         libs/gtkutil/frame.o \
328         libs/gtkutil/filechooser.o \
329         libs/gtkutil/glfont.o \
330         libs/gtkutil/glwidget.o \
331         libs/gtkutil/image.o \
332         libs/gtkutil/idledraw.o \
333         libs/gtkutil/menu.o \
334         libs/gtkutil/messagebox.o \
335         libs/gtkutil/nonmodal.o \
336         libs/gtkutil/paned.o \
337         libs/gtkutil/pointer.o \
338         libs/gtkutil/toolbar.o \
339         libs/gtkutil/widget.o \
340         libs/gtkutil/window.o \
341         libs/gtkutil/xorrectangle.o \
342
343 libxmllib.$(A): CPPFLAGS := $(CPPFLAGS_COMMON) $(CPPFLAGS_XML) $(CPPFLAGS_GLIB) -Ilibs -Iinclude
344 libxmllib.$(A): \
345         libs/xml/ixml.o \
346         libs/xml/xmlparser.o \
347         libs/xml/xmlwriter.o \
348         libs/xml/xmlelement.o \
349         libs/xml/xmltextags.o \
350
351 install/modules/archivezip.$(DLL): LIBS := -lz
352 install/modules/archivezip.$(DLL): CPPFLAGS := $(CPPFLAGS_COMMON) -Ilibs -Iinclude
353 install/modules/archivezip.$(DLL): \
354         plugins/archivezip/plugin.o \
355         plugins/archivezip/archive.o \
356         plugins/archivezip/pkzip.o \
357         plugins/archivezip/zlibstream.o \
358
359 install/modules/entity.$(DLL): CPPFLAGS := $(CPPFLAGS_COMMON) -Ilibs -Iinclude
360 install/modules/entity.$(DLL): \
361         plugins/entity/plugin.o \
362         plugins/entity/entity.o \
363         plugins/entity/eclassmodel.o \
364         plugins/entity/generic.o \
365         plugins/entity/group.o \
366         plugins/entity/light.o \
367         plugins/entity/miscmodel.o \
368         plugins/entity/doom3group.o \
369         plugins/entity/skincache.o \
370         plugins/entity/angle.o \
371         plugins/entity/angles.o \
372         plugins/entity/colour.o \
373         plugins/entity/filters.o \
374         plugins/entity/model.o \
375         plugins/entity/namedentity.o \
376         plugins/entity/origin.o \
377         plugins/entity/scale.o \
378         plugins/entity/targetable.o \
379         plugins/entity/rotation.o \
380         plugins/entity/modelskinkey.o \
381
382 install/modules/image.$(DLL): CPPFLAGS := $(CPPFLAGS_COMMON) -Ilibs -Iinclude
383 install/modules/image.$(DLL): \
384         plugins/image/bmp.o \
385         plugins/image/jpeg.o \
386         plugins/image/image.o \
387         plugins/image/pcx.o \
388         plugins/image/tga.o \
389         plugins/image/dds.o \
390         libjpeg6.$(A) \
391         libddslib.$(A) \
392