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