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 line to enable integrated game engine
41 #CFLAGS += -DGAMEBLENDER=1
44 CFLAGS += $(NAN_DEBUG)
45 CCFLAGS += $(NAN_DEBUG)
48 REL_CFLAGS += -DNDEBUG
49 REL_CCFLAGS += -DNDEBUG
53 # OS dependent parts ---------------------------------------------------
74 CCFLAGS += -pipe -fPIC
77 CPPFLAGS += -D_THREAD_SAFE
79 OPENGL_HEADERS = /System/Library/Frameworks/OpenGL.framework
92 CCFLAGS += -pipe -fPIC
95 CPPFLAGS += -D_THREAD_SAFE
97 OPENGL_HEADERS = /usr/X11R6/include
98 JAVA_HEADERS = /usr/local/jdk1.3.1/include
99 JAVA_SYSTEM_HEADERS = /usr/local/jdk1.3.1/include/freebsd
108 CFLAGS += -n32 -mips3 -Xcpluscomm
109 CCFLAGS += -n32 -mips3 -Xcpluscomm -LANG:std
110 REL_CFLAGS += -O2 -OPT:Olimit=0
111 REL_CCFLAGS += -O2 -OPT:Olimit=0
112 OPENGL_HEADERS = /usr/include
116 ARFLAGSQUIET = -ar -o
123 CFLAGS += -pipe -fPIC
124 CCFLAGS += -pipe -fPIC
132 OPENGL_HEADERS = /usr/X11R6/include
141 CFLAGS += -pipe -fPIC
142 CCFLAGS += -pipe -fPIC
146 CPPFLAGS += -D__FreeBSD__
147 OPENGL_HEADERS = /usr/X11R6/include
158 CFLAGS += -pipe -fPIC
159 CCFLAGS += -pipe -fPIC
164 OPENGL_HEADERS = /usr/openwin/share/include
165 CPPFLAGS += -DSUN_OGL_NO_VERTEX_MACROS
166 JAVA_HEADERS = /usr/java/include
167 JAVA_SYSTEM_HEADERS = /usr/java/include/solaris
169 OPENGL_HEADERS = /usr/local/include
177 ifeq ($(FREE_WINDOWS),true)
180 CFLAGS += -pipe -mno-cygwin -mwindows
181 CCFLAGS += -pipe -mno-cygwin -mwindows
182 CPPFLAGS += -DFREE_WINDOWS
183 #CPPFLAGS += -I/usr/include/mingw
187 #OPENGL_HEADERS = /usr/include/w32api
192 WINRC = $(wildcard *.rc)
195 CC = $(SRCHOME)/tools/cygwin/cl_wrapper.pl
196 CCC = $(SRCHOME)/tools/cygwin/cl_wrapper.pl
197 JAVAC = $(SRCHOME)/tools/cygwin/java_wrapper.pl -c
198 JAVAH = $(SRCHOME)/tools/cygwin/java_wrapper.pl -h
200 REL_CCFLAGS += /O2 -GX
201 DBG_CFLAGS += /Fd$(DIR)/debug/
202 DBG_CCFLAGS += /Fd$(DIR)/debug/
207 CPPFLAGS += -DWIN32 -D_WIN32 -D__WIN32
208 CPPFLAGS += -D_M_IX86
209 CPPFLAGS += -I"/cygdrive/c/Program Files/Microsoft Visual Studio/VC98/include"
210 JAVA_HEADERS = /cygdrive/c/j2sdk1.4.0-beta3/include
211 JAVA_SYSTEM_HEADERS = /cygdrive/c/j2sdk1.4.0-beta3/include/win32
212 CPP = $(SRCHOME)/tools/cygwin/cl_wrapper.pl
216 WINRC = $(wildcard *.rc)
220 ifeq (debug, $(findstring debug, $(MAKECMDGOALS)))
221 export DEBUG_DIR=debug/
224 ifneq (x$(DEBUG_DIR), x)
225 CFLAGS +=$(DBG_CFLAGS)
226 CCFLAGS+=$(DBG_CCFLAGS)
228 CFLAGS +=$(REL_CFLAGS)
229 CCFLAGS+=$(REL_CCFLAGS)
232 # Note: include nan_warn's LEVEL_*_WARNINGS after CC/OS have been set.
239 $(DIR)/$(DEBUG_DIR)%.o: %.c
241 @set -e; $(CC) -M $(CPPFLAGS) $< 2>/dev/null \
242 | sed 's@\($*\)\.o[ :]*@$(DIR)/$(DEBUG_DIR)\1.o : @g' \
243 > $(DIR)/$(DEBUG_DIR)$*.d; \
244 [ -s $(DIR)/$(DEBUG_DIR)$*.d ] || $(RM) $(DIR)/$(DEBUG_DIR)$*.d
248 @$(CC) -c $(CFLAGS) $(CPPFLAGS) $< -o $@
250 $(CC) -c $(CFLAGS) $(CPPFLAGS) $< -o $@
253 $(DIR)/$(DEBUG_DIR)%.o: %.cpp
255 @set -e; $(CCC) -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 @$(CCC) -c $(CCFLAGS) $(CPPFLAGS) $< -o $@
264 $(CCC) -c $(CCFLAGS) $(CPPFLAGS) $< -o $@
267 #$(DIR)/$(DEBUG_DIR)%.res: %.rc
268 # $(SRCHOME)/tools/cygwin/cl_wrapper.pl - rc /fo$@ $<
270 $(DIR)/$(DEBUG_DIR)%.res: %.rc
271 ifeq ($(FREE_WINDOWS),true)
272 windres $< -O coff -o $@
274 $(SRCHOME)/tools/cygwin/cl_wrapper.pl - rc /fo$@ $<
277 $(DIR)/$(DEBUG_DIR)%.class: %.java
279 $(JAVAC) -verbose -g -deprecation -sourcepath . -classpath "$(JARS)" -d $(DIR)/$(DEBUG_DIR) $<
281 $(JAVAC) -verbose -g -deprecation -d $(DIR)/$(DEBUG_DIR) $<
284 $(DIR)/$(DEBUG_DIR)%.h: $(DIR)/$(DEBUG_DIR)%.class
285 $(JAVAH) -classpath $(DIR)/$(DEBUG_DIR) -d $(DIR)/$(DEBUG_DIR) -jni $*
288 @echo "WARNING: Fake header creation rule used, dependencies will be remade"
290 CSRCS ?= $(wildcard *.c)
291 CCSRCS ?= $(wildcard *.cpp)
292 JSRCS ?= $(wildcard *.java)
295 -include $(CSRCS:%.c=$(DIR)/$(DEBUG_DIR)%.d) $(CCSRCS:%.cpp=$(DIR)/$(DEBUG_DIR)%.d)
298 OBJS += $(CSRCS:%.c=$(DIR)/$(DEBUG_DIR)%.o)
299 OBJS += $(CCSRCS:%.cpp=$(DIR)/$(DEBUG_DIR)%.o)
300 OBJS += $(WINRC:%.rc=$(DIR)/$(DEBUG_DIR)%.res)
302 JCLASS += $(JSRCS:%.java=$(DIR)/$(DEBUG_DIR)%.class)
304 LIB_a = $(DIR)/$(DEBUG_DIR)lib$(LIBNAME).a
307 # $OBJS can be empty except for some spaces
308 ifneq (x, x$(strip $(OBJS)))
312 @echo " -- lib: lib$(LIBNAME).a -- "
313 @$(AR) $(ARFLAGSQUIET) $@ $(OBJS)
315 $(AR) $(ARFLAGS) $@ $(OBJS)
319 @echo " -- lib: lib$(LIBNAME).a -- "
320 @$(AR) $(ARFLAGSQUIET) $@ $?
322 $(AR) $(ARFLAGS) $@ $?
330 ALLTARGETS ?= $(LIB_a)
332 all debug :: makedir $(ALLTARGETS)
337 @echo "====> make creator subtarget in `pwd | sed 's/^.*develop\///'`"
338 @$(MAKE) makedir DIR=$(DIR)/$(DEBUG_DIR)cre
339 @$(MAKE) lib CSRCS="$(CRE_CSRCS)" LIBNAME=$(LIBNAME)$@
342 @echo "====> make publisher subtarget in `pwd | sed 's/^.*develop\///'`"
343 @$(MAKE) makedir DIR=$(DIR)/$(DEBUG_DIR)pub
344 @$(MAKE) lib CSRCS="$(PUB_CSRCS)" LIBNAME=$(LIBNAME)$@
347 @echo "====> make player subtarget in `pwd | sed 's/^.*develop\///'`"
348 @$(MAKE) makedir DIR=$(DIR)/player/$(DEBUG_DIR)
349 @$(MAKE) lib CSRCS="$(SAP_CSRCS)" LIBNAME=$(LIBNAME)$@
351 clean:: optclean debugclean
354 @-[ ! -d $(DIR) ] || ( cd $(DIR) && \
355 $(RM) *.o *.a *.d *.res ii_files/*.ii *.class *.h )
358 @-[ ! -d $(DIR)/debug ] || ( cd $(DIR)/debug && \
359 $(RM) *.o *.a *.d *.res ii_files/*.ii *.class *.h )
363 @# don't use mkdir -p. Cygwin will try to make network paths and fail
364 @[ -d $(DIR) ] || mkdir $(DIR)
365 @[ -d $(DIR)/debug ] || mkdir $(DIR)/debug