get rid of annoying makeversion.py, install.py
[divverent/netradiant.git] / q3map2build.sh
1 if [ -n "$CROSS" ]; then
2         CFLAGS="-I$HOME/mingw/include"
3         LDFLAGS="-L$HOME/mingw/lib -lws2_32 -lole32 -lintl -liconv"
4         XML2_CFLAGS="-I$HOME/mingw/include/libxml2"
5         GLIB2_CFLAGS="-I$HOME/mingw/include/glib-2.0 -I$HOME/mingw/lib/glib-2.0/include"
6         CC=i586-mingw32msvc-gcc
7         CXX=i586-mingw32msvc-g++
8         netlib=libs/l_net/l_net_wins.c
9         SUFFIX=.exe
10 else
11         CFLAGS=""
12         LDFLAGS="-lpthread"
13         XML2_CFLAGS="-I/usr/include/libxml2"
14         GLIB2_CFLAGS="-I/usr/include/glib-2.0 -I/usr/lib/glib-2.0/include"
15         CC=gcc
16         CXX=g++
17         netlib=libs/l_net/l_net_berkley.c
18         SUFFIX=
19 fi
20
21 LIBS="-lpng -lmhash -lxml2 -lglib-2.0"
22 CFLAGS_COMMON="-O3 -ffast-math -fno-unsafe-math-optimizations -fno-strict-aliasing -DQ_NO_STLPORT" # -fvisibility=hidden
23 CFLAGS_LIBS="$CFLAGS $CFLAGS_COMMON $XML2_CFLAGS $GLIB2_CFLAGS -Iinclude -Ilibs -Ilibs/jpeg6"
24 CFLAGS_Q3MAP2="-Itools/quake3/common $CFLAGS_LIBS"
25
26 temp="obj/"
27 mkdir -p $temp
28 OBJECTS=
29 compile()
30 {
31         eval sourcefile=\$\{$#\}
32         objectfile=${sourcefile%.*}
33         objectfile=`echo "$objectfile" | tr / -`
34         objectfile="$temp/$objectfile.o"
35         OBJECTS="$OBJECTS $objectfile"
36         if ! [ -f "$objectfile" ]; then
37                 echo "$1        $sourcefile"
38                 "$@" -c -o $objectfile || exit 1
39         fi
40 }
41 link()
42 {
43         out=$1
44         shift
45         linker=$1
46         shift
47         echo "$linker   $out"
48
49         "$linker" $OBJECTS "$@" -o $out$SUFFIX || exit 1
50 }
51
52 compile $CXX $CFLAGS_LIBS libs/cmdlib/cmdlib.cpp
53 compile $CC $CFLAGS_LIBS libs/mathlib/bbox.c
54 compile $CC $CFLAGS_LIBS libs/mathlib/m4x4.c
55 compile $CC $CFLAGS_LIBS libs/mathlib/mathlib.c
56 compile $CC $CFLAGS_LIBS libs/mathlib/ray.c
57 compile $CC $CFLAGS_LIBS libs/l_net/l_net.c
58 compile $CC $CFLAGS_LIBS $netlib
59 compile $CC $CFLAGS_LIBS libs/ddslib/ddslib.c
60 compile $CC $CFLAGS_LIBS libs/picomodel/picointernal.c
61 compile $CC $CFLAGS_LIBS libs/picomodel/picomodel.c
62 compile $CC $CFLAGS_LIBS libs/picomodel/picomodules.c
63 compile $CC $CFLAGS_LIBS libs/picomodel/pm_3ds.c
64 compile $CC $CFLAGS_LIBS libs/picomodel/pm_ase.c
65 compile $CC $CFLAGS_LIBS libs/picomodel/pm_fm.c
66 compile $CC $CFLAGS_LIBS libs/picomodel/pm_lwo.c
67 compile $CC $CFLAGS_LIBS libs/picomodel/pm_md2.c
68 compile $CC $CFLAGS_LIBS libs/picomodel/pm_md3.c
69 compile $CC $CFLAGS_LIBS libs/picomodel/pm_mdc.c
70 compile $CC $CFLAGS_LIBS libs/picomodel/pm_ms3d.c
71 compile $CC $CFLAGS_LIBS libs/picomodel/pm_obj.c
72 compile $CC $CFLAGS_LIBS libs/picomodel/pm_terrain.c
73 compile $CC $CFLAGS_LIBS libs/picomodel/lwo/clip.c
74 compile $CC $CFLAGS_LIBS libs/picomodel/lwo/envelope.c
75 compile $CC $CFLAGS_LIBS libs/picomodel/lwo/list.c
76 compile $CC $CFLAGS_LIBS libs/picomodel/lwo/lwio.c
77 compile $CC $CFLAGS_LIBS libs/picomodel/lwo/lwo2.c
78 compile $CC $CFLAGS_LIBS libs/picomodel/lwo/lwob.c
79 compile $CC $CFLAGS_LIBS libs/picomodel/lwo/pntspols.c
80 compile $CC $CFLAGS_LIBS libs/picomodel/lwo/surface.c
81 compile $CC $CFLAGS_LIBS libs/picomodel/lwo/vecmath.c
82 compile $CC $CFLAGS_LIBS libs/picomodel/lwo/vmap.c
83 compile $CC $CFLAGS_LIBS libs/md5lib/md5lib.c
84 compile $CXX $CFLAGS_LIBS libs/jpeg6/jcomapi.cpp
85 compile $CXX $CFLAGS_LIBS libs/jpeg6/jdapimin.cpp
86 compile $CXX $CFLAGS_LIBS libs/jpeg6/jdapistd.cpp
87 compile $CXX $CFLAGS_LIBS libs/jpeg6/jdatasrc.cpp
88 compile $CXX $CFLAGS_LIBS libs/jpeg6/jdcoefct.cpp
89 compile $CXX $CFLAGS_LIBS libs/jpeg6/jdcolor.cpp
90 compile $CXX $CFLAGS_LIBS libs/jpeg6/jddctmgr.cpp
91 compile $CXX $CFLAGS_LIBS libs/jpeg6/jdhuff.cpp
92 compile $CXX $CFLAGS_LIBS libs/jpeg6/jdinput.cpp
93 compile $CXX $CFLAGS_LIBS libs/jpeg6/jdmainct.cpp
94 compile $CXX $CFLAGS_LIBS libs/jpeg6/jdmarker.cpp
95 compile $CXX $CFLAGS_LIBS libs/jpeg6/jdmaster.cpp
96 compile $CXX $CFLAGS_LIBS libs/jpeg6/jdpostct.cpp
97 compile $CXX $CFLAGS_LIBS libs/jpeg6/jdsample.cpp
98 compile $CXX $CFLAGS_LIBS libs/jpeg6/jdtrans.cpp
99 compile $CXX $CFLAGS_LIBS libs/jpeg6/jerror.cpp
100 compile $CXX $CFLAGS_LIBS libs/jpeg6/jfdctflt.cpp
101 compile $CXX $CFLAGS_LIBS libs/jpeg6/jidctflt.cpp
102 compile $CXX $CFLAGS_LIBS libs/jpeg6/jmemmgr.cpp
103 compile $CXX $CFLAGS_LIBS libs/jpeg6/jmemnobs.cpp
104 compile $CXX $CFLAGS_LIBS libs/jpeg6/jpgload.cpp
105 compile $CXX $CFLAGS_LIBS libs/jpeg6/jutils.cpp
106 compile $CC $CFLAGS_Q3MAP2 tools/quake3/q3map2/bspfile_abstract.c
107 compile $CC $CFLAGS_Q3MAP2 tools/quake3/q3map2/bspfile_ibsp.c
108 compile $CC $CFLAGS_Q3MAP2 tools/quake3/q3map2/bspfile_rbsp.c
109 compile $CC $CFLAGS_Q3MAP2 tools/quake3/q3map2/image.c
110 compile $CC $CFLAGS_Q3MAP2 tools/quake3/q3map2/main.c
111 compile $CC $CFLAGS_Q3MAP2 tools/quake3/q3map2/mesh.c
112 compile $CC $CFLAGS_Q3MAP2 tools/quake3/q3map2/model.c
113 compile $CC $CFLAGS_Q3MAP2 tools/quake3/q3map2/path_init.c
114 compile $CC $CFLAGS_Q3MAP2 tools/quake3/q3map2/shaders.c
115 compile $CC $CFLAGS_Q3MAP2 tools/quake3/q3map2/surface_extra.c
116 compile $CC $CFLAGS_Q3MAP2 tools/quake3/common/cmdlib.c
117 compile $CC $CFLAGS_Q3MAP2 tools/quake3/common/imagelib.c
118 compile $CC $CFLAGS_Q3MAP2 tools/quake3/common/inout.c
119 compile $CC $CFLAGS_Q3MAP2 tools/quake3/common/mutex.c
120 compile $CC $CFLAGS_Q3MAP2 tools/quake3/common/polylib.c
121 compile $CC $CFLAGS_Q3MAP2 tools/quake3/common/scriplib.c
122 compile $CC $CFLAGS_Q3MAP2 tools/quake3/common/threads.c
123 compile $CC $CFLAGS_Q3MAP2 tools/quake3/common/unzip.c
124 compile $CC $CFLAGS_Q3MAP2 tools/quake3/common/vfs.c
125 compile $CC $CFLAGS_Q3MAP2 tools/quake3/q3map2/brush.c
126 compile $CC $CFLAGS_Q3MAP2 tools/quake3/q3map2/brush_primit.c
127 compile $CC $CFLAGS_Q3MAP2 tools/quake3/q3map2/bsp.c
128 compile $CC $CFLAGS_Q3MAP2 tools/quake3/q3map2/decals.c
129 compile $CC $CFLAGS_Q3MAP2 tools/quake3/q3map2/facebsp.c
130 compile $CC $CFLAGS_Q3MAP2 tools/quake3/q3map2/fog.c
131 compile $CC $CFLAGS_Q3MAP2 tools/quake3/q3map2/leakfile.c
132 compile $CC $CFLAGS_Q3MAP2 tools/quake3/q3map2/map.c
133 compile $CC $CFLAGS_Q3MAP2 tools/quake3/q3map2/patch.c
134 compile $CC $CFLAGS_Q3MAP2 tools/quake3/q3map2/portals.c
135 compile $CC $CFLAGS_Q3MAP2 tools/quake3/q3map2/prtfile.c
136 compile $CC $CFLAGS_Q3MAP2 tools/quake3/q3map2/surface.c
137 compile $CC $CFLAGS_Q3MAP2 tools/quake3/q3map2/surface_foliage.c
138 compile $CC $CFLAGS_Q3MAP2 tools/quake3/q3map2/surface_fur.c
139 compile $CC $CFLAGS_Q3MAP2 tools/quake3/q3map2/surface_meta.c
140 compile $CC $CFLAGS_Q3MAP2 tools/quake3/q3map2/tjunction.c
141 compile $CC $CFLAGS_Q3MAP2 tools/quake3/q3map2/tree.c
142 compile $CC $CFLAGS_Q3MAP2 tools/quake3/q3map2/writebsp.c
143 compile $CC $CFLAGS_Q3MAP2 tools/quake3/q3map2/light.c
144 compile $CC $CFLAGS_Q3MAP2 tools/quake3/q3map2/light_bounce.c
145 compile $CC $CFLAGS_Q3MAP2 tools/quake3/q3map2/light_trace.c
146 compile $CC $CFLAGS_Q3MAP2 tools/quake3/q3map2/light_ydnar.c
147 compile $CC $CFLAGS_Q3MAP2 tools/quake3/q3map2/lightmaps_ydnar.c
148 compile $CC $CFLAGS_Q3MAP2 tools/quake3/q3map2/vis.c
149 compile $CC $CFLAGS_Q3MAP2 tools/quake3/q3map2/visflow.c
150 compile $CC $CFLAGS_Q3MAP2 tools/quake3/q3map2/convert_ase.c
151 compile $CC $CFLAGS_Q3MAP2 tools/quake3/q3map2/convert_map.c
152 link q3map2 $CXX $LIBS $LDFLAGS