now added all plugins that make sense for Q3 maps
[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 RADIANT_ABOUTMSG = Custom build
13
14 LDD ?= ldd
15 FIND ?= find
16 RANLIB ?= ranlib
17 AR ?= ar
18 MKDIR ?= mkdir -p
19 CP ?= cp
20 CP_R ?= $(CP) -r
21 RM_R ?= $(RM) -r
22
23 TEE_STDERR ?= | tee /dev/stderr
24
25 CPPFLAGS_GLIB = `pkg-config glib-2.0 --cflags`
26 LIBS_GLIB = `pkg-config glib-2.0 --libs`
27
28 CPPFLAGS_XML = `xml2-config --cflags`
29 LIBS_XML = `xml2-config --libs`
30
31 CPPFLAGS_PNG = `libpng-config --cflags`
32 LIBS_PNG = `libpng-config --libs`
33
34 CPPFLAGS_GTK = `pkg-config gtk+-2.0 --cflags`
35 LIBS_GTK = `pkg-config gtk+-2.0 --libs`
36
37 CPPFLAGS_GTKGLEXT = `pkg-config gtkglext-1.0 --cflags`
38 LIBS_GTKGLEXT = `pkg-config gtkglext-1.0 --libs`
39
40 LDFLAGS := $(LDFLAGS_COMMON)
41
42 # from qe3.cpp: const char* const EXECUTABLE_TYPE = 
43 # from qe3.cpp: #if defined(__linux__) || defined (__FreeBSD__)
44 # from qe3.cpp: "x86"
45 # from qe3.cpp: #elif defined(__APPLE__)
46 # from qe3.cpp: "ppc"
47 # from qe3.cpp: #elif defined(WIN32)
48 # from qe3.cpp: "exe"
49 # from qe3.cpp: #else
50 # from qe3.cpp: #error "unknown platform"
51 # from qe3.cpp: #endif
52 # from qe3.cpp: ;
53
54 .PHONY: all
55 all: \
56         makeversion \
57         install/q3map2.$(EXE) \
58         install/q3data.$(EXE) \
59         install/radiant.$(EXE) \
60         install/modules/archivezip.$(DLL) \
61         install/modules/entity.$(DLL) \
62         install/modules/image.$(DLL) \
63         install/modules/imagepng.$(DLL) \
64         install/modules/mapq3.$(DLL) \
65         install/modules/md3model.$(DLL) \
66         install/modules/model.$(DLL) \
67         install/modules/shaders.$(DLL) \
68         install/modules/vfspk3.$(DLL) \
69         install/modules/bobtoolz.$(DLL) \
70         install/modules/brushexport.$(DLL) \
71         install-data \
72
73 .PHONY: clean
74 clean:
75         $(RM_R) install/
76         $(FIND) . \( -name \*.o -o -name \*.$(DLL) -o -name \*.$(A) -o -name \*.$(EXE) \) -exec $(RM) {} \;
77
78 %.$(EXE):
79         dir=$@; $(MKDIR) $${dir%/*}
80         $(CXX) -o $@ $^ $(LDFLAGS) $(LIBS)
81         [ -z "$(LDD)" ] || [ -z "`$(LDD) -r $@ 2>&1 >/dev/null $(TEE_STDERR)`" ] || { $(RM) $@; exit 1; }
82
83 %.$(A):
84         $(AR) rc $@ $^
85         $(RANLIB) $@
86
87 %.$(DLL):
88         dir=$@; $(MKDIR) $${dir%/*}
89         $(CXX) -shared -o $@ $^ $(LDFLAGS) $(LDFLAGS_DLL) $(LIBS)
90         [ -z "$(LDD)" ] || [ -z "`$(LDD) -r $@ 2>&1 >/dev/null $(TEE_STDERR)`" ] || { $(RM) $@; exit 1; }
91
92 install/q3map2.$(EXE): LIBS := $(LIBS_XML) $(LIBS_GLIB) $(LIBS_PNG)
93 install/q3map2.$(EXE): CPPFLAGS := $(CPPFLAGS_COMMON) $(CPPFLAGS_XML) $(CPPFLAGS_GLIB) $(CPPFLAGS_PNG) -Itools/quake3/common -Ilibs -Iinclude
94 install/q3map2.$(EXE): \
95         tools/quake3/common/cmdlib.o \
96         tools/quake3/common/imagelib.o \
97         tools/quake3/common/inout.o \
98         tools/quake3/common/mutex.o \
99         tools/quake3/common/polylib.o \
100         tools/quake3/common/scriplib.o \
101         tools/quake3/common/threads.o \
102         tools/quake3/common/unzip.o \
103         tools/quake3/common/vfs.o \
104         tools/quake3/common/md4.o \
105         tools/quake3/q3map2/brush.o \
106         tools/quake3/q3map2/brush_primit.o \
107         tools/quake3/q3map2/bspfile_abstract.o \
108         tools/quake3/q3map2/bspfile_ibsp.o \
109         tools/quake3/q3map2/bspfile_rbsp.o \
110         tools/quake3/q3map2/bsp.o \
111         tools/quake3/q3map2/convert_ase.o \
112         tools/quake3/q3map2/convert_map.o \
113         tools/quake3/q3map2/decals.o \
114         tools/quake3/q3map2/facebsp.o \
115         tools/quake3/q3map2/fog.o \
116         tools/quake3/q3map2/image.o \
117         tools/quake3/q3map2/leakfile.o \
118         tools/quake3/q3map2/light_bounce.o \
119         tools/quake3/q3map2/lightmaps_ydnar.o \
120         tools/quake3/q3map2/light.o \
121         tools/quake3/q3map2/light_trace.o \
122         tools/quake3/q3map2/light_ydnar.o \
123         tools/quake3/q3map2/main.o \
124         tools/quake3/q3map2/map.o \
125         tools/quake3/q3map2/mesh.o \
126         tools/quake3/q3map2/model.o \
127         tools/quake3/q3map2/patch.o \
128         tools/quake3/q3map2/path_init.o \
129         tools/quake3/q3map2/portals.o \
130         tools/quake3/q3map2/prtfile.o \
131         tools/quake3/q3map2/shaders.o \
132         tools/quake3/q3map2/surface_extra.o \
133         tools/quake3/q3map2/surface_foliage.o \
134         tools/quake3/q3map2/surface_fur.o \
135         tools/quake3/q3map2/surface_meta.o \
136         tools/quake3/q3map2/surface.o \
137         tools/quake3/q3map2/tjunction.o \
138         tools/quake3/q3map2/tree.o \
139         tools/quake3/q3map2/visflow.o \
140         tools/quake3/q3map2/vis.o \
141         tools/quake3/q3map2/writebsp.o \
142         libmathlib.$(A) \
143         libl_net.$(A) \
144         libjpeg6.$(A) \
145         libpicomodel.$(A) \
146         libddslib.$(A) \
147
148 libmathlib.$(A): CPPFLAGS := $(CPPFLAGS_COMMON) -Ilibs
149 libmathlib.$(A): \
150         libs/mathlib/mathlib.o \
151         libs/mathlib/bbox.o \
152         libs/mathlib/line.o \
153         libs/mathlib/m4x4.o \
154         libs/mathlib/ray.o \
155
156 libl_net.$(A): CPPFLAGS := $(CPPFLAGS_COMMON) -Ilibs
157 libl_net.$(A): \
158         libs/l_net/l_net.o \
159         libs/l_net/l_net_$(NETAPI).o \
160
161 libjpeg6.$(A): CPPFLAGS := $(CPPFLAGS_COMMON) -Ilibs/jpeg6 -Ilibs
162 libjpeg6.$(A): \
163         libs/jpeg6/jcomapi.o \
164         libs/jpeg6/jdcoefct.o \
165         libs/jpeg6/jdinput.o \
166         libs/jpeg6/jdpostct.o \
167         libs/jpeg6/jfdctflt.o \
168         libs/jpeg6/jpgload.o \
169         libs/jpeg6/jdapimin.o \
170         libs/jpeg6/jdcolor.o \
171         libs/jpeg6/jdmainct.o \
172         libs/jpeg6/jdsample.o \
173         libs/jpeg6/jidctflt.o \
174         libs/jpeg6/jutils.o \
175         libs/jpeg6/jdapistd.o \
176         libs/jpeg6/jddctmgr.o \
177         libs/jpeg6/jdmarker.o \
178         libs/jpeg6/jdtrans.o \
179         libs/jpeg6/jmemmgr.o \
180         libs/jpeg6/jdatasrc.o \
181         libs/jpeg6/jdhuff.o \
182         libs/jpeg6/jdmaster.o \
183         libs/jpeg6/jerror.o \
184         libs/jpeg6/jmemnobs.o \
185
186 libpicomodel.$(A): CPPFLAGS := $(CPPFLAGS_COMMON) -Ilibs
187 libpicomodel.$(A): \
188         libs/picomodel/picointernal.o \
189         libs/picomodel/picomodel.o \
190         libs/picomodel/picomodules.o \
191         libs/picomodel/pm_3ds.o \
192         libs/picomodel/pm_ase.o \
193         libs/picomodel/pm_md3.o \
194         libs/picomodel/pm_obj.o \
195         libs/picomodel/pm_ms3d.o \
196         libs/picomodel/pm_mdc.o \
197         libs/picomodel/pm_fm.o \
198         libs/picomodel/pm_md2.o \
199         libs/picomodel/pm_lwo.o \
200         libs/picomodel/pm_terrain.o \
201         libs/picomodel/lwo/clip.o \
202         libs/picomodel/lwo/envelope.o \
203         libs/picomodel/lwo/list.o \
204         libs/picomodel/lwo/lwio.o \
205         libs/picomodel/lwo/lwo2.o \
206         libs/picomodel/lwo/lwob.o \
207         libs/picomodel/lwo/pntspols.o \
208         libs/picomodel/lwo/surface.o \
209         libs/picomodel/lwo/vecmath.o \
210         libs/picomodel/lwo/vmap.o \
211
212 libddslib.$(A): CPPFLAGS := $(CPPFLAGS_COMMON) -Ilibs
213 libddslib.$(A): \
214         libs/ddslib/ddslib.o \
215
216 install/q3data.$(EXE): LIBS := $(LIBS_XML) $(LIBS_GLIB)
217 install/q3data.$(EXE): CPPFLAGS := $(CPPFLAGS_COMMON) $(CPPFLAGS_XML) $(CPPFLAGS_GLIB) -Itools/quake3/common -Ilibs -Iinclude
218 install/q3data.$(EXE): \
219         tools/quake3/common/aselib.o \
220         tools/quake3/common/bspfile.o \
221         tools/quake3/common/cmdlib.o \
222         tools/quake3/common/imagelib.o \
223         tools/quake3/common/inout.o \
224         tools/quake3/common/md4.o \
225         tools/quake3/common/scriplib.o \
226         tools/quake3/common/trilib.o \
227         tools/quake3/common/unzip.o \
228         tools/quake3/common/vfs.o \
229         tools/quake3/q3data/3dslib.o \
230         tools/quake3/q3data/compress.o \
231         tools/quake3/q3data/images.o \
232         tools/quake3/q3data/md3lib.o \
233         tools/quake3/q3data/models.o \
234         tools/quake3/q3data/p3dlib.o \
235         tools/quake3/q3data/polyset.o \
236         tools/quake3/q3data/q3data.o \
237         tools/quake3/q3data/stripper.o \
238         tools/quake3/q3data/video.o \
239         libmathlib.$(A) \
240         libl_net.$(A) \
241
242 install/radiant.$(EXE): LIBS := -ldl -lGL -static-libgcc $(LIBS_XML) $(LIBS_GLIB) $(LIBS_GTK) $(LIBS_GTKGLEXT)
243 install/radiant.$(EXE): CPPFLAGS := $(CPPFLAGS_COMMON) $(CPPFLAGS_XML) $(CPPFLAGS_GLIB) $(CPPFLAGS_GTK) $(CPPFLAGS_GTKGLEXT) -Ilibs -Iinclude
244 #install/radiant.$(EXE): LDFLAGS := -fPIC -Wl,-fini,fini_stub $(LDFLAGS_COMMON)
245 install/radiant.$(EXE): \
246         radiant/autosave.o \
247         radiant/brush.o \
248         radiant/brushmanip.o \
249         radiant/brushmodule.o \
250         radiant/brushnode.o \
251         radiant/brushtokens.o \
252         radiant/brushxml.o \
253         radiant/brush_primit.o \
254         radiant/build.o \
255         radiant/camwindow.o \
256         radiant/clippertool.o \
257         radiant/commands.o \
258         radiant/console.o \
259         radiant/csg.o \
260         radiant/dialog.o \
261         radiant/eclass.o \
262         radiant/eclass_def.o \
263         radiant/eclass_doom3.o \
264         radiant/eclass_fgd.o \
265         radiant/eclass_xml.o \
266         radiant/entity.o \
267         radiant/entityinspector.o \
268         radiant/entitylist.o \
269         radiant/environment.o \
270         radiant/error.o \
271         radiant/feedback.o \
272         radiant/filetypes.o \
273         radiant/filters.o \
274         radiant/findtexturedialog.o \
275         radiant/glwidget.o \
276         radiant/grid.o \
277         radiant/groupdialog.o \
278         radiant/gtkdlgs.o \
279         radiant/gtkmisc.o \
280         radiant/help.o \
281         radiant/image.o \
282         radiant/main.o \
283         radiant/mainframe.o \
284         radiant/map.o \
285         radiant/mru.o \
286         radiant/nullmodel.o \
287         radiant/parse.o \
288         radiant/patch.o \
289         radiant/patchdialog.o \
290         radiant/patchmanip.o \
291         radiant/patchmodule.o \
292         radiant/plugin.o \
293         radiant/pluginapi.o \
294         radiant/pluginmanager.o \
2