From 9fc6b2e18b6f0e5dff4221466f97ed2693341c10 Mon Sep 17 00:00:00 2001 From: Ingo Weinhold Date: Sat, 13 Jul 2002 20:37:40 +0000 Subject: [PATCH] Added rules SimpleTest, PrependObjectHdrs and Filter. The latter one is not longer needed though. git-svn-id: file:///srv/svn/repos/haiku/trunk/current@181 a95241bf-73f2-0310-859d-f6bbb57e9c96 --- Jamrules | 84 +++++++++++++++++++++++++++++++++++++++++++++++++++++++- 1 file changed, 83 insertions(+), 1 deletion(-) diff --git a/Jamrules b/Jamrules index 260a9a925d..2ccdb241b0 100644 --- a/Jamrules +++ b/Jamrules @@ -296,6 +296,43 @@ rule R5ObjectNames return [ FGristFiles $(objects:S=$(SUFOBJ)) ] ; } +rule SimpleTest +{ + # UnitTest : : + # Builds a unit test for an OBOS module. + # The name of the target. + # The list of sources. + # The directory for the target (as passed to FDirName). + # A list of link libraries (as passed to LinkSharedOSLibs). + # A list of public header dirs (as passed to + # UsePublicHeaders). + + local target = $(1) ; + local sources = $(2) ; + local libraries = $(3) ; + local relPath = [ FRelPath src tests : $(SUBDIR_TOKENS) ] ; + + # Turn optimization off. + local optim = $(OPTIM) ; + OPTIM = ; + +# SetupIncludes ; + SetupObjectsDir ; + MakeLocateObjects $(sources) ; + Main $(target) : $(sources) ; + MakeLocate $(target) : [ FDirName $(OBOS_TEST_DIR) $(relPath) ] ; + DEPENDS obostests : $(target) ; + LinkSharedOSLibs $(target) : $(libraries) ; + ObjectDefines $(sources) : TEST_OBOS ; + + # Turn debugging on. That is usually desired for test code. + ObjectCcFlags $(sources) : "-g" ; + ObjectC++Flags $(sources) : "-g" ; + + # Turn optimization on again. + OPTIM = $(optim) ; +} + rule Addon { # Addon : : ; @@ -397,7 +434,7 @@ rule AddResources { # AddResources : ; - SEARCH on $(2) = $(SEARCH_SOURCE) ; + SEARCH on $(2) += $(SEARCH_SOURCE) ; RESFILES on $(1) += $(2) ; } @@ -573,6 +610,27 @@ rule SplitPath return $(components) ; } +rule PrependObjectHdrs +{ + # PrependObjectHdrs : ; + # Prepends to the list of header search dirs of the objects + # specified by . The HDRS variable will not be + # changed, only CCHDRS. + # Note: A subsequent ObjectHdrs invocation will therefore undo the + # effect of this rule. + # NOTE: This is a hack. + + local objects = [ FGristFiles $(1:S=$(SUFOBJ)) ] ; + local dirs = $(2) ; + for object in $(objects) { + # Don't change HDRS to avoid screwing up the header scanning. + PREPENDED_HDRS on $(object) + = $(dirs) [ on $(object) return $(PREPENDED_HDRS) ] ; + CCHDRS on $(object) + = [ FIncludes [ on $(object) return $(PREPENDED_HDRS) $(HDRS) ] ] ; + } +} + rule SymLink { # SymLink : ; @@ -745,6 +803,30 @@ rule ObjectReferences } } +rule Filter +{ + # Filter : ; + # Removes all occurrences of in . + + local list = $(1) ; + local excludes = $(2) ; + local newList ; + local item ; + for item in $(list) { + local skip ; + local exclude ; + for exclude in $(excludes) { + if $(item) = $(exclude) { + skip = true ; + } + } + if ! $(skip) { + newList += item ; + } + } + return $(newList) ; +} + ## Kernel stuff!