Tagging 0.1.5-p2 (again)
[kbuild-mirror.git] / src / kmk / testcase-2ndtargetexp.kmk
blobb877064f10501c4179b578fc6ea647dd2905da48
1 # $Id$
2 ## @file
3 # kBuild - testcase for the 2nd target expansion feature.
7 # Copyright (c) 2008-2009 knut st. osmundsen <bird-kBuild-spamix@anduin.net>
9 # This file is part of kBuild.
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.
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.
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/>
26 DEPTH = ../..
27 include $(PATH_KBUILD)/header.kmk
30 # Enable it.
32 .SECONDTARGETEXPANSION:
36 # This is expanded immediately.
38 foo1 = foo1
39 $(foo1):
40 $(if $(eq $@,foo1),$(ECHO) "foo1 works",$(ECHO) "foo1 is busted @=$@"; exit 1)
42 # Mostly for making sure the ifeq test works below.
43 flush_command_recoding := 1 # see record_waiting_files() in read.c
44 ifeq ($(strip $(commands foo1)),)
45 $(error No commands for foo1: $(commands foo1))
46 endif
50 # This is expanded in the 2nd round.
52 $$(foo2):
53 $(if $(eq $@,foo2),$(ECHO) "foo2 works",$(ECHO) "foo2 is busted @=$@"; exit 1)
55 # Check that a $(foo2) file exists.
56 flush_command_recoding := 1 # see record_waiting_files() in read.c
57 # $ (info $$(foo2) commands: $(commands $$(foo2)))
58 ifeq ($(strip $(commands $$(foo2))),)
59 $(error No commands for $$(foo2): $(commands $$(foo2)))
60 endif
63 all_recursive: foo1 foo2
64 $(ECHO) "2nd target expansion passes smoke testing"
66 # define this last
67 foo2 = foo2