1# file      : tests/cxx/parser/list/makefile
2# copyright : Copyright (c) 2006-2017 Code Synthesis Tools CC
3# license   : GNU GPL v2 + exceptions; see accompanying LICENSE file
4
5include $(dir $(lastword $(MAKEFILE_LIST)))../../../../build/bootstrap.make
6
7xsd := test.xsd
8cxx := driver.cxx
9
10obj := $(addprefix $(out_base)/,$(cxx:.cxx=.o) $(xsd:.xsd=-pskel.o))
11dep := $(obj:.o=.o.d)
12
13driver := $(out_base)/driver
14test   := $(out_base)/.test
15clean  := $(out_base)/.clean
16
17# Import.
18#
19$(call import,\
20  $(scf_root)/import/libxerces-c/stub.make,\
21  l: xerces_c.l,cpp-options: xerces_c.l.cpp-options)
22
23# Build.
24#
25$(driver): $(obj) $(xerces_c.l)
26
27$(obj) $(dep): cpp_options := -I$(out_base) -I$(src_base) -I$(src_root)/libxsd
28$(obj) $(dep): $(xerces_c.l.cpp-options)
29
30genf := $(xsd:.xsd=-pskel.hxx) $(xsd:.xsd=-pskel.ixx) $(xsd:.xsd=-pskel.cxx)
31gen  := $(addprefix $(out_base)/,$(genf))
32
33$(gen): xsd := $(out_root)/xsd/xsd
34$(gen): $(out_root)/xsd/xsd
35
36$(call include-dep,$(dep),$(obj),$(gen))
37
38# Convenience alias for default target.
39#
40$(out_base)/: $(driver)
41
42
43# Test.
44#
45$(test): driver := $(driver)
46$(test): $(driver) $(src_base)/test.xml $(src_base)/output
47	$(call message,test $$1,$$1 $(src_base)/test.xml | diff -u $(src_base)/output -,$(driver))
48
49# Clean.
50#
51$(clean): $(driver).o.clean                                 \
52  $(addsuffix .cxx.clean,$(obj))                            \
53  $(addsuffix .cxx.clean,$(dep))                            \
54  $(addprefix $(out_base)/,$(xsd:.xsd=-pskel.cxx.xsd.clean))
55
56# Generated .gitignore.
57#
58ifeq ($(out_base),$(src_base))
59$(gen): | $(out_base)/.gitignore
60$(driver): | $(out_base)/.gitignore
61
62$(out_base)/.gitignore: files := driver $(genf)
63$(clean): $(out_base)/.gitignore.clean
64
65$(call include,$(bld_root)/git/gitignore.make)
66endif
67
68# How to.
69#
70$(call include,$(bld_root)/cxx/o-e.make)
71$(call include,$(bld_root)/cxx/cxx-o.make)
72$(call include,$(bld_root)/cxx/cxx-d.make)
73
74$(call include,$(bld_root)/cxx/standard.make) # cxx_standard
75ifdef cxx_standard
76$(gen): xsd_options += --std $(cxx_standard)
77$(call include,$(scf_root)/xsd/parser/xsd-cxx.make)
78endif
79
80
81# Dependencies.
82#
83$(call import,$(src_root)/xsd/makefile)
84