1 # Top level makefile fragment for TREELANG For GCC. -*- makefile -*-
3 # Copyright (C) 1994, 1995, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2006
4 # Free Software Foundation, Inc.
6 #This file is part of GCC.
8 #GCC is free software; you can redistribute it and/or modify
9 #it under the terms of the GNU General Public License as published by
10 #the Free Software Foundation; either version 2, or (at your option)
13 #GCC is distributed in the hope that it will be useful,
14 #but WITHOUT ANY WARRANTY; without even the implied warranty of
15 #MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16 #GNU General Public License for more details.
18 #You should have received a copy of the GNU General Public License
19 #along with GCC; see the file COPYING. If not, write to
20 #the Free Software Foundation, 51 Franklin Street, Fifth Floor,
21 #Boston, MA 02110-1301, USA.
23 # This file provides the language dependent support in the main Makefile.
24 # Each language makefile fragment must provide the following targets:
26 # foo.all.build, foo.all.cross, foo.start.encap, foo.rest.encap,
27 # foo.install-normal, foo.install-common, foo.install-man,
28 # foo.uninstall, foo.distdir,
29 # foo.mostlyclean, foo.clean, foo.distclean,
30 # foo.maintainer-clean, foo.stage1, foo.stage2, foo.stage3, foo.stage4
32 # where `foo' is the name of the language.
34 # It should also provide rules for:
36 # - making any compiler driver (eg: gcc)
37 # - the compiler proper (eg: tree1)
38 # - define the names for selecting the language in LANGUAGES.
41 ## note program-prefix and program-suffix options are not supported
42 ## just program_transform_name which is a sed script to transform the
48 GCC_EXTRAS = -B./ -B$(build_tooldir)/bin/ -isystem $(build_tooldir)/include
50 # ./xgcc is the just built compiler. See GCC_FOR_TARGET in the GCC Makefile.in.
51 # If this can't be found, you probably have not done a bootstrap of GCC,
52 # which you need to do.
54 # GCC_FOR_TREELANG = ./xgcc $(GCC_EXTRAS)
56 TREE_GENERATED = lex.c parse.c parse.h parse.output
57 # We need to use something other than treelang here because the directory
61 #strict warnings for treelang
62 treelang-warn = $(STRICT_WARN)
63 # bison emits some unused static arrays (yytoknum)
64 treelang/parse.o-warn = -Wno-error
65 # flex produces 'no previous prototype' warnings
66 treelang/lex.o-warn = -Wno-error
69 # Define the names for selecting treelang in LANGUAGES.
71 .phony: treelang TREELANG
73 treelang TREELANG:treelang.done
75 treelang.done: gtreelang$(exeext) tree1$(exeext)
76 $(STAMP) treelang.done
81 tree1$(exeext): treelang/tree1.o treelang/treetree.o treelang/tree-convert.o \
82 treelang/lex.o treelang/parse.o \
83 $(BACKEND) $(LIBSDEPS) attribs.o
84 $(CC) $(ALL_CFLAGS) $(LDFLAGS) -o $@ \
85 treelang/tree1.o treelang/treetree.o treelang/tree-convert.o \
86 treelang/lex.o treelang/parse.o \
87 $(BACKEND) $(LIBS) attribs.o
89 # Create the compiler driver treelang.
90 gtreelang$(exeext): gcc.o version.o prefix.o intl.o $(EXTRA_GCC_OBJS) \
91 $(LIBDEPS) treelang/spec.o
92 $(CC) $(ALL_CFLAGS) $(LDFLAGS) -o $@ treelang/spec.o \
93 gcc.o version.o prefix.o intl.o $(EXTRA_GCC_OBJS) $(LIBS)
98 # Compiling object files from source files.
102 treelang/tree1.o: treelang/tree1.c $(CONFIG_H) $(SYSTEM_H) coretypes.h $(TM_H) \
103 flags.h toplev.h $(GGC_H) $(TREE_H) diagnostic.h treelang/treelang.h \
104 input.h treelang/treetree.h options.h opts.h \
105 treelang/treetree.h gt-treelang-tree1.h gtype-treelang.h
107 treelang/treetree.o: treelang/treetree.c $(CONFIG_H) $(SYSTEM_H) coretypes.h \
108 $(TM_H) $(TREE_H) flags.h output.h $(RTL_H) $(GGC_H) toplev.h \
109 varray.h $(LANGHOOKS_DEF_H) langhooks.h treelang/treelang.h input.h \
110 treelang/treetree.h treelang/parse.h
112 treelang/tree-convert.o: treelang/tree-convert.c $(CONFIG_H) $(SYSTEM_H) \
113 coretypes.h diagnostic.h $(TREE_H) flags.h toplev.h langhooks.h $(TM_H)
115 treelang/spec.o: treelang/spec.c $(CONFIG_H) $(SYSTEM_H) \
116 coretypes.h diagnostic.h $(TREE_H) flags.h toplev.h langhooks.h $(TM_H)
118 treelang/parse.o: treelang/parse.c $(CONFIG_H) $(SYSTEM_H) coretypes.h \
119 $(TM_H) diagnostic.h treelang/treelang.h input.h treelang/treetree.h \
122 treelang/lex.o: treelang/lex.c $(CONFIG_H) $(SYSTEM_H) coretypes.h \
123 $(TM_H) diagnostic.h $(TREE_H) treelang/treelang.h input.h \
124 treelang/parse.h toplev.h
126 # generated files the files from lex and yacc are put into the source
127 # directory in case someone wants to build but does not have
130 treelang.srcextra: treelang/parse.c treelang/parse.h treelang/lex.c
131 -cp -p $^ $(srcdir)/treelang
133 treelang/lex.c: treelang/lex.l
134 -$(FLEX) $(FLEXFLAGS) -o$@ $<
136 treelang/parse.c treelang/parse.h treelang/parse.output: treelang/parse.y
137 -$(BISON) $(BISONFLAGS) -v --defines --output=treelang/parse.c $<
141 gt-treelang-tree1.h gtype-treelang.h : s-gtype; @true
146 treelang.all.build: treelang
148 _error_not_here_yet - havent even thought about it - it may even work
150 treelang.start.encap:
156 cd $(srcdir)/treelang; etags -o TAGS.sub *.y *.l *.c *.h; \
157 etags --include TAGS.sub --include ../TAGS.sub
159 treelang.info: doc/treelang.info
161 treelang.srcinfo: doc/treelang.info
162 -cp -p $^ $(srcdir)/doc
164 dvi:: doc/treelang.dvi
166 TEXI_TREELANG_FILES = treelang/treelang.texi \
167 $(docdir)/include/gcc-common.texi \
168 $(docdir)/include/gpl.texi \
169 $(docdir)/include/fdl.texi \
170 $(docdir)/include/funding.texi \
173 doc/treelang.info: $(TEXI_TREELANG_FILES)
174 $(MAKEINFO) $(MAKEINFOFLAGS) -I $(docdir)/include -o $@ $<
176 doc/treelang.dvi: $(TEXI_TREELANG_FILES)
177 $(TEXI2DVI) -I $(abs_docdir)/include -o $@ $<
179 html:: $(htmldir)/treelang/index.html
181 $(htmldir)/treelang/index.html: $(TEXI_TREELANG_FILES)
182 $(mkinstalldirs) $(@D)
184 $(TEXI2HTML) -I $(docdir)/include -I $(srcdir)/treelang -o $(@D) $<
189 # Nothing to do here.
190 treelang.install-normal: treelang.install.common
193 .phony:treelang.install.common
194 .phony:treelang.install
196 treelang.install treelang.install.common treelang.install-common: treelang.install.common.done
198 treelang.install.common.done: installdirs treelang.done
199 for name in $(TREE_EXES); \
201 if [ -f $$name ] ; then \
202 name2="`echo \`basename $$name\` | sed -e '$(program_transform_name)' `"; \
203 rm -f $(DESTDIR)$(bindir)/$$name2$(exeext); \
204 echo $(INSTALL_PROGRAM) $$name$(exeext) $(DESTDIR)$(bindir)/$$name2$(exeext); \
205 $(INSTALL_PROGRAM) $$name$(exeext) $(DESTDIR)$(bindir)/$$name2$(exeext); \
206 chmod a+x $(DESTDIR)$(bindir)/$$name2$(exeext); \
209 $(STAMP) treelang.install.common.done
211 # We might not be able to build the info files
212 install-info:: $(DESTDIR)$(infodir)/treelang.info
214 treelang.install-man:
217 for name in $(TREE_EXES); \
220 name2="`echo $$name | sed -e '$(program_transform_name)' `"; \
221 echo becomes $$name2; \
222 echo -rm -rf $(DESTDIR)$(bindir)/$$name2$(exeext); \
223 rm -rf $(DESTDIR)$(bindir)/$$name2$(exeext); \
225 -rm treelang.install.common.done
229 # A lot of the ancillary files are deleted by the main makefile.
230 # We just have to delete files specific to us.
232 treelang.mostlyclean:
233 for name in $(TREE_EXES); \
235 echo deleting $$name; \
236 if [ -f treelang/$$name$(exeext) ] ; then \
237 rm -f treelang/$$name$(exeext); \
240 -rm -f treelang/*$(objext)
241 -rm -f treelang/*$(coverageexts)
245 treelang.clean: treelang.mostlyclean
247 treelang.distclean: treelang.clean
248 -rm -f treelang/config.status
249 -rm -f treelang/*.output
251 treelang.maintainer-clean: treelang.distclean
252 for name in $(TREE_GENERATED); \
254 if [ -f $(srcdir)/treelang/$$name ] ; then \
255 echo deleting $(srcdir)/treelang/$$name; \
256 rm -f $(srcdir)/treelang/$$name; \
259 -rm -R $(srcdir)/treelang/*~
264 # The main makefile has already created stage?/treelang.
266 treelang.stage1: stage1-start
267 -mv treelang/*$(objext) stage1/treelang
268 treelang.stage2: stage2-start
269 -mv treelang/*$(objext) stage2/treelang
270 treelang.stage3: stage3-start
271 -mv treelang/*$(objext) stage3/treelang
272 treelang.stage4: stage4-start
273 -mv treelang/*$(objext) stage4/treelang
274 treelang.stageprofile: stageprofile-start
275 -mv treelang/*$(objext) stageprofile/treelang
276 treelang.stagefeedback: stagefeedback-start
277 -mv treelang/*$(objext) stagefeedback/treelang
281 # This target creates the files that can be rebuilt, but go in the
282 # distribution anyway. It then copies the files to the distdir directory.
284 # not here yet sorry not sure if this is needed or not???
288 check-treelang: treelang.check
290 TESTSUITEDIR = testsuite
292 treelang.check: $(TESTSUITEDIR)/site.exp
293 -mkdir testsuite/treelang
295 # these three files are empty and it seems diff has trouble generating
296 # patch files for new empty files as required for cvs.
297 # STAMP does not cut it here as I need an empty file.
298 -rootme=`${PWD_COMMAND}`; export rootme; \
299 srcdir=`cd ${srcdir}; ${PWD_COMMAND}` ; export srcdir ; \
301 EXPECT=${EXPECT} ; export EXPECT ; \
302 if [ -f $${rootme}/../expect/expect ] ; then \
303 TCL_LIBRARY=`cd .. ; cd ${srcdir}/../tcl/library ; ${PWD_COMMAND}` ; \
304 export TCL_LIBRARY ; fi ; \
305 PATH=`cd ..;${PWD_COMMAND}`:$$PATH; export PATH; \
306 gcc_extras="-B`cd ..;${PWD_COMMAND}` -B`cd ..;${PWD_COMMAND}`/treelang"; export gcc_extras; \
307 $(RUNTEST) --tool treelang $(RUNTESTFLAGS)
309 # copy the output files from the current test to source ie say the new results are OK
310 treelang.check.fix: force
311 srcdir=`cd ${srcdir}; ${PWD_COMMAND}` ; export srcdir ;
312 -cp testsuite/treelang/*.out* t
313 -cp testsuite/treelang/*runpgm* t
318 config.status: treelang/config-lang.in