2 # $Id: nan_compile.mk 8932 2006-11-17 18:29:46Z sirdude $
4 # ***** BEGIN GPL/BL DUAL LICENSE BLOCK *****
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. The Blender
10 # Foundation also sells licenses for use in proprietary software under
11 # the Blender License. See http://www.blender.org/BL/ for information
14 # This program is distributed in the hope that it will be useful,
15 # but WITHOUT ANY WARRANTY; without even the implied warranty of
16 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
17 # GNU General Public License for more details.
19 # You should have received a copy of the GNU General Public License
20 # along with this program; if not, write to the Free Software Foundation,
21 # Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
23 # The Original Code is Copyright (C) 2001-2002 by NaN Holding BV.
24 # All rights reserved.
26 # The Original Code is: all of this file.
28 # Contributor(s): none yet.
30 # ***** END GPL/BL DUAL LICENSE BLOCK *****
34 include nan_definitions.mk
36 CPPFLAGS ?
= $(NAN_CPPFLAGS
)
38 # common parts ---------------------------------------------------
40 # Uncomment next lines to enable integrated game engine
41 ifneq ($(NAN_NO_KETSJI
), true
)
42 CFLAGS
+= -DGAMEBLENDER
=1
43 CFLAGS
+= -DUSE_SUMO_SOLID
44 CCFLAGS
+= -DUSE_SUMO_SOLID
45 ifeq ($(NAN_USE_BULLET
), true
)
46 CFLAGS
+= -DUSE_BULLET
47 CCFLAGS
+= -DUSE_BULLET
50 CPPFLAGS
+= -DNO_KETSJI
54 CFLAGS
+= $(NAN_DEBUG
)
55 CCFLAGS
+= $(NAN_DEBUG
)
58 REL_CFLAGS
+= -DNDEBUG
59 REL_CCFLAGS
+= -DNDEBUG
63 # OS dependent parts ---------------------------------------------------
68 CFLAGS
+= -pipe
-fPIC
-funsigned-char
-fno-strict-aliasing
69 CCFLAGS
+= -pipe
-fPIC
-funsigned-char
-fno-strict-aliasing
84 CFLAGS
+= -pipe
-fPIC
-ffast-math
-mcpu
=7450 -mtune
=G5
-funsigned-char
-fno-strict-aliasing
85 CCFLAGS
+= -pipe
-fPIC
-funsigned-char
-fno-strict-aliasing
87 CFLAGS
+= -pipe
-fPIC
-ffast-math
-march
=pentium-m
-funsigned-char
-fno-strict-aliasing
88 CCFLAGS
+= -pipe
-fPIC
-funsigned-char
-fno-strict-aliasing
92 CPPFLAGS
+= -D_THREAD_SAFE
94 OPENGL_HEADERS
= /System
/Library
/Frameworks
/OpenGL.framework
106 CFLAGS
+= -pipe
-fPIC
-funsigned-char
-fno-strict-aliasing
107 CCFLAGS
+= -pipe
-fPIC
-funsigned-char
-fno-strict-aliasing
110 CPPFLAGS
+= -D_THREAD_SAFE
112 OPENGL_HEADERS
= /usr
/X11R6
/include
113 JAVA_HEADERS
= /usr
/local
/jdk1.3
.1/include
114 JAVA_SYSTEM_HEADERS
= /usr
/local
/jdk1.3
.1/include/freebsd
123 CFLAGS
+= -n32
-mips3
-Xcpluscomm
124 CCFLAGS
+= -n32
-mips3
-Xcpluscomm
-LANG
:std
125 ifdef MIPS73_ISOHEADERS
126 CCFLAGS
+= -LANG
:libc_in_namespace_std
=off
-I
$(MIPS73_ISOHEADERS
)
128 CCFLAGS
+= -LANG
:libc_in_namespace_std
=off
130 REL_CFLAGS
+= -n32
-mips3
-O2
-OPT
:Olimit
=0
131 REL_CCFLAGS
+= -n32
-mips3
-O2
-OPT
:Olimit
=0
132 OPENGL_HEADERS
= /usr
/include
136 ARFLAGSQUIET
= -ar -o
143 CFLAGS
+= -pipe
-fPIC
-funsigned-char
-fno-strict-aliasing
144 CCFLAGS
+= -pipe
-fPIC
-funsigned-char
-fno-strict-aliasing
152 OPENGL_HEADERS
= /usr
/X11R6
/include
161 CFLAGS
+= -pipe
-fPIC
-funsigned-char
-fno-strict-aliasing
162 CCFLAGS
+= -pipe
-fPIC
-funsigned-char
-fno-strict-aliasing
166 CPPFLAGS
+= -D__FreeBSD__
167 OPENGL_HEADERS
= /usr
/X11R6
/include
180 CFLAGS
+= -pipe
-fPIC
-funsigned-char
-fno-strict-aliasing
181 CCFLAGS
+= -pipe
-fPIC
-funsigned-char
-fno-strict-aliasing
182 # CFLAGS += "-fast -xdepend -xarch=v8plus -xO3 -xlibmil -KPIC -DPIC -xchar=unsigned"
183 # CCFLAGS += "-fast -xdepend -xarch=v8plus -xO3 -xlibmil -xlibmopt -features=tmplife -norunpath -KPIC -DPIC -xchar=unsigned"
188 OPENGL_HEADERS
= /usr
/openwin
/share
/include
189 CPPFLAGS
+= -DSUN_OGL_NO_VERTEX_MACROS
190 JAVA_HEADERS
= /usr
/java
/include
191 JAVA_SYSTEM_HEADERS
= /usr
/java
/include/solaris
193 OPENGL_HEADERS
= /usr
/local
/include
201 ifeq ($(FREE_WINDOWS
),true
)
204 CFLAGS
+= -pipe
-mno-cygwin
-mwindows
-funsigned-char
-fno-strict-aliasing
205 CCFLAGS
+= -pipe
-mno-cygwin
-mwindows
-funsigned-char
-fno-strict-aliasing
206 CPPFLAGS
+= -DFREE_WINDOWS
210 #OPENGL_HEADERS = /usr/include/w32api
215 WINRC
= $(wildcard *.rc
)
218 CC
= $(SRCHOME
)/tools
/cygwin
/cl_wrapper.pl
219 CCC
= $(SRCHOME
)/tools
/cygwin
/cl_wrapper.pl
220 JAVAC
= $(SRCHOME
)/tools
/cygwin
/java_wrapper.pl
-c
221 JAVAH
= $(SRCHOME
)/tools
/cygwin
/java_wrapper.pl
-h
223 REL_CCFLAGS
+= /O2
-GX
224 DBG_CFLAGS
+= /Fd
$(DIR
)/debug
/
225 DBG_CCFLAGS
+= /Fd
$(DIR
)/debug
/
230 CPPFLAGS
+= -DWIN32
-D_WIN32
-D__WIN32
231 CPPFLAGS
+= -D_M_IX86
232 CPPFLAGS
+= -I
"/cygdrive/c/Program Files/Microsoft Visual Studio/VC98/include"
233 JAVA_HEADERS
= /cygdrive
/c
/j2sdk1.4
.0-beta3
/include
234 JAVA_SYSTEM_HEADERS
= /cygdrive
/c
/j2sdk1.4
.0-beta3
/include/win32
235 CPP
= $(SRCHOME
)/tools
/cygwin
/cl_wrapper.pl
239 WINRC
= $(wildcard *.rc
)
243 ifeq (debug
, $(findstring debug
, $(MAKECMDGOALS
)))
244 export DEBUG_DIR
=debug
/
247 ifneq (x
$(DEBUG_DIR
), x
)
248 CFLAGS
+=$(DBG_CFLAGS
)
249 CCFLAGS
+=$(DBG_CCFLAGS
)
251 CFLAGS
+=$(REL_CFLAGS
)
252 CCFLAGS
+=$(REL_CCFLAGS
)
255 # Note: include nan_warn's LEVEL_*_WARNINGS after CC/OS have been set.
262 $(DIR
)/$(DEBUG_DIR
)%.o
: %.c
264 @set
-e
; $(CC
) -M
$(CPPFLAGS
) $< 2>/dev
/null \
265 | sed
's@\($*\)\.o[ :]*@$(DIR)/$(DEBUG_DIR)\1.o : @g' \
266 > $(DIR
)/$(DEBUG_DIR
)$*.d
; \
267 [ -s
$(DIR
)/$(DEBUG_DIR
)$*.d
] ||
$(RM
) $(DIR
)/$(DEBUG_DIR
)$*.d
271 @
$(CC
) -c
$(CFLAGS
) $(CPPFLAGS
) $< -o
$@
273 $(CC
) -c
$(CFLAGS
) $(CPPFLAGS
) $< -o
$@
276 $(DIR
)/$(DEBUG_DIR
)%.o
: %.
cpp
278 @set
-e
; $(CCC
) -M
$(CPPFLAGS
) $< 2>/dev
/null \
279 | sed
's@\($*\)\.o[ :]*@$(DIR)/$(DEBUG_DIR)\1.o : @g' \
280 > $(DIR
)/$(DEBUG_DIR
)$*.d
; \
281 [ -s
$(DIR
)/$(DEBUG_DIR
)$*.d
] ||
$(RM
) $(DIR
)/$(DEBUG_DIR
)$*.d
285 @
$(CCC
) -c
$(CCFLAGS
) $(CPPFLAGS
) $< -o
$@
287 $(CCC
) -c
$(CCFLAGS
) $(CPPFLAGS
) $< -o
$@
290 $(DIR
)/$(DEBUG_DIR
)%.res
: %.rc
291 ifeq ($(FREE_WINDOWS
),true
)
292 windres
$< -O coff
-o
$@
294 $(SRCHOME
)/tools
/cygwin
/cl_wrapper.pl
- rc
/fo
$@
$<
297 $(DIR
)/$(DEBUG_DIR
)%.class
: %.java
299 $(JAVAC
) -verbose
-g
-deprecation
-sourcepath .
-classpath
"$(JARS)" -d
$(DIR
)/$(DEBUG_DIR
) $<
301 $(JAVAC
) -verbose
-g
-deprecation
-d
$(DIR
)/$(DEBUG_DIR
) $<
304 $(DIR
)/$(DEBUG_DIR
)%.h
: $(DIR
)/$(DEBUG_DIR
)%.class
305 $(JAVAH
) -classpath
$(DIR
)/$(DEBUG_DIR
) -d
$(DIR
)/$(DEBUG_DIR
) -jni
$*
308 @echo
"WARNING: Fake header creation rule used, dependencies will be remade"
310 CSRCS ?
= $(wildcard *.c
)
311 CCSRCS ?
= $(wildcard *.
cpp)
312 JSRCS ?
= $(wildcard *.java
)
315 -include $(CSRCS
:%.c
=$(DIR
)/$(DEBUG_DIR
)%.d
) $(CCSRCS
:%.
cpp=$(DIR
)/$(DEBUG_DIR
)%.d
)
319 OBJS_AR
+= $(CSRCS
:%.c
=%.o
)
320 OBJS_AR
+= $(CCSRCS
:%.
cpp=%.o
)
321 OBJS_AR
+= $(WINRC
:%.rc
=%.res
)
323 OBJS
+= $(CSRCS
:%.c
=$(DIR
)/$(DEBUG_DIR
)%.o
)
324 OBJS
+= $(CCSRCS
:%.
cpp=$(DIR
)/$(DEBUG_DIR
)%.o
)
325 OBJS
+= $(WINRC
:%.rc
=$(DIR
)/$(DEBUG_DIR
)%.res
)
327 JCLASS
+= $(JSRCS
:%.java
=$(DIR
)/$(DEBUG_DIR
)%.class
)
329 LIB_a
= $(DIR
)/$(DEBUG_DIR
)lib
$(LIBNAME
).a
332 # $OBJS can be empty except for some spaces
333 ifneq (x
, x
$(strip $(OBJS
)))
337 @echo
" -- lib: lib$(LIBNAME).a -- "
338 @cd
$(DIR
)/$(DEBUG_DIR
); $(AR
) $(ARFLAGSQUIET
) $@
$(OBJS_AR
)
340 cd
$(DIR
)/$(DEBUG_DIR
); $(AR
) $(ARFLAGS
) $@
$(OBJS_AR
)
344 @echo
" -- lib: lib$(LIBNAME).a -- "
345 @
$(AR
) $(ARFLAGSQUIET
) $@
$?
347 $(AR
) $(ARFLAGS
) $@
$?
355 ALLTARGETS ?
= $(LIB_a
)
357 all debug
:: makedir
$(ALLTARGETS
)
362 @echo
"====> make creator subtarget in `pwd | sed 's/^.*develop\///'`"
363 @
$(MAKE
) makedir DIR
=$(DIR
)/$(DEBUG_DIR
)cre
364 @
$(MAKE
) lib CSRCS
="$(CRE_CSRCS)" LIBNAME
=$(LIBNAME
)$@
367 @echo
"====> make publisher subtarget in `pwd | sed 's/^.*develop\///'`"
368 @
$(MAKE
) makedir DIR
=$(DIR
)/$(DEBUG_DIR
)pub
369 @
$(MAKE
) lib CSRCS
="$(PUB_CSRCS)" LIBNAME
=$(LIBNAME
)$@
372 @echo
"====> make player subtarget in `pwd | sed 's/^.*develop\///'`"
373 @
$(MAKE
) makedir DIR
=$(DIR
)/player
/$(DEBUG_DIR
)
374 @
$(MAKE
) lib CSRCS
="$(SAP_CSRCS)" LIBNAME
=$(LIBNAME
)$@
376 clean:: optclean debugclean
379 @
-[ ! -d
$(DIR
) ] ||
( cd
$(DIR
) && \
380 $(RM
) *.o
*.a
*.d
*.res ii_files
/*.ii
*.class
*.h
)
383 @
-[ ! -d
$(DIR
)/debug
] ||
( cd
$(DIR
)/debug
&& \
384 $(RM
) *.o
*.a
*.d
*.res ii_files
/*.ii
*.class
*.h
)
388 @
# don't use mkdir -p. Cygwin will try to make network paths and fail
389 @
[ -d
$(DIR
) ] || mkdir
$(DIR
)
390 @
[ -d
$(DIR
)/debug
] || mkdir
$(DIR
)/debug