39232b4f18877c53f7c6ae3f1109ff2ec001ae9c
[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: install/q3map2.$(EXE)
38
39 .PHONY: clean
40 clean:
41         $(FIND) . \( -name \*.o -o -name \*.$(SO) -o -name \*.$(A) -o -name \*.$(EXE) \) -exec $(RM) {} \;
42
43 %.$(EXE):
44         $(CXX) -o $@ $^ $(LDFLAGS) $(LIBS)
45
46 %.$(A):
47         $(AR) rc $@ $^
48         $(RANLIB) $@
49
50 install/q3map2.$(EXE): LIBS := -lmhash
51 install/q3map2.$(EXE): CPPFLAGS := $(CPPFLAGS_COMMON) $(CPPFLAGS_XML) $(CPPFLAGS_GLIB) $(CPPFLAGS_PNG) -Itools/quake3/common -Ilibs -Iinclude
52 install/q3map2.$(EXE): LDFLAGS := $(LDFLAGS_COMMON) $(LDFLAGS_XML) $(LDFLAGS_GLIB) $(LDFLAGS_PNG) 
53 install/q3map2.$(EXE): \
54         tools/quake3/common/cmdlib.o \
55         tools/quake3/common/imagelib.o \
56         tools/quake3/common/inout.o \
57         tools/quake3/common/mutex.o \
58         tools/quake3/common/polylib.o \
59         tools/quake3/common/scriplib.o \
60         tools/quake3/common/threads.o \
61         tools/quake3/common/unzip.o \
62         tools/quake3/common/vfs.o \
63         tools/quake3/q3map2/brush.o \
64         tools/quake3/q3map2/brush_primit.o \
65         tools/quake3/q3map2/bspfile_abstract.o \
66         tools/quake3/q3map2/bspfile_ibsp.o \
67         tools/quake3/q3map2/bspfile_rbsp.o \
68         tools/quake3/q3map2/bsp.o \
69         tools/quake3/q3map2/convert_ase.o \
70         tools/quake3/q3map2/convert_map.o \
71         tools/quake3/q3map2/decals.o \
72         tools/quake3/q3map2/facebsp.o \
73         tools/quake3/q3map2/fog.o \
74         tools/quake3/q3map2/image.o \
75         tools/quake3/q3map2/leakfile.o \
76         tools/quake3/q3map2/light_bounce.o \
77         tools/quake3/q3map2/lightmaps_ydnar.o \
78         tools/quake3/q3map2/light.o \
79         tools/quake3/q3map2/light_trace.o \
80         tools/quake3/q3map2/light_ydnar.o \
81         tools/quake3/q3map2/main.o \
82         tools/quake3/q3map2/map.o \
83         tools/quake3/q3map2/mesh.o \
84         tools/quake3/q3map2/model.o \
85         tools/quake3/q3map2/patch.o \
86         tools/quake3/q3map2/path_init.o \
87         tools/quake3/q3map2/portals.o \
88         tools/quake3/q3map2/prtfile.o \
89         tools/quake3/q3map2/shaders.o \
90         tools/quake3/q3map2/surface_extra.o \
91         tools/quake3/q3map2/surface_foliage.o \
92         tools/quake3/q3map2/surface_fur.o \
93         tools/quake3/q3map2/surface_meta.o \
94         tools/quake3/q3map2/surface.o \
95         tools/quake3/q3map2/tjunction.o \
96         tools/quake3/q3map2/tree.o \
97         tools/quake3/q3map2/visflow.o \
98         tools/quake3/q3map2/vis.o \
99         tools/quake3/q3map2/writebsp.o \
100         libmathlib.$(A) \
101         libl_net.$(A) \
102         libjpeg6.$(A) \
103         libpicomodel.$(A) \
104         libddslib.$(A) \
105
106 libmathlib.$(A): CPPFLAGS := $(CPPFLAGS_COMMON) -Ilibs
107 libmathlib.$(A): \
108         libs/mathlib/mathlib.o \
109         libs/mathlib/bbox.o \
110         libs/mathlib/line.o \
111         libs/mathlib/m4x4.o \
112         libs/mathlib/ray.o \
113
114 libl_net.$(A): CPPFLAGS := $(CPPFLAGS_COMMON) -Ilibs
115 libl_net.$(A): \
116         libs/l_net/l_net.o \
117         libs/l_net/l_net_$(NETAPI).o \
118
119 libjpeg6.$(A): CPPFLAGS := $(CPPFLAGS_COMMON) -Ilibs/jpeg6 -Ilibs
120 libjpeg6.$(A): \
121         libs/jpeg6/jcomapi.o \
122         libs/jpeg6/jdcoefct.o \
123         libs/jpeg6/jdinput.o \
124         libs/jpeg6/jdpostct.o \
125         libs/jpeg6/jfdctflt.o \
126         libs/jpeg6/jpgload.o \
127         libs/jpeg6/jdapimin.o \
128         libs/jpeg6/jdcolor.o \
129         libs/jpeg6/jdmainct.o \
130         libs/jpeg6/jdsample.o \
131         libs/jpeg6/jidctflt.o \
132         libs/jpeg6/jutils.o \
133         libs/jpeg6/jdapistd.o \
134         libs/jpeg6/jddctmgr.o \
135         libs/jpeg6/jdmarker.o \
136         libs/jpeg6/jdtrans.o \
137         libs/jpeg6/jmemmgr.o \
138         libs/jpeg6/jdatasrc.o \
139         libs/jpeg6/jdhuff.o \
140         libs/jpeg6/jdmaster.o \
141         libs/jpeg6/jerror.o \
142         libs/jpeg6/jmemnobs.o \
143
144 libpicomodel.$(A): CPPFLAGS := $(CPPFLAGS_COMMON) -Ilibs
145 libpicomodel.$(A): \
146         libs/picomodel/picointernal.o \
147         libs/picomodel/picomodel.o \
148         libs/picomodel/picomodules.o \
149         libs/picomodel/pm_3ds.o \
150         libs/picomodel/pm_ase.o \
151         libs/picomodel/pm_md3.o \
152         libs/picomodel/pm_obj.o \
153         libs/picomodel/pm_ms3d.o \
154         libs/picomodel/pm_mdc.o \
155         libs/picomodel/pm_fm.o \
156         libs/picomodel/pm_md2.o \
157         libs/picomodel/pm_lwo.o \
158         libs/picomodel/pm_terrain.o \
159         libs/picomodel/lwo/clip.o \
160         libs/picomodel/lwo/envelope.o \
161         libs/picomodel/lwo/list.o \
162         libs/picomodel/lwo/lwio.o \
163         libs/picomodel/lwo/lwo2.o \
164         libs/picomodel/lwo/lwob.o \
165         libs/picomodel/lwo/pntspols.o \
166         libs/picomodel/lwo/surface.o \
167         libs/picomodel/lwo/vecmath.o \
168         libs/picomodel/lwo/vmap.o \
169
170 libddslib.$(A): CPPFLAGS := $(CPPFLAGS_COMMON) -Ilibs
171 libddslib.$(A): \
172         libs/ddslib/ddslib.o \
173