xref: /aoo41x/main/solenv/gbuild/CppunitTest.mk (revision cdf0e10c)
1#*************************************************************************
2#
3# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4#
5# Copyright 2000, 2011 Oracle and/or its affiliates.
6#
7# OpenOffice.org - a multi-platform office productivity suite
8#
9# This file is part of OpenOffice.org.
10#
11# OpenOffice.org is free software: you can redistribute it and/or modify
12# it under the terms of the GNU Lesser General Public License version 3
13# only, as published by the Free Software Foundation.
14#
15# OpenOffice.org is distributed in the hope that it will be useful,
16# but WITHOUT ANY WARRANTY; without even the implied warranty of
17# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
18# GNU Lesser General Public License version 3 for more details
19# (a copy is included in the LICENSE file that accompanied this code).
20#
21# You should have received a copy of the GNU Lesser General Public License
22# version 3 along with OpenOffice.org.  If not, see
23# <http://www.openoffice.org/license.html>
24# for a copy of the LGPLv3 License.
25#
26#*************************************************************************
27
28
29# CppunitTest class
30
31# in non-product builds, ensure that tools-based assertions do not pop up as message box, but are routed to the shell
32DBGSV_ERROR_OUT := shell
33export DBGSV_ERROR_OUT
34
35# defined by platform
36#  gb_CppunitTest_TARGETTYPE
37#  gb_CppunitTest_get_filename
38gb_CppunitTest_CPPTESTTARGET := $(call gb_Executable_get_target,cppunittester)
39gb_CppunitTest_CPPTESTCOMMAND := $(gb_CppunitTest_CPPTESTPRECOMMAND) $(gb_CppunitTest_CPPTESTTARGET)
40gb_CppunitTest__get_linktargetname = CppunitTest/$(call gb_CppunitTest_get_filename,$(1))
41
42.PHONY : $(call gb_CppunitTest_get_clean_target,%)
43$(call gb_CppunitTest_get_clean_target,%) :
44	$(call gb_Helper_abbreviate_dirs,\
45		rm -f $(call gb_CppunitTest_get_target,$*) $(call gb_CppunitTest_get_target,$*).log)
46
47.PHONY : $(call gb_CppunitTest_get_target,%)
48$(call gb_CppunitTest_get_target,%) : $(gb_CppunitTest_CPPTESTTARGET)
49	$(call gb_Output_announce,$*,$(true),CUT,2)
50	$(call gb_Helper_abbreviate_dirs_native,\
51		mkdir -p $(dir $@) && \
52		$(gb_CppunitTest_CPPTESTCOMMAND) $(call gb_LinkTarget_get_target,CppunitTest/$(call gb_CppunitTest_get_libfilename,$*)) > $@.log 2>&1 || (cat $@.log && false))
53
54define gb_CppunitTest_CppunitTest
55$(call gb_CppunitTest__CppunitTest_impl,$(1),$(call gb_CppunitTest__get_linktargetname,$(1)))
56
57endef
58
59define gb_CppunitTest__CppunitTest_impl
60$(call gb_LinkTarget_LinkTarget,$(2))
61$(call gb_LinkTarget_set_targettype,$(2),CppunitTest)
62$(call gb_LinkTarget_add_linked_libs,$(2),cppunit)
63$(call gb_CppunitTest_get_target,$(1)) : $(call gb_LinkTarget_get_target,$(2))
64$(call gb_CppunitTest_get_clean_target,$(1)) : $(call gb_LinkTarget_get_clean_target,$(2))
65$(call gb_CppunitTest_CppunitTest_platform,$(1),$(2),$(gb_CppunitTest_DLLDIR)/$(call gb_CppunitTest_get_libfilename,$(1)))
66$$(eval $$(call gb_Module_register_target,$(call gb_CppunitTest_get_target,$(1)),$(call gb_CppunitTest_get_clean_target,$(1))))
67
68endef
69
70define gb_CppunitTest__forward_to_Linktarget
71gb_CppunitTest_$(1) = $$(call gb_LinkTarget_$(1),$$(call gb_CppunitTest__get_linktargetname,$$(1)),$$(2),$$(3))
72
73endef
74
75$(eval $(foreach method,\
76	add_cobject \
77	add_cobjects \
78	add_cxxobject \
79	add_cxxobjects \
80	add_objcxxobject \
81	add_objcxxobjects \
82	add_exception_objects \
83	add_noexception_objects \
84	set_cflags \
85	set_cxxflags \
86	set_objcxxflags \
87	set_defs \
88	set_include \
89	set_ldflags \
90	set_library_path_flags \
91	add_linked_libs \
92	add_linked_static_libs \
93	add_package_headers \
94	add_sdi_headers \
95	add_precompiled_header \
96,\
97	$(call gb_CppunitTest__forward_to_Linktarget,$(method))\
98))
99
100# vim: set noet sw=4 ts=4:
101