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