2.50: svn merge https://svn.blender.org/svnroot/bf-blender/trunk/blender -r18677...
[blender.git] / source / Makefile
1 #
2 # $Id$
3 #
4 # ***** BEGIN GPL LICENSE BLOCK *****
5 #
6 # This program is free software; you can redistribute it and/or
7 # modify it under the terms of the GNU General Public License
8 # as published by the Free Software Foundation; either version 2
9 # of the License, or (at your option) any later version.
10 #
11 # This program is distributed in the hope that it will be useful,
12 # but WITHOUT ANY WARRANTY; without even the implied warranty of
13 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
14 # GNU General Public License for more details.
15 #
16 # You should have received a copy of the GNU General Public License
17 # along with this program; if not, write to the Free Software Foundation,
18 # Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.
19 #
20 # The Original Code is Copyright (C) 2001-2002 by NaN Holding BV.
21 # All rights reserved.
22 #
23 # The Original Code is: all of this file.
24 #
25 # Contributor(s): none yet.
26 #
27 # ***** END GPL LICENSE BLOCK *****
28 #
29 # Top level makefile. Start looping through subdirs and link....
30 #
31
32 ifndef NANENV
33     export NANENV := $(shell env | grep NAN_)
34 endif
35
36 include nan_definitions.mk
37
38 DIRS = creator blender kernel
39
40 ifneq ($(NAN_NO_KETSJI),true)
41    DIRS += gameengine
42 endif
43
44 ifeq ($(OS),windows)
45     DIRS += icons
46 endif
47
48 ########## buildinfo kludge ###################
49 CPPFLAGS += -I../Physics/common
50 CPPFLAGS += -I../Physics/Dummy
51 ifdef NAN_BUILDINFO
52     BUILDINFO_O = $(DIR)/$(DEBUG_DIR)buildinfo.o
53     BUILDINFO_C = $(SRCHOME)/creator/buildinfo.c
54     BUILD_DATE := $(shell date "+%Y-%m-%d")
55     BUILD_TIME := $(shell date "+%H:%M:%S")
56         BUILD_REV := $(shell svnversion)
57 endif
58
59 ############# set pyplayerlib ##################
60
61
62 ############# libraries ##################
63 # COMLIB COMmon LIBraries for all targets
64 # BPLIB Browser Plugin LIBraries
65 # SPLIB1 Standalone Player LIBraries (pre COMLIB)
66 # SPLIB Standalone Player LIBraries (post COMLIB)
67 # PULIB PUblisher LIBraries
68 # GRPLIB Gui and Render LIBraries for Publisher
69 # LLIBS dynamic system libraries
70 # SADD Static OpenGL libraries
71 # DADD Dynamic OpenGL libraries
72 # NSPLUGLIB PLUGin LIBraries for ns-style api
73 # PLUGAPPLIB libs that form the application to be plugged in
74 # Note: the order is important here
75
76 GRPLIB = $(OCGDIR)/creator/$(DEBUG_DIR)libcreator.a
77 GRPLIB += $(OCGDIR)/blender/windowmanager/$(DEBUG_DIR)libwindowmanager.a
78 GRPLIB += $(NAN_BSP)/lib/$(DEBUG_DIR)libbsp.a
79 GRPLIB += $(NAN_BOOLOP)/lib/$(DEBUG_DIR)libboolop.a
80 GRPLIB += $(NAN_SOUNDSYSTEM)/lib/$(DEBUG_DIR)libSoundSystem.a
81 GRPLIB += $(NAN_GHOST)/lib/$(DEBUG_DIR)libghost.a
82 GRPLIB += $(NAN_STRING)/lib/$(DEBUG_DIR)libstring.a
83 GRPLIB += $(OCGDIR)/blender/render/$(DEBUG_DIR)librender.a
84 GRPLIB += $(OCGDIR)/blender/radiosity/$(DEBUG_DIR)libradiosity.a
85
86 # nlin: the reason that some libraries appear more than once below is
87 # to handle circular dependencies in linking among libraries... some
88 # linkers (e.g. under Linux) need libs to be specified multiple times
89 # to properly resolve circular dependencies. ugly, but it works...
90 # the repeat entries could probably be trimmed down.
91 COMLIB = $(OCGDIR)/blender/blenkernel/$(DEBUG_DIR)libblenkernel.a
92 COMLIB += $(OCGDIR)/blender/blenloader/$(DEBUG_DIR)libblenloader.a
93 COMLIB += $(OCGDIR)/blender/blenpluginapi/$(DEBUG_DIR)libblenpluginapi.a
94 COMLIB += $(OCGDIR)/blender/nodes_shd/$(DEBUG_DIR)libnodes_shd.a
95 COMLIB += $(OCGDIR)/blender/nodes_cmp/$(DEBUG_DIR)libnodes_cmp.a
96 COMLIB += $(OCGDIR)/blender/nodes_tex/$(DEBUG_DIR)libnodes_tex.a
97 COMLIB += $(OCGDIR)/blender/nodes/$(DEBUG_DIR)libnodes.a
98 COMLIB += $(OCGDIR)/blender/imbuf/$(DEBUG_DIR)libimbuf.a
99 COMLIB += $(OCGDIR)/blender/blenlib/$(DEBUG_DIR)libblenlib.a
100 COMLIB += $(NAN_IKSOLVER)/lib/libiksolver.a
101 COMLIB += $(NAN_MOTO)/lib/libmoto.a
102 COMLIB += $(NAN_SUPERLU)/lib/$(DEBUG_DIR)libsuperlu.a   
103 COMLIB += $(OCGDIR)/blender/avi/$(DEBUG_DIR)libavi.a
104 COMLIB += $(NAN_JPEG)/lib/libjpeg.a
105 COMLIB += $(OCGDIR)/blender/gpu/$(DEBUG_DIR)libgpu.a
106 COMLIB += $(NAN_GLEW)/lib/libglew.a
107 COMLIB += $(OCGDIR)/blender/blenfont/$(DEBUG_DIR)libblenfont.a
108
109 ifneq ($(NAN_NO_KETSJI),true)
110     COMLIB += $(OCGDIR)/gameengine/bloutines/$(DEBUG_DIR)libbloutines.a
111     COMLIB += $(OCGDIR)/gameengine/blconverter/$(DEBUG_DIR)libblconverter.a
112     COMLIB += $(OCGDIR)/gameengine/blphys/common/$(DEBUG_DIR)libcommon.a
113     COMLIB += $(OCGDIR)/gameengine/ketsji/$(DEBUG_DIR)libketsji.a
114     COMLIB += $(OCGDIR)/gameengine/blconverter/$(DEBUG_DIR)libblconverter.a
115     COMLIB += $(OCGDIR)/gameengine/blconverter/$(DEBUG_DIR)libblconverter.a
116     COMLIB += $(NAN_SOLID)/lib/libsolid.a
117     COMLIB += $(NAN_SOLID)/lib/libsolid_broad.a 
118     COMLIB += $(NAN_SOLID)/lib/libsolid_complex.a
119     COMLIB += $(NAN_SOLID)/lib/libsolid_convex.a
120     COMLIB += $(OCGDIR)/gameengine/blphys/sumo/$(DEBUG_DIR)libsumo.a
121     COMLIB += $(OCGDIR)/gameengine/blphys/fuzzics/$(DEBUG_DIR)libfuzzics.a
122     COMLIB += $(NAN_QHULL)/lib/libqhull.a
123     COMLIB += $(OCGDIR)/gameengine/blphys/dummy/$(DEBUG_DIR)libdummy.a
124     COMLIB += $(OCGDIR)/gameengine/blphys/common/$(DEBUG_DIR)libcommon.a
125 #    COMLIB += $(OCGDIR)/gameengine/blphys/sumo/$(DEBUG_DIR)libsumo.a
126     COMLIB += $(OCGDIR)/gameengine/blphys/dummy/$(DEBUG_DIR)libdummy.a
127     COMLIB += $(OCGDIR)/gameengine/ketsji/$(DEBUG_DIR)libketsji.a
128     COMLIB += $(OCGDIR)/gameengine/blphys/common/$(DEBUG_DIR)libcommon.a
129 #    COMLIB += $(OCGDIR)/gameengine/blphys/blode/$(DEBUG_DIR)libblode.a
130 #    COMLIB += $(OCGDIR)/gameengine/blphys/sumo/$(DEBUG_DIR)libsumo.a
131     COMLIB += $(OCGDIR)/gameengine/blphys/dummy/$(DEBUG_DIR)libdummy.a
132     COMLIB += $(OCGDIR)/gameengine/blphys/blbullet/$(DEBUG_DIR)libblbullet.a
133     COMLIB += $(OCGDIR)/gameengine/blphys/common/$(DEBUG_DIR)libcommon.a
134 #    COMLIB += $(OCGDIR)/gameengine/blphys/sumo/$(DEBUG_DIR)libsumo.a
135     COMLIB += $(OCGDIR)/gameengine/blphys/dummy/$(DEBUG_DIR)libdummy.a
136     COMLIB += $(OCGDIR)/gameengine/ketsji/$(DEBUG_DIR)libketsji.a
137     COMLIB += $(OCGDIR)/gameengine/logic/$(DEBUG_DIR)liblogic.a
138     COMLIB += $(OCGDIR)/gameengine/logic/Joystick/$(DEBUG_DIR)libJoystick.a
139     COMLIB += $(OCGDIR)/gameengine/rasterizer/$(DEBUG_DIR)librasterizer.a
140     COMLIB += $(OCGDIR)/gameengine/OpenGLrasterizer/$(DEBUG_DIR)libOpenGLrasterizer.a
141     COMLIB += $(OCGDIR)/gameengine/expression/$(DEBUG_DIR)libexpression.a
142     COMLIB += $(OCGDIR)/gameengine/scenegraph/$(DEBUG_DIR)libscenegraph.a
143     COMLIB += $(OCGDIR)/gameengine/videotex/$(DEBUG_DIR)libvideotex.a
144 #    COMLIB += $(OCGDIR)/sumo/$(DEBUG_DIR)libfuzzics.a
145 #    COMLIB += $(OCGDIR)/sumo/$(DEBUG_DIR)libsolid.a
146     COMLIB += $(NAN_MOTO)/lib/libmoto.a
147     COMLIB += $(NAN_SND_LIBS)
148     COMLIB += $(OCGDIR)/kernel/gen_system/$(DEBUG_DIR)libgen_system.a
149     COMLIB += $(OCGDIR)/kernel/gen_messaging/$(DEBUG_DIR)libgen_messaging.a
150     COMLIB += $(OCGDIR)/gameengine/ketsji/KXNetwork/$(DEBUG_DIR)libKXNetwork.a
151     COMLIB += $(OCGDIR)/gameengine/Network/$(DEBUG_DIR)libNetwork.a
152     COMLIB += $(OCGDIR)/gameengine/Network/LoopBackNetwork/$(DEBUG_DIR)libLoopBackNetwork.a
153     COMLIB += $(NAN_BULLET2)/lib/libbullet2.a
154 endif
155
156 COMLIB += $(OCGDIR)/blender/makesdna/$(DEBUG_DIR)libdna.a
157 COMLIB += $(NAN_GUARDEDALLOC)/lib/libguardedalloc.a
158 COMLIB += $(NAN_MEMUTIL)/lib/libmemutil.a
159 COMLIB += $(NAN_BMFONT)/lib/$(DEBUG_DIR)libbmfont.a
160 COMLIB += $(NAN_PNG)/lib/libpng.a
161 COMLIB += $(OCGDIR)/blender/yafray/$(DEBUG_DIR)libyafrayexport.a
162
163 ifeq ($(WITH_QUICKTIME), true)
164     COMLIB += $(OCGDIR)/blender/blenderqt/$(DEBUG_DIR)libblenderqt.a
165 endif
166
167 ifeq ($(WITH_OPENEXR), true)
168     COMLIB += $(OCGDIR)/blender/imbuf/openexr/$(DEBUG_DIR)libopenexr.a
169 endif
170
171 ifeq ($(WITH_OPENJPEG), true)
172     COMLIB += $(OCGDIR)/extern/openjpeg/$(DEBUG_DIR)libopenjpeg.a
173 endif
174
175 COMLIB += $(OCGDIR)/blender/imbuf/cineon/$(DEBUG_DIR)libcineon.a
176
177 ifeq ($(WITH_DDS), true)
178     COMLIB += $(OCGDIR)/blender/imbuf/dds/$(DEBUG_DIR)libdds.a
179 endif
180
181 ifeq ($(WITH_BINRELOC), true)
182     COMLIB += $(OCGDIR)/extern/binreloc/$(DEBUG_DIR)libbinreloc.a
183 endif
184
185 ifeq ($(WITH_FREETYPE2), true)
186     COMLIB += $(OCGDIR)/blender/ftfont/$(DEBUG_DIR)libftfont.a
187     ifeq ($(OS), windows)
188       ifeq ($(FREE_WINDOWS), true)
189         COMLIB += $(NAN_FTGL)/lib/libftgl.a
190         COMLIB += $(NAN_FREETYPE)/lib/libfreetype.a
191       else
192         COMLIB += $(NAN_FTGL)/lib/ftgl_static_ST.lib
193         COMLIB += $(NAN_FREETYPE)/lib/freetype2ST.lib
194       endif
195     else
196       COMLIB += $(NAN_FTGL)/lib/libftgl.a
197       ifeq ($(OS), irix)
198         COMLIB += $(NAN_FREETYPE)/lib/libfreetype.a
199         else
200             COMLIB += $(NAN_FREETYPE)/lib/libfreetype.a
201       endif
202     endif
203 endif
204
205 ifeq ($(OS), irix)
206     COMLIB += $(NAN_SDL)/lib/libSDL.a
207 endif
208
209 ifeq ($(OS), windows)
210     ifeq ($(FREE_WINDOWS), true)
211         COMLIB += $(NAN_SDL)/lib/libSDL.a
212         COMLIB += $(NAN_PTHREADS)/lib/libpthreadGC2.a
213     else
214         COMLIB += $(NAN_SDL)/lib/SDL.lib
215     endif
216 endif
217
218 ifeq ($(WITH_OPENEXR), true)
219     COMLIB += $(NAN_OPENEXR_LIBS)
220 endif
221
222 # note: space_api.a in begin of editors, screen.a in end
223 PULIB = $(NAN_MOTO)/lib/libmoto.a
224 PULIB += $(NAN_DECIMATION)/lib/libdecimation.a
225 PULIB += $(OCGDIR)/blender/readblenfile/$(DEBUG_DIR)libreadblenfile.a
226 PULIB += $(OCGDIR)/blender/ed_space/libed_space.a
227 PULIB += $(OCGDIR)/blender/ed_sound/libed_sound.a
228 PULIB += $(OCGDIR)/blender/ed_action/libed_action.a
229 PULIB += $(OCGDIR)/blender/ed_nla/libed_nla.a
230 PULIB += $(OCGDIR)/blender/ed_script/libed_script.a
231 PULIB += $(OCGDIR)/blender/ed_text/libed_text.a
232 PULIB += $(OCGDIR)/blender/ed_sequencer/libed_sequencer.a
233 PULIB += $(OCGDIR)/blender/ed_file/libed_file.a
234 PULIB += $(OCGDIR)/blender/ed_info/libed_info.a
235 PULIB += $(OCGDIR)/blender/ed_buttons/libed_buttons.a
236 PULIB += $(OCGDIR)/blender/ed_node/libed_node.a
237 PULIB += $(OCGDIR)/blender/ed_graph/libed_graph.a
238 PULIB += $(OCGDIR)/blender/ed_outliner/libed_outliner.a
239 PULIB += $(OCGDIR)/blender/ed_time/libed_time.a
240 PULIB += $(OCGDIR)/blender/ed_preview/libed_preview.a
241 PULIB += $(OCGDIR)/blender/ed_view3d/libed_view3d.a
242 PULIB += $(OCGDIR)/blender/ed_interface/libed_interface.a
243 PULIB += $(OCGDIR)/blender/ed_object/libed_object.a
244 PULIB += $(OCGDIR)/blender/ed_curve/libed_curve.a
245 PULIB += $(OCGDIR)/blender/ed_armature/libed_armature.a
246 PULIB += $(OCGDIR)/blender/ed_mesh/libed_mesh.a
247 PULIB += $(OCGDIR)/blender/ed_sculpt_paint/libed_sculpt_paint.a
248 PULIB += $(OCGDIR)/blender/ed_physics/libed_physics.a
249 PULIB += $(OCGDIR)/blender/ed_animation/libed_animation.a
250 PULIB += $(OCGDIR)/blender/ed_transform/libed_transform.a
251 PULIB += $(OCGDIR)/blender/ed_util/libed_util.a
252 PULIB += $(OCGDIR)/blender/ed_datafiles/libed_datafiles.a
253 PULIB += $(OCGDIR)/blender/ed_image/libed_image.a
254 PULIB += $(OCGDIR)/blender/ed_uvedit/libed_uvedit.a
255 PULIB += $(OCGDIR)/blender/ed_screen/libed_screen.a
256 PULIB += $(OCGDIR)/blender/windowmanager/libwindowmanager.a
257 PULIB += $(OCGDIR)/blender/python/$(DEBUG_DIR)libpython.a
258 PULIB += $(OCGDIR)/blender/makesrna/$(DEBUG_DIR)librna.a
259 # note, no idea but it suddenly doesn't compile :(
260 PULIB += $(OCGDIR)/blender/blenlib/$(DEBUG_DIR)libblenlib.a
261 PULIB += $(NAN_OPENNL)/lib/$(DEBUG_DIR)libopennl.a
262 PULIB += $(NAN_ELBEEM)/lib/$(DEBUG_DIR)libelbeem.a
263
264 ifeq ($(NAN_NO_KETSJI),true)
265     PULIB += $(NAN_MOTO)/lib/libmoto.a
266     PULIB += $(OCGDIR)/kernel/gen_system/$(DEBUG_DIR)libgen_system.a
267     PULIB += $(OCGDIR)/kernel/gen_messaging/$(DEBUG_DIR)libgen_messaging.a
268     COMLIB += $(NAN_SND_LIBS)
269 endif
270
271 SPLIB1 = $(OCGDIR)/gameengine/GamePlayer/ghost/$(DEBUG_DIR)libghost.a
272 SPLIB1 += $(OCGDIR)/gameengine/GamePlayer/common/$(DEBUG_DIR)libcommon.a
273 SPLIB1 += $(OCGDIR)/gameengine/blconverter/$(DEBUG_DIR)libblconverter.a
274 SPLIB1 += $(NAN_STRING)/lib/$(DEBUG_DIR)libstring.a
275 SPLIB1 += $(NAN_GHOST)/lib/$(DEBUG_DIR)libghost.a
276
277 SPLIB = $(OCGDIR)/blender/readblenfile/$(DEBUG_DIR)libreadblenfile.a
278 # this is used for the plugin. It uses some things from libz.a, 
279 # but somehow it consistently fails to resolve these symbols... or 
280 # can I just not check them? nm claims they aren't...
281 SPLIB += $(OCGDIR)/blender/blenkernel/blenkernel_blc/$(DEBUG_DIR)libblenkernel_blc.a
282 SPLIB += $(OCGDIR)/blender/makesrna/$(DEBUG_DIR)librna.a
283
284 # These three need to be explicitly mentioned on the cl, because 
285 # if they are offered as a lib, they are optimized away. (nzc)
286 NSPLUGLIB = $(OCGDIR)/gameengine/GamePlayer/netscape/src/$(DEBUG_DIR)UnixShell.o
287 NSPLUGLIB += $(OCGDIR)/gameengine/GamePlayer/netscape/src/$(DEBUG_DIR)stubs.o
288 NSPLUGLIB += $(OCGDIR)/gameengine/GamePlayer/netscape/src/$(DEBUG_DIR)winstubs.o
289 NSPLUGLIB += $(OCGDIR)/gameengine/GamePlayer/netscape/src/$(DEBUG_DIR)Blender3DPlugin_native_implementation.o
290
291 # Here you can configure what sort of test to make for the plugin.
292 #    PLUGTESTLIB = $(OCGDIR)/gameengine/GamePlayer/netscape/test/$(DEBUG_DIR)libns_api_test_stub.a
293 #    PLUGTESTLIB = $(OCGDIR)/gameengine/GamePlayer/netscape/test/$(DEBUG_DIR)libns_api_test_colorcycle.a
294 #    PLUGTESTLIB = $(OCGDIR)/gameengine/GamePlayer/netscape/test/$(DEBUG_DIR)libns_api_test_gears.a
295 PLUGTESTLIB = $(OCGDIR)/gameengine/GamePlayer/netscape/test/$(DEBUG_DIR)libns_api_test_threaded_gears.a
296
297 # XPCOM is done only for Linux for now
298 ifeq ($(OS),$(findstring $(OS), "linux"))
299   ifeq ($(CPU),i386)
300     NSPLUGLIB += $(OCGDIR)/gameengine/GamePlayer/netscape/src/$(DEBUG_DIR)XPH_xpcom_hooks.o
301   endif
302 endif
303
304 PLUGAPPLIB = $(OCGDIR)/gameengine/GamePlayer/netscape/src/$(DEBUG_DIR)libplugin_ketsji_hooks.a
305
306 ifeq ($(OS),$(findstring $(OS), "freebsd linux irix solaris"))
307     NSPLUGLIB += $(OCGDIR)/gameengine/GamePlayer/netscape/src/$(DEBUG_DIR)PLG_X11_windowing.o
308     PLUGAPPLIB += $(OCGDIR)/gameengine/GamePlayer/common/unix/$(DEBUG_DIR)libunix.a
309 endif
310 ifeq ($(OS),$(findstring $(OS), "windows"))
311     NSPLUGLIB += $(OCGDIR)/gameengine/GamePlayer/netscape/src/$(DEBUG_DIR)PLG_MSWindows_windowing.o
312     NSPLUGLIB += $(OCGDIR)/gameengine/GamePlayer/netscape/src/$(DEBUG_DIR)npB3DPlg.res
313     PLUGAPPLIB += $(OCGDIR)/gameengine/GamePlayer/common/windows/$(DEBUG_DIR)libwindows.a
314 endif
315
316 PLUGAPPLIB += $(OCGDIR)/gameengine/GamePlayer/common/$(DEBUG_DIR)libcommon.a
317
318 ifeq ($(OS),$(findstring $(OS), "linux"))
319   ifeq ($(CPU),i386)
320     PLUGAPPLIB_XPLINK = $(OCGDIR)/gameengine/GamePlayer/netscape/src/$(DEBUG_DIR)_Blender3DPlugin_implementation_.o 
321   endif
322 endif
323
324 # A bit silly... but needed to resolve symbols.
325 PLUGREMLIB = $(NAN_STRING)/lib/$(DEBUG_DIR)libstring.a
326
327 ######################## OS dependencies (alphabetic!) ################
328
329 include nan_link.mk
330
331 ifeq ($(NAN_JUST_BLENDERDYNAMIC),true)
332     BINTARGETS = blenderdynamic
333 endif
334
335 ifeq ($(WITH_BF_DYNAMICOPENGL), true)
336     BINTARGETS += blenderdynamic
337 endif
338
339 ifeq ($(WITH_BF_STATICOPENGL), true)
340     BINTARGETS += blenderstatic
341 endif
342
343 ifeq ($(WITH_BF_BLENDERPLAYER), true)
344     export WITH_BF_GAMEENGINE=true
345     BINTARGETS += blenderplayer
346 endif
347
348 ifeq ($(WITH_BF_WEBPLUGIN), true)
349     BINTARGETS += plugin
350     ifeq ($(OS),linux)
351         ifeq ($(CPU),i386)
352              BINTARGETS += xplink
353         endif
354     endif
355 endif
356
357 ifeq ($(OS),solaris)
358     PULIB += $(NAN_ZLIB)/lib/libz.a
359     SPLIB += $(NAN_ZLIB)/lib/libz.a
360 endif
361
362 # OpenAL libs are already compiled as shared code! Check FMod if we switch to that. (nzc)
363
364 # Some vars to keep the rest of this section mostly readable
365 # in an 80 char term
366 SOUNDSYSTEM = $(OCGDIR)/intern/SoundSystem/$(DEBUG_DIR)libSoundSystem.a
367 DUMMYSOUND  = $(OCGDIR)/intern/DummySoundSystem/$(DEBUG_DIR)libDummySoundSystem.a
368 OPENALSOUND = $(OCGDIR)/intern/OpenALSoundSystem/$(DEBUG_DIR)libOpenALSoundSystem.a
369 SDLSOUND    = $(OCGDIR)/intern/SDLSoundSystem/$(DEBUG_DIR)libSDLSoundSystem.a
370
371 # Some kooky logic going on here ...
372 ifeq ($(NAN_NO_OPENAL), true)
373     NAN_SND_LIBS =  $(SOUNDSYSTEM)
374     NAN_SND_LIBS += $(DUMMYSOUND)
375     NAN_SND_LIBS += $(SOUNDSYSTEM)
376 else
377   ifeq ($(OS),$(findstring $(OS), "freebsd linux windows"))
378     ifeq ($(CPU),$(findstring $(CPU), "i386 powerpc x86_64 parisc64"))
379         NAN_SND_LIBS =  $(SOUNDSYSTEM)
380         NAN_SND_LIBS += $(DUMMYSOUND)
381         NAN_SND_LIBS += $(OPENALSOUND)
382         NAN_SND_LIBS += $(SDLSOUND)
383         NAN_SND_LIBS += $(NAN_OPENAL)/lib/libopenal.a
384         ALUT = $(wildcard $(NAN_OPENAL)/lib/libalut.a)
385         NAN_SND_LIBS += $(ALUT)
386         NAN_SND_LIBS += $(SOUNDSYSTEM)
387     else
388       ifeq ($(OS),windows)
389         NAN_SND_LIBS =  $(SOUNDSYSTEM)
390         NAN_SND_LIBS += $(DUMMYSOUND)
391         NAN_SND_LIBS += $(OPENALSOUND)
392         NAN_SND_LIBS += $(SDLSOUND)
393         NAN_SND_LIBS += $(NAN_OPENAL)/lib/openal_static.lib
394         ALUT = $(wildcard $(NAN_OPENAL)/lib/alut_static.lib)
395         NAN_SND_LIBS += $(ALUT)
396         NAN_SND_LIBS += $(SOUNDSYSTEM)
397       else
398         NAN_SND_LIBS =  $(SOUNDSYSTEM)
399         NAN_SND_LIBS += $(DUMMYSOUND)
400         NAN_SND_LIBS += $(SOUNDSYSTEM)
401       endif
402     endif
403   else
404     ifeq ($(OS),darwin)
405       NAN_SND_LIBS =  $(SOUNDSYSTEM)
406       NAN_SND_LIBS += $(DUMMYSOUND)
407       NAN_SND_LIBS += $(OPENALSOUND)
408       NAN_SND_LIBS += $(NAN_OPENAL)/lib/libopenal.a
409       ALUT = $(wildcard $(NAN_OPENAL)/lib/libalut.a)
410       NAN_SND_LIBS += $(ALUT)
411       NAN_SND_LIBS += $(SOUNDSYSTEM)
412     else
413       ifeq ($(OS), solaris)
414         NAN_SND_LIBS =  $(SOUNDSYSTEM)
415         NAN_SND_LIBS += $(DUMMYSOUND)
416         NAN_SND_LIBS += $(OPENALSOUND)
417         NAN_SND_LIBS += $(SDLSOUND)
418         NAN_SND_LIBS += $(NAN_OPENAL)/lib/libopenal.a
419         ALUT = $(wildcard $(NAN_OPENAL)/lib/libalut.a)
420         NAN_SND_LIBS += $(ALUT)
421         NAN_SND_LIBS += $(SOUNDSYSTEM)
422       else
423         ifeq ($(OS), irix)
424            NAN_SND_LIBS = $(SOUNDSYSTEM)
425            NAN_SND_LIBS += $(DUMMYSOUND)
426            NAN_SND_LIBS += $(SDLSOUND)
427            NAN_SND_LIBS += $(SOUNDSYSTEM)
428         else
429            NAN_SND_LIBS =  $(SOUNDSYSTEM)
430            NAN_SND_LIBS += $(DUMMYSOUND)
431            NAN_SND_LIBS += $(SOUNDSYSTEM)
432         endif
433       endif
434     endif
435   endif
436 endif
437
438 ifeq ($(OS),windows)
439
440     # Might need to change this to $(NAN_MOZILLA_LIB)/nspr4.lib
441     NSPLUGLIB += $(NAN_NSPR)/lib/nspr4.lib
442
443     BINTARGETS = blenderdynamic
444     ifeq ($(FREE_WINDOWS),true)
445         ifneq ($(NAN_NO_KETSJI),true)
446             BINTARGETS += blenderplayer
447         endif
448     else
449         BINTARGETS += blenderplayer
450         BINTARGETS += blenderdynplayer
451         BINTARGETS += plugin
452     endif
453
454     PULIB += $(OCGDIR)/blender/icons/$(DEBUG_DIR)winblender.res
455     PULIB += $(NAN_ZLIB)/lib/libz.a
456     SPLIB += $(OCGDIR)/blender/icons/$(DEBUG_DIR)winblender.res
457     SPLIB += $(NAN_ZLIB)/lib/libz.a
458 endif
459
460
461 # prepare for NAN_BUILDINFO compile at the *sigh* link rules below
462
463 ifdef NAN_BUILDINFO
464     CSRCS =
465     ALLTARGETS =
466     include nan_compile.mk
467 endif
468
469 ################## target rules ########################
470
471 all debug ::
472         @echo "****> Make $@ by $(ID)@$(HOST) at $(MAKE_START) on $(CONFIG_GUESS)"
473 ifdef NANENV
474         @for n in $(NANENV); do \
475             echo "      $$n"; \
476         done
477 endif
478
479 DIR = $(OCGDIR)
480 SOURCEDIR = source
481
482 include nan_subdirs.mk
483
484 ################## target rules ########################
485
486 all:: link
487
488 debug debuglink::
489         @$(MAKE) link DEBUG_DIR="debug/" NANENV=$(NANENV)
490
491 clean:: linkclean debuglinkclean
492
493 link: $(BINTARGETS)
494         @echo "****> Build $(MAKE_START) - `date '+%H:%M:%S %d-%b-%Y'`"
495 ifdef NANENV
496         @for n in $(NANENV); do \
497             echo "      $$n"; \
498         done
499 endif
500
501 linkclean:
502         @$(RM) -r $(DIR)/blenderstatic* \
503                   $(DIR)/blenderplayer* \
504                   $(DIR)/bin/*
505
506 debuglinkclean:
507         @$(RM) -r $(DIR)/debug/blenderstatic* \
508                   $(DIR)/debug/blenderplayer* \
509                   $(DIR)/debug/bin/*
510
511 # Shortcut for Tinderbox release builds. Mortals don't use this.
512 release:
513         @$(MAKE) -C ../release/ all || exit 1;
514
515 ############### Linker rules ###############
516
517 blenderstatic: $(DIR)/$(DEBUG_DIR)bin/blenderstatic
518 blenderdynamic: $(DIR)/$(DEBUG_DIR)bin/blender$(EXT)
519 blenderplayer: $(DIR)/$(DEBUG_DIR)bin/blenderplayer$(EXT)
520 blenderdynplayer: $(DIR)/$(DEBUG_DIR)bin/blenderdynplayer$(EXT)
521
522 # XPCOM connector only for linux so far...
523 ifeq ($(OS),linux)
524     xplink: $(DIR)/$(DEBUG_DIR)bin/Blender3DPlugin$(SOEXT)
525 endif
526
527 # Moz/NS plugin:
528 ifeq ($(OS),$(findstring $(OS), "freebsd linux irix solaris"))
529     plugin: $(DIR)/$(DEBUG_DIR)bin/npBlender3DPlugin$(SOEXT)
530     ptest: $(DIR)/$(DEBUG_DIR)bin/npTestPlugin$(SOEXT)
531 endif
532 # Windows needs a 8.3 name... Why? Dunno...
533 ifeq ($(OS),windows)
534         ifneq ($(FREE_WINDOWS),true)
535             plugin: $(DIR)/$(DEBUG_DIR)npB3DPlg$(SOEXT)
536         endif
537 endif
538
539 $(DIR)/$(DEBUG_DIR)bin/blenderstatic: $(OBJS) $(GRPLIB) $(PULIB) $(COMLIB) 
540         @echo "****> Link $@"
541 ifdef NAN_BUILDINFO
542         $(CCC) $(REL_CFLAGS) -DBUILD_DATE='"$(BUILD_DATE)"' -DBUILD_TIME='"$(BUILD_TIME)"' -DBUILD_REV='"$(BUILD_REV)"' -DBUILD_PLATFORM='"$(CONFIG_GUESS)"' -DBUILD_TYPE='"static"' $(BUILDINFO_C) -c -o $(BUILDINFO_O) -DNAN_BUILDINFO
543 endif
544         mkdir -p $(DIR)/$(DEBUG_DIR)bin
545         $(CCC) $(LDFLAGS) -o $(DIR)/$(DEBUG_DIR)bin/blenderstatic $(BUILDINFO_O) $(OBJS) $(GRPLIB) $(PULIB) $(COMLIB) $(LLIBS) $(SADD) $(LOPTS)
546 ifdef NAN_BUILDINFO
547         /bin/rm $(BUILDINFO_O)
548 endif
549 ifeq ($(OS), darwin)
550         @$(MAKE) -C darwin/ APPLICATION=blenderstatic
551 endif
552
553 $(DIR)/$(DEBUG_DIR)bin/blender$(EXT): $(OBJS) $(GRPLIB) $(PULIB) $(COMLIB) 
554         @echo "****> Link $@"
555 ifdef NAN_BUILDINFO
556         $(CCC) $(REL_CFLAGS) -DBUILD_DATE='"$(BUILD_DATE)"' -DBUILD_TIME='"$(BUILD_TIME)"' -DBUILD_REV='"$(BUILD_REV)"' -DBUILD_PLATFORM='"$(CONFIG_GUESS)"' -DBUILD_TYPE='"dynamic"' $(BUILDINFO_C) -c -o $(BUILDINFO_O) -DNAN_BUILDINFO
557 endif
558         mkdir -p $(DIR)/$(DEBUG_DIR)bin
559         $(CCC) $(LDFLAGS) -o $(DIR)/$(DEBUG_DIR)bin/blender$(EXT) $(BUILDINFO_O) $(OBJS) $(GRPLIB) $(PULIB) $(COMLIB) $(LLIBS)  $(DADD) $(LOPTS)
560 ifdef NAN_BUILDINFO
561         /bin/rm $(BUILDINFO_O)
562 endif
563 ifeq ($(OS), darwin)
564         @$(MAKE) -C darwin/ APPLICATION=blender
565 endif
566
567 $(DIR)/$(DEBUG_DIR)bin/blenderplayer$(EXT): $(OBJS) $(SPLIB1) $(COMLIB) $(SPLIB)
568         @echo "****> Link $@"
569 ifdef NAN_BUILDINFO
570         $(CCC) $(REL_CFLAGS) -DBUILD_DATE='"$(BUILD_DATE)"' -DBUILD_TIME='"$(BUILD_TIME)"' -DBUILD_REV='"$(BUILD_REV)"' -DBUILD_PLATFORM='"$(CONFIG_GUESS)"' -DBUILD_TYPE='"dynamic"' $(BUILDINFO_C) -c -o $(BUILDINFO_O) -DNAN_BUILDINFO
571 endif
572         mkdir -p $(DIR)/$(DEBUG_DIR)bin
573         $(CCC) $(LDFLAGS) -o $(DIR)/$(DEBUG_DIR)bin/blenderplayer$(EXT) $(BUILDINFO_O) $(OBJS) $(SPLIB1) $(COMLIB) $(SPLIB) $(LLIBS) $(DADD) $(LOPTS)
574 ifdef NAN_BUILDINFO
575         /bin/rm $(BUILDINFO_O)
576 endif
577 ifeq ($(OS), darwin)
578         @$(MAKE) -C darwin/ APPLICATION=blenderplayer
579 endif
580
581 $(DIR)/$(DEBUG_DIR)bin/blenderdynplayer$(EXT): $(OBJS) $(COMLIB) $(SPLIB)
582         @echo "****> Link $@"
583 ifdef NAN_BUILDINFO
584         $(CCC) $(REL_CFLAGS) -DBUILD_DATE='"$(BUILD_DATE)"' -DBUILD_TIME='"$(BUILD_TIME)"' -DBUILD_REV='"$(BUILD_REV)"' -DBUILD_PLATFORM='"$(CONFIG_GUESS)"' -DBUILD_TYPE='"dynamic"' $(BUILDINFO_C) -c -o $(BUILDINFO_O) -DNAN_BUILDINFO
585 endif
586         mkdir -p $(DIR)/$(DEBUG_DIR)bin
587         $(CCC) $(LDFLAGS) -o $(DIR)/$(DEBUG_DIR)bin/blenderdynplayer$(EXT) $(BUILDINFO_O) $(OBJS) $(SPLIB1) $(COMLIB) $(SPLIB) $(LLIBS) $(DADD) $(LOPTS)
588 ifdef NAN_BUILDINFO
589         /bin/rm $(BUILDINFO_O)
590 endif
591 ifeq ($(OS), darwin)
592         @$(MAKE) -C darwin/ APPLICATION=blenderplayer
593 endif
594
595 $(DIR)/$(DEBUG_DIR)bin/Blender3DPlugin$(SOEXT): $(PLUGAPPLIB_XPLINK)
596         @echo "****> Link $@"
597 ifdef NAN_BUILDINFO
598         $(CCC) $(REL_CFLAGS) -DBUILD_DATE='"$(BUILD_DATE)"' -DBUILD_TIME='"$(BUILD_TIME)"' -DBUILD_REV='"$(BUILD_REV)"' -DBUILD_PLATFORM='"$(CONFIG_GUESS)"' -DBUILD_TYPE='"dynamic"' $(BUILDINFO_C) -c -o $(BUILDINFO_O) -DNAN_BUILDINFO
599 endif
600         mkdir -p $(DIR)/$(DEBUG_DIR)bin
601         $(CCC) $(DYNLDFLAGS) -o $@ $(PLUGAPPLIB_XPLINK) $(LOPTS)
602 ifdef NAN_BUILDINFO
603         /bin/rm $(BUILDINFO_O)
604 endif
605
606 # Windows build needs a def file? Why? For exposing functions from the
607 # dll to the outside world. However, this is alsi done internally..
608 DEFFILE = ./gameengine/GamePlayer/netscape/src/npB3DPlg.def
609
610 # Windows needs a specific name format for dll.s so we give it one.
611 $(DIR)/$(DEBUG_DIR)npB3DPlg$(SOEXT): $(NSPLUGLIB) $(PLUGAPPLIB) $(COMLIB) $(SPLIB)
612         @echo "****> Link $@"
613 ifdef NAN_BUILDINFO
614         $(CCC) $(REL_CFLAGS) -DBUILD_DATE='"$(BUILD_DATE)"' -DBUILD_TIME='"$(BUILD_TIME)"' -DBUILD_REV='"$(BUILD_REV)"' -DBUILD_PLATFORM='"$(CONFIG_GUESS)"' -DBUILD_TYPE='"dynamic"' $(BUILDINFO_C) -c -o $(BUILDINFO_O) -DNAN_BUILDINFO
615 endif
616 #       $(CCC) $(DYNLDFLAGS) -o $@ $(NSPLUGLIB) $(PLUGAPPLIB) $(COMLIB) $(SPLIB) $(PLUGREMLIB) $(LLIBS) $(DADD) $(LOPTS) 
617         $(CCC) $(DYNLDFLAGS) -o $@ $(NSPLUGLIB) $(PLUGAPPLIB) $(COMLIB) $(SPLIB) $(PLUGREMLIB) $(LLIBS) $(DADD) $(LOPTS) /def:$(DEFFILE)
618 ifdef NAN_BUILDINFO
619         /bin/rm $(BUILDINFO_O)
620 endif
621
622 $(DIR)/$(DEBUG_DIR)bin/npBlender3DPlugin$(SOEXT): $(NSPLUGLIB) $(PLUGAPPLIB) $(COMLIB) $(SPLIB)
623         @echo "****> Link $@"
624 ifdef NAN_BUILDINFO
625         $(CCC) $(REL_CFLAGS) -DBUILD_DATE='"$(BUILD_DATE)"' -DBUILD_TIME='"$(BUILD_TIME)"' -DBUILD_REV='"$(BUILD_REV)"' -DBUILD_PLATFORM='"$(CONFIG_GUESS)"' -DBUILD_TYPE='"dynamic"' $(BUILDINFO_C) -c -o $(BUILDINFO_O) -DNAN_BUILDINFO
626 endif
627         mkdir -p $(DIR)/$(DEBUG_DIR)bin
628         $(CCC) $(DYNLDFLAGS) -o $@ $(NSPLUGLIB) $(PLUGAPPLIB) $(COMLIB) $(SPLIB) $(PLUGREMLIB) $(LLIBS) $(DADD) $(LOPTS)
629 ifdef NAN_BUILDINFO
630         /bin/rm $(BUILDINFO_O)
631 endif
632
633 $(DIR)/$(DEBUG_DIR)bin/npTestPlugin$(SOEXT): $(NSPLUGLIB)
634         @echo "****> Link $@"
635 ifdef NAN_BUILDINFO
636         $(CCC) $(REL_CFLAGS) -DBUILD_DATE='"$(BUILD_DATE)"' -DBUILD_TIME='"$(BUILD_TIME)"' -DBUILD_REV='"$(BUILD_REV)"' -DBUILD_PLATFORM='"$(CONFIG_GUESS)"' -DBUILD_TYPE='"dynamic"' $(BUILDINFO_C) -c -o $(BUILDINFO_O) -DNAN_BUILDINFO
637 endif
638         mkdir -p $(DIR)/$(DEBUG_DIR)bin
639         $(CCC) $(DYNLDFLAGS) -o $@ $(NSPLUGLIB) $(PLUGTESTLIB) $(LLIBS) $(DADD) $(LOPTS)
640 ifdef NAN_BUILDINFO
641         /bin/rm $(BUILDINFO_O)
642 endif
643