added the first plugin
[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
50 .PHONY: clean
51 clean:
52         $(FIND) . \( -name \*.o -o -name \*.$(SO) -o -name \*.$(A) -o -name \*.$(EXE) \) -exec $(RM) {} \;
53
54 %.$(EXE):
55         $(CXX) -o $@ $^ $(LDFLAGS) $(LIBS)
56
57 %.$(A):
58         $(AR) rc $@ $^
59         $(RANLIB) $@
60
61 %.$(DLL):
62         $(CXX) -shared -o $@ $^ $(LDFLAGS) $(LDFLAGS_DLL) $(LIBS)
63
64 install/q3map2.$(EXE): LIBS := -lmhash
65 install/q3map2.$(EXE): CPPFLAGS := $(CPPFLAGS_COMMON) $(CPPFLAGS_XML) $(CPPFLAGS_GLIB) $(CPPFLAGS_PNG) -Itools/quake3/common -Ilibs -Iinclude
66 install/q3map2.$(EXE): LDFLAGS := $(LDFLAGS_COMMON) $(LDFLAGS_XML) $(LDFLAGS_GLIB) $(LDFLAGS_PNG) 
67 install/q3map2.$(EXE): \
68         tools/quake3/common/cmdlib.o \
69         tools/quake3/common/imagelib.o \
70         tools/quake3/common/inout.o \
71         tools/quake3/common/mutex.o \
72         tools/quake3/common/polylib.o \
73         tools/quake3/common/scriplib.o \
74         tools/quake3/common/threads.o \
75         tools/quake3/common/unzip.o \
76         tools/quake3/common/vfs.o \
77         tools/quake3/q3map2/brush.o \
78         tools/quake3/q3map2/brush_primit.o \
79         tools/quake3/q3map2/bspfile_abstract.o \
80         tools/quake3/q3map2/bspfile_ibsp.o \
81         tools/quake3/q3map2/bspfile_rbsp.o \
82         tools/quake3/q3map2/bsp.o \
83         tools/quake3/q3map2/convert_ase.o \
84         tools/quake3/q3map2/convert_map.o \
85         tools/quake3/q3map2/decals.o \
86         tools/quake3/q3map2/facebsp.o \
87         tools/quake3/q3map2/fog.o \
88         tools/quake3/q3map2/image.o \
89         tools/quake3/q3map2/leakfile.o \
90         tools/quake3/q3map2/light_bounce.o \
91         tools/quake3/q3map2/lightmaps_ydnar.o \
92         tools/quake3/q3map2/light.o \
93         tools/quake3/q3map2/light_trace.o \
94         tools/quake3/q3map2/light_ydnar.o \
95         tools/quake3/q3map2/main.o \
96         tools/quake3/q3map2/map.o \
97         tools/quake3/q3map2/mesh.o \
98         tools/quake3/q3map2/model.o \
99         tools/quake3/q3map2/patch.o \
100         tools/quake3/q3map2/path_init.o \
101         tools/quake3/q3map2/portals.o \
102         tools/quake3/q3map2/prtfile.o \
103         tools/quake3/q3map2/shaders.o \
104         tools/quake3/q3map2/surface_extra.o \
105         tools/quake3/q3map2/surface_foliage.o \
106         tools/quake3/q3map2/surface_fur.o \
107         tools/quake3/q3map2/surface_meta.o \
108         tools/quake3/q3map2/surface.o \
109         tools/quake3/q3map2/tjunction.o \
110         tools/quake3/q3map2/tree.o \
111         tools/quake3/q3map2/visflow.o \
112         tools/quake3/q3map2/vis.o \
113         tools/quake3/q3map2/writebsp.o \
114         libmathlib.$(A) \
115         libl_net.$(A) \
116         libjpeg6.$(A) \
117         libpicomodel.$(A) \
118         libddslib.$(A) \
119
120 libmathlib.$(A): CPPFLAGS := $(CPPFLAGS_COMMON) -Ilibs
121 libmathlib.$(A): \
122         libs/mathlib/mathlib.o \
123         libs/mathlib/bbox.o \
124         libs/mathlib/line.o \
125         libs/mathlib/m4x4.o \
126         libs/mathlib/ray.o \
127
128 libl_net.$(A): CPPFLAGS := $(CPPFLAGS_COMMON) -Ilibs
129 libl_net.$(A): \
130         libs/l_net/l_net.o \
131         libs/l_net/l_net_$(NETAPI).o \
132
133 libjpeg6.$(A): CPPFLAGS := $(CPPFLAGS_COMMON) -Ilibs/jpeg6 -Ilibs
134 libjpeg6.$(A): \
135         libs/jpeg6/jcomapi.o \
136         libs/jpeg6/jdcoefct.o \
137         libs/jpeg6/jdinput.o \
138         libs/jpeg6/jdpostct.o \
139         libs/jpeg6/jfdctflt.o \
140         libs/jpeg6/jpgload.o \
141         libs/jpeg6/jdapimin.o \
142         libs/jpeg6/jdcolor.o \
143         libs/jpeg6/jdmainct.o \
144         libs/jpeg6/jdsample.o \
145         libs/jpeg6/jidctflt.o \
146         libs/jpeg6/jutils.o \
147         libs/jpeg6/jdapistd.o \
148         libs/jpeg6/jddctmgr.o \
149         libs/jpeg6/jdmarker.o \
150         libs/jpeg6/jdtrans.o \
151         libs/jpeg6/jmemmgr.o \
152         libs/jpeg6/jdatasrc.o \
153         libs/jpeg6/jdhuff.o \
154         libs/jpeg6/jdmaster.o \
155         libs/jpeg6/jerror.o \
156         libs/jpeg6/jmemnobs.o \
157
158 libpicomodel.$(A): CPPFLAGS := $(CPPFLAGS_COMMON) -Ilibs
159 libpicomodel.$(A): \
160         libs/picomodel/picointernal.o \
161         libs/picomodel/picomodel.o \
162         libs/picomodel/picomodules.o \
163         libs/picomodel/pm_3ds.o \
164         libs/picomodel/pm_ase.o \
165         libs/picomodel/pm_md3.o \
166         libs/picomodel/pm_obj.o \
167         libs/picomodel/pm_ms3d.o \
168         libs/picomodel/pm_mdc.o \
169         libs/picomodel/pm_fm.o \
170         libs/picomodel/pm_md2.o \
171         libs/picomodel/pm_lwo.o \
172         libs/picomodel/pm_terrain.o \
173         libs/picomodel/lwo/clip.o \
174         libs/picomodel/lwo/envelope.o \
175         libs/picomodel/lwo/list.o \
176         libs/picomodel/lwo/lwio.o \
177         libs/picomodel/lwo/lwo2.o \
178         libs/picomodel/lwo/lwob.o \
179         libs/picomodel/lwo/pntspols.o \
180         libs/picomodel/lwo/surface.o \
181         libs/picomodel/lwo/vecmath.o \
182         libs/picomodel/lwo/vmap.o \
183
184 libddslib.$(A): CPPFLAGS := $(CPPFLAGS_COMMON) -Ilibs
185 libddslib.$(A): \
186         libs/ddslib/ddslib.o \
187
188 install/q3data.$(EXE): LIBS := -lmhash
189 install/q3data.$(EXE): CPPFLAGS := $(CPPFLAGS_COMMON) $(CPPFLAGS_XML) $(CPPFLAGS_GLIB) -Itools/quake3/common -Ilibs -Iinclude
190 install/q3data.$(EXE): LDFLAGS := $(LDFLAGS_COMMON) $(LDFLAGS_XML) $(LDFLAGS_GLIB)
191 install/q3data.$(EXE): \
192         tools/quake3/common/aselib.o \
193         tools/quake3/common/bspfile.o \
194         tools/quake3/common/cmdlib.o \
195         tools/quake3/common/imagelib.o \
196         tools/quake3/common/inout.o \
197         tools/quake3/common/md4.o \
198         tools/quake3/common/scriplib.o \
199         tools/quake3/common/trilib.o \
200         tools/quake3/common/unzip.o \
201         tools/quake3/common/vfs.o \
202         tools/quake3/q3data/3dslib.o \
203         tools/quake3/q3data/compress.o \
204         tools/quake3/q3data/images.o \
205         tools/quake3/q3data/md3lib.o \
206         tools/quake3/q3data/models.o \
207         tools/quake3/q3data/p3dlib.o \
208         tools/quake3/q3data/polyset.o \
209         tools/quake3/q3data/q3data.o \
210         tools/quake3/q3data/stripper.o \
211         tools/quake3/q3data/video.o \
212         libmathlib.$(A) \
213         libl_net.$(A) \
214
215 install/radiant.$(EXE): LIBS := -lmhash -ldl -lGL -static-libgcc 
216 install/radiant.$(EXE): CPPFLAGS := $(CPPFLAGS_COMMON) $(CPPFLAGS_XML) $(CPPFLAGS_GLIB) $(CPPFLAGS_GTK) $(CPPFLAGS_GTKGLEXT) -Ilibs -Iinclude
217 install/radiant.$(EXE): LDFLAGS := -fPIC -Wl,-fini,fini_stub $(LDFLAGS_COMMON) $(LDFLAGS_XML) $(LDFLAGS_GLIB) $(LDFLAGS_GTK) $(LDFLAGS_GTKGLEXT)
218 install/radiant.$(EXE): \
219         radiant/autosave.o \
220         radiant/brush.o \
221         radiant/brushmanip.o \
222         radiant/brushmodule.o \
223         radiant/brushnode.o \
224         radiant/brushtokens.o \
225         radiant/brushxml.o \
226         radiant/brush_primit.o \
227         radiant/build.o \
228         radiant/camwindow.o \
229         radiant/clippertool.o \
230         radiant/commands.o \
231         radiant/console.o \
232         radiant/csg.o \
233         radiant/dialog.o \
234         radiant/eclass.o \
235         radiant/eclass_def.o \
236         radiant/eclass_doom3.o \
237         radiant/eclass_fgd.o \
238         radiant/eclass_xml.o \
239         radiant/entity.o \
240         radiant/entityinspector.o \
241         radiant/entitylist.o \
242         radiant/environment.o \
243         radiant/error.o \
244         radiant/feedback.o \
245         radiant/filetypes.o \
246         radiant/filters.o \
247         radiant/findtexturedialog.o \
248         radiant/glwidget.o \
249         radiant/grid.o \
250         radiant/groupdialog.o \
251         radiant/gtkdlgs.o \
252         radiant/gtkmisc.o \
253         radiant/help.o \
254         radiant/image.o \
255         radiant/main.o \
256         radiant/mainframe.o \
257         radiant/map.o \
258         radiant/mru.o \
259         radiant/nullmodel.o \
260         radiant/parse.o \
261         radiant/patch.o \
262         radiant/patchdialog.o \
263         radiant/patchmanip.o \
264         radiant/patchmodule.o \
265         radiant/plugin.o \
266         radiant/pluginapi.o \
267         radiant/pluginmanager.o \
268         radiant/pluginmenu.o \
269         radiant/plugintoolbar.o \
270         radiant/points.o \
271         radiant/preferencedictionary.o \
272         radiant/preferences.o \
273         radiant/qe3.o \
274         radiant/qgl.o \
275         radiant/referencecache.o \
276         radiant/renderer.o \
277         radiant/renderstate.o \
278         radiant/scenegraph.o \
279         radiant/stacktrace.o \
280         radiant/select.o \
281         radiant/selection.o \
282         radiant/server.o \
283         radiant/shaders.o \
284         radiant/sockets.o \
285         radiant/surfacedialog.o \
286         radiant/texmanip.o \
287         radiant/textures.o \
288         radiant/texwindow.o \
289         radiant/timer.o \
290         radiant/treemodel.o \
291         radiant/undo.o \
292         radiant/url.o \
293         radiant/view.o \
294         radiant/watchbsp.o \
295         radiant/winding.o \
296         radiant/windowobservers.o \
297         radiant/xmlstuff.o \
298         radiant/xywindow.o \
299         libmathlib.$(A) \
300         libcmdlib.$(A) \
301         libl_net.$(A) \
302         libprofile.$(A) \
303         libgtkutil.$(A) \
304         libxmllib.$(A) \
305
306 libcmdlib.$(A): CPPFLAGS := $(CPPFLAGS_COMMON) -Ilibs
307 libcmdlib.$(A): \
308         libs/cmdlib/cmdlib.o \
309
310 libprofile.$(A): CPPFLAGS := $(CPPFLAGS_COMMON) -Ilibs -Iinclude
311 libprofile.$(A): \
312         libs/profile/profile.o \
313         libs/profile/file.o \
314
315 libgtkutil.$(A): CPPFLAGS := $(CPPFLAGS_COMMON) $(CPPFLAGS_GLIB) $(CPPFLAGS_GTK) $(CPPFLAGS_GTKGLEXT) -Ilibs -Iinclude
316 libgtkutil.$(A): \
317         libs/gtkutil/accelerator.o \
318         libs/gtkutil/button.o \
319         libs/gtkutil/clipboard.o \
320         libs/gtkutil/closure.o \
321         libs/gtkutil/container.o \
322         libs/gtkutil/cursor.o \
323         libs/gtkutil/dialog.o \
324         libs/gtkutil/entry.o \
325         libs/gtkutil/frame.o \
326         libs/gtkutil/filechooser.o \
327         libs/gtkutil/glfont.o \
328         libs/gtkutil/glwidget.o \
329         libs/gtkutil/image.o \
330         libs/gtkutil/idledraw.o \
331         libs/gtkutil/menu.o \
332         libs/gtkutil/messagebox.o \
333         libs/gtkutil/nonmodal.o \
334         libs/gtkutil/paned.o \
335         libs/gtkutil/pointer.o \
336         libs/gtkutil/toolbar.o \
337         libs/gtkutil/widget.o \
338         libs/gtkutil/window.o \
339         libs/gtkutil/xorrectangle.o \
340
341 libxmllib.$(A): CPPFLAGS := $(CPPFLAGS_COMMON) $(CPPFLAGS_XML) $(CPPFLAGS_GLIB) -Ilibs -Iinclude
342 libxmllib.$(A): \
343         libs/xml/ixml.o \
344         libs/xml/xmlparser.o \
345         libs/xml/xmlwriter.o \
346         libs/xml/xmlelement.o \
347         libs/xml/xmltextags.o \
348
349 install/modules/archivezip.$(DLL): LIBS := -lz
350 install/modules/archivezip.$(DLL): CPPFLAGS := $(CPPFLAGS_COMMON) -Ilibs -Iinclude
351 install/modules/archivezip.$(DLL): \
352         plugins/archivezip/plugin.o \
353         plugins/archivezip/archive.o \
354         plugins/archivezip/pkzip.o \
355         plugins/archivezip/zlibstream.o \
356