Changeset 2717 for trunk/src/kmk/testcase-kBuild-define.kmk
- Timestamp:
- Dec 30, 2013, 1:58:43 AM (12 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/kmk/testcase-kBuild-define.kmk
r2658 r2717 5 5 6 6 # 7 # Copyright (c) 2011-201 2knut st. osmundsen <bird-kBuild-spamx@anduin.net>7 # Copyright (c) 2011-2013 knut st. osmundsen <bird-kBuild-spamx@anduin.net> 8 8 # 9 9 # This file is part of kBuild. … … 24 24 # 25 25 26 DEPTH = ../..26 #DEPTH = ../.. 27 27 #include $(PATH_KBUILD)/header.kmk 28 28 29 if 0 29 30 # object definition syntax: 30 # kobject <type> <name> [extends <object> ] [object specific args...]31 # endkobj [<type> [name]]31 # kobject <type> <name> [extends <object> [by <||>]] [object specific args...] 32 # kendobj [<type> [name]] 32 33 kobject kb-target MyTarget 33 34 .TOOL = GCC 34 35 .SOURCES = file.c 35 endobj 36 kendobj 37 else 38 # Target definition. 39 # kBuild-define-target <name> [extends <target> [by <||>]] [using <template>] 40 # kBuild-endef-target [name] 41 kBuild-define-target MyTarget 42 _TOOL = GCC 43 _SOURCES = file.c 44 kBuild-endef-target 45 endif 36 46 47 if 0 37 48 # accesses an already defined object. 38 49 # syntax: 39 50 # kaccess <type> <name> 40 # endkacc [<type> [name]]51 # kendacc [<type> [name]] 41 52 kaccess kb-target MyTarget 42 53 .SOURCES += file2.c 43 endkacc 54 kendacc 55 else 56 #kBuild-access-target MyTarget 57 #_SOURCES += file2.c 58 #kBuild-endacc-target 59 endif 44 60 45 61 46 62 # Referencing an object variable, the object must exist. 47 63 # syntax: [<type>@<name>].<property> 48 [ kb-target@MyTarget].SOURCES += file3.c49 $(info [ kb-target@MyTarget].SOURCES is $([kb-target@MyTarget].SOURCES))64 [target@MyTarget]_SOURCES += file3.c 65 $(info [target@MyTarget]_SOURCES is $([target@MyTarget]_SOURCES)) 50 66 51 67 52 68 # Test #1 53 k object target BaseTarget with DUMMY as template54 .SOURCES = BaseTargetSource.c55 k endobj56 $(if "$([target@BaseTarget].SOURCES)" == "BaseTargetSource.c",,$(error [target@BaseTarget].SOURCES is '$([target@BaseTarget].SOURCES)' not 'BaseTargetSource.c'))57 $(if "$(BaseTarget_SOURCES)" == "BaseTargetSource.c",,$(error BaseTarget's _SOURCES wasn't set correctly in the global space))69 kBuild-define-target BaseTarget using DUMMY 70 _SOURCES = BaseTargetSource.c 71 kBuild-endef-target BaseTarget 72 $(if-expr "$([target@BaseTarget]_SOURCES)" == "BaseTargetSource.c",,$(error [target@BaseTarget]_SOURCES is '$([target@BaseTarget]_SOURCES)' not 'BaseTargetSource.c')) 73 $(if-expr "$(BaseTarget_SOURCES)" == "BaseTargetSource.c",,$(error BaseTarget's _SOURCES wasn't set correctly in the global space)) 58 74 59 $(if "$([target@BaseTarget].TEMPLATE)" == "DUMMY",,$(error [target@BaseTarget].TEMPLATE is '$([target@BaseTarget].TEMPLATE)' not 'DUMMY'))60 $(if "$(BaseTarget_TEMPLATE)" == "DUMMY",,$(error BaseTarget's _TEMPLATE wasn't set correctly in the global space))75 $(if-expr "$([target@BaseTarget]_TEMPLATE)" == "DUMMY",,$(error [target@BaseTarget]_TEMPLATE is '$([target@BaseTarget]_TEMPLATE)' not 'DUMMY')) 76 $(if-expr "$(BaseTarget_TEMPLATE)" == "DUMMY",,$(error BaseTarget's _TEMPLATE wasn't set correctly in the global space)) 61 77 62 78 # Test #2 63 k objecttarget TargetWithLocals64 local .LOCAL_PROP = no global alias65 k endobj66 $(if "$([target@TargetWithLocals].LOCAL_PROP)" == "no global alias",,$(error [target@TargetWithLocals].LOCAL_PROP is '$([target@TargetWithLocals].LOCAL_PROP)' not 'no global alias'))67 $(if "$(TargetWithLocals_LOCAL_PROP)" == "",,$(error TargetWithLocals_LOCAL_PROP's local property 'LOCAL_PROP' was exposed globally.))79 kBuild-define-target TargetWithLocals 80 local _LOCAL_PROP = no global alias 81 kBuild-endef-target 82 $(if-expr "$([target@TargetWithLocals]_LOCAL_PROP)" == "no global alias",,$(error [target@TargetWithLocals]_LOCAL_PROP is '$([target@TargetWithLocals]_LOCAL_PROP)' not 'no global alias')) 83 $(if-expr "$(TargetWithLocals_LOCAL_PROP)" == "",,$(error TargetWithLocals_LOCAL_PROP's local property 'LOCAL_PROP' was exposed globally.)) 68 84 85 # Test #3 86 kBuild-define-target OutsideMod 87 _SOURCES = file3.c 88 _OTHER = inside-value 89 kBuild-endef-target 90 [target@OutsideMod]_SOURCES += file4.c 91 [target@OutsideMod]_SOURCES <= file2.c 92 [target@OutsideMod]_OTHER = outside-value 93 $(if-expr "$([target@OutsideMod]_SOURCES)" == "file2.c file3.c file4.c",,$(error [target@OutsideMod]_SOURCES is '$([target@OutsideMod]_SOURCES)' not 'file2.c file3.c file4.c')) 94 $(if-expr "OutsideMod_SOURCES" == "file2.c file3.c file4.c",,$(error OutsideMod_SOURCES is '$(OutsideMod_SOURCES)' not 'file2.c file3.c file4.c')) 95 96 $(if-expr "$([target@OutsideMod]_OTHER)" == "outside-value",,$(error [target@OutsideMod]_OTHER is '$([target@OutsideMod]_OTHER)' not 'outside-value')) 97 $(if-expr "$(OutsideMod_OTHER)" == "outside-value",,$(error OutsideMod_OTHER is '$(OutsideMod_OTHER)' not 'outside-value')) 69 98 70 99 all_recursive: 71 #$(ECHO)"kBuild-define-xxxx works fine"100 @kmk_echo "kBuild-define-xxxx works fine" 72 101
Note:
See TracChangeset
for help on using the changeset viewer.