• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1#
2#    Copyright 2016 Nest Labs Inc. All Rights Reserved.
3#
4#    Licensed under the Apache License, Version 2.0 (the "License");
5#    you may not use this file except in compliance with the License.
6#    You may obtain a copy of the License at
7#
8#    http://www.apache.org/licenses/LICENSE-2.0
9#
10#    Unless required by applicable law or agreed to in writing, software
11#    distributed under the License is distributed on an "AS IS" BASIS,
12#    WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13#    See the License for the specific language governing permissions and
14#    limitations under the License.
15#
16
17#
18#    Description:
19#      This file is the GNU automake template for the @PACKAGE_DESCRIPTION@
20#      unit tests.
21#
22
23include $(abs_top_nlbuild_autotools_dir)/automake/pre.am
24
25#
26# Local headers to build against and distribute but not to install
27# since they are not part of the package.
28#
29noinst_HEADERS                                 = \
30    @PACKAGE_SHORT_LOWER@-test.h                 \
31    $(NULL)
32
33#
34# Other files we do want to distribute with the package.
35#
36EXTRA_DIST                                     = \
37    $(NULL)
38
39if @PACKAGE_SHORT_UPPER@_BUILD_TESTS
40# C preprocessor option flags that will apply to all compiled objects in this
41# makefile.
42
43AM_CPPFLAGS                                    = \
44    -I$(top_srcdir)/include                      \
45    $(NULL)
46
47COMMON_LDADD                                   = \
48    -L${top_builddir}/src -l@PACKAGE_SHORT_LOWER@
49    $(NULL)
50
51# Test applications that should be run when the 'check' target is run.
52
53check_PROGRAMS                                 = \
54    @PACKAGE_SHORT_LOWER@-test                   \
55    @PACKAGE_SHORT_LOWER@-test-cxx               \
56    $(NULL)
57
58# Test applications and scripts that should be built and run when the
59# 'check' target is run.
60
61TESTS                                          = \
62    $(check_PROGRAMS)                            \
63    $(NULL)
64
65# The additional environment variables and their values that will be
66# made available to all programs and scripts in TESTS.
67
68TESTS_ENVIRONMENT                              = \
69    $(NULL)
70
71# Source, compiler, and linker options for test programs.
72
73@PACKAGE_SHORT_LOWER@_test_LDADD               = $(COMMON_LDADD)
74@PACKAGE_SHORT_LOWER@_test_SOURCES             = @PACKAGE_SHORT_LOWER@-test.c
75
76@PACKAGE_SHORT_LOWER@_test_cxx_LDADD           = $(COMMON_LDADD)
77@PACKAGE_SHORT_LOWER@_test_cxx_SOURCES         = @PACKAGE_SHORT_LOWER@-test-cxx.cpp
78
79if @PACKAGE_SHORT_UPPER@_BUILD_COVERAGE
80CLEANFILES                                     = $(wildcard *.gcda *.gcno)
81
82if @PACKAGE_SHORT_UPPER@_BUILD_COVERAGE_REPORTS
83# The bundle should positively be qualified with the absolute build
84# path. Otherwise, VPATH will get auto-prefixed to it if there is
85# already such a directory in the non-colocated source tree.
86
87@PACKAGE_SHORT_UPPER@_COVERAGE_BUNDLE                           = ${abs_builddir}/${PACKAGE}${NL_COVERAGE_BUNDLE_SUFFIX}
88@PACKAGE_SHORT_UPPER@_COVERAGE_INFO                             = ${@PACKAGE_SHORT_UPPER@_COVERAGE_BUNDLE}/${PACKAGE}${NL_COVERAGE_INFO_SUFFIX}
89
90$(@PACKAGE_SHORT_UPPER@_COVERAGE_BUNDLE):
91	$(call create-directory)
92
93$(@PACKAGE_SHORT_UPPER@_COVERAGE_INFO): check-local | $(@PACKAGE_SHORT_UPPER@_COVERAGE_BUNDLE)
94	$(call generate-coverage-report,${top_builddir})
95
96coverage-local: $(@PACKAGE_SHORT_UPPER@_COVERAGE_INFO)
97
98clean-local: clean-local-coverage
99
100.PHONY: clean-local-coverage
101clean-local-coverage:
102	-$(AM_V_at)rm -rf $(@PACKAGE_SHORT_UPPER@_COVERAGE_BUNDLE)
103endif # @PACKAGE_SHORT_UPPER@_BUILD_COVERAGE_REPORTS
104endif # @PACKAGE_SHORT_UPPER@_BUILD_COVERAGE
105endif # @PACKAGE_SHORT_UPPER@_BUILD_TESTS
106
107include $(abs_top_nlbuild_autotools_dir)/automake/post.am
108