1 # -*- mode: gnumakefile; tab-width: 8; indent-tabs-mode: t; -*-
6 # ***** BEGIN GPL LICENSE BLOCK *****
8 # This program is free software; you can redistribute it and/or
9 # modify it under the terms of the GNU General Public License
10 # as published by the Free Software Foundation; either version 2
11 # of the License, or (at your option) any later version.
13 # This program is distributed in the hope that it will be useful,
14 # but WITHOUT ANY WARRANTY; without even the implied warranty of
15 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16 # GNU General Public License for more details.
18 # You should have received a copy of the GNU General Public License
19 # along with this program; if not, write to the Free Software Foundation,
20 # Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
22 # The Original Code is Copyright (C) 2001-2002 by NaN Holding BV.
23 # All rights reserved.
25 # The Original Code is: all of this file.
29 # ***** END GPL LICENSE BLOCK *****
33 include nan_definitions.mk
35 CPPFLAGS ?= $(NAN_CPPFLAGS)
37 # common parts ---------------------------------------------------
39 # Uncomment next lines to enable integrated game engine
40 ifneq ($(NAN_NO_KETSJI), true)
41 CFLAGS += -DGAMEBLENDER=1
42 ifeq ($(NAN_USE_BULLET), true)
43 CFLAGS += -DUSE_BULLET
44 CCFLAGS += -DUSE_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 ---------------------------------------------------
76 CFLAGS += -pipe -fPIC -ffast-math -mcpu=7450 -mtune=G5 -funsigned-char -fno-strict-aliasing -Wno-long-double
77 CCFLAGS += -pipe -fPIC -funsigned-char -fno-strict-aliasing -Wno-long-double
79 CFLAGS += -pipe -fPIC -ffast-math -march=pentium-m -funsigned-char -fno-strict-aliasing
80 CCFLAGS += -pipe -fPIC -funsigned-char -fno-strict-aliasing
84 CPPFLAGS += -D_THREAD_SAFE
86 OPENGL_HEADERS = /System/Library/Frameworks/OpenGL.framework
98 CFLAGS += -pipe -fPIC -funsigned-char -fno-strict-aliasing
99 CCFLAGS += -pipe -fPIC -funsigned-char -fno-strict-aliasing
102 CPPFLAGS += -D_THREAD_SAFE
104 OPENGL_HEADERS = /usr/X11R6/include
105 JAVA_HEADERS = /usr/local/jdk1.3.1/include
106 JAVA_SYSTEM_HEADERS = /usr/local/jdk1.3.1/include/freebsd
113 ifeq ($(IRIX_USE_GCC),true)
116 CFLAGS += -fPIC -funsigned-char -fno-strict-aliasing -mabi=n32 -mips4
117 CCFLAGS += -fPIC -fpermissive -funsigned-char -fno-strict-aliasing -mabi=n32 -mips4
120 DBG_CFLAGS += -g3 -gdwarf-2 -ggdb
121 DBG_CCFLAGS += -g3 -gdwarf-2 -ggdb
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
135 OPENGL_HEADERS = /usr/include
139 ARFLAGSQUIET = -ar -o
147 CFLAGS += -pipe -fPIC -funsigned-char -fno-strict-aliasing
148 CCFLAGS += -pipe -fPIC -funsigned-char -fno-strict-aliasing
155 OPENGL_HEADERS = /usr/X11R6/include
164 CFLAGS += -pipe -fPIC -funsigned-char -fno-strict-aliasing
165 CCFLAGS += -pipe -fPIC -funsigned-char -fno-strict-aliasing
169 CPPFLAGS += -D__FreeBSD__
170 OPENGL_HEADERS = /usr/X11R6/include
177 # Adding gcc flag to $CC is not good, however if its not there makesdna wont build - Campbell
178 ifeq (x86_64, $(findstring x86_64, $(CPU)))
190 CFLAGS += -pipe -fPIC -funsigned-char -fno-strict-aliasing
191 CCFLAGS += -pipe -fPIC -funsigned-char -fno-strict-aliasing
192 # CFLAGS += "-fast -xdepend -xarch=v8plus -xO3 -xlibmil -KPIC -DPIC -xchar=unsigned"
193 # CCFLAGS += "-fast -xdepend -xarch=v8plus -xO3 -xlibmil -xlibmopt -features=tmplife -norunpath -KPIC -DPIC -xchar=unsigned"
195 # Note, you might still want to compile a 32 bit binary if you have a 64bit system. if so remove the following lines
196 # ifeq ($(findstring 64,$(CPU)), 64)
205 # ifeq ($(CPU),sparc)
206 ifeq ($(findstring sparc,$(CPU)), sparc)
207 OPENGL_HEADERS = /usr/openwin/share/include
208 CPPFLAGS += -DSUN_OGL_NO_VERTEX_MACROS
209 JAVA_HEADERS = /usr/java/include
210 JAVA_SYSTEM_HEADERS = /usr/java/include/solaris
212 # OPENGL_HEADERS = /usr/X11/include/mesa
213 OPENGL_HEADERS = /usr/X11/include/
221 ifeq ($(FREE_WINDOWS),true)
224 CFLAGS += -pipe -mno-cygwin -mwindows -funsigned-char -fno-strict-aliasing
225 CCFLAGS += -pipe -mno-cygwin -mwindows -funsigned-char -fno-strict-aliasing
226 CPPFLAGS += -DFREE_WINDOWS
230 #OPENGL_HEADERS = /usr/include/w32api
235 WINRC = $(wildcard *.rc)
238 CC ?= $(SRCHOME)/tools/cygwin/cl_wrapper.pl
239 CCC ?= $(SRCHOME)/tools/cygwin/cl_wrapper.pl
240 JAVAC = $(SRCHOME)/tools/cygwin/java_wrapper.pl -c
241 JAVAH = $(SRCHOME)/tools/cygwin/java_wrapper.pl -h
243 REL_CCFLAGS += /O2 -GX
244 DBG_CFLAGS += /Fd$(DIR)/debug/
245 DBG_CCFLAGS += /Fd$(DIR)/debug/
250 CPPFLAGS += -DWIN32 -D_WIN32 -D__WIN32
251 CPPFLAGS += -D_M_IX86
252 CPPFLAGS += -I"/cygdrive/c/Program Files/Microsoft Visual Studio/VC98/include"
253 JAVA_HEADERS = /cygdrive/c/j2sdk1.4.0-beta3/include
254 JAVA_SYSTEM_HEADERS = /cygdrive/c/j2sdk1.4.0-beta3/include/win32
255 CPP = $(SRCHOME)/tools/cygwin/cl_wrapper.pl
259 WINRC = $(wildcard *.rc)
263 ifeq (debug, $(findstring debug, $(MAKECMDGOALS)))
264 export DEBUG_DIR=debug/
267 ifneq (x$(DEBUG_DIR), x)
268 CFLAGS +=$(DBG_CFLAGS)
269 CCFLAGS+=$(DBG_CCFLAGS)
271 CFLAGS +=$(REL_CFLAGS)
272 CCFLAGS+=$(REL_CCFLAGS)
275 # Note: include nan_warn's LEVEL_*_WARNINGS after CC/OS have been set.
282 $(DIR)/$(DEBUG_DIR)%.o: %.c
284 @set -e; $(CC) -M $(CPPFLAGS) $< 2>/dev/null \
285 | sed 's@\($*\)\.o[ :]*@$(DIR)/$(DEBUG_DIR)\1.o : @g' \
286 > $(DIR)/$(DEBUG_DIR)$*.d; \
287 [ -s $(DIR)/$(DEBUG_DIR)$*.d ] || $(RM) $(DIR)/$(DEBUG_DIR)$*.d
291 @$(CC) -c $(CFLAGS) $(CPPFLAGS) $< -o $@
293 $(CC) -c $(CFLAGS) $(CPPFLAGS) $< -o $@
296 $(DIR)/$(DEBUG_DIR)%.o: %.cpp
298 @set -e; $(CCC) -M $(CPPFLAGS) $< 2>/dev/null \
299 | sed 's@\($*\)\.o[ :]*@$(DIR)/$(DEBUG_DIR)\1.o : @g' \
300 > $(DIR)/$(DEBUG_DIR)$*.d; \
301 [ -s $(DIR)/$(DEBUG_DIR)$*.d ] || $(RM) $(DIR)/$(DEBUG_DIR)$*.d
305 @$(CCC) -c $(CCFLAGS) $(CPPFLAGS) $< -o $@
307 $(CCC) -c $(CCFLAGS) $(CPPFLAGS) $< -o $@
310 $(DIR)/$(DEBUG_DIR)%.res: %.rc
311 ifeq ($(FREE_WINDOWS),true)
312 windres $< -O coff -o $@
314 $(SRCHOME)/tools/cygwin/cl_wrapper.pl - rc /fo$@ $<
317 $(DIR)/$(DEBUG_DIR)%.class: %.java
319 $(JAVAC) -verbose -g -deprecation -sourcepath . -classpath "$(JARS)" -d $(DIR)/$(DEBUG_DIR) $<
321 $(JAVAC) -verbose -g -deprecation -d $(DIR)/$(DEBUG_DIR) $<
324 $(DIR)/$(DEBUG_DIR)%.h: $(DIR)/$(DEBUG_DIR)%.class
325 $(JAVAH) -classpath $(DIR)/$(DEBUG_DIR) -d $(DIR)/$(DEBUG_DIR) -jni $*
328 @echo "WARNING: Fake header creation rule used, dependencies will be remade"
330 CSRCS ?= $(wildcard *.c)
331 CCSRCS ?= $(wildcard *.cpp)
332 JSRCS ?= $(wildcard *.java)
335 -include $(CSRCS:%.c=$(DIR)/$(DEBUG_DIR)%.d) $(CCSRCS:%.cpp=$(DIR)/$(DEBUG_DIR)%.d)
339 OBJS_AR += $(CSRCS:%.c=%.o)
340 OBJS_AR += $(CCSRCS:%.cpp=%.o)
341 OBJS_AR += $(WINRC:%.rc=%.res)
343 OBJS += $(CSRCS:%.c=$(DIR)/$(DEBUG_DIR)%.o)
344 OBJS += $(CCSRCS:%.cpp=$(DIR)/$(DEBUG_DIR)%.o)
345 OBJS += $(WINRC:%.rc=$(DIR)/$(DEBUG_DIR)%.res)
347 JCLASS += $(JSRCS:%.java=$(DIR)/$(DEBUG_DIR)%.class)
349 LIB_a = $(DIR)/$(DEBUG_DIR)lib$(LIBNAME).a
352 # $OBJS can be empty except for some spaces
353 ifneq (x, x$(strip $(OBJS)))
357 @echo " -- lib: lib$(LIBNAME).a -- "
358 @cd $(DIR)/$(DEBUG_DIR); $(AR) $(ARFLAGSQUIET) $@ $(OBJS_AR)
360 cd $(DIR)/$(DEBUG_DIR); $(AR) $(ARFLAGS) $@ $(OBJS_AR)
364 @echo " -- lib: lib$(LIBNAME).a -- "
365 @$(AR) $(ARFLAGSQUIET) $@ $?
367 $(AR) $(ARFLAGS) $@ $?
375 ALLTARGETS ?= $(LIB_a)
377 all debug :: makedir $(ALLTARGETS)
382 @echo "====> make creator subtarget in `pwd | sed 's/^.*develop\///'`"
383 @$(MAKE) makedir DIR=$(DIR)/$(DEBUG_DIR)cre
384 @$(MAKE) lib CSRCS="$(CRE_CSRCS)" LIBNAME=$(LIBNAME)$@
387 @echo "====> make publisher subtarget in `pwd | sed 's/^.*develop\///'`"
388 @$(MAKE) makedir DIR=$(DIR)/$(DEBUG_DIR)pub
389 @$(MAKE) lib CSRCS="$(PUB_CSRCS)" LIBNAME=$(LIBNAME)$@
392 @echo "====> make player subtarget in `pwd | sed 's/^.*develop\///'`"
393 @$(MAKE) makedir DIR=$(DIR)/player/$(DEBUG_DIR)
394 @$(MAKE) lib CSRCS="$(SAP_CSRCS)" LIBNAME=$(LIBNAME)$@
396 clean:: optclean debugclean
399 @-[ ! -d $(DIR) ] || ( cd $(DIR) && \
400 $(RM) *.o *.a *.d *.res ii_files/*.ii *.class *.h )
403 @-[ ! -d $(DIR)/debug ] || ( cd $(DIR)/debug && \
404 $(RM) *.o *.a *.d *.res ii_files/*.ii *.class *.h )
408 @# don't use mkdir -p. Cygwin will try to make network paths and fail
409 @[ -d $(DIR) ] || mkdir $(DIR)
410 @[ -d $(DIR)/debug ] || mkdir $(DIR)/debug