1# file      : examples/cxx/hello/libhello/test/makefile
2# copyright : Copyright (c) 2004-2012 Code Synthesis Tools CC
3# license   : GNU GPL v2; see accompanying LICENSE file
4
5include $(dir $(lastword $(MAKEFILE_LIST)))../build/bootstrap.make
6
7cxx_tun := driver.cxx
8cxx_obj := $(addprefix $(out_base)/,$(cxx_tun:.cxx=.o))
9cxx_od  := $(cxx_obj:.o=.o.d)
10
11hello.l             := $(out_root)/hello/hello.l
12hello.l.cpp-options := $(out_root)/hello/hello.l.cpp-options
13
14driver  := $(out_base)/driver
15clean   := $(out_base)/.clean
16test    := $(out_base)/.test
17
18
19# Build.
20#
21$(driver): $(cxx_obj) $(hello.l)
22
23$(cxx_obj) $(cxx_od): $(hello.l.cpp-options)
24$(cxx_obj) $(cxx_od): cpp_options := -I$(out_base)
25
26$(call -include,$(cxx_od))
27
28
29# Test.
30#
31.PHONY: $(test)
32
33$(test): $(driver)
34	$<
35
36
37# Clean.
38#
39.PHONY: $(clean)
40
41$(clean): $(driver).o.clean           \
42  $(addsuffix .cxx.clean,$(cxx_obj))  \
43  $(addsuffix .cxx.clean,$(cxx_od))   \
44  $(out_base)/driver.hxx.m4.clean
45
46
47# Aliases.
48#
49ifdef %interactive%
50
51.PHONY: clean test
52
53test: $(test)
54clean: $(clean)
55
56endif
57
58
59# How to.
60#
61$(call include,$(bld_root)/cxx/o-e.make)
62$(call include,$(bld_root)/cxx/cxx-o.make)
63$(call include,$(bld_root)/cxx/cxx-d.make)
64$(call include,$(bld_root)/m4/m4.make)
65
66
67# Import build rules.
68#
69$(call import,$(src_root)/hello/makefile)
70