0
0
mirror of https://github.com/zeux/pugixml.git synced 2024-12-28 14:48:43 +08:00

unicode: Added Linux build rules, converted Jamrules.jam to Unix file endings

git-svn-id: http://pugixml.googlecode.com/svn/trunk@278 99668b35-9821-0410-8761-19e4c4f06640
This commit is contained in:
arseny.kapoulkine 2010-04-20 20:44:06 +00:00
parent 7fa89486bf
commit 20edc02ff7

View File

@ -1,401 +1,430 @@
# Rules for Jamfile.jam # Rules for Jamfile.jam
if ( $(toolset:I=^mingw) ) if ( $(toolset:I=^mingw) || $(toolset) = "gcc" )
{ {
CCFLAGS += -D$(defines) ; if ( $(toolset) = "gcc" )
{
if ( $(configuration) = "debug" ) GCCPATH = "" ;
{ }
CCFLAGS += -D_DEBUG ; else
} {
else GCCPATH = "%$(toolset)_PATH%\bin\\" ;
{ }
CCFLAGS += -DNDEBUG -O3 ;
} CCFLAGS += -D$(defines) ;
if ( PUGIXML_NO_EXCEPTIONS in $(defines) ) if ( $(configuration) = "debug" )
{ {
CCFLAGS += -fno-exceptions ; CCFLAGS += -D_DEBUG ;
} }
else
actions ObjectAction {
{ CCFLAGS += -DNDEBUG -O3 ;
"%$(toolset)_PATH%\bin\gcc" -W -Wall -Wextra -Werror -pedantic -c $(>) -o $(<) $(CCFLAGS) }
}
if ( PUGIXML_NO_EXCEPTIONS in $(defines) )
actions LibraryAction {
{ CCFLAGS += -fno-exceptions ;
"%$(toolset)_PATH%\bin\ar" rc $(<) $(>) }
}
actions ObjectAction
actions LinkAction {
{ "$(GCCPATH)gcc" -W -Wall -Wextra -Werror -pedantic -c $(>) -o $(<) $(CCFLAGS)
"%$(toolset)_PATH%\bin\g++" $(>) -o $(<) -static-libgcc $(LDFLAGS) }
}
actions LibraryAction
actions CoverageAction {
{ "$(GCCPATH)ar" rc $(<) $(>)
"%$(toolset)_PATH%\bin\gcov" $(>:\\) $(GCOVFLAGS) | perl tests/gcov-filter.pl }
}
} actions LinkAction
else if ( $(toolset:I=^msvc) ) {
{ "$(GCCPATH)g++" $(>) -o $(<) -static-libgcc $(LDFLAGS)
CCFLAGS += /D$(defines) ; }
if ( $(configuration) = "debug" ) actions CoverageAction
{ {
CCFLAGS += /D_DEBUG /MTd ; "$(GCCPATH)gcov" $(>:\\) $(GCOVFLAGS) | perl tests/gcov-filter.pl
} }
else }
{ else if ( $(toolset:I=^msvc) )
CCFLAGS += /DNDEBUG /Ox /MT ; {
} CCFLAGS += /D$(defines) ;
if ( $(toolset) != msvc6 ) if ( $(configuration) = "debug" )
{ {
CCFLAGS += /Wp64 /W4 ; CCFLAGS += /D_DEBUG /MTd ;
} }
else else
{ {
CCFLAGS += /W3 ; # lots of warnings at W4 in standard library CCFLAGS += /DNDEBUG /Ox /MT ;
} }
if ( ! ( PUGIXML_NO_EXCEPTIONS in $(defines) ) ) if ( $(toolset) != msvc6 )
{ {
CCFLAGS += /EHsc ; CCFLAGS += /Wp64 /W4 ;
} }
else if ( $(toolset) = "msvc6" || $(toolset) = "msvc71" ) else
{ {
# No no-exception STL in MSVC6, buggy no-exception STL in MSVC71 CCFLAGS += /W3 ; # lots of warnings at W4 in standard library
CCFLAGS += /EHsc ; }
}
else if ( ! ( PUGIXML_NO_EXCEPTIONS in $(defines) ) )
{ {
CCFLAGS += /D_HAS_EXCEPTIONS=0 ; CCFLAGS += /EHsc ;
} }
else if ( $(toolset) = "msvc6" || $(toolset) = "msvc71" )
if ( $(toolset:I=x64$) ) {
{ # No no-exception STL in MSVC6, buggy no-exception STL in MSVC71
postfix = "\\amd64" ; CCFLAGS += /EHsc ;
sdk_postfix = "\\x64" ; }
LDFLAGS += /MACHINE:X64 ; else
} {
else CCFLAGS += /D_HAS_EXCEPTIONS=0 ;
{ }
postfix = "" ;
sdk_postfix = "" ; if ( $(toolset:I=x64$) )
} {
postfix = "\\amd64" ;
actions ObjectAction sdk_postfix = "\\x64" ;
{ LDFLAGS += /MACHINE:X64 ;
"%$(toolset)_PATH%\bin$(postfix)\cl.exe" /WX /I"%$(toolset)_PATH%\include" /c $(>) /Fo$(<) /nologo $(CCFLAGS) }
} else
{
actions LibraryAction postfix = "" ;
{ sdk_postfix = "" ;
"%$(toolset)_PATH%\bin$(postfix)\lib.exe" /NOLOGO /OUT:$(<) $(>) }
}
actions ObjectAction
actions LinkAction {
{ "%$(toolset)_PATH%\bin$(postfix)\cl.exe" /WX /I"%$(toolset)_PATH%\include" /c $(>) /Fo$(<) /nologo $(CCFLAGS)
"%$(toolset)_PATH%\bin$(postfix)\link.exe" /SUBSYSTEM:CONSOLE /NOLOGO /OUT:$(<) $(>) /LIBPATH:"%$(toolset)_PATH%\lib$(postfix)" /LIBPATH:"%$(toolset)_PATH%\PlatformSDK\lib" /LIBPATH:"%WINSDK_PATH%\Lib$(sdk_postfix)" $(LDFLAGS) }
}
actions LibraryAction
actions CoverageAction {
{ "%$(toolset)_PATH%\bin$(postfix)\lib.exe" /NOLOGO /OUT:$(<) $(>)
} }
}
else if ( $(toolset) = "ic8" ) actions LinkAction
{ {
msvc = "msvc7" ; "%$(toolset)_PATH%\bin$(postfix)\link.exe" /SUBSYSTEM:CONSOLE /NOLOGO /OUT:$(<) $(>) /LIBPATH:"%$(toolset)_PATH%\lib$(postfix)" /LIBPATH:"%$(toolset)_PATH%\PlatformSDK\lib" /LIBPATH:"%WINSDK_PATH%\Lib$(sdk_postfix)" $(LDFLAGS)
}
CCFLAGS += /D$(defines) ;
actions CoverageAction
if ( $(configuration) = "debug" ) {
{ }
CCFLAGS += /D_DEBUG /MTd ; }
} else if ( $(toolset) = "ic8" )
else {
{ msvc = "msvc7" ;
CCFLAGS += /DNDEBUG /Ox /MT ;
} CCFLAGS += /D$(defines) ;
if ( ! ( PUGIXML_NO_EXCEPTIONS in $(defines) ) ) if ( $(configuration) = "debug" )
{ {
CCFLAGS += /EHsc ; CCFLAGS += /D_DEBUG /MTd ;
} }
else
actions ObjectAction {
{ CCFLAGS += /DNDEBUG /Ox /MT ;
"%$(toolset)_PATH%\bin\icl.exe" /W4 /WX /Wport /Qwd981,444,280,383,909,304,167,177 /I"%$(msvc)_PATH%\include" /I"%$(toolset)_PATH%\include" /c $(>) /Fo$(<) /nologo $(CCFLAGS) }
}
if ( ! ( PUGIXML_NO_EXCEPTIONS in $(defines) ) )
actions LibraryAction {
{ CCFLAGS += /EHsc ;
"%$(msvc)_PATH%\bin\lib.exe" /NOLOGO /OUT:$(<) $(>) }
}
actions ObjectAction
actions LinkAction {
{ "%$(toolset)_PATH%\bin\icl.exe" /W4 /WX /Wport /Qwd981,444,280,383,909,304,167,177 /I"%$(msvc)_PATH%\include" /I"%$(toolset)_PATH%\include" /c $(>) /Fo$(<) /nologo $(CCFLAGS)
"%$(msvc)_PATH%\bin\link.exe" /SUBSYSTEM:CONSOLE /NOLOGO /OUT:$(<) $(>) /LIBPATH:"%$(toolset)_PATH%\lib" /LIBPATH:"%$(msvc)_PATH%\lib" /LIBPATH:"%$(msvc)_PATH%\PlatformSDK\lib" $(LDFLAGS) }
}
actions LibraryAction
actions CoverageAction {
{ "%$(msvc)_PATH%\bin\lib.exe" /NOLOGO /OUT:$(<) $(>)
} }
}
else if ( $(toolset:I=^dmc) ) actions LinkAction
{ {
CCFLAGS += -D$(defines) ; "%$(msvc)_PATH%\bin\link.exe" /SUBSYSTEM:CONSOLE /NOLOGO /OUT:$(<) $(>) /LIBPATH:"%$(toolset)_PATH%\lib" /LIBPATH:"%$(msvc)_PATH%\lib" /LIBPATH:"%$(msvc)_PATH%\PlatformSDK\lib" $(LDFLAGS)
}
if ( $(configuration) = "debug" )
{ actions CoverageAction
CCFLAGS += -D_DEBUG ; {
} }
else }
{ else if ( $(toolset:I=^dmc) )
CCFLAGS += -DNDEBUG ; {
} CCFLAGS += -D$(defines) ;
if ( ! ( PUGIXML_NO_EXCEPTIONS in $(defines) ) ) if ( $(configuration) = "debug" )
{ {
CCFLAGS += -Ae ; CCFLAGS += -D_DEBUG ;
} }
else
actions ObjectAction {
{ CCFLAGS += -DNDEBUG ;
"%$(toolset)_PATH%\bin\dmc.exe" -c -f -I%$(toolset)_PATH%\stlport\stlport -wx $(>) -o$(<) $(CCFLAGS) }
}
if ( ! ( PUGIXML_NO_EXCEPTIONS in $(defines) ) )
actions LibraryAction {
{ CCFLAGS += -Ae ;
"%$(toolset)_PATH%\bin\lib.exe" -c $(<) $(>) }
}
actions ObjectAction
actions LinkAction {
{ "%$(toolset)_PATH%\bin\dmc.exe" -c -f -I%$(toolset)_PATH%\stlport\stlport -wx $(>) -o$(<) $(CCFLAGS)
"%$(toolset)_PATH%\bin\link.exe" $(>:\\) , $(<:\\) , nul , $(LDFLAGS:\\) }
}
actions LibraryAction
actions CoverageAction {
{ "%$(toolset)_PATH%\bin\lib.exe" -c $(<) $(>)
} }
}
else if ( $(toolset:I=^cw) ) actions LinkAction
{ {
cw_bin = "%$(toolset)_PATH%\\Other Metrowerks Tools\\Command Line Tools" ; "%$(toolset)_PATH%\bin\link.exe" $(>:\\) , $(<:\\) , nul , $(LDFLAGS:\\)
CCFLAGS += -D$(defines) ; }
if ( $(configuration) = "debug" ) actions CoverageAction
{ {
CCFLAGS += -D_DEBUG ; }
} }
else else if ( $(toolset:I=^cw) )
{ {
CCFLAGS += -DNDEBUG -O4 ; cw_bin = "%$(toolset)_PATH%\\Other Metrowerks Tools\\Command Line Tools" ;
} CCFLAGS += -D$(defines) ;
if ( PUGIXML_NO_EXCEPTIONS in $(defines) ) if ( $(configuration) = "debug" )
{ {
CCFLAGS += -Cpp_exceptions off ; CCFLAGS += -D_DEBUG ;
} }
else
actions ObjectAction {
{ CCFLAGS += -DNDEBUG -O4 ;
"$(cw_bin)\mwcc.exe" -c -cwd include -ansi strict -iso_templates on -msext off -w all,cmdline,iserror,nonotused,nonotinlined,noimplicitconv,nounwanted $(>) -o $(<) $(CCFLAGS) }
}
if ( PUGIXML_NO_EXCEPTIONS in $(defines) )
actions LibraryAction {
{ CCFLAGS += -Cpp_exceptions off ;
"$(cw_bin)\mwld.exe" -library -o $(<) $(>) }
}
actions ObjectAction
actions LinkAction {
{ "$(cw_bin)\mwcc.exe" -c -cwd include -ansi strict -iso_templates on -msext off -w all,cmdline,iserror,nonotused,nonotinlined,noimplicitconv,nounwanted $(>) -o $(<) $(CCFLAGS)
"$(cw_bin)\mwld.exe" -subsystem console -o $(<) $(>) $(LDFLAGS) }
}
actions LibraryAction
actions CoverageAction {
{ "$(cw_bin)\mwld.exe" -library -o $(<) $(>)
} }
}
else if ( $(toolset:I=^bcc) ) actions LinkAction
{ {
CCFLAGS += -D$(defines) ; "$(cw_bin)\mwld.exe" -subsystem console -o $(<) $(>) $(LDFLAGS)
}
if ( $(configuration) = "debug" )
{ actions CoverageAction
CCFLAGS += -D_DEBUG ; {
} }
else }
{ else if ( $(toolset:I=^bcc) )
CCFLAGS += -DNDEBUG -Ox ; {
} CCFLAGS += -D$(defines) ;
actions ObjectAction if ( $(configuration) = "debug" )
{ {
"%$(toolset)_PATH%\bin\bcc32.exe" $(CCFLAGS) -c -q -Q -fp -w -w! -w-8026 -w-8027 -w-8091 -w-8004 -o $(<) $(>) CCFLAGS += -D_DEBUG ;
} }
else
actions LibraryAction {
{ CCFLAGS += -DNDEBUG -Ox ;
"%$(toolset)_PATH%\bin\tlib.exe" /C $(<:\\) -+$(>:\\) }
}
actions ObjectAction
actions LinkAction {
{ "%$(toolset)_PATH%\bin\bcc32.exe" $(CCFLAGS) -c -q -Q -fp -w -w! -w-8026 -w-8027 -w-8091 -w-8004 -o $(<) $(>)
"%$(toolset)_PATH%\bin\ilink32.exe" -L"%$(toolset)_PATH%\lib" -Tpe -ap -Gn -x -c "%$(toolset)_PATH%\lib\c0x32.obj" $(>:\\) , $(<:\\) , , $(LDFLAGS:\\) cw32 import32 }
}
actions LibraryAction
actions CoverageAction {
{ "%$(toolset)_PATH%\bin\tlib.exe" /C $(<:\\) -+$(>:\\)
} }
}
else actions LinkAction
{ {
exit "Unknown toolset $(toolset)!" ; "%$(toolset)_PATH%\bin\ilink32.exe" -L"%$(toolset)_PATH%\lib" -Tpe -ap -Gn -x -c "%$(toolset)_PATH%\lib\c0x32.obj" $(>:\\) , $(<:\\) , , $(LDFLAGS:\\) cw32 import32
} }
actions screenoutput RunAction actions CoverageAction
{ {
$(>:\\) }
} }
else
actions quietly ignore MakeDirAction {
{ exit "Unknown toolset $(toolset)!" ;
mkdir $(<:\\) >nul 2>&1 }
}
if ( $(UNIX) )
actions quietly ignore DeleteAction {
{ actions screenoutput RunAction
del /F $(>:\\) >nul 2>&1 {
} $(>)
}
rule MakeFileDir TARGET
{ actions quietly ignore MakeDirAction
local DIR = $(TARGET:D) ; {
mkdir -p $(<)
MakeDirAction $(DIR) ; }
Needs $(TARGET) : $(DIR) ;
} actions quietly ignore DeleteAction
{
rule Alias TARGET : SOURCE rm -f $(>)
{ }
NotFile $(TARGET) ; }
Always $(TARGET) ; else
Depends $(TARGET) : $(SOURCE) ; {
} actions screenoutput RunAction
{
rule Object TARGET : SOURCE $(>:\\)
{ }
HDRRULE on $(SOURCE) = C.HdrRule ;
HDRSCAN on $(SOURCE) = $(C.HDRPATTERN) ; actions quietly ignore MakeDirAction
{
MakeFileDir $(TARGET) ; mkdir $(<:\\) >nul 2>&1
ObjectAction $(TARGET) : $(SOURCE) ; }
Depends $(TARGET) : $(SOURCE) ;
} actions quietly ignore DeleteAction
{
rule Objects SOURCES del /F $(>:\\) >nul 2>&1
{ }
local OBJECTS ; }
for SOURCE in $(SOURCES) rule MakeFileDir TARGET
{ {
local OBJECT = $(BUILD)/$(SOURCE:S=.o) ; local DIR = $(TARGET:D) ;
Object $(OBJECT) : $(SOURCE) ; MakeDirAction $(DIR) ;
OBJECTS += $(OBJECT) ; Needs $(TARGET) : $(DIR) ;
} }
return $(OBJECTS) ; rule Alias TARGET : SOURCE
} {
NotFile $(TARGET) ;
rule Library TARGET : SOURCES Always $(TARGET) ;
{ Depends $(TARGET) : $(SOURCE) ;
# build object files }
local OBJECTS = [ Objects $(SOURCES) ] ;
rule Object TARGET : SOURCE
# build library {
local LIBRARY = $(BUILD)/$(TARGET).a ; HDRRULE on $(SOURCE) = C.HdrRule ;
HDRSCAN on $(SOURCE) = $(C.HDRPATTERN) ;
MakeFileDir $(LIBRARY) ;
LibraryAction $(LIBRARY) : $(OBJECTS) ; MakeFileDir $(TARGET) ;
Depends $(LIBRARY) : $(OBJECTS) ; ObjectAction $(TARGET) : $(SOURCE) ;
Depends $(TARGET) : $(SOURCE) ;
# make alias }
Alias $(TARGET) : $(LIBRARY) ;
rule Objects SOURCES
# remember library path for linking {
$(TARGET)_path = $(LIBRARY) ; local OBJECTS ;
# remember library objects for coverage for SOURCE in $(SOURCES)
$(TARGET)_objects = $(OBJECTS) ; {
} local OBJECT = $(BUILD)/$(SOURCE:S=.o) ;
rule Application TARGET : SOURCES : LIBRARIES Object $(OBJECT) : $(SOURCE) ;
{ OBJECTS += $(OBJECT) ;
# build object files }
local OBJECTS = [ Objects $(SOURCES) ] ;
return $(OBJECTS) ;
# get binary path }
local EXECUTABLE = $(BUILD)/$(TARGET).exe ;
rule Library TARGET : SOURCES
# set libraries {
LDFLAGS on $(EXECUTABLE) = $(LDFLAGS) $($(LIBRARIES)_path) ; # build object files
local OBJECTS = [ Objects $(SOURCES) ] ;
# build application
MakeFileDir $(EXECUTABLE) ; # build library
LinkAction $(EXECUTABLE) : $(OBJECTS) ; local LIBRARY = $(BUILD)/$(TARGET).a ;
Depends $(EXECUTABLE) : $(OBJECTS) $($(LIBRARIES)_path) ;
MakeFileDir $(LIBRARY) ;
# make alias LibraryAction $(LIBRARY) : $(OBJECTS) ;
Alias $(TARGET) : $(EXECUTABLE) ; Depends $(LIBRARY) : $(OBJECTS) ;
# remember executable path for running # make alias
$(TARGET)_path = $(EXECUTABLE) ; Alias $(TARGET) : $(LIBRARY) ;
# remember executable objects for coverage # remember library path for linking
$(TARGET)_objects = $(OBJECTS) $($(LIBRARIES)_objects) ; $(TARGET)_path = $(LIBRARY) ;
}
# remember library objects for coverage
rule CleanCoverage TARGET $(TARGET)_objects = $(OBJECTS) ;
{ }
# make target
local CLEAN_TARGET = $(TARGET)_clean_coverage ; rule Application TARGET : SOURCES : LIBRARIES
{
NotFile $(CLEAN_TARGET) ; # build object files
Always $(CLEAN_TARGET) ; local OBJECTS = [ Objects $(SOURCES) ] ;
Depends $(TARGET) : $(CLEAN_TARGET) ;
# get binary path
# clean object files local EXECUTABLE = $(BUILD)/$(TARGET).exe ;
local FILES = $($(SOURCE)_objects:S=.gcda) ;
# set libraries
DeleteAction $(CLEAN_TARGET) : $(FILES) ; LDFLAGS on $(EXECUTABLE) = $(LDFLAGS) $($(LIBRARIES)_path) ;
}
# build application
rule Test TARGET : SOURCE MakeFileDir $(EXECUTABLE) ;
{ LinkAction $(EXECUTABLE) : $(OBJECTS) ;
# make alias Depends $(EXECUTABLE) : $(OBJECTS) $($(LIBRARIES)_path) ;
Alias $(TARGET) : $(SOURCE) ;
# make alias
# run tests Alias $(TARGET) : $(EXECUTABLE) ;
RunAction $(TARGET) : $($(SOURCE)_path) ;
# remember executable path for running
# remember executable objects for coverage $(TARGET)_path = $(EXECUTABLE) ;
$(TARGET)_objects = $($(SOURCE)_objects) ;
# remember executable objects for coverage
# clean coverage files before run $(TARGET)_objects = $(OBJECTS) $($(LIBRARIES)_objects) ;
CleanCoverage $(TARGET) ; }
}
rule CleanCoverage TARGET
rule Coverage TARGET : SOURCE {
{ # make target
local FILES = $($(SOURCE)_objects:S=.gcda) ; local CLEAN_TARGET = $(TARGET)_clean_coverage ;
# disable "independent target" warnings NotFile $(CLEAN_TARGET) ;
NotFile $(FILES) ; Always $(CLEAN_TARGET) ;
Depends $(TARGET) : $(CLEAN_TARGET) ;
CoverageAction $(TARGET) : $(FILES) ;
Depends $(TARGET) : $(SOURCE) ; # clean object files
} local FILES = $($(SOURCE)_objects:S=.gcda) ;
DeleteAction $(CLEAN_TARGET) : $(FILES) ;
}
rule Test TARGET : SOURCE
{
# make alias
Alias $(TARGET) : $(SOURCE) ;
# run tests
RunAction $(TARGET) : $($(SOURCE)_path) ;
# remember executable objects for coverage
$(TARGET)_objects = $($(SOURCE)_objects) ;
# clean coverage files before run
CleanCoverage $(TARGET) ;
}
rule Coverage TARGET : SOURCE
{
local FILES = $($(SOURCE)_objects:S=.gcda) ;
# disable "independent target" warnings
NotFile $(FILES) ;
CoverageAction $(TARGET) : $(FILES) ;
Depends $(TARGET) : $(SOURCE) ;
}