VirtualBox

source: kBuild/trunk/src/kmk/testcase-kBuild-define.kmk@ 2718

Last change on this file since 2718 was 2718, checked in by bird, 11 years ago

kmk: Variable aliases.

  • Property svn:eol-style set to native
  • Property svn:keywords set to Id
File size: 3.7 KB
Line 
1# $Id: testcase-kBuild-define.kmk 2718 2013-12-30 21:30:47Z bird $
2## @file
3# kBuild - testcase for the kBuild-define-* directives.
4#
5
6#
7# Copyright (c) 2011-2013 knut st. osmundsen <[email protected]>
8#
9# This file is part of kBuild.
10#
11# kBuild is free software; you can redistribute it and/or modify
12# it under the terms of the GNU General Public License as published by
13# the Free Software Foundation; either version 3 of the License, or
14# (at your option) any later version.
15#
16# kBuild is distributed in the hope that it will be useful,
17# but WITHOUT ANY WARRANTY; without even the implied warranty of
18# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
19# GNU General Public License for more details.
20#
21# You should have received a copy of the GNU General Public License
22# along with kBuild. If not, see <http://www.gnu.org/licenses/>
23#
24#
25
26#DEPTH = ../..
27#include $(PATH_KBUILD)/header.kmk
28
29if 0
30# object definition syntax:
31# kobject <type> <name> [extends <object> [by <||>]] [object specific args...]
32# kendobj [<type> [name]]
33kobject kb-target MyTarget
34.TOOL = GCC
35.SOURCES = file.c
36kendobj
37else
38# Target definition.
39# kBuild-define-target <name> [extends <target> [by <||>]] [using <template>]
40# kBuild-endef-target [name]
41kBuild-define-target MyTarget
42_TOOL = GCC
43_SOURCES = file.c
44kBuild-endef-target
45endif
46
47if 0
48# accesses an already defined object.
49# syntax:
50# kaccess <type> <name>
51# kendacc [<type> [name]]
52kaccess kb-target MyTarget
53.SOURCES += file2.c
54kendacc
55else
56#kBuild-access-target MyTarget
57#_SOURCES += file2.c
58#kBuild-endacc-target
59endif
60
61
62# Referencing an object variable, the object must exist.
63# syntax: [<type>@<name>].<property>
64[target@MyTarget]_SOURCES += file3.c
65$(info [target@MyTarget]_SOURCES is $([target@MyTarget]_SOURCES))
66
67
68# Test #1
69kBuild-define-target BaseTarget using DUMMY
70_SOURCES = BaseTargetSource.c
71kBuild-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))
74
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))
77
78# Test #2
79kBuild-define-target TargetWithLocals
80local _LOCAL_PROP = no global alias
81kBuild-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.))
84
85# Test #3
86kBuild-define-target OutsideMod
87_SOURCES = file3.c
88_OTHER = inside-value
89kBuild-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'))
98
99all_recursive:
100 @kmk_echo "kBuild-define-xxxx works fine"
101
Note: See TracBrowser for help on using the repository browser.

© 2025 Oracle Support Privacy / Do Not Sell My Info Terms of Use Trademark Policy Automated Access Etiquette