- Timestamp:
- Sep 9, 2012 11:08:19 PM (12 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/kmk/testcase-kBuild-define.kmk
r2549 r2655 5 5 6 6 # 7 # Copyright (c) 2011 knut st. osmundsen <[email protected]>7 # Copyright (c) 2011-2012 knut st. osmundsen <[email protected]> 8 8 # 9 9 # This file is part of kBuild. … … 27 27 #include $(PATH_KBUILD)/header.kmk 28 28 29 kBuild-define-target MyTarget 29 # object definition syntax: 30 # kobject <type> <name> [extends <object> [by overriding|prepending|appending]] [object specific args...] 31 # endkobj [<type> [name]] 32 kobject kb-target MyTarget 33 .SOURCES = file.c 34 endobj 30 35 31 _TEMPLATE = MyTemplate 32 _SOURCES = MySourceFile.c 33 34 kBuild-endef-target MyTarget 35 $(if "$(MyTarget_TEMPLATE)" == "MyTemplate",,$(error MyTarget's _TEMPLATE wasn't set correctly in the global space)) 36 $(if "$(MyTarget_SOURCES)" == "MySourceFile.c",,$(error MyTarget's _TEMPLATE wasn't set correctly in the global space)) 36 # accesses an already defined object. 37 # syntax: 38 # kaccess <type> <name> 39 # endkacc [<type> [name]] 40 kaccess kb-target MyTarget 41 .SOURCES += file2.c 42 endkacc 37 43 38 44 39 INDIRECT_NAME = MyTarget$(strip $1) 40 kBuild-define-target $(call INDIRECT_NAME, 2) 41 42 local _TEMPLATE = MyTemplate2 43 _SOURCES = MySourceFile2.c 44 45 kBuild-endef-target $(call INDIRECT_NAME, 2) 46 $(if "$(_TEMPLATE)" == "",,$(error _TEMPLATE has leaked out into the global space)) 45 # Referencing an object variable, the object must exist. 46 # syntax: [<type>@<name>].<property> 47 [kb-target@MyTarget].SOURCES += file3.c 48 $(info [kb-target@MyTarget].SOURCES is $([kb-target@MyTarget].SOURCES)) 47 49 48 50 51 # Test #1 52 kobject target BaseTarget with DUMMY as template 53 .SOURCES = BaseTargetSource.c 54 kendobj 55 $(if "$([target@BaseTarget].SOURCES)" == "BaseTargetSource.c",,$(error [target@BaseTarget].SOURCES is '$([target@BaseTarget].SOURCES)' not 'BaseTargetSource.c')) 56 $(if "$(BaseTarget_SOURCES)" == "BaseTargetSource.c",,$(error BaseTarget's _SOURCES wasn't set correctly in the global space)) 57 58 $(if "$([target@BaseTarget].TEMPLATE)" == "DUMMY",,$(error [target@BaseTarget].TEMPLATE is '$([target@BaseTarget].TEMPLATE)' not 'DUMMY')) 59 $(if "$(BaseTarget_TEMPLATE)" == "DUMMY",,$(error BaseTarget's _TEMPLATE wasn't set correctly in the global space)) 60 61 # Test #2 62 kobject target TargetWithLocals 63 local .LOCAL_PROP = no global alias 64 kendobj 65 $(if "$([target@TargetWithLocals].LOCAL_PROP)" == "no global alias",,$(error [target@TargetWithLocals].LOCAL_PROP is '$([target@TargetWithLocals].LOCAL_PROP)' not 'no global alias')) 66 $(if "$(TargetWithLocals_LOCAL_PROP)" == "",,$(error TargetWithLocals_LOCAL_PROP's local property 'LOCAL_PROP' was exposed globally.)) 49 67 50 68 … … 52 70 #$(ECHO) "kBuild-define-xxxx works fine" 53 71 54 55 56
Note:
See TracChangeset
for help on using the changeset viewer.