VirtualBox

Changeset 2655 in kBuild for trunk/src


Ignore:
Timestamp:
Sep 9, 2012 11:08:19 PM (12 years ago)
Author:
bird
Message:

work in progress.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/kmk/testcase-kBuild-define.kmk

    r2549 r2655  
    55
    66#
    7 # Copyright (c) 2011 knut st. osmundsen <[email protected]>
     7# Copyright (c) 2011-2012 knut st. osmundsen <[email protected]>
    88#
    99# This file is part of kBuild.
     
    2727#include $(PATH_KBUILD)/header.kmk
    2828
    29 kBuild-define-target MyTarget
     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
    3035
    31 _TEMPLATE = MyTemplate
    32 _SOURCES  = MySourceFile.c
    33 
    34 kBuild-endef-target  MyTarget
    35 $(if "$(MyTarget_TEMPLATE)" == "MyTemplate",,$(error MyTarget's _TEMPLATE wasn't set correctly in the global space))
    36 $(if "$(MyTarget_SOURCES)" == "MySourceFile.c",,$(error MyTarget's _TEMPLATE wasn't set correctly in the global space))
     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
    3743
    3844
    39 INDIRECT_NAME = MyTarget$(strip $1)
    40 kBuild-define-target $(call INDIRECT_NAME, 2)
    41 
    42 local _TEMPLATE = MyTemplate2
    43 _SOURCES  = MySourceFile2.c
    44 
    45 kBuild-endef-target  $(call INDIRECT_NAME, 2)
    46 $(if "$(_TEMPLATE)" == "",,$(error _TEMPLATE has leaked out into the global space))
     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))
    4749
    4850
     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.))
    4967
    5068
     
    5270        #$(ECHO) "kBuild-define-xxxx works fine"
    5371
    54 
    55 
    56 
Note: See TracChangeset for help on using the changeset viewer.

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