VirtualBox

source: kBuild/trunk/src/kmk/testcase-2ndtargetexp.kmk@ 1701

Last change on this file since 1701 was 1701, checked in by bird, 16 years ago

kmk: Implemented secondary target expansion. Fixes #42.

  • Property svn:eol-style set to native
  • Property svn:keywords set to Author Date Id Revision
File size: 1.8 KB
Line 
1# $Id: testcase-2ndtargetexp.kmk 1701 2008-09-02 02:06:18Z bird $
2## @file
3# kBuild - testcase for the 2nd target expansion feature.
4#
5
6#
7# Copyright (c) 2008 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 2 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, write to the Free Software
23# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
24#
25#
26
27DEPTH = ../..
28include $(PATH_KBUILD)/header.kmk
29
30#
31# Enable it.
32#
33.SECONDTARGETEXPANSION:
34
35
36#
37# This is expanded immediately.
38#
39foo1 = foo1
40$(foo1):
41 $(if $(eq $@,foo1),$(ECHO) "foo1 works",$(ECHO) "foo1 is busted @=$@"; exit 1)
42
43# Mostly for making sure the ifeq test works below.
44flush_command_recoding := 1 # see record_waiting_files() in read.c
45ifeq ($(strip $(commands foo1)),)
46$(error No commands for foo1: $(commands foo1))
47endif
48
49
50#
51# This is expanded in the 2nd round.
52#
53$$(foo2):
54 $(if $(eq $@,foo2),$(ECHO) "foo2 works",$(ECHO) "foo2 is busted @=$@"; exit 1)
55
56# Check that a $(foo2) file exists.
57flush_command_recoding := 1 # see record_waiting_files() in read.c
58# $ (info $$(foo2) commands: $(commands $$(foo2)))
59ifeq ($(strip $(commands $$(foo2))),)
60$(error No commands for $$(foo2): $(commands $$(foo2)))
61endif
62
63
64all_recursive: foo1 foo2
65 $(ECHO) "2nd target expansion passes smoke testing"
66
67# define this last
68foo2 = foo2
69
Note: See TracBrowser for help on using the repository browser.

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