aboutsummaryrefslogtreecommitdiff
path: root/build/xsd/parser/xsd-cxx.make
blob: ae2d9b745ec85e712f4f1f9415b882e1b970e00c (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
# file      : build/xsd/parser/xsd-cxx.make
# author    : Boris Kolpackov <boris@codesynthesis.com>
# copyright : Copyright (c) 2005-2011 Code Synthesis Tools CC
# license   : GNU GPL v2 + exceptions; see accompanying LICENSE file

#@@ Need to use extensions from cxx config.
#

# C++/Parser mapping.
#
ifeq ($(xsd_parser_skel_suffix),)
xsd_parser_skel_suffix := -pskel
endif

xsd_parser_pattern :=                      \
$(out_base)/%$(xsd_parser_skel_suffix).cxx \
$(out_base)/%$(xsd_parser_skel_suffix).hxx \
$(out_base)/%$(xsd_parser_skel_suffix).ixx

ifneq ($(xsd_parser_impl_suffix),)
xsd_parser_pattern +=                      \
$(out_base)/%$(xsd_parser_impl_suffix).cxx \
$(out_base)/%$(xsd_parser_impl_suffix).hxx \
$(out_base)/%-driver.cxx
endif


$(xsd_parser_pattern): xsd := xsd
$(xsd_parser_pattern): xsd_command := cxx-parser

ops := --generate-inline --skel-file-suffix $(xsd_parser_skel_suffix)

ifneq ($(xsd_pimpl_suffix),)
ops += --impl-file-suffix $(xsd_parser_impl_suffix)
endif

$(xsd_parser_pattern): xsd_options := $(ops)


.PRECIOUS: $(xsd_parser_pattern)

ifeq ($(out_base),$(src_base))

$(xsd_parser_pattern): $(src_base)/%.xsd
	$(call message,xsd $<,$(xsd) $(xsd_command) $(xsd_options) --output-dir $(dir $@) $<)

else

$(xsd_parser_pattern): $(src_base)/%.xsd | $$(dir $$@).
	$(call message,xsd $<,$(xsd) $(xsd_command) $(xsd_options) --output-dir $(dir $@) $<)

$(xsd_parser_pattern): $(out_base)/%.xsd | $$(dir $$@).
	$(call message,xsd $<,$(xsd) $(xsd_command) $(xsd_options) --output-dir $(dir $@) $<)

endif


.PHONY: $(out_base)/%$(xsd_parser_skel_suffix).cxx.xsd.clean

$(out_base)/%$(xsd_parser_skel_suffix).cxx.xsd.clean:
	$(call message,rm $$1,rm -f $$1,$(@:.cxx.xsd.clean=.cxx))
	$(call message,rm $$1,rm -f $$1,$(@:.cxx.xsd.clean=.hxx))
	$(call message,rm $$1,rm -f $$1,$(@:.cxx.xsd.clean=.ixx))

ifneq ($(xsd_parser_impl_suffix),)
.PHONY: $(out_base)/%$(xsd_parser_impl_suffix).cxx.xsd.clean

$(out_base)/%$(xsd_parser_impl_suffix).cxx.xsd.clean:
	$(call message,rm $$1,rm -f $$1,$(@:.cxx.xsd.clean=.cxx))
	$(call message,rm $$1,rm -f $$1,$(@:.cxx.xsd.clean=.hxx))
	$(call message,rm $$1,rm -f $$1,$(out_base)/$*-driver.cxx)
endif

# Reset the config variables so they won't take effect in other places.
#
xsd_parser_skel_suffix :=
xsd_parser_impl_suffix :=