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 ---------------------------------------------------
83 CFLAGS += -pipe -fPIC -ffast-math -mcpu=7450 -mtune=G5
84 CCFLAGS += -pipe -fPIC
87 CPPFLAGS += -D_THREAD_SAFE
89 OPENGL_HEADERS = /System/Library/Frameworks/OpenGL.framework
101 CFLAGS += -pipe -fPIC
102 CCFLAGS += -pipe -fPIC
105 CPPFLAGS += -D_THREAD_SAFE
107 OPENGL_HEADERS = /usr/X11R6/include
108 JAVA_HEADERS = /usr/local/jdk1.3.1/include
109 JAVA_SYSTEM_HEADERS = /usr/local/jdk1.3.1/include/freebsd
118 CFLAGS += -n32 -mips3 -Xcpluscomm
119 CCFLAGS += -n32 -mips3 -Xcpluscomm -LANG:std
120 ifdef MIPS73_ISOHEADERS
121 CCFLAGS += -LANG:libc_in_namespace_std=off -I$(MIPS73_ISOHEADERS)
123 CCFLAGS += -LANG:libc_in_namespace_std=off
125 REL_CFLAGS += -n32 -mips3 -O2 -OPT:Olimit=0
126 REL_CCFLAGS += -n32 -mips3 -O2 -OPT:Olimit=0
127 OPENGL_HEADERS = /usr/include
131 ARFLAGSQUIET = -ar -o
138 CFLAGS += -pipe -fPIC
139 CCFLAGS += -pipe -fPIC
147 OPENGL_HEADERS = /usr/X11R6/include
156 CFLAGS += -pipe -fPIC
157 CCFLAGS += -pipe -fPIC
161 CPPFLAGS += -D__FreeBSD__
162 OPENGL_HEADERS = /usr/X11R6/include
173 CFLAGS += -pipe -fPIC
174 CCFLAGS += -pipe -fPIC
179 OPENGL_HEADERS = /usr/openwin/share/include
180 CPPFLAGS += -DSUN_OGL_NO_VERTEX_MACROS
181 JAVA_HEADERS = /usr/java/include
182 JAVA_SYSTEM_HEADERS = /usr/java/include/solaris
184 OPENGL_HEADERS = /usr/local/include
192 ifeq ($(FREE_WINDOWS),true)
195 CFLAGS += -pipe -mno-cygwin -mwindows
196 CCFLAGS += -pipe -mno-cygwin -mwindows
197 CPPFLAGS += -DFREE_WINDOWS
201 #OPENGL_HEADERS = /usr/include/w32api
206 WINRC = $(wildcard *.rc)
209 CC = $(SRCHOME)/tools/cygwin/cl_wrapper.pl
210 CCC = $(SRCHOME)/tools/cygwin/cl_wrapper.pl
211 JAVAC = $(SRCHOME)/tools/cygwin/java_wrapper.pl -c
212 JAVAH = $(SRCHOME)/tools/cygwin/java_wrapper.pl -h
214 REL_CCFLAGS += /O2 -GX
215 DBG_CFLAGS += /Fd$(DIR)/debug/
216 DBG_CCFLAGS += /Fd$(DIR)/debug/
221 CPPFLAGS += -DWIN32 -D_WIN32 -D__WIN32
222 CPPFLAGS += -D_M_IX86
223 CPPFLAGS += -I"/cygdrive/c/Program Files/Microsoft Visual Studio/VC98/include"
224 JAVA_HEADERS = /cygdrive/c/j2sdk1.4.0-beta3/include
225 JAVA_SYSTEM_HEADERS = /cygdrive/c/j2sdk1.4.0-beta3/include/win32
226 CPP = $(SRCHOME)/tools/cygwin/cl_wrapper.pl
230 WINRC = $(wildcard *.rc)
234 ifeq (debug, $(findstring debug, $(MAKECMDGOALS)))
235 export DEBUG_DIR=debug/
238 ifneq (x$(DEBUG_DIR), x)
239 CFLAGS +=$(DBG_CFLAGS)
240 CCFLAGS+=$(DBG_CCFLAGS)
242 CFLAGS +=$(REL_CFLAGS)
243 CCFLAGS+=$(REL_CCFLAGS)
246 # Note: include nan_warn's LEVEL_*_WARNINGS after CC/OS have been set.
253 $(DIR)/$(DEBUG_DIR)%.o: %.c
255 @set -e; $(CC) -M $(CPPFLAGS) $< 2>/dev/null \
256 | sed 's@\($*\)\.o[ :]*@$(DIR)/$(DEBUG_DIR)\1.o : @g' \
257 > $(DIR)/$(DEBUG_DIR)$*.d; \
258 [ -s $(DIR)/$(DEBUG_DIR)$*.d ] || $(RM) $(DIR)/$(DEBUG_DIR)$*.d
262 @$(CC) -c $(CFLAGS) $(CPPFLAGS) $< -o $@
264 $(CC) -c $(CFLAGS) $(CPPFLAGS) $< -o $@
267 $(DIR)/$(DEBUG_DIR)%.o: %.cpp
269 @set -e; $(CCC) -M $(CPPFLAGS) $< 2>/dev/null \
270 | sed 's@\($*\)\.o[ :]*@$(DIR)/$(DEBUG_DIR)\1.o : @g' \
271 > $(DIR)/$(DEBUG_DIR)$*.d; \
272 [ -s $(DIR)/$(DEBUG_DIR)$*.d ] || $(RM) $(DIR)/$(DEBUG_DIR)$*.d
276 @$(CCC) -c $(CCFLAGS) $(CPPFLAGS) $< -o $@
278 $(CCC) -c $(CCFLAGS) $(CPPFLAGS) $< -o $@
281 $(DIR)/$(DEBUG_DIR)%.res: %.rc
282 ifeq ($(FREE_WINDOWS),true)
283 windres $< -O coff -o $@
285 $(SRCHOME)/tools/cygwin/cl_wrapper.pl - rc /fo$@ $<
288 $(DIR)/$(DEBUG_DIR)%.class: %.java
290 $(JAVAC) -verbose -g -deprecation -sourcepath . -classpath "$(JARS)" -d $(DIR)/$(DEBUG_DIR) $<
292 $(JAVAC) -verbose -g -deprecation -d $(DIR)/$(DEBUG_DIR) $<
295 $(DIR)/$(DEBUG_DIR)%.h: $(DIR)/$(DEBUG_DIR)%.class
296 $(JAVAH) -classpath $(DIR)/$(DEBUG_DIR) -d $(DIR)/$(DEBUG_DIR) -jni $*
299 @echo "WARNING: Fake header creation rule used, dependencies will be remade"
301 CSRCS ?= $(wildcard *.c)
302 CCSRCS ?= $(wildcard *.cpp)
303 JSRCS ?= $(wildcard *.java)
306 -include $(CSRCS:%.c=$(DIR)/$(DEBUG_DIR)%.d) $(CCSRCS:%.cpp=$(DIR)/$(DEBUG_DIR)%.d)
310 OBJS_AR += $(CSRCS:%.c=%.o)
311 OBJS_AR += $(CCSRCS:%.cpp=%.o)
312 OBJS_AR += $(WINRC:%.rc=%.res)
314 OBJS += $(CSRCS:%.c=$(DIR)/$(DEBUG_DIR)%.o)
315 OBJS += $(CCSRCS:%.cpp=$(DIR)/$(DEBUG_DIR)%.o)
316 OBJS += $(WINRC:%.rc=$(DIR)/$(DEBUG_DIR)%.res)
318 JCLASS += $(JSRCS:%.java=$(DIR)/$(DEBUG_DIR)%.class)
320 LIB_a = $(DIR)/$(DEBUG_DIR)lib$(LIBNAME).a
323 # $OBJS can be empty except for some spaces
324 ifneq (x, x$(strip $(OBJS)))
328 @echo " -- lib: lib$(LIBNAME).a -- "
329 @cd $(DIR)/$(DEBUG_DIR); $(AR) $(ARFLAGSQUIET) $@ $(OBJS_AR)
331 cd $(DIR)/$(DEBUG_DIR); $(AR) $(ARFLAGS) $@ $(OBJS_AR)
335 @echo " -- lib: lib$(LIBNAME).a -- "
336 @$(AR) $(ARFLAGSQUIET) $@ $?
338 $(AR) $(ARFLAGS) $@ $?
346 ALLTARGETS ?= $(LIB_a)
348 all debug :: makedir $(ALLTARGETS)
353 @echo "====> make creator subtarget in `pwd | sed 's/^.*develop\///'`"
354 @$(MAKE) makedir DIR=$(DIR)/$(DEBUG_DIR)cre
355 @$(MAKE) lib CSRCS="$(CRE_CSRCS)" LIBNAME=$(LIBNAME)$@
358 @echo "====> make publisher subtarget in `pwd | sed 's/^.*develop\///'`"
359 @$(MAKE) makedir DIR=$(DIR)/$(DEBUG_DIR)pub
360 @$(MAKE) lib CSRCS="$(PUB_CSRCS)" LIBNAME=$(LIBNAME)$@
363 @echo "====> make player subtarget in `pwd | sed 's/^.*develop\///'`"
364 @$(MAKE) makedir DIR=$(DIR)/player/$(DEBUG_DIR)
365 @$(MAKE) lib CSRCS="$(SAP_CSRCS)" LIBNAME=$(LIBNAME)$@
367 clean:: optclean debugclean
370 @-[ ! -d $(DIR) ] || ( cd $(DIR) && \
371 $(RM) *.o *.a *.d *.res ii_files/*.ii *.class *.h )
374 @-[ ! -d $(DIR)/debug ] || ( cd $(DIR)/debug && \
375 $(RM) *.o *.a *.d *.res ii_files/*.ii *.class *.h )
379 @# don't use mkdir -p. Cygwin will try to make network paths and fail
380 @[ -d $(DIR) ] || mkdir $(DIR)
381 @[ -d $(DIR)/debug ] || mkdir $(DIR)/debug