2007-06-12 01:00:15 +02:00
|
|
|
C++ = g++ ;
|
|
|
|
CC = gcc ;
|
|
|
|
LINK = gcc ;
|
2005-05-01 00:03:47 +02:00
|
|
|
|
2008-01-10 00:29:39 +01:00
|
|
|
MSPACES = 1 ;
|
|
|
|
|
2007-06-12 01:00:15 +02:00
|
|
|
if ! $(LUA_VERSION) {
|
|
|
|
LUA_VERSION = 5.0 ;
|
|
|
|
}
|
|
|
|
|
2005-01-08 12:40:14 +01:00
|
|
|
if ! $(HAVE_LUA) {
|
|
|
|
HAVE_LUA = 1 ;
|
|
|
|
}
|
|
|
|
|
2006-02-19 23:43:56 +01:00
|
|
|
if ! $(CPU) {
|
|
|
|
CPU = pentium2 ;
|
2008-05-26 01:17:39 +02:00
|
|
|
ARCH = -march=$(CPU) -mtune=$(CPU) -mmmx -mieee-fp ;
|
2006-02-19 23:43:56 +01:00
|
|
|
}
|
|
|
|
|
2005-05-08 19:32:01 +02:00
|
|
|
if $(DISTCC_HOSTS) {
|
2005-05-07 15:38:46 +02:00
|
|
|
DISTCC = 1 ;
|
|
|
|
}
|
|
|
|
|
|
|
|
if $(DISTCC) {
|
2003-04-27 19:03:12 +02:00
|
|
|
CC = distcc $(CC) ;
|
|
|
|
C++ = distcc $(C++) ;
|
|
|
|
Echo Compiling with distcc ;
|
|
|
|
}
|
|
|
|
|
|
|
|
if ! $(CCACHE_DIR) {
|
|
|
|
} else {
|
|
|
|
CC = ccache $(CC) ;
|
|
|
|
C++ = ccache $(C++) ;
|
|
|
|
Echo Compiling with ccache ;
|
|
|
|
}
|
|
|
|
|
2005-05-07 12:07:06 +02:00
|
|
|
if $(DMALLOC) {
|
|
|
|
Echo Compiling with dmalloc ;
|
|
|
|
CCFLAGS += -DUSE_DMALLOC ;
|
2005-05-07 15:38:46 +02:00
|
|
|
C++FLAGS += -DUSE_DMALLOC ;
|
2005-05-07 12:07:06 +02:00
|
|
|
LINKFLAGS += -ldmalloc ;
|
|
|
|
}
|
|
|
|
|
2006-02-19 23:43:56 +01:00
|
|
|
if $(COVERAGE) = 1 {
|
|
|
|
Echo Compiling with gcov info ;
|
|
|
|
CCFLAGS += -fprofile-arcs -ftest-coverage ;
|
|
|
|
C++FLAGS += -fprofile-arcs -ftest-coverage ;
|
|
|
|
LINKFLAGS += -fprofile-arcs -ftest-coverage ;
|
|
|
|
}
|
|
|
|
|
2004-01-12 17:22:14 +01:00
|
|
|
if $(PROFILE) = 1 {
|
|
|
|
Echo Compiling with profiler ;
|
2006-01-01 23:20:52 +01:00
|
|
|
CCFLAGS += -pg -ggdb ;
|
|
|
|
LINKFLAGS += -pg -ggdb ;
|
2004-01-12 17:22:14 +01:00
|
|
|
}
|
|
|
|
|
2003-04-27 19:03:12 +02:00
|
|
|
CCFLAGS += -Wall ;
|
|
|
|
|
|
|
|
CCFLAGS += -Wwrite-strings
|
2008-04-20 16:48:15 +02:00
|
|
|
-Wundef
|
2008-04-25 17:46:39 +02:00
|
|
|
-Wstrict-prototypes
|
2003-04-27 19:03:12 +02:00
|
|
|
-Werror-implicit-function-declaration
|
2004-04-08 12:14:23 +02:00
|
|
|
-Wno-char-subscripts
|
2005-06-10 00:03:41 +02:00
|
|
|
-Wpointer-arith
|
|
|
|
# -Wshadow
|
|
|
|
# -Wcast-qual
|
2008-04-22 12:40:20 +02:00
|
|
|
-Wcast-align
|
2005-06-10 00:03:41 +02:00
|
|
|
# -Wconversion
|
|
|
|
# -Wunreachable-code
|
2008-04-22 12:40:20 +02:00
|
|
|
-Werror
|
2003-04-27 19:03:12 +02:00
|
|
|
;
|
|
|
|
|
2005-01-07 00:38:22 +01:00
|
|
|
# this require the latet luabind from CVS
|
2005-01-13 13:42:36 +01:00
|
|
|
if ! $(LUABIND) {
|
|
|
|
LUABIND = "B7" ;
|
|
|
|
}
|
|
|
|
|
|
|
|
C++FLAGS += -DHAVE_LUABIND_$(LUABIND) ;
|
2005-05-08 19:32:01 +02:00
|
|
|
if $(LOCAL_USR) {
|
|
|
|
XMLHDRS = $(LOCAL_USR)/include/libxml2 ;
|
|
|
|
C++FLAGS += -I$(LOCAL_USR)/include ;
|
|
|
|
CFLAGS += -I$(LOCAL_USR)/include ;
|
|
|
|
LINKLIBS += -L$(LOCAL_USR)/lib ;
|
2004-09-05 16:08:10 +02:00
|
|
|
} else {
|
|
|
|
XMLHDRS = /usr/include/libxml2 ;
|
|
|
|
}
|
2005-01-27 12:30:21 +01:00
|
|
|
C++FLAGS += -DHAVE_LUABIND_$(LUABIND) ;
|
2004-04-18 14:30:31 +02:00
|
|
|
|
2004-04-08 12:14:23 +02:00
|
|
|
rule iconv
|
|
|
|
{
|
2004-04-08 12:29:58 +02:00
|
|
|
if $(LINK_ICONV) {
|
|
|
|
LINKLIBS on $(<) += -liconv ;
|
|
|
|
}
|
2004-04-08 12:14:23 +02:00
|
|
|
}
|
|
|
|
|
2008-05-22 09:37:17 +02:00
|
|
|
rule zlib
|
|
|
|
{
|
|
|
|
LINKLIBS on $(<) += -lz ;
|
|
|
|
}
|
|
|
|
|
2004-04-08 12:14:23 +02:00
|
|
|
rule luabind
|
|
|
|
{
|
2004-09-05 16:08:10 +02:00
|
|
|
LINKLIBS on $(<) += -L$(LUABIND_ROOT)/lib ;
|
2007-06-12 01:00:15 +02:00
|
|
|
if $(LUA_VERSION) = 5.1 {
|
|
|
|
LINKLIBS on $(<) += -llua5.1 ;
|
|
|
|
} else {
|
|
|
|
LINKLIBS on $(<) += -llua50 -llualib50 ;
|
|
|
|
}
|
2004-04-08 12:14:23 +02:00
|
|
|
LINKLIBS on $(<) += -lm -lluabind ;
|
|
|
|
}
|
|
|
|
|
|
|
|
rule libxml2
|
|
|
|
{
|
|
|
|
LINKLIBS on $(<) += -lxml2 ;
|
|
|
|
}
|
|
|
|
|
2003-12-14 13:27:09 +01:00
|
|
|
rule UsingLuabind
|
|
|
|
{
|
|
|
|
SubDirHdrs $(LUABIND_ROOT)/include ;
|
|
|
|
}
|
|
|
|
|
|
|
|
rule UsingLua
|
|
|
|
{
|
2007-06-12 01:00:15 +02:00
|
|
|
if $(LUA_VERSION) = 5.1 {
|
|
|
|
SubDirHdrs /usr/include/lua5.1 ;
|
|
|
|
} else {
|
|
|
|
SubDirHdrs /usr/include/lua50 ;
|
|
|
|
}
|
2003-12-14 13:27:09 +01:00
|
|
|
}
|
|
|
|
|
2003-04-27 19:03:12 +02:00
|
|
|
rule TargetDirectory
|
|
|
|
{
|
|
|
|
# Now set up SEARCH_SOURCE, LOCATE_TARGET, SOURCE_GRIST
|
|
|
|
# These can be reset if needed. For example, if the source
|
|
|
|
# directory should not hold object files, LOCATE_TARGET can
|
|
|
|
# subsequently be redefined.
|
|
|
|
|
|
|
|
local path = [ FDirName $(SUBDIR) $(TARGET_PREFIX) ] ;
|
|
|
|
SEARCH_SOURCE = $(SUBDIR) ;
|
|
|
|
LOCATE_SOURCE = $(ALL_LOCATE_TARGET) $(path) ;
|
|
|
|
LOCATE_TARGET = $(ALL_LOCATE_TARGET) $(path) ;
|
|
|
|
SOURCE_GRIST = $(path) ;
|
|
|
|
if $(DEBUG) = 1 {
|
2008-04-24 03:13:47 +02:00
|
|
|
SubDirCcFlags -ggdb ;
|
|
|
|
SubDirC++Flags -ggdb ;
|
2008-05-26 01:17:39 +02:00
|
|
|
OPTIM = -O0 -ffloat-store ;
|
2003-04-27 19:03:12 +02:00
|
|
|
}
|
|
|
|
else {
|
2008-05-26 01:17:39 +02:00
|
|
|
SubDirCcFlags -DNDEBUG ;
|
|
|
|
SubDirC++Flags -DNDEBUG ;
|
|
|
|
OPTIM = -Os -ffloat-store ;
|
2003-04-27 19:03:12 +02:00
|
|
|
}
|
2008-05-26 01:17:39 +02:00
|
|
|
SubDirCcFlags $(ARCH) ;
|
|
|
|
SubDirC++Flags $(ARCH) ;
|
2003-04-27 19:03:12 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
if ! $(DEBUG) {
|
|
|
|
ECHO Assuming DEBUG=1 ;
|
|
|
|
DEBUG = 1 ;
|
|
|
|
}
|
|
|
|
|
2008-04-24 03:13:47 +02:00
|
|
|
if $(MSPACES) {
|
2008-04-26 18:46:05 +02:00
|
|
|
CCFLAGS += -DMSPACES -DDL_DEBUG=0 ;
|
|
|
|
C++FLAGS += -DMSPACES -DDL_DEBUG=0 ;
|
2008-04-24 03:13:47 +02:00
|
|
|
}
|
|
|
|
|
2005-01-27 12:30:21 +01:00
|
|
|
if $(WITHOUT_LUA) {
|
2006-02-19 23:43:56 +01:00
|
|
|
ECHO Compiling without LUA ;
|
2005-01-27 12:30:21 +01:00
|
|
|
}
|
|
|
|
|
2006-02-19 23:43:56 +01:00
|
|
|
if $(DEBUG) = 0 {
|
|
|
|
TARGET_PREFIX = Release ;
|
|
|
|
}
|
|
|
|
else {
|
|
|
|
TARGET_PREFIX = Debug ;
|
|
|
|
}
|
2004-03-29 08:06:55 +02:00
|
|
|
if $(PROFILE) = 1 {
|
|
|
|
TARGET_PREFIX = Profile ;
|
2003-04-27 19:03:12 +02:00
|
|
|
}
|
2006-02-19 23:43:56 +01:00
|
|
|
if $(COVERAGE) = 1 {
|
|
|
|
TARGET_PREFIX = Coverage ;
|
2003-04-27 19:03:12 +02:00
|
|
|
}
|
|
|
|
|
2004-03-29 08:06:55 +02:00
|
|
|
|
2006-02-19 23:43:56 +01:00
|
|
|
|