| 1 | # $Id: testcase-kBuild-define.kmk 2658 2012-09-10 21:00:10Z 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 |
|
|---|
| 26 | DEPTH = ../..
|
|---|
| 27 | #include $(PATH_KBUILD)/header.kmk
|
|---|
| 28 |
|
|---|
| 29 | # object definition syntax:
|
|---|
| 30 | # kobject <type> <name> [extends <object>] [object specific args...]
|
|---|
| 31 | # endkobj [<type> [name]]
|
|---|
| 32 | kobject kb-target MyTarget
|
|---|
| 33 | .TOOL = GCC
|
|---|
| 34 | .SOURCES = file.c
|
|---|
| 35 | endobj
|
|---|
| 36 |
|
|---|
| 37 | # accesses an already defined object.
|
|---|
| 38 | # syntax:
|
|---|
| 39 | # kaccess <type> <name>
|
|---|
| 40 | # endkacc [<type> [name]]
|
|---|
| 41 | kaccess kb-target MyTarget
|
|---|
| 42 | .SOURCES += file2.c
|
|---|
| 43 | endkacc
|
|---|
| 44 |
|
|---|
| 45 |
|
|---|
| 46 | # Referencing an object variable, the object must exist.
|
|---|
| 47 | # syntax: [<type>@<name>].<property>
|
|---|
| 48 | [kb-target@MyTarget].SOURCES += file3.c
|
|---|
| 49 | $(info [kb-target@MyTarget].SOURCES is $([kb-target@MyTarget].SOURCES))
|
|---|
| 50 |
|
|---|
| 51 |
|
|---|
| 52 | # Test #1
|
|---|
| 53 | kobject target BaseTarget with DUMMY as template
|
|---|
| 54 | .SOURCES = BaseTargetSource.c
|
|---|
| 55 | kendobj
|
|---|
| 56 | $(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))
|
|---|
| 58 |
|
|---|
| 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))
|
|---|
| 61 |
|
|---|
| 62 | # Test #2
|
|---|
| 63 | kobject target TargetWithLocals
|
|---|
| 64 | local .LOCAL_PROP = no global alias
|
|---|
| 65 | kendobj
|
|---|
| 66 | $(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.))
|
|---|
| 68 |
|
|---|
| 69 |
|
|---|
| 70 | all_recursive:
|
|---|
| 71 | #$(ECHO) "kBuild-define-xxxx works fine"
|
|---|
| 72 |
|
|---|