2 # Copyright (C) 1996-2018 Free Software Foundation, Inc.
4 # This program is free software; you can redistribute it and/or modify
5 # it under the terms of the GNU General Public License as published by
6 # the Free Software Foundation; either version 2, or (at your option)
9 # This program is distributed in the hope that it will be useful,
10 # but WITHOUT ANY WARRANTY; without even the implied warranty of
11 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 # GNU General Public License for more details.
14 # You should have received a copy of the GNU General Public License
15 # along with this program. If not, see <https://www.gnu.org/licenses/>.
17 # Make sure that object names don't clash when using subdir-objects.
18 # The check is done for clashing programs, clashing libraries and
19 # a program that clashes with a library
25 cat >> configure.ac
<< 'END'
31 cat > Makefile.am
<< 'END'
32 AUTOMAKE_OPTIONS
= subdir-objects foreign
37 noinst_PROGRAMS
+= foo src
/foo
38 foo_SOURCES
= src
/foo.c src
/main.c
39 foo_CPPFLAGS
= -DVAL=0
40 src_foo_CPPFLAGS
= -DVAL=1
41 src_foo_SOURCES
= src
/foo.c src
/main.c
44 noinst_PROGRAMS
+= bar src
/bar
45 noinst_LIBRARIES
+= libbar.a src
/libbar.a
46 bar_SOURCES
= src
/main.c
48 src_bar_SOURCES
= src
/main.c
49 src_bar_LDADD
= src
/libbar.a
50 libbar_a_SOURCES
= src
/foo.c
51 libbar_a_CPPFLAGS
= -DVAL=0
52 src_libbar_a_SOURCES
= src
/foo.c
53 src_libbar_a_CPPFLAGS
= -DVAL=1
55 # CLASHING PROGRAM + LIB
56 noinst_PROGRAMS
+= libzap_a src
/zap
57 noinst_LIBRARIES
+= src
/libzap.a
58 libzap_a_SOURCES
= src
/main.c src
/foo.c
59 libzap_a_CPPFLAGS
= -DVAL=2
60 src_zap_SOURCES
= src
/main.c
61 src_zap_LDADD
= src
/libzap.a
62 src_libzap_a_SOURCES
= src
/foo.c
63 src_libzap_a_CPPFLAGS
= -DVAL=3
66 noinst_PROGRAMS
+= src
/foo-uniq
67 src_foo_uniq_SOURCES
= src
/main.c src
/foo.c
68 src_foo_uniq_CPPFLAGS
= -DVAL=4
71 cat > src
/foo.c
<< 'END'
79 cat > src
/main.c
<< 'END'
91 $AUTOMAKE --add-missing
96 .
/foo || fail_
"./foo should return 0"
97 .
/src
/foo
; test $?
= 1 || fail_
"./src/foo should return 1"
98 .
/bar || fail_
"./bar should return 0"
99 .
/src
/bar
; test $?
= 1 || fail_
"./src/bar should return 1"
100 .
/libzap_a
; test $?
= 2 || fail_
"./libfoo_a should return 2"
101 .
/src
/zap
; test $?
= 3 || fail_
"./src/prog_libfoo should return 3"
102 .
/src
/foo-uniq
; test $?
= 4 || fail_
"./foo_uniq should return 4"