1# Makefile for regression testing the GNU debugger.
2# Copyright (C) 1997, 1998, 2007 Free Software Foundation, Inc.
3
4# This file is part of GDB.
5
6# This program is free software; you can redistribute it and/or modify
7# it under the terms of the GNU General Public License as published by
8# the Free Software Foundation; either version 3 of the License, or
9# (at your option) any later version.
10#
11# This program is distributed in the hope that it will be useful,
12# but WITHOUT ANY WARRANTY; without even the implied warranty of
13# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
14# GNU General Public License for more details.
15#
16# You should have received a copy of the GNU General Public License
17# along with this program.  If not, see <http://www.gnu.org/licenses/>.
18
19VPATH = @srcdir@
20srcdir = @srcdir@
21prefix = @prefix@
22exec_prefix = @exec_prefix@
23
24build_canonical = @build@
25build_alias = @build_alias@
26host_canonical = @host@
27host_alias = @host_alias@
28target_canonical = @target@
29target_alias = @target_alias@
30program_transform_name = @program_transform_name@
31
32arch = @arch@
33
34SHELL = /bin/sh
35SUBDIRS = @subdirs@
36RPATH_ENVVAR = @RPATH_ENVVAR@
37
38EXPECT = `if [ -f $${rootme}/../../expect/expect ] ; then \
39          echo $${rootme}/../../expect/expect ; \
40          else echo expect ; fi`
41
42RUNTEST = `if [ -f $${srcdir}/../../dejagnu/runtest ] ; then \
43		echo $${srcdir}/../../dejagnu/runtest ; else echo runtest; \
44	   fi`
45
46RUNTESTFLAGS =
47
48#### host, target, and site specific Makefile frags come in here.
49
50# The use of $$(x_FOR_TARGET) reduces the command line length by not
51# duplicating the lengthy definition.
52
53TARGET_FLAGS_TO_PASS = \
54        "prefix=$(prefix)" \
55        "exec_prefix=$(exec_prefix)" \
56        "against=$(against)" \
57        'CC=$$(CC_FOR_TARGET)' \
58        "CC_FOR_TARGET=$(CC_FOR_TARGET)" \
59        "CFLAGS=$(TESTSUITE_CFLAGS)" \
60        "CHILLFLAGS=$(CHILLFLAGS)" \
61        'CHILL=$$(CHILL_FOR_TARGET)' \
62        "CHILL_FOR_TARGET=$(CHILL_FOR_TARGET)" \
63        "CHILL_LIB=$(CHILL_LIB)" \
64        'CXX=$$(CXX_FOR_TARGET)' \
65        "CXX_FOR_TARGET=$(CXX_FOR_TARGET)" \
66        "CXXFLAGS=$(CXXFLAGS)" \
67        "MAKEINFO=$(MAKEINFO)" \
68        "INSTALL=$(INSTALL)" \
69        "INSTALL_PROGRAM=$(INSTALL_PROGRAM)" \
70        "INSTALL_DATA=$(INSTALL_DATA)" \
71        "RUNTESTFLAGS=$(RUNTESTFLAGS)"
72
73#        "RUNTEST=$(RUNTEST)" \
74
75all:
76	@echo "Nothing to be done for all..."
77
78.NOEXPORT:
79info:
80install-info:
81dvi:
82
83install:
84
85uninstall: force
86
87installcheck:
88
89check:  check-DEJAGNU check-recursive
90
91#test1:
92check-recursive: 
93	@for i in . ${SUBDIRS}; do \
94		if [ $$i = . ] ; then continue ; fi ; \
95		if [ -d ./$$i ] ; then \
96			if (rootme=`pwd`/ ; export rootme ; \
97			    rootsrc=`cd $(srcdir); pwd`/ ; export rootsrc ; \
98                                echo "check recursively into $$i directory..."; \
99				cd ./$$i; \
100				$(MAKE) $(TARGET_FLAGS_TO_PASS) check) ; then true ; \
101			else exit 1 ; fi ; \
102		else true ; fi ; \
103	done
104
105#test2:	
106check-DEJAGNU: site.exp
107	echo "Dejagnu-checking in `pwd` directory ..."
108	rootme=`pwd`; export rootme; echo rootme = $$rootme; \
109	srcdir=`cd ${srcdir}; pwd`; export srcdir ; echo srcdir = $$srcdir; \
110	EXPECT=${EXPECT} ; export EXPECT ; echo EXPECT = $$EXPECT; \
111	if [ -f $$rootme/../../expect/expect ]; then \
112	  TCL_LIBRARY=`cd $$srcdir/../../tcl/library && pwd`; \
113	  export TCL_LIBRARY; \
114	fi; \
115        echo TCL_LIBRARY = $$TCL_LIBRARY; \
116	runtest=$(RUNTEST); echo runtest = $$runtest; \
117	if $(SHELL) -c "$$runtest --version" > /dev/null 2>&1; then \
118	  $$runtest $(RUNTESTFLAGS); \
119	else echo "WARNING: could not find \`runtest'" 1>&2; :;\
120	fi
121
122
123site.exp: Makefile
124	@echo 'Making a new site.exp file...'
125	-@rm -f site.bak
126	@echo '## these variables are automatically generated by make ##' > $@-t
127	@echo '# Do not edit here.  If you wish to override these values' >> $@-t
128	@echo '# edit the last section' >> $@-t
129	@echo 'set tool sim' >> $@-t
130	@echo 'set srcdir $(srcdir)' >> $@-t
131	@echo 'set objdir' `pwd` >> $@-t
132	@echo 'set arch $(arch)' >> $@-t
133	@echo 'set build_alias $(build_alias)' >> $@-t
134	@echo 'set build_triplet $(build_canonical)' >> $@-t
135	@echo 'set host_alias $(host_alias)' >> $@-t
136	@echo 'set host_triplet $(host_canonical)' >> $@-t
137	@echo 'set target_alias $(target_alias)' >> $@-t
138	@echo 'set target_triplet $(target_canonical)' >> $@-t
139	@echo '## All variables above are generated by configure. Do Not Edit ##' >> $@-t
140	-@sed '1,/^## All variables above are.*##/ d' site.exp >> $@-t
141	-@mv site.exp site.bak
142	@mv $@-t site.exp
143
144force:;
145
146clean mostlyclean:
147	-rm -f *~ core *.o a.out xgdb *.x *.grt
148	-rm -f *.rum *.c *.dif *.*out
149	if [ x"${SUBDIRS}" != x ] ; then \
150	    for dir in ${SUBDIRS}; \
151	    do \
152		    echo "$$dir:"; \
153		    if [ -d $$dir ]; then \
154			    (cd $$dir; $(MAKE) clean); \
155		    fi; \
156	    done ; \
157	else true; fi
158
159distclean maintainer-clean realclean: clean
160	-rm -f *~ core
161	-rm -f Makefile config.status *-init.exp
162	-rm -fr *.log summary detail *.plog *.sum *.psum site.*
163	if [ x"${SUBDIRS}" != x ] ; then \
164	    for dir in ${SUBDIRS}; \
165	    do \
166		    echo "$$dir:"; \
167		    if [ -d $$dir ]; then \
168			    (cd $$dir; $(MAKE) distclean); \
169		    fi; \
170	    done ; \
171	else true; fi
172
173Makefile : Makefile.in config.status
174	$(SHELL) config.status
175
176config.status: $(srcdir)/configure
177	$(SHELL) ./config.status --recheck
178# FIXME: Requires --enable-maintainer-mode, which one could add, but
179# it's provided by automake.  Maybe switch to automake someday.
180#$(srcdir)/configure: @MAINT@ $(srcdir)/configure.in
181#	cd $(srcdir) && autoconf
182