1# file      : tests/compiler/sloc-counter/makefile
2# copyright : Copyright (c) 2009-2017 Code Synthesis Tools CC
3# license   : MIT; see accompanying LICENSE file
4
5include $(dir $(lastword $(MAKEFILE_LIST)))../../../build/bootstrap.make
6
7cxx_tun := driver.cxx
8
9#
10#
11cxx_obj  := $(addprefix $(out_base)/,$(cxx_tun:.cxx=.o))
12cxx_od   := $(cxx_obj:.o=.o.d)
13
14cutl.l             := $(out_root)/cutl/cutl.l
15cutl.l.cpp-options := $(out_root)/cutl/cutl.l.cpp-options
16
17driver   := $(out_base)/driver
18test     := $(out_base)/.test
19clean    := $(out_base)/.clean
20
21# Build.
22#
23$(driver): $(cxx_obj) $(cutl.l)
24$(cxx_obj) $(cxx_od): $(cutl.l.cpp-options)
25
26
27$(call include-dep,$(cxx_od))
28
29
30# Alias for default target.
31#
32$(out_base)/: $(driver)
33
34
35# Test.
36#
37$(test): driver := $(driver)
38$(test): $(driver) $(src_base)/test.cxx $(src_base)/test.std
39	$(call message,test $$1,$$1 $(src_base)/test.cxx | diff -u $(src_base)/test.std -,$(driver))
40
41
42# Clean.
43#
44$(clean):                            \
45  $(driver).o.clean                  \
46  $(addsuffix .cxx.clean,$(cxx_obj)) \
47  $(addsuffix .cxx.clean,$(cxx_od))
48
49
50# Generated .gitignore.
51#
52ifeq ($(out_base),$(src_base))
53$(driver): | $(out_base)/.gitignore
54
55$(out_base)/.gitignore: files := driver
56$(clean): $(out_base)/.gitignore.clean
57
58$(call include,$(bld_root)/git/gitignore.make)
59endif
60
61
62# How to.
63#
64$(call include,$(bld_root)/cxx/o-e.make)
65$(call include,$(bld_root)/cxx/cxx-o.make)
66$(call include,$(bld_root)/cxx/cxx-d.make)
67
68# Dependencies.
69#
70$(call import,$(src_root)/cutl/makefile)
71