2 # Copyright (C) 2013-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 # Expose part of automake bug#13928: if the subdir-objects option is
18 # in use and a source file is listed in a _SOURCES variable with a
19 # leading $(srcdir) component, Automake will generate a Makefile that
20 # tries to create the corresponding object file in $(srcdir) as well.
25 cat >> configure.ac
<<'END'
28 AM_CONDITIONAL([OBVIOUS], [:])
29 AC_CONFIG_FILES([sub/Makefile])
33 cat > Makefile.am
<<'END'
34 AUTOMAKE_OPTIONS = subdir-objects
39 noinst_PROGRAMS = test test2
40 test_SOURCES = $(srcdir)/test.c
42 test2_SOURCES = $(indir)
46 indir += ${srcdir}/$(LESS)/test.c
53 test ! -f @srcdir@/test.$(OBJEXT)
54 test -f test.$(OBJEXT)
55 test ! -f @srcdir@/more/test.$(OBJEXT)
56 test -f more/test.$(OBJEXT)
58 test ! -f @srcdir@/bar.$(OBJEXT)
60 test ! -f @srcdir@/baz.$(OBJEXT)
63 test ! -d @srcdir@/$(DEPDIR)
64 test ! -d @srcdir@/more/$(DEPDIR)
66 test -d more/$(DEPDIR)
68 check-local: test-objs
72 cat > sub
/Makefile.am
<<'END'
73 AUTOMAKE_OPTIONS = subdir-objects
85 mkfiles
='Makefile.in sub/Makefile.in'
86 $EGREP '(test|ba[rz])\.|DEPDIR|dirstamp|srcdir' $mkfiles # For debugging.
87 $EGREP '\$.(top_)?srcdir./(test|ba[rz])\.[o$]' $mkfiles && exit 1
88 $FGREP '\$.(top_)?srcdir./.*$(am__dirstamp)' $mkfiles && exit 1
89 $FGREP '\$.(top_)?srcdir./.*$(DEPDIR)' $mkfiles && exit 1
101 echo 'int foo (void);' > sub
/foo.h