merge with 2.5 at r18679
[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 += $(NAN_DECIMATION)/lib/libdecimation.a
93 COMLIB += $(OCGDIR)/blender/blenloader/$(DEBUG_DIR)libblenloader.a
94 COMLIB += $(OCGDIR)/blender/blenpluginapi/$(DEBUG_DIR)libblenpluginapi.a
95 COMLIB += $(OCGDIR)/blender/nodes_shd/$(DEBUG_DIR)libnodes_shd.a
96 COMLIB += $(OCGDIR)/blender/nodes_cmp/$(DEBUG_DIR)libnodes_cmp.a
97 COMLIB += $(OCGDIR)/blender/nodes_tex/$(DEBUG_DIR)libnodes_tex.a
98 COMLIB += $(OCGDIR)/blender/nodes/$(DEBUG_DIR)libnodes.a
99 COMLIB += $(OCGDIR)/blender/imbuf/$(DEBUG_DIR)libimbuf.a
100 COMLIB += $(OCGDIR)/blender/blenlib/$(DEBUG_DIR)libblenlib.a
101 COMLIB += $(NAN_IKSOLVER)/lib/libiksolver.a
102 COMLIB += $(NAN_MOTO)/lib/libmoto.a
103 COMLIB += $(NAN_OPENNL)/lib/$(DEBUG_DIR)libopennl.a
104 COMLIB += $(NAN_SUPERLU)/lib/$(DEBUG_DIR)libsuperlu.a   
105 COMLIB += $(OCGDIR)/blender/avi/$(DEBUG_DIR)libavi.a
106 COMLIB += $(NAN_JPEG)/lib/libjpeg.a
107 COMLIB += $(OCGDIR)/blender/gpu/$(DEBUG_DIR)libgpu.a
108 COMLIB += $(NAN_GLEW)/lib/libglew.a
109 COMLIB += $(NAN_ELBEEM)/lib/$(DEBUG_DIR)libelbeem.a
110
111 ifneq ($(NAN_NO_KETSJI),true)
112     COMLIB += $(OCGDIR)/gameengine/bloutines/$(DEBUG_DIR)libbloutines.a
113     COMLIB += $(OCGDIR)/gameengine/blconverter/$(DEBUG_DIR)libblconverter.a
114     COMLIB += $(OCGDIR)/gameengine/blphys/common/$(DEBUG_DIR)libcommon.a
115     COMLIB += $(OCGDIR)/gameengine/ketsji/$(DEBUG_DIR)libketsji.a
116     COMLIB += $(OCGDIR)/gameengine/blconverter/$(DEBUG_DIR)libblconverter.a
117     COMLIB += $(OCGDIR)/gameengine/blconverter/$(DEBUG_DIR)libblconverter.a
118     COMLIB += $(NAN_SOLID)/lib/libsolid.a
119     COMLIB += $(NAN_SOLID)/lib/libsolid_broad.a 
120     COMLIB += $(NAN_SOLID)/lib/libsolid_complex.a
121     COMLIB += $(NAN_SOLID)/lib/libsolid_convex.a
122     COMLIB += $(OCGDIR)/gameengine/blphys/sumo/$(DEBUG_DIR)libsumo.a
123     COMLIB += $(OCGDIR)/gameengine/blphys/fuzzics/$(DEBUG_DIR)libfuzzics.a
124     COMLIB += $(NAN_QHULL)/lib/libqhull.a
125     COMLIB += $(OCGDIR)/gameengine/blphys/dummy/$(DEBUG_DIR)libdummy.a
126     COMLIB += $(OCGDIR)/gameengine/blphys/common/$(DEBUG_DIR)libcommon.a
127 #    COMLIB += $(OCGDIR)/gameengine/blphys/sumo/$(DEBUG_DIR)libsumo.a
128     COMLIB += $(OCGDIR)/gameengine/blphys/dummy/$(DEBUG_DIR)libdummy.a
129     COMLIB += $(OCGDIR)/gameengine/ketsji/$(DEBUG_DIR)libketsji.a
130     COMLIB += $(OCGDIR)/gameengine/blphys/common/$(DEBUG_DIR)libcommon.a
131 #    COMLIB += $(OCGDIR)/gameengine/blphys/blode/$(DEBUG_DIR)libblode.a
132 #    COMLIB += $(OCGDIR)/gameengine/blphys/sumo/$(DEBUG_DIR)libsumo.a
133     COMLIB += $(OCGDIR)/gameengine/blphys/dummy/$(DEBUG_DIR)libdummy.a
134     COMLIB += $(OCGDIR)/gameengine/blphys/blbullet/$(DEBUG_DIR)libblbullet.a
135     COMLIB += $(OCGDIR)/gameengine/blphys/common/$(DEBUG_DIR)libcommon.a
136 #    COMLIB += $(OCGDIR)/gameengine/blphys/sumo/$(DEBUG_DIR)libsumo.a
137     COMLIB += $(OCGDIR)/gameengine/blphys/dummy/$(DEBUG_DIR)libdummy.a
138     COMLIB += $(OCGDIR)/gameengine/ketsji/$(DEBUG_DIR)libketsji.a
139     COMLIB += $(OCGDIR)/gameengine/logic/$(DEBUG_DIR)liblogic.a
140     COMLIB += $(OCGDIR)/gameengine/logic/Joystick/$(DEBUG_DIR)libJoystick.a
141     COMLIB += $(OCGDIR)/gameengine/rasterizer/$(DEBUG_DIR)librasterizer.a
142     COMLIB += $(OCGDIR)/gameengine/OpenGLrasterizer/$(DEBUG_DIR)libOpenGLrasterizer.a
143     COMLIB += $(OCGDIR)/gameengine/expression/$(DEBUG_DIR)libexpression.a
144     COMLIB += $(OCGDIR)/gameengine/scenegraph/$(DEBUG_DIR)libscenegraph.a
145     COMLIB += $(OCGDIR)/gameengine/videotex/$(DEBUG_DIR)libvideotex.a
146 #    COMLIB += $(OCGDIR)/sumo/$(DEBUG_DIR)libfuzzics.a
147 #    COMLIB += $(OCGDIR)/sumo/$(DEBUG_DIR)libsolid.a
148     COMLIB += $(NAN_MOTO)/lib/libmoto.a
149     COMLIB += $(NAN_SND_LIBS)
150     COMLIB += $(OCGDIR)/kernel/gen_system/$(DEBUG_DIR)libgen_system.a
151     COMLIB += $(OCGDIR)/kernel/gen_messaging/$(DEBUG_DIR)libgen_messaging.a
152     COMLIB += $(OCGDIR)/gameengine/ketsji/KXNetwork/$(DEBUG_DIR)libKXNetwork.a
153     COMLIB += $(OCGDIR)/gameengine/Network/$(DEBUG_DIR)libNetwork.a
154     COMLIB += $(OCGDIR)/gameengine/Network/LoopBackNetwork/$(DEBUG_DIR)libLoopBackNetwork.a
155     COMLIB += $(NAN_BULLET2)/lib/libbullet2.a
156 endif
157
158 COMLIB += $(OCGDIR)/blender/makesdna/$(DEBUG_DIR)libdna.a
159 COMLIB += $(NAN_GUARDEDALLOC)/lib/libguardedalloc.a
160 COMLIB += $(NAN_MEMUTIL)/lib/libmemutil.a
161 COMLIB += $(NAN_BMFONT)/lib/$(DEBUG_DIR)libbmfont.a
162 COMLIB += $(NAN_PNG)/lib/libpng.a
163 COMLIB += $(OCGDIR)/blender/yafray/$(DEBUG_DIR)libyafrayexport.a
164
165 ifeq ($(WITH_QUICKTIME), true)
166     COMLIB += $(OCGDIR)/blender/blenderqt/$(DEBUG_DIR)libblenderqt.a
167 endif
168
169 ifeq ($(WITH_OPENEXR), true)
170     COMLIB += $(OCGDIR)/blender/imbuf/openexr/$(DEBUG_DIR)libopenexr.a
171 endif
172
173 COMLIB += $(OCGDIR)/blender/imbuf/cineon/$(DEBUG_DIR)libcineon.a
174
175 ifeq ($(WITH_DDS), true)
176     COMLIB += $(OCGDIR)/blender/imbuf/dds/$(DEBUG_DIR)libdds.a
177 endif
178
179 ifeq ($(WITH_BINRELOC), true)
180     COMLIB += $(OCGDIR)/extern/binreloc/$(DEBUG_DIR)libbinreloc.a
181 endif
182
183 ifeq ($(WITH_FREETYPE2), true)
184     COMLIB += $(OCGDIR)/blender/ftfont/$(DEBUG_DIR)libftfont.a
185     ifeq ($(OS), windows)
186       ifeq ($(FREE_WINDOWS), true)
187         COMLIB += $(NAN_FTGL)/lib/libftgl.a
188         COMLIB += $(NAN_FREETYPE)/lib/libfreetype.a
189       else
190         COMLIB += $(NAN_FTGL)/lib/ftgl_static_ST.lib
191         COMLIB += $(NAN_FREETYPE)/lib/freetype2ST.lib
192       endif
193     else
194       COMLIB += $(NAN_FTGL)/lib/libftgl.a
195       ifeq ($(OS), irix)
196         COMLIB += $(NAN_FREETYPE)/lib/libfreetype.a
197         else
198             COMLIB += $(NAN_FREETYPE)/lib/libfreetype.a
199       endif
200     endif
201 endif
202
203 ifeq ($(OS), irix)
204     COMLIB += $(NAN_SDL)/lib/libSDL.a
205 endif
206
207 ifeq ($(OS), windows)
208     ifeq ($(FREE_WINDOWS), true)
209         COMLIB += $(NAN_SDL)/lib/libSDL.a
210         COMLIB += $(NAN_PTHREADS)/lib/libpthreadGC2.a
211     else
212         COMLIB += $(NAN_SDL)/lib/SDL.lib
213     endif
214 endif
215
216 ifeq ($(WITH_OPENEXR), true)
217     COMLIB += $(NAN_OPENEXR_LIBS)
218 endif
219
220 # note: space_api.a in begin of editors, screen.a in end
221 PULIB = $(NAN_MOTO)/lib/libmoto.a
222 PULIB += $(OCGDIR)/blender/readblenfile/$(DEBUG_DIR)libreadblenfile.a
223 PULIB += $(OCGDIR)/blender/ed_space/libed_space.a
224 PULIB += $(OCGDIR)/blender/ed_sound/libed_sound.a
225 PULIB += $(OCGDIR)/blender/ed_action/libed_action.a
226 PULIB += $(OCGDIR)/blender/ed_nla/libed_nla.a
227 PULIB += $(OCGDIR)/blender/ed_script/libed_script.a
228 PULIB += $(OCGDIR)/blender/ed_text/libed_text.a
229 PULIB += $(OCGDIR)/blender/ed_sequencer/libed_sequencer.a
230 PULIB += $(OCGDIR)/blender/ed_file/libed_file.a
231 PULIB += $(OCGDIR)/blender/ed_info/libed_info.a
232 PULIB += $(OCGDIR)/blender/ed_buttons/libed_buttons.a
233 PULIB += $(OCGDIR)/blender/ed_node/libed_node.a
234 PULIB += $(OCGDIR)/blender/ed_image/libed_image.a
235 PULIB += $(OCGDIR)/blender/ed_ipo/libed_ipo.a
236 PULIB += $(OCGDIR)/blender/ed_outliner/libed_outliner.a
237 PULIB += $(OCGDIR)/blender/ed_time/libed_time.a
238 PULIB += $(OCGDIR)/blender/ed_preview/libed_preview.a
239 PULIB += $(OCGDIR)/blender/ed_view3d/libed_view3d.a
240 PULIB += $(OCGDIR)/blender/ed_interface/libed_interface.a
241 PULIB += $(OCGDIR)/blender/ed_object/libed_object.a
242 PULIB += $(OCGDIR)/blender/ed_curve/libed_curve.a
243 PULIB += $(OCGDIR)/blender/ed_armature/libed_armature.a
244 PULIB += $(OCGDIR)/blender/ed_mesh/libed_mesh.a
245 PULIB += $(OCGDIR)/blender/ed_sculpt/libed_sculpt.a
246 PULIB += $(OCGDIR)/blender/ed_physics/libed_physics.a
247 PULIB += $(OCGDIR)/blender/ed_animation/libed_animation.a
248 PULIB += $(OCGDIR)/blender/ed_transform/libed_transform.a
249 PULIB += $(OCGDIR)/blender/ed_util/libed_util.a
250 PULIB += $(OCGDIR)/blender/ed_uvedit/libed_uvedit.a
251 PULIB += $(OCGDIR)/blender/ed_datafiles/libed_datafiles.a
252 PULIB += $(OCGDIR)/blender/ed_screen/libed_screen.a
253 PULIB += $(OCGDIR)/blender/windowmanager/libwindowmanager.a
254 PULIB += $(OCGDIR)/blender/python/$(DEBUG_DIR)libpython.a
255 PULIB += $(OCGDIR)/blender/makesrna/$(DEBUG_DIR)librna.a
256 # note, no idea but it suddenly doesn't compile :(
257 PULIB += $(OCGDIR)/blender/blenlib/$(DEBUG_DIR)libblenlib.a
258
259 ifeq ($(NAN_NO_KETSJI),true)
260     PULIB += $(NAN_MOTO)/lib/libmoto.a
261     PULIB += $(OCGDIR)/kernel/gen_system/$(DEBUG_DIR)libgen_system.a
262     PULIB += $(OCGDIR)/kernel/gen_messaging/$(DEBUG_DIR)libgen_messaging.a
263     COMLIB += $(NAN_SND_LIBS)
264 endif
265
266 SPLIB1 = $(OCGDIR)/gameengine/GamePlayer/ghost/$(DEBUG_DIR)libghost.a
267 SPLIB1 += $(OCGDIR)/gameengine/GamePlayer/common/$(DEBUG_DIR)libcommon.a
268 SPLIB1 += $(OCGDIR)/gameengine/blconverter/$(DEBUG_DIR)libblconverter.a
269 SPLIB1 += $(NAN_STRING)/lib/$(DEBUG_DIR)libstring.a
270 SPLIB1 += $(NAN_GHOST)/lib/$(DEBUG_DIR)libghost.a
271
272 SPLIB = $(OCGDIR)/blender/readblenfile/$(DEBUG_DIR)libreadblenfile.a
273 # this is used for the plugin. It uses some things from libz.a, 
274 # but somehow it consistently fails to resolve these symbols... or 
275 # can I just not check them? nm claims they aren't...
276 SPLIB += $(OCGDIR)/blender/blenkernel/blenkernel_blc/$(DEBUG_DIR)libblenkernel_blc.a
277 SPLIB += $(OCGDIR)/blender/makesrna/$(DEBUG_DIR)librna.a
278
279 # These three need to be explicitly mentioned on the cl, because 
280 # if they are offered as a lib, they are optimized away. (nzc)
281 NSPLUGLIB = $(OCGDIR)/gameengine/GamePlayer/netscape/src/$(DEBUG_DIR)UnixShell.o
282 NSPLUGLIB += $(OCGDIR)/gameengine/GamePlayer/netscape/src/$(DEBUG_DIR)stubs.o
283 NSPLUGLIB += $(OCGDIR)/gameengine/GamePlayer/netscape/src/$(DEBUG_DIR)winstubs.o
284 NSPLUGLIB += $(OCGDIR)/gameengine/GamePlayer/netscape/src/$(DEBUG_DIR)Blender3DPlugin_native_implementation.o
285
286 # Here you can configure what sort of test to make for the plugin.
287 #    PLUGTESTLIB = $(OCGDIR)/gameengine/GamePlayer/netscape/test/$(DEBUG_DIR)libns_api_test_stub.a
288 #    PLUGTESTLIB = $(OCGDIR)/gameengine/GamePlayer/netscape/test/$(DEBUG_DIR)libns_api_test_colorcycle.a
289 #    PLUGTESTLIB = $(OCGDIR)/gameengine/GamePlayer/netscape/test/$(DEBUG_DIR)libns_api_test_gears.a
290 PLUGTESTLIB = $(OCGDIR)/gameengine/GamePlayer/netscape/test/$(DEBUG_DIR)libns_api_test_threaded_gears.a
291
292 # XPCOM is done only for Linux for now
293 ifeq ($(OS),$(findstring $(OS), "linux"))
294   ifeq ($(CPU),i386)
295     NSPLUGLIB += $(OCGDIR)/gameengine/GamePlayer/netscape/src/$(DEBUG_DIR)XPH_xpcom_hooks.o
296   endif
297 endif
298
299 PLUGAPPLIB = $(OCGDIR)/gameengine/GamePlayer/netscape/src/$(DEBUG_DIR)libplugin_ketsji_hooks.a
300
301 ifeq ($(OS),$(findstring $(OS), "freebsd linux irix solaris"))
302     NSPLUGLIB += $(OCGDIR)/gameengine/GamePlayer/netscape/src/$(DEBUG_DIR)PLG_X11_windowing.o
303     PLUGAPPLIB += $(OCGDIR)/gameengine/GamePlayer/common/unix/$(DEBUG_DIR)libunix.a
304 endif
305 ifeq ($(OS),$(findstring $(OS), "windows"))
306     NSPLUGLIB += $(OCGDIR)/gameengine/GamePlayer/netscape/src/$(DEBUG_DIR)PLG_MSWindows_windowing.o
307     NSPLUGLIB += $(OCGDIR)/gameengine/GamePlayer/netscape/src/$(DEBUG_DIR)npB3DPlg.res
308     PLUGAPPLIB += $(OCGDIR)/gameengine/GamePlayer/common/windows/$(DEBUG_DIR)libwindows.a
309 endif
310
311 PLUGAPPLIB += $(OCGDIR)/gameengine/GamePlayer/common/$(DEBUG_DIR)libcommon.a
312
313 ifeq ($(OS),$(findstring $(OS), "linux"))
314   ifeq ($(CPU),i386)
315     PLUGAPPLIB_XPLINK = $(OCGDIR)/gameengine/GamePlayer/netscape/src/$(DEBUG_DIR)_Blender3DPlugin_implementation_.o 
316   endif
317 endif
318
319 # A bit silly... but needed to resolve symbols.
320 PLUGREMLIB = $(NAN_STRING)/lib/$(DEBUG_DIR)libstring.a
321
322 ######################## OS dependencies (alphabetic!) ################
323
324 include nan_link.mk
325
326 ifeq ($(NAN_JUST_BLENDERDYNAMIC),true)
327     BINTARGETS = blenderdynamic
328 endif
329
330 ifeq ($(WITH_BF_DYNAMICOPENGL), true)
331     BINTARGETS += blenderdynamic
332 endif
333
334 ifeq ($(WITH_BF_STATICOPENGL), true)
335     BINTARGETS += blenderstatic
336 endif
337
338 ifeq ($(WITH_BF_BLENDERPLAYER), true)
339     export WITH_BF_GAMEENGINE=true
340     BINTARGETS += blenderplayer
341 endif
342
343 ifeq ($(WITH_BF_WEBPLUGIN), true)
344     BINTARGETS += plugin
345     ifeq ($(OS),linux)
346         ifeq ($(CPU),i386)
347              BINTARGETS += xplink
348         endif
349     endif
350 endif
351
352 ifeq ($(OS),solaris)
353     PULIB += $(NAN_ZLIB)/lib/libz.a
354     SPLIB += $(NAN_ZLIB)/lib/libz.a
355 endif
356
357 # OpenAL libs are already compiled as shared code! Check FMod if we switch to that. (nzc)
358
359 # Some vars to keep the rest of this section mostly readable
360 # in an 80 char term
361 SOUNDSYSTEM = $(OCGDIR)/intern/SoundSystem/$(DEBUG_DIR)libSoundSystem.a
362 DUMMYSOUND  = $(OCGDIR)/intern/DummySoundSystem/$(DEBUG_DIR)libDummySoundSystem.a
363 OPENALSOUND = $(OCGDIR)/intern/OpenALSoundSystem/$(DEBUG_DIR)libOpenALSoundSystem.a
364 SDLSOUND    = $(OCGDIR)/intern/SDLSoundSystem/$(DEBUG_DIR)libSDLSoundSystem.a
365
366 # Some kooky logic going on here ...
367 ifeq ($(NAN_NO_OPENAL), true)
368     NAN_SND_LIBS =  $(SOUNDSYSTEM)
369     NAN_SND_LIBS += $(DUMMYSOUND)
370     NAN_SND_LIBS += $(SOUNDSYSTEM)
371 else
372   ifeq ($(OS),$(findstring $(OS), "freebsd linux windows"))
373     ifeq ($(CPU),$(findstring $(CPU), "i386 powerpc x86_64 parisc64"))
374         NAN_SND_LIBS =  $(SOUNDSYSTEM)
375         NAN_SND_LIBS += $(DUMMYSOUND)
376         NAN_SND_LIBS += $(OPENALSOUND)
377         NAN_SND_LIBS += $(SDLSOUND)
378         NAN_SND_LIBS += $(NAN_OPENAL)/lib/libopenal.a
379         ALUT = $(wildcard $(NAN_OPENAL)/lib/libalut.a)
380         NAN_SND_LIBS += $(ALUT)
381         NAN_SND_LIBS += $(SOUNDSYSTEM)
382     else
383       ifeq ($(OS),windows)
384         NAN_SND_LIBS =  $(SOUNDSYSTEM)
385         NAN_SND_LIBS += $(DUMMYSOUND)
386         NAN_SND_LIBS += $(OPENALSOUND)
387         NAN_SND_LIBS += $(SDLSOUND)
388         NAN_SND_LIBS += $(NAN_OPENAL)/lib/openal_static.lib
389         ALUT = $(wildcard $(NAN_OPENAL)/lib/alut_static.lib)
390         NAN_SND_LIBS += $(ALUT)
391         NAN_SND_LIBS += $(SOUNDSYSTEM)
392       else
393         NAN_SND_LIBS =  $(SOUNDSYSTEM)
394         NAN_SND_LIBS += $(DUMMYSOUND)
395         NAN_SND_LIBS += $(SOUNDSYSTEM)
396       endif
397     endif
398   else
399     ifeq ($(OS),darwin)
400       NAN_SND_LIBS =  $(SOUNDSYSTEM)
401       NAN_SND_LIBS += $(DUMMYSOUND)
402       NAN_SND_LIBS += $(OPENALSOUND)
403       NAN_SND_LIBS += $(NAN_OPENAL)/lib/libopenal.a
404       ALUT = $(wildcard $(NAN_OPENAL)/lib/libalut.a)
405       NAN_SND_LIBS += $(ALUT)
406       NAN_SND_LIBS += $(SOUNDSYSTEM)
407     else
408       ifeq ($(OS), solaris)
409         NAN_SND_LIBS =  $(SOUNDSYSTEM)
410         NAN_SND_LIBS += $(DUMMYSOUND)
411         NAN_SND_LIBS += $(OPENALSOUND)
412         NAN_SND_LIBS += $(SDLSOUND)
413         NAN_SND_LIBS += $(NAN_OPENAL)/lib/libopenal.a
414         ALUT = $(wildcard $(NAN_OPENAL)/lib/libalut.a)
415         NAN_SND_LIBS += $(ALUT)
416         NAN_SND_LIBS += $(SOUNDSYSTEM)
417       else
418         ifeq ($(OS), irix)
419            NAN_SND_LIBS = $(SOUNDSYSTEM)
420            NAN_SND_LIBS += $(DUMMYSOUND)
421            NAN_SND_LIBS += $(SDLSOUND)
422            NAN_SND_LIBS += $(SOUNDSYSTEM)
423         else
424            NAN_SND_LIBS =  $(SOUNDSYSTEM)
425            NAN_SND_LIBS += $(DUMMYSOUND)
426            NAN_SND_LIBS += $(SOUNDSYSTEM)
427         endif
428       endif
429     endif
430   endif
431 endif
432
433 ifeq ($(OS),windows)
434
435     # Might need to change this to $(NAN_MOZILLA_LIB)/nspr4.lib
436     NSPLUGLIB += $(NAN_NSPR)/lib/nspr4.lib
437
438     BINTARGETS = blenderdynamic
439     ifeq ($(FREE_WINDOWS),true)
440         ifneq ($(NAN_NO_KETSJI),true)
441             BINTARGETS += blenderplayer
442         endif
443     else
444         BINTARGETS += blenderplayer
445         BINTARGETS += blenderdynplayer
446         BINTARGETS += plugin
447     endif
448
449     PULIB += $(OCGDIR)/blender/icons/$(DEBUG_DIR)winblender.res
450     PULIB += $(NAN_ZLIB)/lib/libz.a
451     SPLIB += $(OCGDIR)/blender/icons/$(DEBUG_DIR)winblender.res
452     SPLIB += $(NAN_ZLIB)/lib/libz.a
453 endif
454
455
456 # prepare for NAN_BUILDINFO compile at the *sigh* link rules below
457
458 ifdef NAN_BUILDINFO
459     CSRCS =
460     ALLTARGETS =
461     include nan_compile.mk
462 endif
463
464 ################## target rules ########################
465
466 all debug ::
467         @echo "****> Make $@ by $(ID)@$(HOST) at $(MAKE_START) on $(CONFIG_GUESS)"
468 ifdef NANENV
469         @for n in $(NANENV); do \
470             echo "      $$n"; \
471         done
472 endif
473
474 DIR = $(OCGDIR)
475 SOURCEDIR = source
476
477 include nan_subdirs.mk
478
479 ################## target rules ########################
480
481 all:: link
482
483 debug debuglink::
484         @$(MAKE) link DEBUG_DIR="debug/" NANENV=$(NANENV)
485
486 clean:: linkclean debuglinkclean
487
488 link: $(BINTARGETS)
489         @echo "****> Build $(MAKE_START) - `date '+%H:%M:%S %d-%b-%Y'`"
490 ifdef NANENV
491         @for n in $(NANENV); do \
492             echo "      $$n"; \
493         done
494 endif
495
496 linkclean:
497         @$(RM) -r $(DIR)/blenderstatic* \
498                   $(DIR)/blenderplayer* \
499                   $(DIR)/bin/*
500
501 debuglinkclean:
502         @$(RM) -r $(DIR)/debug/blenderstatic* \
503                   $(DIR)/debug/blenderplayer* \
504                   $(DIR)/debug/bin/*
505
506 # Shortcut for Tinderbox release builds. Mortals don't use this.
507 release:
508         @$(MAKE) -C ../release/ all || exit 1;
509
510 ############### Linker rules ###############
511
512 blenderstatic: $(DIR)/$(DEBUG_DIR)bin/blenderstatic
513 blenderdynamic: $(DIR)/$(DEBUG_DIR)bin/blender$(EXT)
514 blenderplayer: $(DIR)/$(DEBUG_DIR)bin/blenderplayer$(EXT)
515 blenderdynplayer: $(DIR)/$(DEBUG_DIR)bin/blenderdynplayer$(EXT)
516
517 # XPCOM connector only for linux so far...
518 ifeq ($(OS),linux)
519     xplink: $(DIR)/$(DEBUG_DIR)bin/Blender3DPlugin$(SOEXT)
520 endif
521
522 # Moz/NS plugin:
523 ifeq ($(OS),$(findstring $(OS), "freebsd linux irix solaris"))
524     plugin: $(DIR)/$(DEBUG_DIR)bin/npBlender3DPlugin$(SOEXT)
525     ptest: $(DIR)/$(DEBUG_DIR)bin/npTestPlugin$(SOEXT)
526 endif
527 # Windows needs a 8.3 name... Why? Dunno...
528 ifeq ($(OS),windows)
529         ifneq ($(FREE_WINDOWS),true)
530             plugin: $(DIR)/$(DEBUG_DIR)npB3DPlg$(SOEXT)
531         endif
532 endif
533
534 $(DIR)/$(DEBUG_DIR)bin/blenderstatic: $(OBJS) $(GRPLIB) $(PULIB) $(COMLIB) 
535         @echo "****> Link $@"
536 ifdef NAN_BUILDINFO
537         $(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
538 endif
539         mkdir -p $(DIR)/$(DEBUG_DIR)bin
540         $(CCC) $(LDFLAGS) -o $(DIR)/$(DEBUG_DIR)bin/blenderstatic $(BUILDINFO_O) $(OBJS) $(GRPLIB) $(PULIB) $(COMLIB) $(LLIBS) $(SADD) $(LOPTS)
541 ifdef NAN_BUILDINFO
542         /bin/rm $(BUILDINFO_O)
543 endif
544 ifeq ($(OS), darwin)
545         @$(MAKE) -C darwin/ APPLICATION=blenderstatic
546 endif
547
548 $(DIR)/$(DEBUG_DIR)bin/blender$(EXT): $(OBJS) $(GRPLIB) $(PULIB) $(COMLIB) 
549         @echo "****> Link $@"
550 ifdef NAN_BUILDINFO
551         $(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
552 endif
553         mkdir -p $(DIR)/$(DEBUG_DIR)bin
554         $(CCC) $(LDFLAGS) -o $(DIR)/$(DEBUG_DIR)bin/blender$(EXT) $(BUILDINFO_O) $(OBJS) $(GRPLIB) $(PULIB) $(COMLIB) $(LLIBS)  $(DADD) $(LOPTS)
555 ifdef NAN_BUILDINFO
556         /bin/rm $(BUILDINFO_O)
557 endif
558 ifeq ($(OS), darwin)
559         @$(MAKE) -C darwin/ APPLICATION=blender
560 endif
561
562 $(DIR)/$(DEBUG_DIR)bin/blenderplayer$(EXT): $(OBJS) $(SPLIB1) $(COMLIB) $(SPLIB)
563         @echo "****> Link $@"
564 ifdef NAN_BUILDINFO
565         $(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
566 endif
567         mkdir -p $(DIR)/$(DEBUG_DIR)bin
568         $(CCC) $(LDFLAGS) -o $(DIR)/$(DEBUG_DIR)bin/blenderplayer$(EXT) $(BUILDINFO_O) $(OBJS) $(SPLIB1) $(COMLIB) $(SPLIB) $(LLIBS) $(DADD) $(LOPTS)
569 ifdef NAN_BUILDINFO
570         /bin/rm $(BUILDINFO_O)
571 endif
572 ifeq ($(OS), darwin)
573         @$(MAKE) -C darwin/ APPLICATION=blenderplayer
574 endif
575
576 $(DIR)/$(DEBUG_DIR)bin/blenderdynplayer$(EXT): $(OBJS) $(COMLIB) $(SPLIB)
577         @echo "****> Link $@"
578 ifdef NAN_BUILDINFO
579         $(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
580 endif
581         mkdir -p $(DIR)/$(DEBUG_DIR)bin
582         $(CCC) $(LDFLAGS) -o $(DIR)/$(DEBUG_DIR)bin/blenderdynplayer$(EXT) $(BUILDINFO_O) $(OBJS) $(SPLIB1) $(COMLIB) $(SPLIB) $(LLIBS) $(DADD) $(LOPTS)
583 ifdef NAN_BUILDINFO
584         /bin/rm $(BUILDINFO_O)
585 endif
586 ifeq ($(OS), darwin)
587         @$(MAKE) -C darwin/ APPLICATION=blenderplayer
588 endif
589
590 $(DIR)/$(DEBUG_DIR)bin/Blender3DPlugin$(SOEXT): $(PLUGAPPLIB_XPLINK)
591         @echo "****> Link $@"
592 ifdef NAN_BUILDINFO
593         $(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
594 endif
595         mkdir -p $(DIR)/$(DEBUG_DIR)bin
596         $(CCC) $(DYNLDFLAGS) -o $@ $(PLUGAPPLIB_XPLINK) $(LOPTS)
597 ifdef NAN_BUILDINFO
598         /bin/rm $(BUILDINFO_O)
599 endif
600
601 # Windows build needs a def file? Why? For exposing functions from the
602 # dll to the outside world. However, this is alsi done internally..
603 DEFFILE = ./gameengine/GamePlayer/netscape/src/npB3DPlg.def
604
605 # Windows needs a specific name format for dll.s so we give it one.
606 $(DIR)/$(DEBUG_DIR)npB3DPlg$(SOEXT): $(NSPLUGLIB) $(PLUGAPPLIB) $(COMLIB) $(SPLIB)
607         @echo "****> Link $@"
608 ifdef NAN_BUILDINFO
609         $(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
610 endif
611 #       $(CCC) $(DYNLDFLAGS) -o $@ $(NSPLUGLIB) $(PLUGAPPLIB) $(COMLIB) $(SPLIB) $(PLUGREMLIB) $(LLIBS) $(DADD) $(LOPTS) 
612         $(CCC) $(DYNLDFLAGS) -o $@ $(NSPLUGLIB) $(PLUGAPPLIB) $(COMLIB) $(SPLIB) $(PLUGREMLIB) $(LLIBS) $(DADD) $(LOPTS) /def:$(DEFFILE)
613 ifdef NAN_BUILDINFO
614         /bin/rm $(BUILDINFO_O)
615 endif
616
617 $(DIR)/$(DEBUG_DIR)bin/npBlender3DPlugin$(SOEXT): $(NSPLUGLIB) $(PLUGAPPLIB) $(COMLIB) $(SPLIB)
618         @echo "****> Link $@"
619 ifdef NAN_BUILDINFO
620         $(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
621 endif
622         mkdir -p $(DIR)/$(DEBUG_DIR)bin
623         $(CCC) $(DYNLDFLAGS) -o $@ $(NSPLUGLIB) $(PLUGAPPLIB) $(COMLIB) $(SPLIB) $(PLUGREMLIB) $(LLIBS) $(DADD) $(LOPTS)
624 ifdef NAN_BUILDINFO
625         /bin/rm $(BUILDINFO_O)
626 endif
627
628 $(DIR)/$(DEBUG_DIR)bin/npTestPlugin$(SOEXT): $(NSPLUGLIB)
629         @echo "****> Link $@"
630 ifdef NAN_BUILDINFO
631         $(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
632 endif
633         mkdir -p $(DIR)/$(DEBUG_DIR)bin
634         $(CCC) $(DYNLDFLAGS) -o $@ $(NSPLUGLIB) $(PLUGTESTLIB) $(LLIBS) $(DADD) $(LOPTS)
635 ifdef NAN_BUILDINFO
636         /bin/rm $(BUILDINFO_O)
637 endif
638