1#!/usr/local/bin/python3.8
2
3# Copyright 2003 Dave Abrahams
4# Copyright 2002, 2003 Vladimir Prus
5# Distributed under the Boost Software License, Version 1.0.
6# (See accompanying file LICENSE_1_0.txt or http://www.boost.org/LICENSE_1_0.txt)
7
8# This tests that :
9#  1) the 'make' correctly assigns types to produced targets
10#  2) if 'make' creates targets of type CPP, they are correctly used.
11
12import BoostBuild
13
14t = BoostBuild.Tester(use_test_config=False)
15
16# In order to correctly link this app, 'b.cpp', created by a 'make' rule, should
17# be compiled.
18
19t.write("jamroot.jam", "import gcc ;")
20
21t.write("jamfile.jam", r'''
22import os ;
23if [ os.name ] = NT
24{
25    actions create
26    {
27        echo int main() {} > $(<)
28    }
29}
30else
31{
32    actions create
33    {
34        echo "int main() {}" > $(<)
35    }
36}
37
38IMPORT $(__name__) : create : : create ;
39
40exe a : l dummy.cpp ;
41
42# Needs to be a static lib for Windows - main() cannot appear in DLL.
43static-lib l : a.cpp b.cpp ;
44
45make b.cpp : : create ;
46''')
47
48t.write("a.cpp", "")
49
50t.write("dummy.cpp", "// msvc needs at least one object file\n")
51
52t.run_build_system()
53
54t.expect_addition("bin/$toolset/debug*/a.exe")
55
56t.cleanup()
57