summaryrefslogtreecommitdiff
path: root/Jamrules.jam
diff options
context:
space:
mode:
Diffstat (limited to 'Jamrules.jam')
-rw-r--r--Jamrules.jam399
1 files changed, 212 insertions, 187 deletions
diff --git a/Jamrules.jam b/Jamrules.jam
index 9ceb265..ab99e13 100644
--- a/Jamrules.jam
+++ b/Jamrules.jam
@@ -11,30 +11,42 @@ if ( $(toolset:I=^mingw) || $(toolset:I=^gcc) )
GCCPATH = "%$(toolset)_PATH%\\bin\\" ;
}
- CCFLAGS += -D$(defines) ;
-
- if ( $(configuration) = "debug" )
- {
- CCFLAGS += -D_DEBUG ;
- }
- else
+ if ( $(OS) != MACOSX )
{
- CCFLAGS += -DNDEBUG -O3 ;
+ LDFLAGS += -static-libgcc -static ;
}
- if ( PUGIXML_NO_EXCEPTIONS in $(defines) )
+ rule GetCFlags CONFIG : DEFINES
{
- CCFLAGS += -fno-exceptions ;
- }
+ local RESULT = -D$(DEFINES) ;
- if ( $(OS) != MACOSX )
- {
- LDFLAGS += -static-libgcc -static ;
+ RESULT += -W -Wall -Wextra -Werror -pedantic ;
+
+ if ( $(fulldebug) )
+ {
+ RESULT += -g ;
+ }
+
+ if ( $(CONFIG) = "debug" )
+ {
+ RESULT += -D_DEBUG ;
+ }
+ else
+ {
+ RESULT += -DNDEBUG -O3 ;
+ }
+
+ if ( PUGIXML_NO_EXCEPTIONS in $(DEFINES) )
+ {
+ RESULT += -fno-exceptions ;
+ }
+
+ return $(RESULT) ;
}
actions ObjectAction
{
- "$(GCCPATH)gcc" -W -Wall -Wextra -Werror -pedantic -c $(>) -o $(<) $(CCFLAGS)
+ "$(GCCPATH)gcc" -c $(>) -o $(<) $(CCFLAGS)
}
actions LibraryAction
@@ -46,68 +58,14 @@ if ( $(toolset:I=^mingw) || $(toolset:I=^gcc) )
{
"$(GCCPATH)g++" $(>) -o $(<) $(LDFLAGS)
}
-
- actions maxtargets 1 CoverageAction
- {
- "$(GCCPATH)gcov" $(>) $(GCOVFLAGS) | perl tests/gcov-filter.pl
- }
}
else if ( $(toolset:I=^msvc) )
{
- CCFLAGS += /D$(defines) ;
-
if ( $(fulldebug) )
{
- CCFLAGS += /Z7 ;
LDFLAGS += /DEBUG ;
}
- if ( $(configuration) = "debug" )
- {
- CCFLAGS += /D_DEBUG /MTd ;
- }
- else
- {
- CCFLAGS += /DNDEBUG /Ox /MT ;
- }
-
- if ( $(toolset) = msvc7 || $(toolset) = msvc71 || $(toolset) = msvc8 )
- {
- CCFLAGS += /Wp64 ; # Wp64 is deprecated from msvc9
- }
-
- if ( $(toolset) != msvc6 )
- {
- CCFLAGS += /W4 ;
- }
- else
- {
- CCFLAGS += /W3 ; # lots of warnings at W4 in standard library
- }
-
- if ( $(toolset) = msvc7 || $(toolset) = msvc71 || $(toolset) = msvc8 )
- {
- CCFLAGS += "/I\"%$(toolset)_PATH%\\PlatformSDK\\include\"" ;
- }
- else if ( $(toolset) != msvc6 )
- {
- CCFLAGS += "/I\"%WINSDK_PATH%\\Include\"" ;
- }
-
- if ( ! ( PUGIXML_NO_EXCEPTIONS in $(defines) ) )
- {
- CCFLAGS += /EHsc ;
- }
- else if ( $(toolset) = "msvc6" || $(toolset) = "msvc71" )
- {
- # No no-exception STL in MSVC6, buggy no-exception STL in MSVC71
- CCFLAGS += /EHsc ;
- }
- else
- {
- CCFLAGS += /D_HAS_EXCEPTIONS=0 ;
- }
-
if ( $(toolset:I=x64$) )
{
postfix = "\\amd64" ;
@@ -120,9 +78,58 @@ else if ( $(toolset:I=^msvc) )
sdk_postfix = "" ;
}
+ rule GetCFlags CONFIG : DEFINES
+ {
+ local RESULT = /D$(DEFINES) ;
+
+ if ( $(fulldebug) )
+ {
+ RESULT += /Z7 ;
+ }
+
+ if ( $(CONFIG) = "debug" )
+ {
+ RESULT += /D_DEBUG /MTd ;
+ }
+ else
+ {
+ RESULT += /DNDEBUG /Ox /MT ;
+ }
+
+ if ( $(toolset) = msvc7 || $(toolset) = msvc71 || $(toolset) = msvc8 )
+ {
+ RESULT += /Wp64 ; # Wp64 is deprecated from msvc9
+ }
+
+ if ( $(toolset) != msvc6 )
+ {
+ RESULT += /W4 ;
+ }
+ else
+ {
+ RESULT += /W3 ; # lots of warnings at W4 in standard library
+ }
+
+ if ( ! ( PUGIXML_NO_EXCEPTIONS in $(DEFINES) ) )
+ {
+ RESULT += /EHsc ;
+ }
+ else if ( $(toolset) = "msvc6" || $(toolset) = "msvc71" )
+ {
+ # No no-exception STL in MSVC6, buggy no-exception STL in MSVC71
+ RESULT += /EHsc ;
+ }
+ else
+ {
+ RESULT += /D_HAS_EXCEPTIONS=0 ;
+ }
+
+ return $(RESULT) ;
+ }
+
actions ObjectAction
{
- "%$(toolset)_PATH%\bin$(postfix)\cl.exe" /WX /I"%$(toolset)_PATH%\include" /c $(>) /Fo$(<) /nologo $(CCFLAGS)
+ "%$(toolset)_PATH%\bin$(postfix)\cl.exe" /WX /I"%$(toolset)_PATH%\include" /I"%$(toolset)_PATH%\PlatformSDK\include" /I"%WINSDK_PATH%\Include" /c $(>) /Fo$(<) /nologo $(CCFLAGS)
}
actions LibraryAction
@@ -134,10 +141,6 @@ else if ( $(toolset:I=^msvc) )
{
"%$(toolset)_PATH%\bin$(postfix)\link.exe" /SUBSYSTEM:CONSOLE /NOLOGO /OUT:$(<) /PDB:$(<:S=.pdb) $(>) /LIBPATH:"%$(toolset)_PATH%\lib$(postfix)" /LIBPATH:"%$(toolset)_PATH%\PlatformSDK\lib$(postfix)" /LIBPATH:"%WINSDK_PATH%\Lib$(sdk_postfix)" $(LDFLAGS)
}
-
- actions CoverageAction
- {
- }
}
else if ( $(toolset:I=^ic) )
{
@@ -173,31 +176,38 @@ else if ( $(toolset:I=^ic) )
msvc_postfix = "" ;
}
- CCFLAGS += /D$(defines) ;
-
- if ( $(toolset) != ic8 )
+ rule GetCFlags CONFIG : DEFINES
{
- CCFLAGS += /fp:precise ;
- }
+ local RESULT = /D$(DEFINES) ;
- if ( $(configuration) = "debug" )
- {
- CCFLAGS += /D_DEBUG /Od /MTd ;
- }
- else
- {
- CCFLAGS += /DNDEBUG /Ox /MT ;
- }
+ RESULT += /W3 /WX /Qvec_report0 ;
- if ( ! ( PUGIXML_NO_EXCEPTIONS in $(defines) ) )
- {
- CCFLAGS += /EHsc ;
+ if ( $(toolset) != ic8 )
+ {
+ RESULT += /fp:precise ;
+ }
+
+ if ( $(CONFIG) = "debug" )
+ {
+ RESULT += /D_DEBUG /Od /MTd ;
+ }
+ else
+ {
+ RESULT += /DNDEBUG /Ox /MT ;
+ }
+
+ if ( ! ( PUGIXML_NO_EXCEPTIONS in $(DEFINES) ) )
+ {
+ RESULT += /EHsc ;
+ }
+
+ return $(RESULT) ;
}
actions ObjectAction
{
set PATH=%$(msvc)_PATH%\bin
- "%$(toolset)_PATH%\bin$(postfix)\icl.exe" /W3 /WX /Qvec_report0 /I"%$(msvc)_PATH%\include" /I"%$(msvc)_PATH%\PlatformSDK\Include" /I"%$(toolset)_PATH%\include" /c $(>) /Fo$(<) /nologo $(CCFLAGS)
+ "%$(toolset)_PATH%\bin$(postfix)\icl.exe" /I"%$(msvc)_PATH%\include" /I"%$(msvc)_PATH%\PlatformSDK\Include" /I"%$(toolset)_PATH%\include" /c $(>) /Fo$(<) /nologo $(CCFLAGS)
}
actions LibraryAction
@@ -209,32 +219,35 @@ else if ( $(toolset:I=^ic) )
{
"%$(msvc)_PATH%\bin\link.exe" /SUBSYSTEM:CONSOLE /NOLOGO /OUT:$(<) $(>) /LIBPATH:"%$(toolset)_PATH%\lib$(postfix)" /LIBPATH:"%$(msvc)_PATH%\lib$(msvc_postfix)" /LIBPATH:"%$(msvc)_PATH%\PlatformSDK\lib$(msvc_postfix)" $(LDFLAGS)
}
-
- actions CoverageAction
- {
- }
}
else if ( $(toolset:I=^dmc) )
{
- CCFLAGS += -D$(defines) ;
-
- if ( $(configuration) = "debug" )
+ rule GetCFlags CONFIG : DEFINES
{
- CCFLAGS += -D_DEBUG ;
- }
- else
- {
- CCFLAGS += -DNDEBUG ;
- }
+ local RESULT = -D$(DEFINES) ;
- if ( ! ( PUGIXML_NO_EXCEPTIONS in $(defines) ) )
- {
- CCFLAGS += -Ae ;
+ RESULT += -wx -f ;
+
+ if ( $(CONFIG) = "debug" )
+ {
+ RESULT += -D_DEBUG ;
+ }
+ else
+ {
+ RESULT += -DNDEBUG -o ;
+ }
+
+ if ( ! ( PUGIXML_NO_EXCEPTIONS in $(DEFINES) ) )
+ {
+ RESULT += -Ae ;
+ }
+
+ return $(RESULT) ;
}
actions ObjectAction
{
- "%$(toolset)_PATH%\bin\dmc.exe" -c -f -I%$(toolset)_PATH%\stlport\stlport -wx $(>) -o$(<) $(CCFLAGS)
+ "%$(toolset)_PATH%\bin\dmc.exe" -c -I%$(toolset)_PATH%\stlport\stlport $(>) -o$(<) $(CCFLAGS)
}
actions LibraryAction
@@ -246,33 +259,37 @@ else if ( $(toolset:I=^dmc) )
{
"%$(toolset)_PATH%\bin\link.exe" $(>:\\) , $(<:\\) , nul , $(LDFLAGS:\\) -L/co/ma
}
-
- actions CoverageAction
- {
- }
}
else if ( $(toolset:I=^cw) )
{
cw_bin = "%$(toolset)_PATH%\\Other Metrowerks Tools\\Command Line Tools" ;
- CCFLAGS += -D$(defines) ;
- if ( $(configuration) = "debug" )
+ rule GetCFlags CONFIG : DEFINES
{
- CCFLAGS += -D_DEBUG ;
- }
- else
- {
- CCFLAGS += -DNDEBUG -O4 ;
- }
+ local RESULT = -D$(DEFINES) ;
- if ( PUGIXML_NO_EXCEPTIONS in $(defines) )
- {
- CCFLAGS += -Cpp_exceptions off ;
+ RESULT += -cwd include -ansi strict -iso_templates on -msext off -w all,cmdline,iserror,nonotused,nonotinlined,noimplicitconv,nounwanted ;
+
+ if ( $(CONFIG) = "debug" )
+ {
+ RESULT += -D_DEBUG ;
+ }
+ else
+ {
+ RESULT += -DNDEBUG -O4 ;
+ }
+
+ if ( PUGIXML_NO_EXCEPTIONS in $(DEFINES) )
+ {
+ RESULT += -Cpp_exceptions off ;
+ }
+
+ return $(RESULT) ;
}
actions ObjectAction
{
- "$(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)\mwcc.exe" -c $(>) -o $(<) $(CCFLAGS)
}
actions LibraryAction
@@ -284,27 +301,30 @@ else if ( $(toolset:I=^cw) )
{
"$(cw_bin)\mwld.exe" -subsystem console -o $(<) $(>) $(LDFLAGS)
}
-
- actions CoverageAction
- {
- }
}
else if ( $(toolset:I=^bcc) )
{
- CCFLAGS += -D$(defines) ;
-
- if ( $(configuration) = "debug" )
+ rule GetCFlags CONFIG : DEFINES
{
- CCFLAGS += -D_DEBUG ;
- }
- else
- {
- CCFLAGS += -DNDEBUG -Ox ;
+ local RESULT = -D$(DEFINES) ;
+
+ RESULT += -fp -w -w! -w-8026 -w-8027 -w-8091 -w-8004 ;
+
+ if ( $(CONFIG) = "debug" )
+ {
+ RESULT += -D_DEBUG ;
+ }
+ else
+ {
+ RESULT += -DNDEBUG -Ox ;
+ }
+
+ return $(RESULT) ;
}
actions ObjectAction
{
- "%$(toolset)_PATH%\bin\bcc32.exe" $(CCFLAGS) -c -q -Q -fp -w -w! -w-8026 -w-8027 -w-8091 -w-8004 -o $(<) $(>)
+ "%$(toolset)_PATH%\bin\bcc32.exe" $(CCFLAGS) -c -q -Q -o $(<) $(>)
}
actions LibraryAction
@@ -316,32 +336,35 @@ else if ( $(toolset:I=^bcc) )
{
"%$(toolset)_PATH%\bin\ilink32.exe" -L"%$(toolset)_PATH%\lib" -Tpe -ap -Gn -x -c "%$(toolset)_PATH%\lib\c0x32.obj" $(>:\\) , $(<:\\) , , $(LDFLAGS:\\) cw32 import32
}
-
- actions CoverageAction
- {
- }
}
else if ( $(toolset:I=^suncc) )
{
- CCFLAGS += -D$(defines) ;
-
- if ( $(configuration) = "debug" )
+ rule GetCFlags CONFIG : DEFINES
{
- CCFLAGS += -D_DEBUG ;
- }
- else
- {
- CCFLAGS += -DNDEBUG -O ;
- }
+ local RESULT = -D$(DEFINES) ;
- if ( PUGIXML_NO_EXCEPTIONS in $(defines) )
- {
- CCFLAGS += -noex ;
+ RESULT += +w -xwe ;
+
+ if ( $(CONFIG) = "debug" )
+ {
+ RESULT += -D_DEBUG ;
+ }
+ else
+ {
+ RESULT += -DNDEBUG -O ;
+ }
+
+ if ( PUGIXML_NO_EXCEPTIONS in $(DEFINES) )
+ {
+ RESULT += -noex ;
+ }
+
+ return $(RESULT) ;
}
actions ObjectAction
{
- sunCC $(CCFLAGS) +w -xwe -c -o $(<) $(>)
+ sunCC $(CCFLAGS) -c -o $(<) $(>)
}
actions LibraryAction
@@ -353,14 +376,28 @@ else if ( $(toolset:I=^suncc) )
{
sunCC $(>) -o $(<) $(LDFLAGS)
}
+}
+else
+{
+ exit "Unknown toolset $(toolset)!" ;
+}
- actions CoverageAction
+COVSUCCESS = "echo $" "(COVPREFIX) success" ;
+
+if ( $(toolset:I=^mingw) || $(toolset:I=^gcc) )
+{
+ actions maxtargets 1 CoverageAction
{
+ @($(COVSUCCESS:J=):A)
+ "$(GCCPATH)gcov" $(>) $(GCOVFLAGS) | perl tests/gcov-filter.pl $(COVPREFIX)$(SPACE)gcov
}
}
else
{
- exit "Unknown toolset $(toolset)!" ;
+ actions CoverageAction
+ {
+ @($(COVSUCCESS:J=):A)
+ }
}
if ( $(UNIX) )
@@ -413,17 +450,21 @@ rule Alias TARGET : SOURCE
Depends $(TARGET) : $(SOURCE) ;
}
-rule Object TARGET : SOURCE
+rule Object TARGET : SOURCE : CCFLAGS
{
HDRRULE on $(SOURCE) = C.HdrRule ;
HDRSCAN on $(SOURCE) = $(C.HDRPATTERN) ;
MakeFileDir $(TARGET) ;
+
ObjectAction $(TARGET) : $(SOURCE) ;
Depends $(TARGET) : $(SOURCE) ;
+
+ CCFLAGS on $(TARGET) = $(CCFLAGS) ;
+ UseCommandLine $(TARGET) : $(CCFLAGS) ;
}
-rule Objects SOURCES
+rule Objects BUILD : SOURCES : CCFLAGS
{
local OBJECTS ;
@@ -431,56 +472,40 @@ rule Objects SOURCES
{
local OBJECT = $(BUILD)/$(SOURCE:S=.o) ;
- Object $(OBJECT) : $(SOURCE) ;
+ Object $(OBJECT) : $(SOURCE) : $(CCFLAGS) ;
OBJECTS += $(OBJECT) ;
}
return $(OBJECTS) ;
}
-rule Library TARGET : SOURCES
+rule Library TARGET : SOURCES : CCFLAGS
{
# build object files
- local OBJECTS = [ Objects $(SOURCES) ] ;
+ local OBJECTS = [ Objects $(TARGET:D) : $(SOURCES) : $(CCFLAGS) ] ;
# build library
- local LIBRARY = $(BUILD)/$(TARGET).a ;
-
- MakeFileDir $(LIBRARY) ;
- LibraryAction $(LIBRARY) : $(OBJECTS) ;
- Depends $(LIBRARY) : $(OBJECTS) ;
-
- # make alias
- Alias $(TARGET) : $(LIBRARY) ;
-
- # remember library path for linking
- $(TARGET)_path = $(LIBRARY) ;
+ MakeFileDir $(TARGET) ;
+ LibraryAction $(TARGET) : $(OBJECTS) ;
+ Depends $(TARGET) : $(OBJECTS) ;
# remember library objects for coverage
$(TARGET)_objects = $(OBJECTS) ;
}
-rule Application TARGET : SOURCES : LIBRARIES
+rule Application TARGET : SOURCES : CCFLAGS : LIBRARIES
{
# build object files
- local OBJECTS = [ Objects $(SOURCES) ] ;
-
- # get binary path
- local EXECUTABLE = $(BUILD)/$(TARGET).exe ;
+ local OBJECTS = [ Objects $(TARGET:D) : $(SOURCES) : $(CCFLAGS) ] ;
# set libraries
- LDFLAGS on $(EXECUTABLE) = $(LDFLAGS) $($(LIBRARIES)_path) ;
+ LDFLAGS on $(TARGET) = $(LDFLAGS) $(LIBRARIES) ;
# build application
- MakeFileDir $(EXECUTABLE) ;
- LinkAction $(EXECUTABLE) : $(OBJECTS) ;
- Depends $(EXECUTABLE) : $(OBJECTS) $($(LIBRARIES)_path) ;
-
- # make alias
- Alias $(TARGET) : $(EXECUTABLE) ;
+ MakeFileDir $(TARGET) ;
- # remember executable path for running
- $(TARGET)_path = $(EXECUTABLE) ;
+ LinkAction $(TARGET) : $(OBJECTS) ;
+ Depends $(TARGET) : $(OBJECTS) $(LIBRARIES) ;
# remember executable objects for coverage
$(TARGET)_objects = $(OBJECTS) $($(LIBRARIES)_objects) ;
@@ -510,7 +535,7 @@ rule Test TARGET : SOURCE
Alias $(TARGET) : $(SOURCE) ;
# run tests
- RunAction $(TARGET) : $($(SOURCE)_path) ;
+ RunAction $(TARGET) : $(SOURCE) ;
# remember executable objects for coverage
$(TARGET)_objects = $($(SOURCE)_objects) ;