| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161 | #! /bin/sh# Copyright (C) 2011-2017 Free Software Foundation, Inc.## This program is free software; you can redistribute it and/or modify# it under the terms of the GNU General Public License as published by# the Free Software Foundation; either version 2, or (at your option)# any later version.## This program is distributed in the hope that it will be useful,# but WITHOUT ANY WARRANTY; without even the implied warranty of# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the# GNU General Public License for more details.## You should have received a copy of the GNU General Public License# along with this program.  If not, see <http://www.gnu.org/licenses/>.# Check that C++ source and header files derived from non-distributed# Yacc sources are cleaned by "make clean", while C++ source and# header files derived from distributed Yacc sources are cleaned by# "make maintainer-clean".# See also sister test 'yacc-clean.sh'.required='c++ yacc'. test-init.shcat >> configure.ac << 'END'AC_PROG_CXXAC_PROG_YACCAC_CONFIG_FILES([sub1/Makefile sub2/Makefile])AC_OUTPUTENDcat > Makefile.am << 'END'# Use two subdirectories, one to test with '-d' in YFLAGS, the# other one to test with empty YFLAGS.SUBDIRS = sub1 sub2ENDmkdir sub1 sub2cat > sub1/Makefile.am << 'END'bin_PROGRAMS = foo bar baz quxfoo_SOURCES = mainfoo.cc parsefoo.yxxbar_SOURCES = mainbar.cpp parsebar.yybar_YFLAGS = $(AM_YFLAGS)baz_SOURCES = mainbaz.c++nodist_baz_SOURCES = parsebaz.y++qux_SOURCES = mainqux.cxxnodist_qux_SOURCES = parsequx.yppqux_YFLAGS = $(AM_YFLAGS)parsebaz.y++ parsequx.ypp:	cp $(srcdir)/parsefoo.yxx $@CLEANFILES = parsebaz.y++ parsequx.yppENDcat > sub2/Makefile.am << 'END'include $(top_srcdir)/sub1/Makefile.amAM_YFLAGS = -dENDcat > sub1/parsefoo.yxx << 'END'%{// This file should contain valid C++ but invalid C.#include <cstdio>// "std::" qualification required by Sun C++ 5.9.int yylex (void) { return std::getchar (); }void yyerror (const char *s) { return; }%}%%x : 'x' { };ENDcp sub1/parsefoo.yxx sub1/parsebar.yycp sub1/parsefoo.yxx sub2/parsefoo.yxxcp sub1/parsefoo.yxx sub2/parsebar.yycat > sub1/mainfoo.cc << 'END'// This file should contain valid C++ but invalid C.using namespace std;int main (int argc, char **argv){  extern int yyparse (void);  return yyparse ();}ENDcp sub1/mainfoo.cc sub1/mainbar.cppcp sub1/mainfoo.cc sub1/mainbaz.c++cp sub1/mainfoo.cc sub1/mainqux.cxxcp sub1/main???.c* sub2$ACLOCAL$AUTOCONF$AUTOMAKE -a./configurecp config.status config.sav$MAKEls -l . sub1 sub2# Sanity checks.test -f sub1/parsefoo.cxxtest -f sub1/bar-parsebar.cctest -f sub1/parsebaz.y++test -f sub1/parsebaz.c++test -f sub1/parsequx.ypptest -f sub1/qux-parsequx.cpptest -f sub2/parsefoo.cxxtest -f sub2/parsefoo.hxxtest -f sub2/bar-parsebar.cctest -f sub2/bar-parsebar.hhtest -f sub2/parsebaz.y++test -f sub2/parsebaz.c++test -f sub2/parsebaz.h++test -f sub2/parsequx.ypptest -f sub2/qux-parsequx.cpptest -f sub2/qux-parsequx.hppfor target in clean distclean; do  $MAKE $target  ls -l . sub1 sub2  test -f sub1/parsefoo.cxx  test -f sub1/bar-parsebar.cc  test ! -e sub1/parsebaz.y++  test ! -e sub1/parsebaz.c++  test ! -e sub1/parsequx.ypp  test ! -e sub1/qux-parsequx.cpp  test -f sub2/parsefoo.cxx  test -f sub2/parsefoo.hxx  test -f sub2/bar-parsebar.cc  test -f sub2/bar-parsebar.hh  test ! -e sub2/parsebaz.y++  test ! -e sub2/parsebaz.c++  test ! -e sub2/parsebaz.h++  test ! -e sub2/parsequx.ypp  test ! -e sub2/qux-parsequx.cpp  test ! -e sub2/qux-parsequx.hppdonecp config.sav config.status./config.status # re-create Makefile$MAKE maintainer-cleanls -l . sub1 sub2test -f sub1/parsefoo.yxxtest -f sub1/parsebar.yytest ! -e sub1/parsefoo.cxxtest ! -e sub1/bar-parsebar.cctest -f sub2/parsefoo.yxxtest -f sub2/parsebar.yytest ! -e sub2/parsefoo.cxxtest ! -e sub2/parsefoo.hxxtest ! -e sub2/bar-parsebar.cctest ! -e sub2/bar-parsebar.hh:
 |