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
125 CFLAGS += -n32 -mips3 -Xcpluscomm
126 CCFLAGS += -n32 -mips3 -Xcpluscomm -LANG:std
127 ifdef MIPS73_ISOHEADERS
128 CCFLAGS += -LANG:libc_in_namespace_std=off -I$(MIPS73_ISOHEADERS)
130 CCFLAGS += -LANG:libc_in_namespace_std=off
132 REL_CFLAGS += -n32 -mips3 -O2 -OPT:Olimit=0
133 REL_CCFLAGS += -n32 -mips3 -O2 -OPT:Olimit=0
134 OPENGL_HEADERS = /usr/include
138 ARFLAGSQUIET = -ar -o
145 CFLAGS += -pipe -fPIC -funsigned-char -fno-strict-aliasing
146 CCFLAGS += -pipe -fPIC -funsigned-char -fno-strict-aliasing
154 OPENGL_HEADERS = /usr/X11R6/include
163 CFLAGS += -pipe -fPIC -funsigned-char -fno-strict-aliasing
164 CCFLAGS += -pipe -fPIC -funsigned-char -fno-strict-aliasing
168 CPPFLAGS += -D__FreeBSD__
169 OPENGL_HEADERS = /usr/X11R6/include
176 # Adding gcc flag to $CC is not good, however if its not there makesdna wont build - Campbell
177 ifeq (x86_64, $(findstring x86_64, $(CPU)))
189 CFLAGS += -pipe -fPIC -funsigned-char -fno-strict-aliasing
190 CCFLAGS += -pipe -fPIC -funsigned-char -fno-strict-aliasing
191 # CFLAGS += "-fast -xdepend -xarch=v8plus -xO3 -xlibmil -KPIC -DPIC -xchar=unsigned"
192 # CCFLAGS += "-fast -xdepend -xarch=v8plus -xO3 -xlibmil -xlibmopt -features=tmplife -norunpath -KPIC -DPIC -xchar=unsigned"
194 # Note, you might still want to compile a 32 bit binary if you have a 64bit system. if so remove the following lines
195 # ifeq ($(findstring 64,$(CPU)), 64)
204 # ifeq ($(CPU),sparc)
205 ifeq ($(findstring sparc,$(CPU)), sparc)
206 OPENGL_HEADERS = /usr/openwin/share/include
207 CPPFLAGS += -DSUN_OGL_NO_VERTEX_MACROS
208 JAVA_HEADERS = /usr/java/include
209 JAVA_SYSTEM_HEADERS = /usr/java/include/solaris
211 # OPENGL_HEADERS = /usr/X11/include/mesa
212 OPENGL_HEADERS = /usr/X11/include/
220 ifeq ($(FREE_WINDOWS),true)
223 CFLAGS += -pipe -mno-cygwin -mwindows -funsigned-char -fno-strict-aliasing
224 CCFLAGS += -pipe -mno-cygwin -mwindows -funsigned-char -fno-strict-aliasing
225 CPPFLAGS += -DFREE_WINDOWS
229 #OPENGL_HEADERS = /usr/include/w32api
234 WINRC = $(wildcard *.rc)
237 CC = $(SRCHOME)/tools/cygwin/cl_wrapper.pl
238 CCC = $(SRCHOME)/tools/cygwin/cl_wrapper.pl
239 JAVAC = $(SRCHOME)/tools/cygwin/java_wrapper.pl -c
240 JAVAH = $(SRCHOME)/tools/cygwin/java_wrapper.pl -h
242 REL_CCFLAGS += /O2 -GX
243 DBG_CFLAGS += /Fd$(DIR)/debug/
244 DBG_CCFLAGS += /Fd$(DIR)/debug/
249 CPPFLAGS += -DWIN32 -D_WIN32 -D__WIN32
250 CPPFLAGS += -D_M_IX86
251 CPPFLAGS += -I"/cygdrive/c/Program Files/Microsoft Visual Studio/VC98/include"
252 JAVA_HEADERS = /cygdrive/c/j2sdk1.4.0-beta3/include
253 JAVA_SYSTEM_HEADERS = /cygdrive/c/j2sdk1.4.0-beta3/include/win32
254 CPP = $(SRCHOME)/tools/cygwin/cl_wrapper.pl
258 WINRC = $(wildcard *.rc)
262 ifeq (debug, $(findstring debug, $(MAKECMDGOALS)))
263 export DEBUG_DIR=debug/
266 ifneq (x$(DEBUG_DIR), x)
267 CFLAGS +=$(DBG_CFLAGS)
268 CCFLAGS+=$(DBG_CCFLAGS)
270 CFLAGS +=$(REL_CFLAGS)
271 CCFLAGS+=$(REL_CCFLAGS)
274 # Note: include nan_warn's LEVEL_*_WARNINGS after CC/OS have been set.
281 $(DIR)/$(DEBUG_DIR)%.o: %.c
283 @set -e; $(CC) -M $(CPPFLAGS) $< 2>/dev/null \
284 | sed 's@\($*\)\.o[ :]*@$(DIR)/$(DEBUG_DIR)\1.o : @g' \
285 > $(DIR)/$(DEBUG_DIR)$*.d; \
286 [ -s $(DIR)/$(DEBUG_DIR)$*.d ] || $(RM) $(DIR)/$(DEBUG_DIR)$*.d
290 @$(CC) -c $(CFLAGS) $(CPPFLAGS) $< -o $@
292 $(CC) -c $(CFLAGS) $(CPPFLAGS) $< -o $@
295 $(DIR)/$(DEBUG_DIR)%.o: %.cpp
297 @set -e; $(CCC) -M $(CPPFLAGS) $< 2>/dev/null \
298 | sed 's@\($*\)\.o[ :]*@$(DIR)/$(DEBUG_DIR)\1.o : @g' \
299 > $(DIR)/$(DEBUG_DIR)$*.d; \
300 [ -s $(DIR)/$(DEBUG_DIR)$*.d ] || $(RM) $(DIR)/$(DEBUG_DIR)$*.d
304 @$(CCC) -c $(CCFLAGS) $(CPPFLAGS) $< -o $@
306 $(CCC) -c $(CCFLAGS) $(CPPFLAGS) $< -o $@
309 $(DIR)/$(DEBUG_DIR)%.res: %.rc
310 ifeq ($(FREE_WINDOWS),true)
311 windres $< -O coff -o $@
313 $(SRCHOME)/tools/cygwin/cl_wrapper.pl - rc /fo$@ $<
316 $(DIR)/$(DEBUG_DIR)%.class: %.java
318 $(JAVAC) -verbose -g -deprecation -sourcepath . -classpath "$(JARS)" -d $(DIR)/$(DEBUG_DIR) $<
320 $(JAVAC) -verbose -g -deprecation -d $(DIR)/$(DEBUG_DIR) $<
323 $(DIR)/$(DEBUG_DIR)%.h: $(DIR)/$(DEBUG_DIR)%.class
324 $(JAVAH) -classpath $(DIR)/$(DEBUG_DIR) -d $(DIR)/$(DEBUG_DIR) -jni $*
327 @echo "WARNING: Fake header creation rule used, dependencies will be remade"
329 CSRCS ?= $(wildcard *.c)
330 CCSRCS ?= $(wildcard *.cpp)
331 JSRCS ?= $(wildcard *.java)
334 -include $(CSRCS:%.c=$(DIR)/$(DEBUG_DIR)%.d) $(CCSRCS:%.cpp=$(DIR)/$(DEBUG_DIR)%.d)
338 OBJS_AR += $(CSRCS:%.c=%.o)
339 OBJS_AR += $(CCSRCS:%.cpp=%.o)
340 OBJS_AR += $(WINRC:%.rc=%.res)
342 OBJS += $(CSRCS:%.c=$(DIR)/$(DEBUG_DIR)%.o)
343 OBJS += $(CCSRCS:%.cpp=$(DIR)/$(DEBUG_DIR)%.o)
344 OBJS += $(WINRC:%.rc=$(DIR)/$(DEBUG_DIR)%.res)
346 JCLASS += $(JSRCS:%.java=$(DIR)/$(DEBUG_DIR)%.class)
348 LIB_a = $(DIR)/$(DEBUG_DIR)lib$(LIBNAME).a
351 # $OBJS can be empty except for some spaces
352 ifneq (x, x$(strip $(OBJS)))
356 @echo " -- lib: lib$(LIBNAME).a -- "
357 @cd $(DIR)/$(DEBUG_DIR); $(AR) $(ARFLAGSQUIET) $@ $(OBJS_AR)
359 cd $(DIR)/$(DEBUG_DIR); $(AR) $(ARFLAGS) $@ $(OBJS_AR)
363 @echo " -- lib: lib$(LIBNAME).a -- "
364 @$(AR) $(ARFLAGSQUIET) $@ $?
366 $(AR) $(ARFLAGS) $@ $?
374 ALLTARGETS ?= $(LIB_a)
376 all debug :: makedir $(ALLTARGETS)
381 @echo "====> make creator subtarget in `pwd | sed 's/^.*develop\///'`"
382 @$(MAKE) makedir DIR=$(DIR)/$(DEBUG_DIR)cre
383 @$(MAKE) lib CSRCS="$(CRE_CSRCS)" LIBNAME=$(LIBNAME)$@
386 @echo "====> make publisher subtarget in `pwd | sed 's/^.*develop\///'`"
387 @$(MAKE) makedir DIR=$(DIR)/$(DEBUG_DIR)pub
388 @$(MAKE) lib CSRCS="$(PUB_CSRCS)" LIBNAME=$(LIBNAME)$@
391 @echo "====> make player subtarget in `pwd | sed 's/^.*develop\///'`"
392 @$(MAKE) makedir DIR=$(DIR)/player/$(DEBUG_DIR)
393 @$(MAKE) lib CSRCS="$(SAP_CSRCS)" LIBNAME=$(LIBNAME)$@
395 clean:: optclean debugclean
398 @-[ ! -d $(DIR) ] || ( cd $(DIR) && \
399 $(RM) *.o *.a *.d *.res ii_files/*.ii *.class *.h )
402 @-[ ! -d $(DIR)/debug ] || ( cd $(DIR)/debug && \
403 $(RM) *.o *.a *.d *.res ii_files/*.ii *.class *.h )
407 @# don't use mkdir -p. Cygwin will try to make network paths and fail
408 @[ -d $(DIR) ] || mkdir $(DIR)
409 @[ -d $(DIR)/debug ] || mkdir $(DIR)/debug