summaryrefslogtreecommitdiff
path: root/cli/makefile
blob: c06f8d4a8de6af2642d141069e76e65e7bcf706e (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
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
# file      : cli/makefile
# author    : Boris Kolpackov <boris@codesynthesis.com>
# copyright : Copyright (c) 2009-2011 Code Synthesis Tools CC
# license   : MIT; see accompanying LICENSE file

include $(dir $(lastword $(MAKEFILE_LIST)))../build/bootstrap.make

cxx_tun := cli.cxx lexer.cxx parser.cxx

cxx_tun +=               \
options.cxx              \
context.cxx              \
header.cxx               \
inline.cxx               \
source.cxx               \
runtime-header.cxx       \
runtime-inline.cxx       \
runtime-source.cxx       \
man.cxx                  \
html.cxx                 \
generator.cxx            \
name-processor.cxx

cxx_tun +=               \
semantics/class.cxx      \
semantics/elements.cxx   \
semantics/expression.cxx \
semantics/namespace.cxx  \
semantics/option.cxx     \
semantics/unit.cxx

cxx_tun +=               \
traversal/class.cxx      \
traversal/elements.cxx   \
traversal/namespace.cxx  \
traversal/option.cxx     \
traversal/unit.cxx

cli_tun := options.cli

#
#
cxx_obj  := $(addprefix $(out_base)/,$(cxx_tun:.cxx=.o) $(cli_tun:.cli=.o))
cxx_od   := $(cxx_obj:.o=.o.d)

cli      := $(out_base)/cli
clean    := $(out_base)/.clean
install  := $(out_base)/.install

# Import.
#
$(call import,\
  $(scf_root)/import/libcutl/stub.make,\
  l: cutl.l,cpp-options: cutl.l.cpp-options)

# Build.
#
$(cli): $(cxx_obj) $(cutl.l)

$(cxx_obj) $(cxx_od): cpp_options := -I$(src_base) -I$(out_base)
$(cxx_obj) $(cxx_od): $(cutl.l.cpp-options)

genf := $(cli_tun:.cli=.hxx) $(cli_tun:.cli=.ixx) $(cli_tun:.cli=.cxx)
gen  := $(addprefix $(out_base)/,$(genf))

$(gen): cli := $(out_root)/cli/cli
$(gen): cli_options += --generate-file-scanner --guard-prefix CLI \
--reserved-name stdout

$(call include-dep,$(cxx_od),$(cxx_obj),$(gen))

# Alias for default target.
#
$(out_base)/: $(cli)

# Install.
#
$(install): $(cli)
	$(call install-exec,$<,$(install_bin_dir)/cli)

# Clean.
#
$(clean):                            \
  $(cli).o.clean                     \
  $(addsuffix .cxx.clean,$(cxx_obj)) \
  $(addsuffix .cxx.clean,$(cxx_od))

# Generated .gitignore.
#
ifeq ($(out_base),$(src_base))
$(cli): | $(out_base)/.gitignore

$(out_base)/.gitignore: files := cli
$(clean): $(out_base)/.gitignore.clean

$(call include,$(bld_root)/git/gitignore.make)
endif

# how to
#
$(call include,$(bld_root)/cxx/o-e.make)
$(call include,$(bld_root)/cxx/cxx-o.make)
$(call include,$(bld_root)/cxx/cxx-d.make)
$(call include,$(scf_root)/cli/cli-cxx.make)
$(call include,$(bld_root)/install.make)