1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
|
# Top level makefile fragment for TREELANG For GCC. -*- makefile -*-
# Copyright (C) 1994, 1995, 1997, 1998, 1999, 2000, 2001, 2002, 2003
# Free Software Foundation, Inc.
#This file is part of GCC.
#GCC 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.
#GCC 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 GCC; see the file COPYING. If not, write to
#the Free Software Foundation, 59 Temple Place - Suite 330,
#Boston, MA 02111-1307, USA.
# This file provides the language dependent support in the main Makefile.
# Each language makefile fragment must provide the following targets:
#
# foo.all.build, foo.all.cross, foo.start.encap, foo.rest.encap,
# foo.info, foo.dvi,
# foo.install-normal, foo.install-common, foo.install-info, foo.install-man,
# foo.uninstall, foo.distdir,
# foo.mostlyclean, foo.clean, foo.distclean, foo.extraclean,
# foo.maintainer-clean, foo.stage1, foo.stage2, foo.stage3, foo.stage4
#
# where `foo' is the name of the language.
#
# It should also provide rules for:
#
# - making any compiler driver (eg: GCC)
# - the compiler proper (eg: treelang)
# - define the names for selecting the language in LANGUAGES.
#
## note program-prefix and program-suffix options are not supported
## just program_transform_name which is a sed script to transform the
## names
TREELANGSED = sed
TREELANGSEDFLAGS = -n
# back end compiler libraries etc
TREE_BE_LIBS = $(BACKEND) $(LIBIBERTY) $(INTLLIBS) $(LIBS) $(LIBDEPS)
GCC_EXTRAS = -B./ -B$(build_tooldir)/bin/ -isystem $(build_tooldir)/include
# ./xgcc is the just built compiler. See GCC_FOR_TARGET in the GCC Makefile.in.
# If this can't be found, you probably have not done a bootstrap of GCC,
# which you need to do.
# GCC_FOR_TREELANG = ./xgcc $(GCC_EXTRAS)
TREE_GENERATED = $(srcdir)/treelang/lex.c $(srcdir)/treelang/parse.c\
$(srcdir)/treelang/parse.h $(srcdir)/treelang/parse.output $(srcdir)/treelang/TAGS
TREE_SOURCE = ${srcdir}/treelang/parse.y ${srcdir}/treelang/lex.l ${srcdir}/treelang/tree1.c ${srcdir}/treelang/treelang.h ${srcdir}/treelang/treetree.c $(srcdir)/treelang/treetree.h
TREE_EXES = tree1$(exeext)
#no -Wtraditional warnings, allow long long
treelang-warn = $(LOOSE_WARN) -pedantic -Wno-long-long -Wmissing-prototypes -Wmissing-declarations
# bison emits some unused static arrays (yytoknum)
treelang/parse.o-warn = -Wno-error
#
# Define the names for selecting treelang in LANGUAGES.
.phony: treelang TREELANG
treelang TREELANG:treelang.done
treelang.done: tree1$(exeext)
$(STAMP) treelang.done
# no preprocessor
# core compiler
tree1$(exeext): treelang/tree1.o treelang/treetree.o treelang/lex.o treelang/parse.o\
$(TREE_BE_LIBS) c-convert.o c-typeck.o c-common.o c-decl.o attribs.o
$(CC) $(ALL_CFLAGS) $(LDFLAGS) -o $@ \
treelang/tree1.o treelang/treetree.o treelang/lex.o treelang/parse.o c-convert.o\
c-typeck.o c-common.o c-decl.o attribs.o $(TREE_BE_LIBS)
#
# Compiling object files from source files.
# object file makes
treelang/tree1.o: treelang/tree1.c $(CONFIG_H) $(SYSTEM_H) coretypes.h $(TM_H) \
flags.h toplev.h $(GGC_H) $(TREE_H) diagnostic.h treelang/treelang.h \
treelang/treetree.h \
treelang/treetree.h gt-treelang-tree1.h gtype-treelang.h
treelang/treetree.o: treelang/treetree.c $(CONFIG_H) $(SYSTEM_H) coretypes.h \
$(TM_H) $(TREE_H) flags.h output.h $(C_TREE_H) $(RTL_H) $(GGC_H) toplev.h \
varray.h $(LANGHOOKS_DEF_H) langhooks.h treelang/treelang.h \
treelang/treetree.h treelang/parse.h
treelang/parse.o: treelang/parse.c $(CONFIG_H) $(SYSTEM_H) coretypes.h \
$(TM_H) diagnostic.h treelang/treelang.h treelang/treetree.h
treelang/lex.o: treelang/lex.c $(CONFIG_H) $(SYSTEM_H) coretypes.h \
$(TM_H) diagnostic.h $(TREE_H) treelang/treelang.h treelang/parse.h
# generated files the files from lex and yacc are put into the source
# directory in case someone wants to build but does not have
# lex/yacc
$(srcdir)/treelang/lex.c: $(srcdir)/treelang/lex.l
$(LEX) $(LEXFLAGS) -o$(srcdir)/treelang/lex.c $(srcdir)/treelang/lex.l
$(srcdir)/treelang/parse.c $(srcdir)/treelang/parse.h: $(srcdir)/treelang/parse.y
$(BISON) $(BISONFLAGS) -v $(srcdir)/treelang/parse.y\
--output=$(srcdir)/treelang/parse.c --defines
# -v
gt-treelang-tree1.h gtype-treelang.h : s-gtype; @true
#
# Build hooks:
treelang.all.build: treelang
treelang.all.cross:
_error_not_here_yet - havent even thought about it - it may even work
treelang.start.encap:
treelang.rest.encap:
.phony:treelang.info
treelang.info: $(srcdir)/treelang/treelang.info
$(srcdir)/treelang/treelang.info: $(srcdir)/treelang/treelang.texi \
$(srcdir)/doc/include/gcc-common.texi \
$(srcdir)/doc/include/gpl.texi \
$(srcdir)/doc/include/fdl.texi \
$(srcdir)/doc/include/funding.texi
cd $(srcdir) && $(MAKEINFO) $(MAKEINFOFLAGS) -Idoc/include \
-o treelang/treelang.info treelang/treelang.texi
treelang.dvi: $(srcdir)/treelang/treelang.texi \
$(srcdir)/doc/include/gcc-common.texi \
$(srcdir)/doc/include/gpl.texi \
$(srcdir)/doc/include/fdl.texi \
$(srcdir)/doc/include/funding.texi
s=`cd $(srcdir); ${PWD}`; export s; \
cd treelang && $(TEXI2DVI) -I $$s/doc/include $$s/treelang/treelang.texi
treelang.generated-manpages:
#
# Install hooks:
# Nothing to do here.
treelang.install-normal: treelang.install.common
# Install
.phony:treelang.install.common
.phony:treelang.install
treelang.install treelang.install.common treelang.install-common: treelang.install.common.done
treelang.install.common.done: installdirs treelang.done
for name in $(TREE_EXES); \
do \
if [ -f $$name ] ; then \
name2="`echo \`basename $$name\` | sed -e '$(program_transform_name)' `"; \
rm -f $(DESTDIR)$(bindir)/$$name2$(exeext); \
echo $(INSTALL_PROGRAM) $$name$(exeext) $(DESTDIR)$(bindir)/$$name2$(exeext); \
$(INSTALL_PROGRAM) $$name$(exeext) $(DESTDIR)$(bindir)/$$name2$(exeext); \
chmod a+x $(DESTDIR)$(bindir)/$$name2$(exeext); \
fi ; \
done
$(STAMP) treelang.install.common.done
# We might not be able to build the info files
.PHONY: treelang.
treelang.:
treelang.install-info: treelang.$(BUILD_INFO)
if [ -f $(srcdir)/treelang/treelang.info ] ; then \
rm -f $(DESTDIR)$(infodir)/treelang.info*; \
for f in $(srcdir)/treelang/treelang.info*; do \
realfile=`echo $$f | sed -e 's|.*/\([^/]*\)$$|\1|'`; \
$(INSTALL_DATA) $$f $(DESTDIR)$(infodir)/$$realfile; \
done; \
chmod a-x $(DESTDIR)$(infodir)/treelang.info*; \
else true; fi
@if [ -f $(srcdir)/treelang/treelang.info ] ; then \
if $(SHELL) -c 'install-info --version | sed 1q | fgrep -s -v -i debian' >/dev/null 2>&1; then \
echo " install-info --info-dir=$(DESTDIR)$(infodir) $(DESTDIR)$(infodir)/treelang.info"; \
install-info --info-dir=$(DESTDIR)$(infodir) $(DESTDIR)$(infodir)/treelang.info || : ; \
else : ; fi; \
else : ; fi
treelang.install-man:
treelang.uninstall:
for name in $(TREE_EXES); \
do \
echo $$name; \
name2="`echo $$name | sed -e '$(program_transform_name)' `"; \
echo becomes $$name2; \
echo -rm -rf $(DESTDIR)$(bindir)/$$name2$(exeext); \
rm -rf $(DESTDIR)$(bindir)/$$name2$(exeext); \
done
-rm treelang.install.common.done
#
# Clean hooks:
# A lot of the ancillary files are deleted by the main makefile.
# We just have to delete files specific to us.
treelang.mostlyclean:
for name in $(TREE_EXES); \
do \
echo deleting $$name; \
if [ -f treelang/$$name$(exeext) ] ; then \
rm -f treelang/$$name$(exeext); \
fi ; \
done
-rm -f treelang/*$(objext)
-rm -f treelang/*$(coverageexts)
-rm treelang.done
treelang.clean: treelang.mostlyclean
treelang.distclean: treelang.clean
-rm -f treelang/config.status
-rm -f treelang/*.output
treelang.extraclean: treelang.distclean
treelang.maintainer-clean: treelang.extraclean
for name in $(TREE_GENERATED); \
do \
if [ -f $(srcdir)/treelang/$$name ] ; then \
echo deleting $(srcdir)/treelang/$$name; \
rm -f $(srcdir)/treelang/$$name; \
fi ; \
done
-rm -R $(srcdir)/treelang/*~
#
# Stage hooks:
# The main makefile has already created stage?/treelang.
treelang.stage1: stage1-start
-mv treelang/*$(objext) stage1/treelang
treelang.stage2: stage2-start
-mv treelang/*$(objext) stage2/treelang
treelang.stage3: stage3-start
-mv treelang/*$(objext) stage3/treelang
treelang.stage4: stage4-start
-mv treelang/*$(objext) stage4/treelang
#
# Maintenance hooks:
# This target creates the files that can be rebuilt, but go in the
# distribution anyway. It then copies the files to the distdir directory.
treelang.distdir:
# not here yet sorry not sure if this is needed or not???
# test hook
# the other languages are hard coded in the main makefile.in - that seems to be wrong
check-treelang: treelang.check
TESTSUITEDIR = testsuite
treelang.check: $(TESTSUITEDIR)/site.exp
-mkdir testsuite/treelang
# these three files are empty and it seems diff has trouble generating
# patch files for new empty files as required for cvs.
# STAMP does not cut it here as I need an empty file.
touch $(srcdir)/testsuite/treelang/{a01gcco01runpgmerr,a01gcc.out01,a01gcc.out01err}
-rootme=`${PWD}`; export rootme; \
srcdir=`cd ${srcdir}; ${PWD}` ; export srcdir ; \
cd testsuite; \
EXPECT=${EXPECT} ; export EXPECT ; \
TRANSFORM=$(program_transform_name); export TRANSFORM; \
if [ -f $${rootme}/../expect/expect ] ; then \
TCL_LIBRARY=`cd .. ; cd ${srcdir}/../tcl/library ; ${PWD}` ; \
export TCL_LIBRARY ; fi ; \
PATH=`cd ..;${PWD}`:$$PATH; export PATH; \
gcc_extras="-B`cd ..;${PWD}` -B`cd ..;${PWD}`/treelang"; export gcc_extras; \
$(RUNTEST) --tool treelang $(RUNTESTFLAGS)
rm $(srcdir)/testsuite/treelang/{a01gcco01runpgmerr,a01gcc.out01,a01gcc.out01err}
# GCC_EXTRAS="$(GCC_EXTRAS)"; export GCC_EXTRAS; \
# copy the output files from the current test to source ie say the new results are OK
treelang.check.fix: force
srcdir=`cd ${srcdir}; ${PWD}` ; export srcdir ;
-cp testsuite/treelang/*.out* t
-cp testsuite/treelang/*runpgm* t
-rm -f t/*nofilename
treelang.wc: force
wc ${TREE_SOURCE}
#
# Update the tags table for emacs find label (alt-.) function
TAGS: treelang.tags
.PHONY: treelang.tags
treelang.tags:
cd $(srcdir)/treelang; \
etags -l c ${TREE_SOURCE}
.PHONY: treelang.html
treelang.html:
cd $(srcdir)/treelang && texi2html -I ../doc/include -verbose -menu -split_chapter -number treelang.texi
# mv treelang*.html $(srcdir)/treelang
|