1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
|
# $Id: testcase-kBuild-define.kmk 2658 2012-09-10 21:00:10Z bird $
## @file
# kBuild - testcase for the kBuild-define-* directives.
#
#
# Copyright (c) 2011-2012 knut st. osmundsen <bird-kBuild-spamx@anduin.net>
#
# 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 <http://www.gnu.org/licenses/>
#
#
DEPTH = ../..
#include $(PATH_KBUILD)/header.kmk
# object definition syntax:
# kobject <type> <name> [extends <object>] [object specific args...]
# endkobj [<type> [name]]
kobject kb-target MyTarget
.TOOL = GCC
.SOURCES = file.c
endobj
# accesses an already defined object.
# syntax:
# kaccess <type> <name>
# endkacc [<type> [name]]
kaccess kb-target MyTarget
.SOURCES += file2.c
endkacc
# Referencing an object variable, the object must exist.
# syntax: [<type>@<name>].<property>
[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"
|