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 CCFLAGS += -LANG:libc_in_namespace_std=off
121 REL_CFLAGS += -n32 -mips3 -O2 -OPT:Olimit=0
122 REL_CCFLAGS += -n32 -mips3 -O2 -OPT:Olimit=0
123 OPENGL_HEADERS = /usr/include
127 ARFLAGSQUIET = -ar -o
134 CFLAGS += -pipe -fPIC
135 CCFLAGS += -pipe -fPIC
143 OPENGL_HEADERS = /usr/X11R6/include
152 CFLAGS += -pipe -fPIC
153 CCFLAGS += -pipe -fPIC
157 CPPFLAGS += -D__FreeBSD__
158 OPENGL_HEADERS = /usr/X11R6/include
169 CFLAGS += -pipe -fPIC
170 CCFLAGS += -pipe -fPIC
175 OPENGL_HEADERS = /usr/openwin/share/include
176 CPPFLAGS += -DSUN_OGL_NO_VERTEX_MACROS
177 JAVA_HEADERS = /usr/java/include
178 JAVA_SYSTEM_HEADERS = /usr/java/include/solaris
180 OPENGL_HEADERS = /usr/local/include
188 ifeq ($(FREE_WINDOWS),true)
191 CFLAGS += -pipe -mno-cygwin -mwindows
192 CCFLAGS += -pipe -mno-cygwin -mwindows
193 CPPFLAGS += -DFREE_WINDOWS
197 #OPENGL_HEADERS = /usr/include/w32api
202 WINRC = $(wildcard *.rc)
205 CC = $(SRCHOME)/tools/cygwin/cl_wrapper.pl
206 CCC = $(SRCHOME)/tools/cygwin/cl_wrapper.pl
207 JAVAC = $(SRCHOME)/tools/cygwin/java_wrapper.pl -c
208 JAVAH = $(SRCHOME)/tools/cygwin/java_wrapper.pl -h
210 REL_CCFLAGS += /O2 -GX
211 DBG_CFLAGS += /Fd$(DIR)/debug/
212 DBG_CCFLAGS += /Fd$(DIR)/debug/
217 CPPFLAGS += -DWIN32 -D_WIN32 -D__WIN32
218 CPPFLAGS += -D_M_IX86
219 CPPFLAGS += -I"/cygdrive/c/Program Files/Microsoft Visual Studio/VC98/include"
220 JAVA_HEADERS = /cygdrive/c/j2sdk1.4.0-beta3/include
221 JAVA_SYSTEM_HEADERS = /cygdrive/c/j2sdk1.4.0-beta3/include/win32
222 CPP = $(SRCHOME)/tools/cygwin/cl_wrapper.pl
226 WINRC = $(wildcard *.rc)
230 ifeq (debug, $(findstring debug, $(MAKECMDGOALS)))
231 export DEBUG_DIR=debug/
234 ifneq (x$(DEBUG_DIR), x)
235 CFLAGS +=$(DBG_CFLAGS)
236 CCFLAGS+=$(DBG_CCFLAGS)
238 CFLAGS +=$(REL_CFLAGS)
239 CCFLAGS+=$(REL_CCFLAGS)
242 # Note: include nan_warn's LEVEL_*_WARNINGS after CC/OS have been set.
249 $(DIR)/$(DEBUG_DIR)%.o: %.c
251 @set -e; $(CC) -M $(CPPFLAGS) $< 2>/dev/null \
252 | sed 's@\($*\)\.o[ :]*@$(DIR)/$(DEBUG_DIR)\1.o : @g' \
253 > $(DIR)/$(DEBUG_DIR)$*.d; \
254 [ -s $(DIR)/$(DEBUG_DIR)$*.d ] || $(RM) $(DIR)/$(DEBUG_DIR)$*.d
258 @$(CC) -c $(CFLAGS) $(CPPFLAGS) $< -o $@
260 $(CC) -c $(CFLAGS) $(CPPFLAGS) $< -o $@
263 $(DIR)/$(DEBUG_DIR)%.o: %.cpp
265 @set -e; $(CCC) -M $(CPPFLAGS) $< 2>/dev/null \
266 | sed 's@\($*\)\.o[ :]*@$(DIR)/$(DEBUG_DIR)\1.o : @g' \
267 > $(DIR)/$(DEBUG_DIR)$*.d; \
268 [ -s $(DIR)/$(DEBUG_DIR)$*.d ] || $(RM) $(DIR)/$(DEBUG_DIR)$*.d
272 @$(CCC) -c $(CCFLAGS) $(CPPFLAGS) $< -o $@
274 $(CCC) -c $(CCFLAGS) $(CPPFLAGS) $< -o $@
277 $(DIR)/$(DEBUG_DIR)%.res: %.rc
278 ifeq ($(FREE_WINDOWS),true)
279 windres $< -O coff -o $@
281 $(SRCHOME)/tools/cygwin/cl_wrapper.pl - rc /fo$@ $<
284 $(DIR)/$(DEBUG_DIR)%.class: %.java
286 $(JAVAC) -verbose -g -deprecation -sourcepath . -classpath "$(JARS)" -d $(DIR)/$(DEBUG_DIR) $<
288 $(JAVAC) -verbose -g -deprecation -d $(DIR)/$(DEBUG_DIR) $<
291 $(DIR)/$(DEBUG_DIR)%.h: $(DIR)/$(DEBUG_DIR)%.class
292 $(JAVAH) -classpath $(DIR)/$(DEBUG_DIR) -d $(DIR)/$(DEBUG_DIR) -jni $*
295 @echo "WARNING: Fake header creation rule used, dependencies will be remade"
297 CSRCS ?= $(wildcard *.c)
298 CCSRCS ?= $(wildcard *.cpp)
299 JSRCS ?= $(wildcard *.java)
302 -include $(CSRCS:%.c=$(DIR)/$(DEBUG_DIR)%.d) $(CCSRCS:%.cpp=$(DIR)/$(DEBUG_DIR)%.d)
305 OBJS += $(CSRCS:%.c=$(DIR)/$(DEBUG_DIR)%.o)
306 OBJS += $(CCSRCS:%.cpp=$(DIR)/$(DEBUG_DIR)%.o)
307 OBJS += $(WINRC:%.rc=$(DIR)/$(DEBUG_DIR)%.res)
309 JCLASS += $(JSRCS:%.java=$(DIR)/$(DEBUG_DIR)%.class)
311 LIB_a = $(DIR)/$(DEBUG_DIR)lib$(LIBNAME).a
314 # $OBJS can be empty except for some spaces
315 ifneq (x, x$(strip $(OBJS)))
319 @echo " -- lib: lib$(LIBNAME).a -- "
320 @$(AR) $(ARFLAGSQUIET) $@ $(OBJS)
322 $(AR) $(ARFLAGS) $@ $(OBJS)
326 @echo " -- lib: lib$(LIBNAME).a -- "
327 @$(AR) $(ARFLAGSQUIET) $@ $?
329 $(AR) $(ARFLAGS) $@ $?
337 ALLTARGETS ?= $(LIB_a)
339 all debug :: makedir $(ALLTARGETS)
344 @echo "====> make creator subtarget in `pwd | sed 's/^.*develop\///'`"
345 @$(MAKE) makedir DIR=$(DIR)/$(DEBUG_DIR)cre
346 @$(MAKE) lib CSRCS="$(CRE_CSRCS)" LIBNAME=$(LIBNAME)$@
349 @echo "====> make publisher subtarget in `pwd | sed 's/^.*develop\///'`"
350 @$(MAKE) makedir DIR=$(DIR)/$(DEBUG_DIR)pub
351 @$(MAKE) lib CSRCS="$(PUB_CSRCS)" LIBNAME=$(LIBNAME)$@
354 @echo "====> make player subtarget in `pwd | sed 's/^.*develop\///'`"
355 @$(MAKE) makedir DIR=$(DIR)/player/$(DEBUG_DIR)
356 @$(MAKE) lib CSRCS="$(SAP_CSRCS)" LIBNAME=$(LIBNAME)$@
358 clean:: optclean debugclean
361 @-[ ! -d $(DIR) ] || ( cd $(DIR) && \
362 $(RM) *.o *.a *.d *.res ii_files/*.ii *.class *.h )
365 @-[ ! -d $(DIR)/debug ] || ( cd $(DIR)/debug && \
366 $(RM) *.o *.a *.d *.res ii_files/*.ii *.class *.h )
370 @# don't use mkdir -p. Cygwin will try to make network paths and fail
371 @[ -d $(DIR) ] || mkdir $(DIR)
372 @[ -d $(DIR)/debug ] || mkdir $(DIR)/debug