2.5
[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 GRPLIB += $(NAN_OPENNL)/lib/$(DEBUG_DIR)libopennl.a
86 GRPLIB += $(NAN_SUPERLU)/lib/$(DEBUG_DIR)libsuperlu.a   
87
88 # nlin: the reason that some libraries appear more than once below is
89 # to handle circular dependencies in linking among libraries... some
90 # linkers (e.g. under Linux) need libs to be specified multiple times
91 # to properly resolve circular dependencies. ugly, but it works...
92 # the repeat entries could probably be trimmed down.
93 COMLIB = $(OCGDIR)/blender/blenkernel/$(DEBUG_DIR)libblenkernel.a
94 COMLIB += $(NAN_DECIMATION)/lib/libdecimation.a
95 COMLIB += $(OCGDIR)/blender/blenloader/$(DEBUG_DIR)libblenloader.a
96 COMLIB += $(OCGDIR)/blender/blenpluginapi/$(DEBUG_DIR)libblenpluginapi.a
97 COMLIB += $(OCGDIR)/blender/nodes_shd/$(DEBUG_DIR)libnodes_shd.a
98 COMLIB += $(OCGDIR)/blender/nodes_cmp/$(DEBUG_DIR)libnodes_cmp.a
99 COMLIB += $(OCGDIR)/blender/nodes_tex/$(DEBUG_DIR)libnodes_tex.a
100 COMLIB += $(OCGDIR)/blender/nodes/$(DEBUG_DIR)libnodes.a
101 COMLIB += $(OCGDIR)/blender/imbuf/$(DEBUG_DIR)libimbuf.a
102 COMLIB += $(OCGDIR)/blender/blenlib/$(DEBUG_DIR)libblenlib.a
103 COMLIB += $(NAN_IKSOLVER)/lib/libiksolver.a
104 COMLIB += $(NAN_OPENNL)/lib/$(DEBUG_DIR)libopennl.a
105 COMLIB += $(NAN_SUPERLU)/lib/$(DEBUG_DIR)libsuperlu.a   
106 COMLIB += $(OCGDIR)/blender/avi/$(DEBUG_DIR)libavi.a
107 COMLIB += $(NAN_JPEG)/lib/libjpeg.a
108 COMLIB += $(OCGDIR)/blender/gpu/$(DEBUG_DIR)libgpu.a
109 COMLIB += $(NAN_GLEW)/lib/libglew.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 ($(WITH_VERSE), true)
204    ifeq ($(OS), windows)
205        ifeq ($(FREE_WINDOWS), true)
206            COMLIB += $(NAN_VERSE)/lib/libverse.a
207        else
208            COMLIB += $(NAN_VERSE)/lib/verse.lib
209        endif
210    else
211        COMLIB += $(NAN_VERSE)/lib/libverse.a
212    endif
213 endif
214
215 ifeq ($(OS), irix)
216     COMLIB += $(NAN_SDL)/lib/libSDL.a
217 endif
218
219 ifeq ($(OS), windows)
220     ifeq ($(FREE_WINDOWS), true)
221         COMLIB += $(NAN_SDL)/lib/libSDL.a
222         COMLIB += $(NAN_PTHREADS)/lib/libpthreadGC2.a
223     else
224         COMLIB += $(NAN_SDL)/lib/SDL.lib
225     endif
226 endif
227
228 ifeq ($(WITH_OPENEXR), true)
229     COMLIB += $(NAN_OPENEXR_LIBS)
230 endif
231
232 # note: space_api.a in begin of editors, screen.a in end
233 PULIB = $(NAN_MOTO)/lib/libmoto.a
234 PULIB += $(NAN_ELBEEM)/lib/$(DEBUG_DIR)libelbeem.a
235 PULIB += $(OCGDIR)/blender/readblenfile/$(DEBUG_DIR)libreadblenfile.a
236 PULIB += $(OCGDIR)/blender/ed_space/libed_space.a
237 PULIB += $(OCGDIR)/blender/ed_sound/libed_sound.a
238 PULIB += $(OCGDIR)/blender/ed_action/libed_action.a
239 PULIB += $(OCGDIR)/blender/ed_nla/libed_nla.a
240 PULIB += $(OCGDIR)/blender/ed_script/libed_script.a
241 PULIB += $(OCGDIR)/blender/ed_text/libed_text.a
242 PULIB += $(OCGDIR)/blender/ed_sequencer/libed_sequencer.a
243 PULIB += $(OCGDIR)/blender/ed_file/libed_file.a
244 PULIB += $(OCGDIR)/blender/ed_info/libed_info.a
245 PULIB += $(OCGDIR)/blender/ed_buttons/libed_buttons.a
246 PULIB += $(OCGDIR)/blender/ed_node/libed_node.a
247 PULIB += $(OCGDIR)/blender/ed_image/libed_image.a
248 PULIB += $(OCGDIR)/blender/ed_ipo/libed_ipo.a
249 PULIB += $(OCGDIR)/blender/ed_outliner/libed_outliner.a
250 PULIB += $(OCGDIR)/blender/ed_time/libed_time.a
251 PULIB += $(OCGDIR)/blender/ed_view3d/libed_view3d.a
252 PULIB += $(OCGDIR)/blender/ed_interface/libed_interface.a
253 PULIB += $(OCGDIR)/blender/ed_object/libed_object.a
254 PULIB += $(OCGDIR)/blender/ed_mesh/libed_mesh.a
255 PULIB += $(OCGDIR)/blender/ed_animation/libed_animation.a
256 PULIB += $(OCGDIR)/blender/ed_transform/libed_transform.a
257 PULIB += $(OCGDIR)/blender/ed_util/libed_util.a
258 PULIB += $(OCGDIR)/blender/ed_datafiles/libed_datafiles.a
259 PULIB += $(OCGDIR)/blender/ed_screen/libed_screen.a
260 PULIB += $(OCGDIR)/blender/windowmanager/libwindowmanager.a
261 PULIB += $(OCGDIR)/blender/python/$(DEBUG_DIR)libpython.a
262 PULIB += $(OCGDIR)/blender/makesrna/$(DEBUG_DIR)librna.a
263 # note, no idea but it suddenly doesn't compile :(
264 PULIB += $(OCGDIR)/blender/blenlib/$(DEBUG_DIR)libblenlib.a
265
266 ifeq ($(NAN_NO_KETSJI),true)
267     PULIB += $(NAN_MOTO)/lib/libmoto.a
268     PULIB += $(OCGDIR)/kernel/gen_system/$(DEBUG_DIR)libgen_system.a
269     PULIB += $(OCGDIR)/kernel/gen_messaging/$(DEBUG_DIR)libgen_messaging.a
270     COMLIB += $(NAN_SND_LIBS)
271 endif
272
273 SPLIB1 = $(OCGDIR)/gameengine/GamePlayer/ghost/$(DEBUG_DIR)libghost.a
274 SPLIB1 += $(OCGDIR)/gameengine/GamePlayer/common/$(DEBUG_DIR)libcommon.a
275 SPLIB1 += $(OCGDIR)/gameengine/blconverter/$(DEBUG_DIR)libblconverter.a
276 SPLIB1 += $(NAN_STRING)/lib/$(DEBUG_DIR)libstring.a
277 SPLIB1 += $(NAN_GHOST)/lib/$(DEBUG_DIR)libghost.a
278
279 SPLIB = $(OCGDIR)/blender/readblenfile/$(DEBUG_DIR)libreadblenfile.a
280 # this is used for the plugin. It uses some things from libz.a, 
281 # but somehow it consistently fails to resolve these symbols... or 
282 # can I just not check them? nm claims they aren't...
283 SPLIB += $(OCGDIR)/blender/blenkernel/blenkernel_blc/$(DEBUG_DIR)libblenkernel_blc.a
284 SPLIB += $(OCGDIR)/blender/makesrna/$(DEBUG_DIR)librna.a
285
286 # These three need to be explicitly mentioned on the cl, because 
287 # if they are offered as a lib, they are optimized away. (nzc)
288 NSPLUGLIB = $(OCGDIR)/gameengine/GamePlayer/netscape/src/$(DEBUG_DIR)UnixShell.o
289 NSPLUGLIB += $(OCGDIR)/gameengine/GamePlayer/netscape/src/$(DEBUG_DIR)stubs.o
290 NSPLUGLIB += $(OCGDIR)/gameengine/GamePlayer/netscape/src/$(DEBUG_DIR)winstubs.o
291 NSPLUGLIB += $(OCGDIR)/gameengine/GamePlayer/netscape/src/$(DEBUG_DIR)Blender3DPlugin_native_implementation.o
292
293 # Here you can configure what sort of test to make for the plugin.
294 #    PLUGTESTLIB = $(OCGDIR)/gameengine/GamePlayer/netscape/test/$(DEBUG_DIR)libns_api_test_stub.a
295 #    PLUGTESTLIB = $(OCGDIR)/gameengine/GamePlayer/netscape/test/$(DEBUG_DIR)libns_api_test_colorcycle.a
296 #    PLUGTESTLIB = $(OCGDIR)/gameengine/GamePlayer/netscape/test/$(DEBUG_DIR)libns_api_test_gears.a
297 PLUGTESTLIB = $(OCGDIR)/gameengine/GamePlayer/netscape/test/$(DEBUG_DIR)libns_api_test_threaded_gears.a
298
299 # XPCOM is done only for Linux for now
300 ifeq ($(OS),$(findstring $(OS), "linux"))
301   ifeq ($(CPU),i386)
302     NSPLUGLIB += $(OCGDIR)/gameengine/GamePlayer/netscape/src/$(DEBUG_DIR)XPH_xpcom_hooks.o
303   endif
304 endif
305
306 PLUGAPPLIB = $(OCGDIR)/gameengine/GamePlayer/netscape/src/$(DEBUG_DIR)libplugin_ketsji_hooks.a
307
308 ifeq ($(OS),$(findstring $(OS), "freebsd linux irix solaris"))
309     NSPLUGLIB += $(OCGDIR)/gameengine/GamePlayer/netscape/src/$(DEBUG_DIR)PLG_X11_windowing.o
310     PLUGAPPLIB += $(OCGDIR)/gameengine/GamePlayer/common/unix/$(DEBUG_DIR)libunix.a
311 endif
312 ifeq ($(OS),$(findstring $(OS), "windows"))
313     NSPLUGLIB += $(OCGDIR)/gameengine/GamePlayer/netscape/src/$(DEBUG_DIR)PLG_MSWindows_windowing.o
314     NSPLUGLIB += $(OCGDIR)/gameengine/GamePlayer/netscape/src/$(DEBUG_DIR)npB3DPlg.res
315     PLUGAPPLIB += $(OCGDIR)/gameengine/GamePlayer/common/windows/$(DEBUG_DIR)libwindows.a
316 endif
317
318 PLUGAPPLIB += $(OCGDIR)/gameengine/GamePlayer/common/$(DEBUG_DIR)libcommon.a
319
320 ifeq ($(OS),$(findstring $(OS), "linux"))
321   ifeq ($(CPU),i386)
322     PLUGAPPLIB_XPLINK = $(OCGDIR)/gameengine/GamePlayer/netscape/src/$(DEBUG_DIR)_Blender3DPlugin_implementation_.o 
323   endif
324 endif
325
326 # A bit silly... but needed to resolve symbols.
327 PLUGREMLIB = $(NAN_STRING)/lib/$(DEBUG_DIR)libstring.a
328
329 ######################## OS dependencies (alphabetic!) ################
330
331 include nan_link.mk
332
333 ifeq ($(NAN_JUST_BLENDERDYNAMIC),true)
334     BINTARGETS = blenderdynamic
335 endif
336
337 ifeq ($(WITH_BF_DYNAMICOPENGL), true)
338     BINTARGETS += blenderdynamic
339 endif
340
341 ifeq ($(WITH_BF_STATICOPENGL), true)
342     BINTARGETS += blenderstatic
343 endif
344
345 ifeq ($(WITH_BF_BLENDERPLAYER), true)
346     export WITH_BF_GAMEENGINE=true
347     BINTARGETS += blenderplayer
348 endif
349
350 ifeq ($(WITH_BF_WEBPLUGIN), true)
351     BINTARGETS += plugin
352     ifeq ($(OS),linux)
353         ifeq ($(CPU),i386)
354              BINTARGETS += xplink
355         endif
356     endif
357 endif
358
359 ifeq ($(OS),solaris)
360     PULIB += $(NAN_ZLIB)/lib/libz.a
361     SPLIB += $(NAN_ZLIB)/lib/libz.a
362 endif
363
364 # OpenAL libs are already compiled as shared code! Check FMod if we switch to that. (nzc)
365
366 # Some vars to keep the rest of this section mostly readable
367 # in an 80 char term
368 SOUNDSYSTEM = $(OCGDIR)/intern/SoundSystem/$(DEBUG_DIR)libSoundSystem.a
369 DUMMYSOUND  = $(OCGDIR)/intern/DummySoundSystem/$(DEBUG_DIR)libDummySoundSystem.a
370 OPENALSOUND = $(OCGDIR)/intern/OpenALSoundSystem/$(DEBUG_DIR)libOpenALSoundSystem.a
371 SDLSOUND    = $(OCGDIR)/intern/SDLSoundSystem/$(DEBUG_DIR)libSDLSoundSystem.a
372
373 # Some kooky logic going on here ...
374 ifeq ($(NAN_NO_OPENAL), true)
375     NAN_SND_LIBS =  $(SOUNDSYSTEM)
376     NAN_SND_LIBS += $(DUMMYSOUND)
377     NAN_SND_LIBS += $(SOUNDSYSTEM)
378 else
379   ifeq ($(OS),$(findstring $(OS), "freebsd linux windows"))
380     ifeq ($(CPU),$(findstring $(CPU), "i386 powerpc x86_64 parisc64"))
381         NAN_SND_LIBS =  $(SOUNDSYSTEM)
382         NAN_SND_LIBS += $(DUMMYSOUND)
383         NAN_SND_LIBS += $(OPENALSOUND)
384         NAN_SND_LIBS += $(SDLSOUND)
385         NAN_SND_LIBS += $(NAN_OPENAL)/lib/libopenal.a
386         ALUT = $(wildcard $(NAN_OPENAL)/lib/libalut.a)
387         NAN_SND_LIBS += $(ALUT)
388         NAN_SND_LIBS += $(SOUNDSYSTEM)
389     else
390       ifeq ($(OS),windows)
391         NAN_SND_LIBS =  $(SOUNDSYSTEM)
392         NAN_SND_LIBS += $(DUMMYSOUND)
393         NAN_SND_LIBS += $(OPENALSOUND)
394         NAN_SND_LIBS += $(SDLSOUND)
395         NAN_SND_LIBS += $(NAN_OPENAL)/lib/openal_static.lib
396         ALUT = $(wildcard $(NAN_OPENAL)/lib/alut_static.lib)
397         NAN_SND_LIBS += $(ALUT)
398         NAN_SND_LIBS += $(SOUNDSYSTEM)
399       else
400         NAN_SND_LIBS =  $(SOUNDSYSTEM)
401         NAN_SND_LIBS += $(DUMMYSOUND)
402         NAN_SND_LIBS += $(SOUNDSYSTEM)
403       endif
404     endif
405   else
406     ifeq ($(OS),darwin)
407       NAN_SND_LIBS =  $(SOUNDSYSTEM)
408       NAN_SND_LIBS += $(DUMMYSOUND)
409       NAN_SND_LIBS += $(OPENALSOUND)
410       NAN_SND_LIBS += $(NAN_OPENAL)/lib/libopenal.a
411       ALUT = $(wildcard $(NAN_OPENAL)/lib/libalut.a)
412       NAN_SND_LIBS += $(ALUT)
413       NAN_SND_LIBS += $(SOUNDSYSTEM)
414     else
415       ifeq ($(OS), solaris)
416         NAN_SND_LIBS =  $(SOUNDSYSTEM)
417         NAN_SND_LIBS += $(DUMMYSOUND)
418         NAN_SND_LIBS += $(OPENALSOUND)
419         NAN_SND_LIBS += $(SDLSOUND)
420         NAN_SND_LIBS += $(NAN_OPENAL)/lib/libopenal.a
421         ALUT = $(wildcard $(NAN_OPENAL)/lib/libalut.a)
422         NAN_SND_LIBS += $(ALUT)
423         NAN_SND_LIBS += $(SOUNDSYSTEM)
424       else
425         ifeq ($(OS), irix)
426            NAN_SND_LIBS = $(SOUNDSYSTEM)
427            NAN_SND_LIBS += $(DUMMYSOUND)
428            NAN_SND_LIBS += $(SDLSOUND)
429            NAN_SND_LIBS += $(SOUNDSYSTEM)
430         else
431            NAN_SND_LIBS =  $(SOUNDSYSTEM)
432            NAN_SND_LIBS += $(DUMMYSOUND)
433            NAN_SND_LIBS += $(SOUNDSYSTEM)
434         endif
435       endif
436     endif
437   endif
438 endif
439
440 ifeq ($(OS),windows)
441
442     # Might need to change this to $(NAN_MOZILLA_LIB)/nspr4.lib
443     NSPLUGLIB += $(NAN_NSPR)/lib/nspr4.lib
444
445     BINTARGETS = blenderdynamic
446     ifeq ($(FREE_WINDOWS),true)
447         ifneq ($(NAN_NO_KETSJI),true)
448             BINTARGETS += blenderplayer
449         endif
450     else
451         BINTARGETS += blenderplayer
452         BINTARGETS += blenderdynplayer
453         BINTARGETS += plugin
454     endif
455
456     PULIB += $(OCGDIR)/blender/icons/$(DEBUG_DIR)winblender.res
457     PULIB += $(NAN_ZLIB)/lib/libz.a
458     SPLIB += $(OCGDIR)/blender/icons/$(DEBUG_DIR)winblender.res
459     SPLIB += $(NAN_ZLIB)/lib/libz.a
460 endif
461
462
463 # prepare for NAN_BUILDINFO compile at the *sigh* link rules below
464
465 ifdef NAN_BUILDINFO
466     CSRCS =
467     ALLTARGETS =
468     include nan_compile.mk
469 endif
470
471 ################## target rules ########################
472
473 all debug ::
474         @echo "****> Make $@ by $(ID)@$(HOST) at $(MAKE_START) on $(CONFIG_GUESS)"
475 ifdef NANENV
476         @for n in $(NANENV); do \
477             echo "      $$n"; \
478         done
479 endif
480
481 DIR = $(OCGDIR)
482 SOURCEDIR = source
483
484 include nan_subdirs.mk
485
486 ################## target rules ########################
487
488 all:: link
489
490 debug debuglink::
491         @$(MAKE) link DEBUG_DIR="debug/" NANENV=$(NANENV)
492
493 clean:: linkclean debuglinkclean
494
495 link: $(BINTARGETS)
496         @echo "****> Build $(MAKE_START) - `date '+%H:%M:%S %d-%b-%Y'`"
497 ifdef NANENV
498         @for n in $(NANENV); do \
499             echo "      $$n"; \
500         done
501 endif
502
503 linkclean:
504         @$(RM) -r $(DIR)/blenderstatic* \
505                   $(DIR)/blenderplayer* \
506                   $(DIR)/bin/*
507
508 debuglinkclean:
509         @$(RM) -r $(DIR)/debug/blenderstatic* \
510                   $(DIR)/debug/blenderplayer* \
511                   $(DIR)/debug/bin/*
512
513 # Shortcut for Tinderbox release builds. Mortals don't use this.
514 release:
515         @$(MAKE) -C ../release/ all || exit 1;
516
517 ############### Linker rules ###############
518
519 blenderstatic: $(DIR)/$(DEBUG_DIR)bin/blenderstatic
520 blenderdynamic: $(DIR)/$(DEBUG_DIR)bin/blender$(EXT)
521 blenderplayer: $(DIR)/$(DEBUG_DIR)bin/blenderplayer$(EXT)
522 blenderdynplayer: $(DIR)/$(DEBUG_DIR)bin/blenderdynplayer$(EXT)
523
524 # XPCOM connector only for linux so far...
525 ifeq ($(OS),linux)
526     xplink: $(DIR)/$(DEBUG_DIR)bin/Blender3DPlugin$(SOEXT)
527 endif
528
529 # Moz/NS plugin:
530 ifeq ($(OS),$(findstring $(OS), "freebsd linux irix solaris"))
531     plugin: $(DIR)/$(DEBUG_DIR)bin/npBlender3DPlugin$(SOEXT)
532     ptest: $(DIR)/$(DEBUG_DIR)bin/npTestPlugin$(SOEXT)
533 endif
534 # Windows needs a 8.3 name... Why? Dunno...
535 ifeq ($(OS),windows)
536         ifneq ($(FREE_WINDOWS),true)
537             plugin: $(DIR)/$(DEBUG_DIR)npB3DPlg$(SOEXT)
538         endif
539 endif
540
541 $(DIR)/$(DEBUG_DIR)bin/blenderstatic: $(OBJS) $(GRPLIB) $(COMLIB) $(PULIB)
542         @echo "****> Link $@"
543 ifdef NAN_BUILDINFO
544         $(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
545 endif
546         mkdir -p $(DIR)/$(DEBUG_DIR)bin
547         $(CCC) $(LDFLAGS) -o $(DIR)/$(DEBUG_DIR)bin/blenderstatic $(BUILDINFO_O) $(OBJS) $(GRPLIB) $(COMLIB) $(PULIB) $(LLIBS) $(SADD) $(LOPTS)
548 ifdef NAN_BUILDINFO
549         /bin/rm $(BUILDINFO_O)
550 endif
551 ifeq ($(OS), darwin)
552         @$(MAKE) -C darwin/ APPLICATION=blenderstatic
553 endif
554
555 $(DIR)/$(DEBUG_DIR)bin/blender$(EXT): $(OBJS) $(GRPLIB) $(COMLIB) $(PULIB)
556         @echo "****> Link $@"
557 ifdef NAN_BUILDINFO
558         $(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
559 endif
560         mkdir -p $(DIR)/$(DEBUG_DIR)bin
561         $(CCC) $(LDFLAGS) -o $(DIR)/$(DEBUG_DIR)bin/blender$(EXT) $(BUILDINFO_O) $(OBJS) $(GRPLIB) $(COMLIB) $(PULIB) $(LLIBS) $(DADD) $(LOPTS)
562 ifdef NAN_BUILDINFO
563         /bin/rm $(BUILDINFO_O)
564 endif
565 ifeq ($(OS), darwin)
566         @$(MAKE) -C darwin/ APPLICATION=blender
567 endif
568
569 $(DIR)/$(DEBUG_DIR)bin/blenderplayer$(EXT): $(OBJS) $(SPLIB1) $(COMLIB) $(SPLIB)
570         @echo "****> Link $@"
571 ifdef NAN_BUILDINFO
572         $(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
573 endif
574         mkdir -p $(DIR)/$(DEBUG_DIR)bin
575         $(CCC) $(LDFLAGS) -o $(DIR)/$(DEBUG_DIR)bin/blenderplayer$(EXT) $(BUILDINFO_O) $(OBJS) $(SPLIB1) $(COMLIB) $(SPLIB) $(LLIBS) $(DADD) $(LOPTS)
576 ifdef NAN_BUILDINFO
577         /bin/rm $(BUILDINFO_O)
578 endif
579 ifeq ($(OS), darwin)
580         @$(MAKE) -C darwin/ APPLICATION=blenderplayer
581 endif
582
583 $(DIR)/$(DEBUG_DIR)bin/blenderdynplayer$(EXT): $(OBJS) $(COMLIB) $(SPLIB)
584         @echo "****> Link $@"
585 ifdef NAN_BUILDINFO
586         $(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
587 endif
588         mkdir -p $(DIR)/$(DEBUG_DIR)bin
589         $(CCC) $(LDFLAGS) -o $(DIR)/$(DEBUG_DIR)bin/blenderdynplayer$(EXT) $(BUILDINFO_O) $(OBJS) $(SPLIB1) $(COMLIB) $(SPLIB) $(LLIBS) $(DADD) $(LOPTS)
590 ifdef NAN_BUILDINFO
591         /bin/rm $(BUILDINFO_O)
592 endif
593 ifeq ($(OS), darwin)
594         @$(MAKE) -C darwin/ APPLICATION=blenderplayer
595 endif
596
597 $(DIR)/$(DEBUG_DIR)bin/Blender3DPlugin$(SOEXT): $(PLUGAPPLIB_XPLINK)
598         @echo "****> Link $@"
599 ifdef NAN_BUILDINFO
600         $(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
601 endif
602         mkdir -p $(DIR)/$(DEBUG_DIR)bin
603         $(CCC) $(DYNLDFLAGS) -o $@ $(PLUGAPPLIB_XPLINK) $(LOPTS)
604 ifdef NAN_BUILDINFO
605         /bin/rm $(BUILDINFO_O)
606 endif
607
608 # Windows build needs a def file? Why? For exposing functions from the
609 # dll to the outside world. However, this is alsi done internally..
610 DEFFILE = ./gameengine/GamePlayer/netscape/src/npB3DPlg.def
611
612 # Windows needs a specific name format for dll.s so we give it one.
613 $(DIR)/$(DEBUG_DIR)npB3DPlg$(SOEXT): $(NSPLUGLIB) $(PLUGAPPLIB) $(COMLIB) $(SPLIB)
614         @echo "****> Link $@"
615 ifdef NAN_BUILDINFO
616         $(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
617 endif
618 #       $(CCC) $(DYNLDFLAGS) -o $@ $(NSPLUGLIB) $(PLUGAPPLIB) $(COMLIB) $(SPLIB) $(PLUGREMLIB) $(LLIBS) $(DADD) $(LOPTS) 
619         $(CCC) $(DYNLDFLAGS) -o $@ $(NSPLUGLIB) $(PLUGAPPLIB) $(COMLIB) $(SPLIB) $(PLUGREMLIB) $(LLIBS) $(DADD) $(LOPTS) /def:$(DEFFILE)
620 ifdef NAN_BUILDINFO
621         /bin/rm $(BUILDINFO_O)
622 endif
623
624 $(DIR)/$(DEBUG_DIR)bin/npBlender3DPlugin$(SOEXT): $(NSPLUGLIB) $(PLUGAPPLIB) $(COMLIB) $(SPLIB)
625         @echo "****> Link $@"
626 ifdef NAN_BUILDINFO
627         $(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
628 endif
629         mkdir -p $(DIR)/$(DEBUG_DIR)bin
630         $(CCC) $(DYNLDFLAGS) -o $@ $(NSPLUGLIB) $(PLUGAPPLIB) $(COMLIB) $(SPLIB) $(PLUGREMLIB) $(LLIBS) $(DADD) $(LOPTS)
631 ifdef NAN_BUILDINFO
632         /bin/rm $(BUILDINFO_O)
633 endif
634
635 $(DIR)/$(DEBUG_DIR)bin/npTestPlugin$(SOEXT): $(NSPLUGLIB)
636         @echo "****> Link $@"
637 ifdef NAN_BUILDINFO
638         $(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
639 endif
640         mkdir -p $(DIR)/$(DEBUG_DIR)bin
641         $(CCC) $(DYNLDFLAGS) -o $@ $(NSPLUGLIB) $(PLUGTESTLIB) $(LLIBS) $(DADD) $(LOPTS)
642 ifdef NAN_BUILDINFO
643         /bin/rm $(BUILDINFO_O)
644 endif
645