4 # ***** BEGIN GPL 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.
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.
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.
20 # The Original Code is Copyright (C) 2001-2002 by NaN Holding BV.
21 # All rights reserved.
23 # The Original Code is: all of this file.
25 # Contributor(s): none yet.
27 # ***** END GPL LICENSE BLOCK *****
31 include nan_definitions.mk
33 CPPFLAGS ?= $(NAN_CPPFLAGS)
35 # common parts ---------------------------------------------------
37 # Uncomment next lines to enable integrated game engine
38 ifneq ($(NAN_NO_KETSJI), true)
39 CFLAGS += -DGAMEBLENDER=1
40 CFLAGS += -DUSE_SUMO_SOLID
41 CCFLAGS += -DUSE_SUMO_SOLID
42 ifeq ($(NAN_USE_BULLET), true)
43 CFLAGS += -DUSE_BULLET -DWITH_BULLET
44 CCFLAGS += -DUSE_BULLET -DWITH_BULLET
47 CPPFLAGS += -DNO_KETSJI
50 ifeq ($(WITH_BF_OPENMP), true)
56 CFLAGS += $(NAN_DEBUG)
57 CCFLAGS += $(NAN_DEBUG)
60 REL_CFLAGS += -DNDEBUG
61 REL_CCFLAGS += -DNDEBUG
65 # OS dependent parts ---------------------------------------------------
70 CFLAGS += -pipe -fPIC -funsigned-char -fno-strict-aliasing
71 CCFLAGS += -pipe -fPIC -funsigned-char -fno-strict-aliasing
86 CFLAGS += -pipe -fPIC -ffast-math -mcpu=7450 -mtune=G5 -funsigned-char -fno-strict-aliasing
87 CCFLAGS += -pipe -fPIC -funsigned-char -fno-strict-aliasing
89 CFLAGS += -pipe -fPIC -ffast-math -march=pentium-m -funsigned-char -fno-strict-aliasing
90 CCFLAGS += -pipe -fPIC -funsigned-char -fno-strict-aliasing
94 CPPFLAGS += -D_THREAD_SAFE
96 OPENGL_HEADERS = /System/Library/Frameworks/OpenGL.framework
108 CFLAGS += -pipe -fPIC -funsigned-char -fno-strict-aliasing
109 CCFLAGS += -pipe -fPIC -funsigned-char -fno-strict-aliasing
112 CPPFLAGS += -D_THREAD_SAFE
114 OPENGL_HEADERS = /usr/X11R6/include
115 JAVA_HEADERS = /usr/local/jdk1.3.1/include
116 JAVA_SYSTEM_HEADERS = /usr/local/jdk1.3.1/include/freebsd
123 ifeq ($(IRIX_USE_GCC),true)
126 CFLAGS += -fPIC -funsigned-char -fno-strict-aliasing -mabi=n32 -mips4
127 CCFLAGS += -fPIC -fpermissive -funsigned-char -fno-strict-aliasing -mabi=n32 -mips4
130 CPPFLAGS += -DXP_UNIX
131 DBG_CFLAGS += -g3 -gdwarf-2 -ggdb
132 DBG_CCFLAGS += -g3 -gdwarf-2 -ggdb
136 CFLAGS += -n32 -mips3 -Xcpluscomm
137 CCFLAGS += -n32 -mips3 -Xcpluscomm -LANG:std
138 ifdef MIPS73_ISOHEADERS
139 CCFLAGS += -LANG:libc_in_namespace_std=off -I$(MIPS73_ISOHEADERS)
141 CCFLAGS += -LANG:libc_in_namespace_std=off
143 REL_CFLAGS += -n32 -mips3 -O2 -OPT:Olimit=0
144 REL_CCFLAGS += -n32 -mips3 -O2 -OPT:Olimit=0
146 OPENGL_HEADERS = /usr/include
150 ARFLAGSQUIET = -ar -o
157 CFLAGS += -pipe -fPIC -funsigned-char -fno-strict-aliasing
158 CCFLAGS += -pipe -fPIC -funsigned-char -fno-strict-aliasing
166 OPENGL_HEADERS = /usr/X11R6/include
175 CFLAGS += -pipe -fPIC -funsigned-char -fno-strict-aliasing
176 CCFLAGS += -pipe -fPIC -funsigned-char -fno-strict-aliasing
180 CPPFLAGS += -D__FreeBSD__
181 OPENGL_HEADERS = /usr/X11R6/include
188 # Adding gcc flag to $CC is not good, however if its not there makesdna wont build - Campbell
189 ifeq (x86_64, $(findstring x86_64, $(CPU)))
201 CFLAGS += -pipe -fPIC -funsigned-char -fno-strict-aliasing
202 CCFLAGS += -pipe -fPIC -funsigned-char -fno-strict-aliasing
203 # CFLAGS += "-fast -xdepend -xarch=v8plus -xO3 -xlibmil -KPIC -DPIC -xchar=unsigned"
204 # CCFLAGS += "-fast -xdepend -xarch=v8plus -xO3 -xlibmil -xlibmopt -features=tmplife -norunpath -KPIC -DPIC -xchar=unsigned"
206 # Note, you might still want to compile a 32 bit binary if you have a 64bit system. if so remove the following lines
207 # ifeq ($(findstring 64,$(CPU)), 64)
216 # ifeq ($(CPU),sparc)
217 ifeq ($(findstring sparc,$(CPU)), sparc)
218 OPENGL_HEADERS = /usr/openwin/share/include
219 CPPFLAGS += -DSUN_OGL_NO_VERTEX_MACROS
220 JAVA_HEADERS = /usr/java/include
221 JAVA_SYSTEM_HEADERS = /usr/java/include/solaris
223 # OPENGL_HEADERS = /usr/X11/include/mesa
224 OPENGL_HEADERS = /usr/X11/include/
232 ifeq ($(FREE_WINDOWS),true)
235 CFLAGS += -pipe -mno-cygwin -mwindows -funsigned-char -fno-strict-aliasing
236 CCFLAGS += -pipe -mno-cygwin -mwindows -funsigned-char -fno-strict-aliasing
237 CPPFLAGS += -DFREE_WINDOWS
241 #OPENGL_HEADERS = /usr/include/w32api
246 WINRC = $(wildcard *.rc)
249 CC = $(SRCHOME)/tools/cygwin/cl_wrapper.pl
250 CCC = $(SRCHOME)/tools/cygwin/cl_wrapper.pl
251 JAVAC = $(SRCHOME)/tools/cygwin/java_wrapper.pl -c
252 JAVAH = $(SRCHOME)/tools/cygwin/java_wrapper.pl -h
254 REL_CCFLAGS += /O2 -GX
255 DBG_CFLAGS += /Fd$(DIR)/debug/
256 DBG_CCFLAGS += /Fd$(DIR)/debug/
261 CPPFLAGS += -DWIN32 -D_WIN32 -D__WIN32
262 CPPFLAGS += -D_M_IX86
263 CPPFLAGS += -I"/cygdrive/c/Program Files/Microsoft Visual Studio/VC98/include"
264 JAVA_HEADERS = /cygdrive/c/j2sdk1.4.0-beta3/include
265 JAVA_SYSTEM_HEADERS = /cygdrive/c/j2sdk1.4.0-beta3/include/win32
266 CPP = $(SRCHOME)/tools/cygwin/cl_wrapper.pl
270 WINRC = $(wildcard *.rc)
274 ifeq (debug, $(findstring debug, $(MAKECMDGOALS)))
275 export DEBUG_DIR=debug/
278 ifneq (x$(DEBUG_DIR), x)
279 CFLAGS +=$(DBG_CFLAGS)
280 CCFLAGS+=$(DBG_CCFLAGS)
282 CFLAGS +=$(REL_CFLAGS)
283 CCFLAGS+=$(REL_CCFLAGS)
286 # Note: include nan_warn's LEVEL_*_WARNINGS after CC/OS have been set.
293 $(DIR)/$(DEBUG_DIR)%.o: %.c
295 @set -e; $(CC) -M $(CPPFLAGS) $< 2>/dev/null \
296 | sed 's@\($*\)\.o[ :]*@$(DIR)/$(DEBUG_DIR)\1.o : @g' \
297 > $(DIR)/$(DEBUG_DIR)$*.d; \
298 [ -s $(DIR)/$(DEBUG_DIR)$*.d ] || $(RM) $(DIR)/$(DEBUG_DIR)$*.d
302 @$(CC) -c $(CFLAGS) $(CPPFLAGS) $< -o $@
304 $(CC) -c $(CFLAGS) $(CPPFLAGS) $< -o $@
307 $(DIR)/$(DEBUG_DIR)%.o: %.cpp
309 @set -e; $(CCC) -M $(CPPFLAGS) $< 2>/dev/null \
310 | sed 's@\($*\)\.o[ :]*@$(DIR)/$(DEBUG_DIR)\1.o : @g' \
311 > $(DIR)/$(DEBUG_DIR)$*.d; \
312 [ -s $(DIR)/$(DEBUG_DIR)$*.d ] || $(RM) $(DIR)/$(DEBUG_DIR)$*.d
316 @$(CCC) -c $(CCFLAGS) $(CPPFLAGS) $< -o $@
318 $(CCC) -c $(CCFLAGS) $(CPPFLAGS) $< -o $@
321 $(DIR)/$(DEBUG_DIR)%.res: %.rc
322 ifeq ($(FREE_WINDOWS),true)
323 windres $< -O coff -o $@
325 $(SRCHOME)/tools/cygwin/cl_wrapper.pl - rc /fo$@ $<
328 $(DIR)/$(DEBUG_DIR)%.class: %.java
330 $(JAVAC) -verbose -g -deprecation -sourcepath . -classpath "$(JARS)" -d $(DIR)/$(DEBUG_DIR) $<
332 $(JAVAC) -verbose -g -deprecation -d $(DIR)/$(DEBUG_DIR) $<
335 $(DIR)/$(DEBUG_DIR)%.h: $(DIR)/$(DEBUG_DIR)%.class
336 $(JAVAH) -classpath $(DIR)/$(DEBUG_DIR) -d $(DIR)/$(DEBUG_DIR) -jni $*
339 @echo "WARNING: Fake header creation rule used, dependencies will be remade"
341 CSRCS ?= $(wildcard *.c)
342 CCSRCS ?= $(wildcard *.cpp)
343 JSRCS ?= $(wildcard *.java)
346 -include $(CSRCS:%.c=$(DIR)/$(DEBUG_DIR)%.d) $(CCSRCS:%.cpp=$(DIR)/$(DEBUG_DIR)%.d)
350 OBJS_AR += $(CSRCS:%.c=%.o)
351 OBJS_AR += $(CCSRCS:%.cpp=%.o)
352 OBJS_AR += $(WINRC:%.rc=%.res)
354 OBJS += $(CSRCS:%.c=$(DIR)/$(DEBUG_DIR)%.o)
355 OBJS += $(CCSRCS:%.cpp=$(DIR)/$(DEBUG_DIR)%.o)
356 OBJS += $(WINRC:%.rc=$(DIR)/$(DEBUG_DIR)%.res)
358 JCLASS += $(JSRCS:%.java=$(DIR)/$(DEBUG_DIR)%.class)
360 LIB_a = $(DIR)/$(DEBUG_DIR)lib$(LIBNAME).a
363 # $OBJS can be empty except for some spaces
364 ifneq (x, x$(strip $(OBJS)))
368 @echo " -- lib: lib$(LIBNAME).a -- "
369 @cd $(DIR)/$(DEBUG_DIR); $(AR) $(ARFLAGSQUIET) $@ $(OBJS_AR)
371 cd $(DIR)/$(DEBUG_DIR); $(AR) $(ARFLAGS) $@ $(OBJS_AR)
375 @echo " -- lib: lib$(LIBNAME).a -- "
376 @$(AR) $(ARFLAGSQUIET) $@ $?
378 $(AR) $(ARFLAGS) $@ $?
386 ALLTARGETS ?= $(LIB_a)
388 all debug :: makedir $(ALLTARGETS)
393 @echo "====> make creator subtarget in `pwd | sed 's/^.*develop\///'`"
394 @$(MAKE) makedir DIR=$(DIR)/$(DEBUG_DIR)cre
395 @$(MAKE) lib CSRCS="$(CRE_CSRCS)" LIBNAME=$(LIBNAME)$@
398 @echo "====> make publisher subtarget in `pwd | sed 's/^.*develop\///'`"
399 @$(MAKE) makedir DIR=$(DIR)/$(DEBUG_DIR)pub
400 @$(MAKE) lib CSRCS="$(PUB_CSRCS)" LIBNAME=$(LIBNAME)$@
403 @echo "====> make player subtarget in `pwd | sed 's/^.*develop\///'`"
404 @$(MAKE) makedir DIR=$(DIR)/player/$(DEBUG_DIR)
405 @$(MAKE) lib CSRCS="$(SAP_CSRCS)" LIBNAME=$(LIBNAME)$@
407 clean:: optclean debugclean
410 @-[ ! -d $(DIR) ] || ( cd $(DIR) && \
411 $(RM) *.o *.a *.d *.res ii_files/*.ii *.class *.h )
414 @-[ ! -d $(DIR)/debug ] || ( cd $(DIR)/debug && \
415 $(RM) *.o *.a *.d *.res ii_files/*.ii *.class *.h )
419 @# don't use mkdir -p. Cygwin will try to make network paths and fail
420 @[ -d $(DIR) ] || mkdir $(DIR)
421 @[ -d $(DIR)/debug ] || mkdir $(DIR)/debug