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