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 ($(BF_PROFILE), true)
55 ifeq ($(WITH_BF_OPENMP), true)
61 CFLAGS += $(NAN_DEBUG)
62 CCFLAGS += $(NAN_DEBUG)
65 REL_CFLAGS += -DNDEBUG
66 REL_CCFLAGS += -DNDEBUG
70 # OS dependent parts ---------------------------------------------------
75 CFLAGS += -pipe -fPIC -funsigned-char -fno-strict-aliasing
76 CCFLAGS += -pipe -fPIC -funsigned-char -fno-strict-aliasing
91 CFLAGS += -pipe -fPIC -ffast-math -mcpu=7450 -mtune=G5 -funsigned-char -fno-strict-aliasing
92 CCFLAGS += -pipe -fPIC -funsigned-char -fno-strict-aliasing
94 CFLAGS += -pipe -fPIC -ffast-math -march=pentium-m -funsigned-char -fno-strict-aliasing
95 CCFLAGS += -pipe -fPIC -funsigned-char -fno-strict-aliasing
99 CPPFLAGS += -D_THREAD_SAFE
101 OPENGL_HEADERS = /System/Library/Frameworks/OpenGL.framework
113 CFLAGS += -pipe -fPIC -funsigned-char -fno-strict-aliasing
114 CCFLAGS += -pipe -fPIC -funsigned-char -fno-strict-aliasing
117 CPPFLAGS += -D_THREAD_SAFE
119 OPENGL_HEADERS = /usr/X11R6/include
120 JAVA_HEADERS = /usr/local/jdk1.3.1/include
121 JAVA_SYSTEM_HEADERS = /usr/local/jdk1.3.1/include/freebsd
128 ifeq ($(IRIX_USE_GCC),true)
131 CFLAGS += -fPIC -funsigned-char -fno-strict-aliasing -mabi=n32 -mips4
132 CCFLAGS += -fPIC -fpermissive -funsigned-char -fno-strict-aliasing -mabi=n32 -mips4
135 CPPFLAGS += -DXP_UNIX
136 DBG_CFLAGS += -g3 -gdwarf-2 -ggdb
137 DBG_CCFLAGS += -g3 -gdwarf-2 -ggdb
141 CFLAGS += -n32 -mips3 -Xcpluscomm
142 CCFLAGS += -n32 -mips3 -Xcpluscomm -LANG:std
143 ifdef MIPS73_ISOHEADERS
144 CCFLAGS += -LANG:libc_in_namespace_std=off -I$(MIPS73_ISOHEADERS)
146 CCFLAGS += -LANG:libc_in_namespace_std=off
148 REL_CFLAGS += -n32 -mips3 -O2 -OPT:Olimit=0
149 REL_CCFLAGS += -n32 -mips3 -O2 -OPT:Olimit=0
151 OPENGL_HEADERS = /usr/include
155 ARFLAGSQUIET = -ar -o
162 CFLAGS += -pipe -fPIC -funsigned-char -fno-strict-aliasing
163 CCFLAGS += -pipe -fPIC -funsigned-char -fno-strict-aliasing
171 OPENGL_HEADERS = /usr/X11R6/include
180 CFLAGS += -pipe -fPIC -funsigned-char -fno-strict-aliasing
181 CCFLAGS += -pipe -fPIC -funsigned-char -fno-strict-aliasing
185 CPPFLAGS += -D__FreeBSD__
186 OPENGL_HEADERS = /usr/X11R6/include
193 # Adding gcc flag to $CC is not good, however if its not there makesdna wont build - Campbell
194 ifeq (x86_64, $(findstring x86_64, $(CPU)))
206 CFLAGS += -pipe -fPIC -funsigned-char -fno-strict-aliasing
207 CCFLAGS += -pipe -fPIC -funsigned-char -fno-strict-aliasing
208 # CFLAGS += "-fast -xdepend -xarch=v8plus -xO3 -xlibmil -KPIC -DPIC -xchar=unsigned"
209 # CCFLAGS += "-fast -xdepend -xarch=v8plus -xO3 -xlibmil -xlibmopt -features=tmplife -norunpath -KPIC -DPIC -xchar=unsigned"
211 # Note, you might still want to compile a 32 bit binary if you have a 64bit system. if so remove the following lines
212 # ifeq ($(findstring 64,$(CPU)), 64)
221 # ifeq ($(CPU),sparc)
222 ifeq ($(findstring sparc,$(CPU)), sparc)
223 OPENGL_HEADERS = /usr/openwin/share/include
224 CPPFLAGS += -DSUN_OGL_NO_VERTEX_MACROS
225 JAVA_HEADERS = /usr/java/include
226 JAVA_SYSTEM_HEADERS = /usr/java/include/solaris
228 # OPENGL_HEADERS = /usr/X11/include/mesa
229 OPENGL_HEADERS = /usr/X11/include/
237 ifeq ($(FREE_WINDOWS),true)
240 CFLAGS += -pipe -mno-cygwin -mwindows -funsigned-char -fno-strict-aliasing
241 CCFLAGS += -pipe -mno-cygwin -mwindows -funsigned-char -fno-strict-aliasing
242 CPPFLAGS += -DFREE_WINDOWS
246 #OPENGL_HEADERS = /usr/include/w32api
251 WINRC = $(wildcard *.rc)
254 CC = $(SRCHOME)/tools/cygwin/cl_wrapper.pl
255 CCC = $(SRCHOME)/tools/cygwin/cl_wrapper.pl
256 JAVAC = $(SRCHOME)/tools/cygwin/java_wrapper.pl -c
257 JAVAH = $(SRCHOME)/tools/cygwin/java_wrapper.pl -h
259 REL_CCFLAGS += /O2 -GX
260 DBG_CFLAGS += /Fd$(DIR)/debug/
261 DBG_CCFLAGS += /Fd$(DIR)/debug/
266 CPPFLAGS += -DWIN32 -D_WIN32 -D__WIN32
267 CPPFLAGS += -D_M_IX86
268 CPPFLAGS += -I"/cygdrive/c/Program Files/Microsoft Visual Studio/VC98/include"
269 JAVA_HEADERS = /cygdrive/c/j2sdk1.4.0-beta3/include
270 JAVA_SYSTEM_HEADERS = /cygdrive/c/j2sdk1.4.0-beta3/include/win32
271 CPP = $(SRCHOME)/tools/cygwin/cl_wrapper.pl
275 WINRC = $(wildcard *.rc)
279 ifeq (debug, $(findstring debug, $(MAKECMDGOALS)))
280 export DEBUG_DIR=debug/
283 ifneq (x$(DEBUG_DIR), x)
284 CFLAGS +=$(DBG_CFLAGS)
285 CCFLAGS+=$(DBG_CCFLAGS)
287 CFLAGS +=$(REL_CFLAGS)
288 CCFLAGS+=$(REL_CCFLAGS)
291 # Note: include nan_warn's LEVEL_*_WARNINGS after CC/OS have been set.
298 $(DIR)/$(DEBUG_DIR)%.o: %.c
300 @set -e; $(CC) -M $(CPPFLAGS) $< 2>/dev/null \
301 | sed 's@\($*\)\.o[ :]*@$(DIR)/$(DEBUG_DIR)\1.o : @g' \
302 > $(DIR)/$(DEBUG_DIR)$*.d; \
303 [ -s $(DIR)/$(DEBUG_DIR)$*.d ] || $(RM) $(DIR)/$(DEBUG_DIR)$*.d
307 @$(CC) -c $(CFLAGS) $(CPPFLAGS) $< -o $@
309 $(CC) -c $(CFLAGS) $(CPPFLAGS) $< -o $@
312 $(DIR)/$(DEBUG_DIR)%.o: %.cpp
314 @set -e; $(CCC) -M $(CPPFLAGS) $< 2>/dev/null \
315 | sed 's@\($*\)\.o[ :]*@$(DIR)/$(DEBUG_DIR)\1.o : @g' \
316 > $(DIR)/$(DEBUG_DIR)$*.d; \
317 [ -s $(DIR)/$(DEBUG_DIR)$*.d ] || $(RM) $(DIR)/$(DEBUG_DIR)$*.d
321 @$(CCC) -c $(CCFLAGS) $(CPPFLAGS) $< -o $@
323 $(CCC) -c $(CCFLAGS) $(CPPFLAGS) $< -o $@
326 $(DIR)/$(DEBUG_DIR)%.res: %.rc
327 ifeq ($(FREE_WINDOWS),true)
328 windres $< -O coff -o $@
330 $(SRCHOME)/tools/cygwin/cl_wrapper.pl - rc /fo$@ $<
333 $(DIR)/$(DEBUG_DIR)%.class: %.java
335 $(JAVAC) -verbose -g -deprecation -sourcepath . -classpath "$(JARS)" -d $(DIR)/$(DEBUG_DIR) $<
337 $(JAVAC) -verbose -g -deprecation -d $(DIR)/$(DEBUG_DIR) $<
340 $(DIR)/$(DEBUG_DIR)%.h: $(DIR)/$(DEBUG_DIR)%.class
341 $(JAVAH) -classpath $(DIR)/$(DEBUG_DIR) -d $(DIR)/$(DEBUG_DIR) -jni $*
344 @echo "WARNING: Fake header creation rule used, dependencies will be remade"
346 CSRCS ?= $(wildcard *.c)
347 CCSRCS ?= $(wildcard *.cpp)
348 JSRCS ?= $(wildcard *.java)
351 -include $(CSRCS:%.c=$(DIR)/$(DEBUG_DIR)%.d) $(CCSRCS:%.cpp=$(DIR)/$(DEBUG_DIR)%.d)
355 OBJS_AR += $(CSRCS:%.c=%.o)
356 OBJS_AR += $(CCSRCS:%.cpp=%.o)
357 OBJS_AR += $(WINRC:%.rc=%.res)
359 OBJS += $(CSRCS:%.c=$(DIR)/$(DEBUG_DIR)%.o)
360 OBJS += $(CCSRCS:%.cpp=$(DIR)/$(DEBUG_DIR)%.o)
361 OBJS += $(WINRC:%.rc=$(DIR)/$(DEBUG_DIR)%.res)
363 JCLASS += $(JSRCS:%.java=$(DIR)/$(DEBUG_DIR)%.class)
365 LIB_a = $(DIR)/$(DEBUG_DIR)lib$(LIBNAME).a
368 # $OBJS can be empty except for some spaces
369 ifneq (x, x$(strip $(OBJS)))
373 @echo " -- lib: lib$(LIBNAME).a -- "
374 @cd $(DIR)/$(DEBUG_DIR); $(AR) $(ARFLAGSQUIET) $@ $(OBJS_AR)
376 cd $(DIR)/$(DEBUG_DIR); $(AR) $(ARFLAGS) $@ $(OBJS_AR)
380 @echo " -- lib: lib$(LIBNAME).a -- "
381 @$(AR) $(ARFLAGSQUIET) $@ $?
383 $(AR) $(ARFLAGS) $@ $?
391 ALLTARGETS ?= $(LIB_a)
393 all debug :: makedir $(ALLTARGETS)
398 @echo "====> make creator subtarget in `pwd | sed 's/^.*develop\///'`"
399 @$(MAKE) makedir DIR=$(DIR)/$(DEBUG_DIR)cre
400 @$(MAKE) lib CSRCS="$(CRE_CSRCS)" LIBNAME=$(LIBNAME)$@
403 @echo "====> make publisher subtarget in `pwd | sed 's/^.*develop\///'`"
404 @$(MAKE) makedir DIR=$(DIR)/$(DEBUG_DIR)pub
405 @$(MAKE) lib CSRCS="$(PUB_CSRCS)" LIBNAME=$(LIBNAME)$@
408 @echo "====> make player subtarget in `pwd | sed 's/^.*develop\///'`"
409 @$(MAKE) makedir DIR=$(DIR)/player/$(DEBUG_DIR)
410 @$(MAKE) lib CSRCS="$(SAP_CSRCS)" LIBNAME=$(LIBNAME)$@
412 clean:: optclean debugclean
415 @-[ ! -d $(DIR) ] || ( cd $(DIR) && \
416 $(RM) *.o *.a *.d *.res ii_files/*.ii *.class *.h )
419 @-[ ! -d $(DIR)/debug ] || ( cd $(DIR)/debug && \
420 $(RM) *.o *.a *.d *.res ii_files/*.ii *.class *.h )
424 @# don't use mkdir -p. Cygwin will try to make network paths and fail
425 @[ -d $(DIR) ] || mkdir $(DIR)
426 @[ -d $(DIR)/debug ] || mkdir $(DIR)/debug