add q3data
[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 # from qe3.cpp: const char* const EXECUTABLE_TYPE = 
25 # from qe3.cpp: #if defined(__linux__) || defined (__FreeBSD__)
26 # from qe3.cpp: "x86"
27 # from qe3.cpp: #elif defined(__APPLE__)
28 # from qe3.cpp: "ppc"
29 # from qe3.cpp: #elif defined(WIN32)
30 # from qe3.cpp: "exe"
31 # from qe3.cpp: #else
32 # from qe3.cpp: #error "unknown platform"
33 # from qe3.cpp: #endif
34 # from qe3.cpp: ;
35
36 .PHONY: all
37 all: \
38         install/q3map2.$(EXE) \
39         install/q3data.$(EXE) \
40
41 .PHONY: clean
42 clean:
43         $(FIND) . \( -name \*.o -o -name \*.$(SO) -o -name \*.$(A) -o -name \*.$(EXE) \) -exec $(RM) {} \;
44
45 %.$(EXE):
46         $(CXX) -o $@ $^ $(LDFLAGS) $(LIBS)
47
48 %.$(A):
49         $(AR) rc $@ $^
50         $(RANLIB) $@
51
52 install/q3map2.$(EXE): LIBS := -lmhash
53 install/q3map2.$(EXE): CPPFLAGS := $(CPPFLAGS_COMMON) $(CPPFLAGS_XML) $(CPPFLAGS_GLIB) $(CPPFLAGS_PNG) -Itools/quake3/common -Ilibs -Iinclude
54 install/q3map2.$(EXE): LDFLAGS := $(LDFLAGS_COMMON) $(LDFLAGS_XML) $(LDFLAGS_GLIB) $(LDFLAGS_PNG) 
55 install/q3map2.$(EXE): \
56         tools/quake3/common/cmdlib.o \
57         tools/quake3/common/imagelib.o \
58         tools/quake3/common/inout.o \
59         tools/quake3/common/mutex.o \
60         tools/quake3/common/polylib.o \
61         tools/quake3/common/scriplib.o \
62         tools/quake3/common/threads.o \
63         tools/quake3/common/unzip.o \
64         tools/quake3/common/vfs.o \
65         tools/quake3/q3map2/brush.o \
66         tools/quake3/q3map2/brush_primit.o \
67         tools/quake3/q3map2/bspfile_abstract.o \
68         tools/quake3/q3map2/bspfile_ibsp.o \
69         tools/quake3/q3map2/bspfile_rbsp.o \
70         tools/quake3/q3map2/bsp.o \
71         tools/quake3/q3map2/convert_ase.o \
72         tools/quake3/q3map2/convert_map.o \
73         tools/quake3/q3map2/decals.o \
74         tools/quake3/q3map2/facebsp.o \
75         tools/quake3/q3map2/fog.o \
76         tools/quake3/q3map2/image.o \
77         tools/quake3/q3map2/leakfile.o \
78         tools/quake3/q3map2/light_bounce.o \
79         tools/quake3/q3map2/lightmaps_ydnar.o \
80         tools/quake3/q3map2/light.o \
81         tools/quake3/q3map2/light_trace.o \
82         tools/quake3/q3map2/light_ydnar.o \
83         tools/quake3/q3map2/main.o \
84         tools/quake3/q3map2/map.o \
85         tools/quake3/q3map2/mesh.o \
86         tools/quake3/q3map2/model.o \
87         tools/quake3/q3map2/patch.o \
88         tools/quake3/q3map2/path_init.o \
89         tools/quake3/q3map2/portals.o \
90         tools/quake3/q3map2/prtfile.o \
91         tools/quake3/q3map2/shaders.o \
92         tools/quake3/q3map2/surface_extra.o \
93         tools/quake3/q3map2/surface_foliage.o \
94         tools/quake3/q3map2/surface_fur.o \
95         tools/quake3/q3map2/surface_meta.o \
96         tools/quake3/q3map2/surface.o \
97         tools/quake3/q3map2/tjunction.o \
98         tools/quake3/q3map2/tree.o \
99         tools/quake3/q3map2/visflow.o \
100         tools/quake3/q3map2/vis.o \
101         tools/quake3/q3map2/writebsp.o \
102         libmathlib.$(A) \
103         libl_net.$(A) \
104         libjpeg6.$(A) \
105         libpicomodel.$(A) \
106         libddslib.$(A) \
107
108 libmathlib.$(A): CPPFLAGS := $(CPPFLAGS_COMMON) -Ilibs
109 libmathlib.$(A): \
110         libs/mathlib/mathlib.o \
111         libs/mathlib/bbox.o \
112         libs/mathlib/line.o \
113         libs/mathlib/m4x4.o \
114         libs/mathlib/ray.o \
115
116 libl_net.$(A): CPPFLAGS := $(CPPFLAGS_COMMON) -Ilibs
117 libl_net.$(A): \
118         libs/l_net/l_net.o \
119         libs/l_net/l_net_$(NETAPI).o \
120
121 libjpeg6.$(A): CPPFLAGS := $(CPPFLAGS_COMMON) -Ilibs/jpeg6 -Ilibs
122 libjpeg6.$(A): \
123         libs/jpeg6/jcomapi.o \
124         libs/jpeg6/jdcoefct.o \
125         libs/jpeg6/jdinput.o \
126         libs/jpeg6/jdpostct.o \
127         libs/jpeg6/jfdctflt.o \
128         libs/jpeg6/jpgload.o \
129         libs/jpeg6/jdapimin.o \
130         libs/jpeg6/jdcolor.o \
131         libs/jpeg6/jdmainct.o \
132         libs/jpeg6/jdsample.o \
133         libs/jpeg6/jidctflt.o \
134         libs/jpeg6/jutils.o \
135         libs/jpeg6/jdapistd.o \
136         libs/jpeg6/jddctmgr.o \
137         libs/jpeg6/jdmarker.o \
138         libs/jpeg6/jdtrans.o \
139         libs/jpeg6/jmemmgr.o \
140         libs/jpeg6/jdatasrc.o \
141         libs/jpeg6/jdhuff.o \
142         libs/jpeg6/jdmaster.o \
143         libs/jpeg6/jerror.o \
144         libs/jpeg6/jmemnobs.o \
145
146 libpicomodel.$(A): CPPFLAGS := $(CPPFLAGS_COMMON) -Ilibs
147 libpicomodel.$(A): \
148         libs/picomodel/picointernal.o \
149         libs/picomodel/picomodel.o \
150         libs/picomodel/picomodules.o \
151         libs/picomodel/pm_3ds.o \
152         libs/picomodel/pm_ase.o \
153         libs/picomodel/pm_md3.o \
154         libs/picomodel/pm_obj.o \
155         libs/picomodel/pm_ms3d.o \
156         libs/picomodel/pm_mdc.o \
157         libs/picomodel/pm_fm.o \
158         libs/picomodel/pm_md2.o \
159         libs/picomodel/pm_lwo.o \
160         libs/picomodel/pm_terrain.o \
161         libs/picomodel/lwo/clip.o \
162         libs/picomodel/lwo/envelope.o \
163         libs/picomodel/lwo/list.o \
164         libs/picomodel/lwo/lwio.o \
165         libs/picomodel/lwo/lwo2.o \
166         libs/picomodel/lwo/lwob.o \
167         libs/picomodel/lwo/pntspols.o \
168         libs/picomodel/lwo/surface.o \
169         libs/picomodel/lwo/vecmath.o \
170         libs/picomodel/lwo/vmap.o \
171
172 libddslib.$(A): CPPFLAGS := $(CPPFLAGS_COMMON) -Ilibs
173 libddslib.$(A): \
174         libs/ddslib/ddslib.o \
175
176 install/q3data.$(EXE): LIBS := -lmhash
177 install/q3data.$(EXE): CPPFLAGS := $(CPPFLAGS_COMMON) $(CPPFLAGS_XML) $(CPPFLAGS_GLIB) -Itools/quake3/common -Ilibs -Iinclude
178 install/q3data.$(EXE): LDFLAGS := $(LDFLAGS_COMMON) $(LDFLAGS_XML) $(LDFLAGS_GLIB)
179 install/q3data.$(EXE): \
180         tools/quake3/common/aselib.o \
181         tools/quake3/common/bspfile.o \
182         tools/quake3/common/cmdlib.o \
183         tools/quake3/common/imagelib.o \
184         tools/quake3/common/inout.o \
185         tools/quake3/common/md4.o \
186         tools/quake3/common/scriplib.o \
187         tools/quake3/common/trilib.o \
188         tools/quake3/common/unzip.o \
189         tools/quake3/common/vfs.o \
190         tools/quake3/q3data/3dslib.o \
191         tools/quake3/q3data/compress.o \
192         tools/quake3/q3data/images.o \
193         tools/quake3/q3data/md3lib.o \
194         tools/quake3/q3data/models.o \
195         tools/quake3/q3data/p3dlib.o \
196         tools/quake3/q3data/polyset.o \
197         tools/quake3/q3data/q3data.o \
198         tools/quake3/q3data/stripper.o \
199         tools/quake3/q3data/video.o \
200         libmathlib.$(A) \
201         libl_net.$(A) \
202