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

Last change on this file since 2656 was 2655, checked in by bird, 13 years ago

work in progress.

  • Property svn:eol-style set to native
  • Property svn:keywords set to Id
File size: 2.5 KB
Line 
1# $Id: testcase-kBuild-define.kmk 2655 2012-09-09 23:08:19Z bird $
2## @file
3# kBuild - testcase for the kBuild-define-* directives.
4#
5
6#
7# Copyright (c) 2011-2012 knut st. osmundsen <bird-kBuild-spamx@anduin.net>
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
26DEPTH = ../..
27#include $(PATH_KBUILD)/header.kmk
28
29# object definition syntax:
30# kobject <type> <name> [extends <object> [by overriding|prepending|appending]] [object specific args...]
31# endkobj [<type> [name]]
32kobject kb-target MyTarget
33.SOURCES = file.c
34endobj
35
36# accesses an already defined object.
37# syntax:
38# kaccess <type> <name>
39# endkacc [<type> [name]]
40kaccess kb-target MyTarget
41.SOURCES += file2.c
42endkacc
43
44
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))
49
50
51# Test #1
52kobject target BaseTarget with DUMMY as template
53.SOURCES = BaseTargetSource.c
54kendobj
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
62kobject target TargetWithLocals
63local .LOCAL_PROP = no global alias
64kendobj
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.))
67
68
69all_recursive:
70 #$(ECHO) "kBuild-define-xxxx works fine"
71
Note: See TracBrowser for help on using the repository browser.