# $Id: testcase-kBuild-define.kmk 2655 2012-09-09 23:08:19Z bird $ ## @file # kBuild - testcase for the kBuild-define-* directives. # # # Copyright (c) 2011-2012 knut st. osmundsen # # This file is part of kBuild. # # kBuild is free software; you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by # the Free Software Foundation; either version 3 of the License, or # (at your option) any later version. # # kBuild is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU General Public License for more details. # # You should have received a copy of the GNU General Public License # along with kBuild. If not, see # # DEPTH = ../.. #include $(PATH_KBUILD)/header.kmk # object definition syntax: # kobject [extends [by overriding|prepending|appending]] [object specific args...] # endkobj [ [name]] kobject kb-target MyTarget .SOURCES = file.c endobj # accesses an already defined object. # syntax: # kaccess # endkacc [ [name]] kaccess kb-target MyTarget .SOURCES += file2.c endkacc # Referencing an object variable, the object must exist. # syntax: [@]. [kb-target@MyTarget].SOURCES += file3.c $(info [kb-target@MyTarget].SOURCES is $([kb-target@MyTarget].SOURCES)) # Test #1 kobject target BaseTarget with DUMMY as template .SOURCES = BaseTargetSource.c kendobj $(if "$([target@BaseTarget].SOURCES)" == "BaseTargetSource.c",,$(error [target@BaseTarget].SOURCES is '$([target@BaseTarget].SOURCES)' not 'BaseTargetSource.c')) $(if "$(BaseTarget_SOURCES)" == "BaseTargetSource.c",,$(error BaseTarget's _SOURCES wasn't set correctly in the global space)) $(if "$([target@BaseTarget].TEMPLATE)" == "DUMMY",,$(error [target@BaseTarget].TEMPLATE is '$([target@BaseTarget].TEMPLATE)' not 'DUMMY')) $(if "$(BaseTarget_TEMPLATE)" == "DUMMY",,$(error BaseTarget's _TEMPLATE wasn't set correctly in the global space)) # Test #2 kobject target TargetWithLocals local .LOCAL_PROP = no global alias kendobj $(if "$([target@TargetWithLocals].LOCAL_PROP)" == "no global alias",,$(error [target@TargetWithLocals].LOCAL_PROP is '$([target@TargetWithLocals].LOCAL_PROP)' not 'no global alias')) $(if "$(TargetWithLocals_LOCAL_PROP)" == "",,$(error TargetWithLocals_LOCAL_PROP's local property 'LOCAL_PROP' was exposed globally.)) all_recursive: #$(ECHO) "kBuild-define-xxxx works fine"