1#    Makefile template for Configure for the sim library.
2#    Copyright (C) 1993, 1995, 1997, 1998, 2007 Free Software Foundation, Inc.
3#    Written by Cygnus Support.
4# 
5# This file is part of BFD, the Binary File Descriptor library.
6# 
7# This program is free software; you can redistribute it and/or modify
8# it under the terms of the GNU General Public License as published by
9# the Free Software Foundation; either version 3 of the License, or
10# (at your option) any later version.
11#
12# This program is distributed in the hope that it will be useful,
13# but WITHOUT ANY WARRANTY; without even the implied warranty of
14# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
15# GNU General Public License for more details.
16#
17# You should have received a copy of the GNU General Public License
18# along with this program.  If not, see <http://www.gnu.org/licenses/>.
19
20VPATH = @srcdir@
21srcdir = @srcdir@
22
23prefix = @prefix@
24exec_prefix = @exec_prefix@
25
26host_alias = @host_alias@
27target_alias = @target_alias@
28program_transform_name = @program_transform_name@
29bindir = @bindir@
30libdir = @libdir@
31tooldir = $(libdir)/$(target_alias)
32
33datadir = @datadir@
34mandir = @mandir@
35man1dir = $(mandir)/man1
36man2dir = $(mandir)/man2
37man3dir = $(mandir)/man3
38man4dir = $(mandir)/man4
39man5dir = $(mandir)/man5
40man6dir = $(mandir)/man6
41man7dir = $(mandir)/man7
42man8dir = $(mandir)/man8
43man9dir = $(mandir)/man9
44infodir = @infodir@
45includedir = @includedir@
46
47SHELL = @SHELL@
48
49INSTALL = @INSTALL@
50INSTALL_PROGRAM = @INSTALL_PROGRAM@
51INSTALL_DATA = @INSTALL_DATA@
52
53AR = @AR@
54AR_FLAGS = rc
55CC = @CC@
56CFLAGS = @CFLAGS@
57CC_FOR_BUILD = @CC_FOR_BUILD@
58CFLAGS_FOR_BUILD = @CFLAGS_FOR_BUILD@
59MAKEINFO = makeinfo
60RANLIB = @RANLIB@
61
62SUBDIRS = @subdirs@
63
64INCDIR = $(srcdir)/../include
65CSEARCH = -I. -I$(srcdir) -I$(INCDIR)
66DEP = mkdep
67
68#### Makefile fragments come in here.
69# @target_makefile_frag@
70###
71
72# Name of the ChangeLog file.
73ChangeLog = ChangeLog
74
75
76RUNTEST = `if [ -f $${srcdir}/../dejagnu/runtest ] ; then \
77		echo $${srcdir}/../dejagnu/runtest ; else echo runtest; \
78	   fi`
79RUNTESTFLAGS=
80
81FLAGS_TO_PASS = \
82	"prefix=$(prefix)" \
83	"exec_prefix=$(exec_prefix)" \
84	"bindir=$(bindir)" \
85	"mandir=$(mandir)" \
86	"libdir=$(libdir)" \
87	"against=$(against)" \
88	"AR=$(AR)" \
89	"AR_FLAGS=$(AR_FLAGS)" \
90	"CC=$(CC)" \
91	"CC_FOR_BUILD=$(CC_FOR_BUILD)" \
92	"CFLAGS=$(CFLAGS)" \
93	"CFLAGS_FOR_BUILD=$(CFLAGS_FOR_BUILD)" \
94	"RANLIB=$(RANLIB)" \
95	"MAKEINFO=$(MAKEINFO)" \
96	"INSTALL=$(INSTALL)" \
97	"INSTALL_DATA=$(INSTALL_DATA)" \
98	"INSTALL_PROGRAM=$(INSTALL_PROGRAM)" \
99	"RUNTEST=$(RUNTEST)" \
100	"RUNTESTFLAGS=$(RUNTESTFLAGS)" \
101	"SHELL=$(SHELL)"
102
103# The use of $$(x_FOR_TARGET) reduces the command line length by not
104# duplicating the lengthy definition.
105TARGET_FLAGS_TO_PASS = \
106	"prefix=$(prefix)" \
107	"exec_prefix=$(exec_prefix)" \
108	"against=$(against)" \
109	'CC=$$(CC_FOR_TARGET)' \
110	"CC_FOR_TARGET=$(CC_FOR_TARGET)" \
111	"CFLAGS=$(CFLAGS)" \
112	"CHILLFLAGS=$(CHILLFLAGS)" \
113	'CHILL=$$(CHILL_FOR_TARGET)' \
114	"CHILL_FOR_TARGET=$(CHILL_FOR_TARGET)" \
115	"CHILL_LIB=$(CHILL_LIB)" \
116	'CXX=$$(CXX_FOR_TARGET)' \
117	"CXX_FOR_TARGET=$(CXX_FOR_TARGET)" \
118	"CXXFLAGS=$(CXXFLAGS)" \
119	"INSTALL=$(INSTALL)" \
120	"INSTALL_PROGRAM=$(INSTALL_PROGRAM)" \
121	"INSTALL_DATA=$(INSTALL_DATA)" \
122	"MAKEINFO=$(MAKEINFO)" \
123	"RUNTEST=$(RUNTEST)" \
124	"RUNTESTFLAGS=$(RUNTESTFLAGS)"
125
126
127all:
128	@rootme=`pwd` ; export rootme ; \
129	for dir in . `echo ${SUBDIRS} | sed 's/testsuite//'` ; do \
130		if [ "$$dir" = "." ]; then \
131			true; \
132		elif [ -d $$dir ]; then \
133			(cd $$dir; $(MAKE) $(FLAGS_TO_PASS)) || exit 1; \
134		else true; fi; \
135	done
136
137clean mostlyclean:
138	@rootme=`pwd` ; export rootme ; \
139	for dir in . ${SUBDIRS}; do \
140		if [ "$$dir" = "." ]; then \
141			true; \
142		elif [ -d $$dir ]; then \
143			(cd $$dir; $(MAKE) $(FLAGS_TO_PASS) $@) || exit 1; \
144		else true; fi; \
145	done
146
147distclean maintainer-clean realclean:
148	@rootme=`pwd` ; export rootme ; \
149	for dir in . ${SUBDIRS}; do \
150		if [ "$$dir" = "." ]; then \
151			true; \
152		elif [ -d $$dir ]; then \
153			(cd $$dir; $(MAKE) $(FLAGS_TO_PASS) $@) || exit 1; \
154		else true; fi; \
155	done
156	rm -f Makefile config.cache config.log config.status
157
158install:
159	@rootme=`pwd` ; export rootme ; \
160	for dir in . ${SUBDIRS}; do \
161		if [ "$$dir" = "." ]; then \
162			true; \
163		elif [ -d $$dir ]; then \
164			(cd $$dir; $(MAKE) $(FLAGS_TO_PASS) install) || exit 1; \
165		else true; fi; \
166	done
167
168installcheck:
169	@echo No installcheck target is available yet for the GNU simulators.
170
171installcheck:
172
173# The check target can not use subdir_do, because subdir_do does not
174# use TARGET_FLAGS_TO_PASS.
175check: force
176	@if [ -f testsuite/Makefile ]; then \
177	  rootme=`pwd`; export rootme; \
178	  rootsrc=`cd $(srcdir); pwd`; export rootsrc; \
179	  cd testsuite; \
180	  $(MAKE) $(TARGET_FLAGS_TO_PASS) check; \
181	else true; fi
182
183
184
185info:
186install-info:
187dvi:
188pdf:
189
190### 
191### 
192
193.NOEXPORT:
194MAKEOVERRIDES=
195
196.PHONY: check installcheck
197check:
198installcheck:
199
200TAGS:
201
202force:
203
204Makefile: Makefile.in config.status
205	$(SHELL) ./config.status
206
207config.status: configure
208	$(SHELL) ./config.status --recheck
209
210# Utility to run autoconf in each directory that uses the common framework.
211# This is intended to be invoked in $srcdir as
212# "make -f Makefile.in autoconf-common SHELL=/bin/sh".
213.PHONY: autoconf-common autoheader-common
214autoconf-common autoheader-common:
215	for d in * ; \
216	do \
217	    if [ -d $$d -a -f $$d/configure.ac ] ; \
218	    then \
219		 echo "Running autoconf in $$d ..." ; \
220		 (cd $$d && autoconf --force) ; \
221		 if [ $@ = autoheader-common ] && [ -f $$d/config.in ] ; \
222		 then \
223		   echo "Running autoheader in $$d ..." ; \
224		   (cd $$d && autoheader --force) ; \
225		 fi ; \
226	    fi ; \
227	done
228
229autoconf-changelog autoheader-changelog:
230	id=$(ID) ; \
231	test x$$id = x && id="`id | sed -e 's/^[^(]*(\([^)]*\).*$$/\1/'`" ; \
232	name=$(NAME) ; \
233	test x$$name = x && name=`grep "^$$id:" /etc/passwd | cut -f 5 -d ':'` ; \
234	host=$(HOST) ; \
235	test x$$host = x && host="`hostname`" ; \
236	date=$(DATE) ; \
237	test x$$date = x && date="`date +%Y-%m-%d`" ; \
238	echo "$$date $$name $$id@$$host" ; \
239	for d in * ; \
240	do \
241	    if [ -d $$d -a -f $$d/configure.ac ] ; \
242	    then \
243		 echo "Creating new-$(ChangeLog) in $$d ..." ; \
244		 ( echo "$$date  $$name  <$$id@$$host>" ; \
245		   echo "" ; \
246		   echo "	* configure: Regenerated to track ../common/aclocal.m4 changes." ; \
247		   if [ $@ = autoheader-changelog ] ; \
248		   then \
249		     echo "	* config.in: Ditto." ; \
250		   fi ; \
251		   echo "" ; \
252		   cat $$d/$(ChangeLog) \
253		 ) > $$d/new-$(ChangeLog) ; \
254	    fi ; \
255	done
256
257autoconf-install autoheader-install:
258	for d in * ; \
259	do \
260	    if [ -d $$d -a -f $$d/configure.ac ] ; \
261	    then \
262		 echo "Moving $$d/new-$(ChangeLog) to $$d/$(ChangeLog) ..." ; \
263		 mv $$d/new-$(ChangeLog) $$d/$(ChangeLog) ; \
264	    fi ; \
265	done
266