]> git.ipfire.org Git - people/ms/gcc.git/blame - gcc/m2/Make-lang.in
[modula2] Add $(CXX_FLAGS) to the bootstrap tool rules.
[people/ms/gcc.git] / gcc / m2 / Make-lang.in
CommitLineData
1eee94d3
GM
1# Top level -*- makefile -*- fragment for GNU M2.
2
83ffe9cd 3# Copyright (C) 2000-2023 Free Software Foundation, Inc.
1eee94d3
GM
4
5#This file is part of GCC.
6
7#GCC 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, or (at your option)
10#any later version.
11
12#GCC 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 GCC; see the file COPYING3. If not see
19#<http://www.gnu.org/licenses/>.
20
21# Actual names to use when installing a native compiler.
22GM2_INSTALL_NAME = $(shell echo gm2|sed '$(program_transform_name)')
23GM2_TARGET_INSTALL_NAME = $(target_noncanonical)-$(shell echo gm2|sed '$(program_transform_name)')
24
25# Actual names to use when installing a cross-compiler.
26GM2_CROSS_NAME = `echo gm2|sed '$(program_transform_cross_name)'`
27
28M2_MAINTAINER = no
29
5b918b20 30GM2_1 = ./gm2 -B./m2/stage1 -g -fm2-g
1eee94d3
GM
31
32GM2_FOR_TARGET = $(STAGE_CC_WRAPPER) ./gm2 -B./ -B$(build_tooldir)/bin/ -L$(objdir)/../ld $(TFLAGS)
33
ebc41f9a
RO
34# FIXME: Get from gcc-plugin.m4 instead of hardcoding.
35ifeq (,$(findstring darwin,$(host)))
36 soext=.so
37else
38 soext=.dylib
39 PLUGINLDFLAGS = -Wl,-undefined,dynamic_lookup
40 PLUGINLDFLAGS += -Wl,-install_name,m2rte$(soext)
41 PLUGINLDFLAGS += -nodefaultlibs
42endif
43
8d2c5b61 44TEXISRC = $(srcdir)/doc/gm2.texi \
1eee94d3
GM
45 m2/gm2-libs.texi \
46 m2/gm2-ebnf.texi \
47 m2/SYSTEM-pim.texi \
48 m2/SYSTEM-iso.texi \
8d2c5b61
GM
49 m2/Builtins.texi \
50 m2/gpl_v3_without_node.texi
1eee94d3 51
8d2c5b61 52RSTSRC = $(srcdir)/doc/gm2.texi \
1eee94d3
GM
53 m2/gm2-libs.rst \
54 m2/gm2-ebnf.rst \
55 m2/SYSTEM-pim.rst \
56 m2/SYSTEM-iso.rst \
57 m2/Builtins.rst
58
59# Define the names for selecting modula-2 in LANGUAGES.
60m2 modula-2 modula2: gm2$(exeext) xgcc$(exeext) cc1gm2$(exeext) \
61 $(GCC_PASSES) $(GCC_PARTS)
62m2.serial = cc1gm2$(exeext)
63
64m2.srcinfo: doc/m2.info
65 -cp -p $^ $(srcdir)/doc
66
67ifeq ($(HAVE_PYTHON),yes)
68m2.srcextra: m2/SYSTEM-pim.texi m2/SYSTEM-iso.texi m2/gm2-libs.texi m2/gm2-ebnf.texi
69 -cp -p m2/SYSTEM-pim.texi $(srcdir)/m2
70 -cp -p m2/SYSTEM-iso.texi $(srcdir)/m2
71 -cp -p m2/gm2-libs.texi $(srcdir)/m2
72 -cp -p m2/gm2-ebnf.texi $(srcdir)/m2
1eee94d3
GM
73else
74m2.srcextra:
75endif
76
77m2.srcman: doc/gm2.1
78 -cp -p $^ $(srcdir)/doc
79
80# Tell GNU make to ignore these if they exist.
81.PHONY: m2 modula-2 modula2
82
83GM2_PROG_DEP=gm2$(exeext) xgcc$(exeext) cc1gm2$(exeext)
84
85include m2/config-make
86
87LIBSTDCXX=../$(TARGET_SUBDIR)/libstdc++-v3/src/.libs/libstdc++.a
88
89PGE=m2/pge$(exeext)
90
91SRC_PREFIX=G
92
93m2/gm2spec.o: $(srcdir)/m2/gm2spec.cc $(SYSTEM_H) $(GCC_H) $(CONFIG_H) \
94 m2/gm2config.h $(TARGET_H) $(PLUGIN_HEADERS) \
95 $(generated_files) $(C_TREE_H) insn-attr-common.h
96 (SHLIB_LINK='$(SHLIB_LINK)' \
97 SHLIB_MULTILIB='$(SHLIB_MULTILIB)'; \
98 $(COMPILER) $(ALL_COMPILERFLAGS) $(ALL_CPPFLAGS) $(INCLUDES) \
99 $(DRIVER_DEFINES) \
100 -DLIBSUBDIR=\"$(libsubdir)\" \
101 -DPREFIX=\"$(prefix)\" \
102 -c $(srcdir)/m2/gm2spec.cc $(OUTPUT_OPTION))
103
104# Create the compiler driver for M2.
105CFLAGS-m2/m2/gm2spec.o += $(DRIVER_DEFINES)
106
107GM2_OBJS = $(GCC_OBJS) prefix.o intl.o m2/gm2spec.o
108
109# Create the compiler driver for gm2.
110gm2$(exeext): $(GM2_OBJS) $(EXTRA_GCC_OBJS) libcommon-target.a $(LIBDEPS) \
111 m2/gm2config.h
112 +$(LINKER) $(ALL_LINKERFLAGS) $(LDFLAGS) -o $@ \
113 $(GM2_OBJS) $(EXTRA_GCC_OBJS) libcommon-target.a \
114 $(EXTRA_GCC_LIBS) $(LIBS)
115
116# Create a version of the gm2 driver which calls the cross-compiler.
117gm2-cross$(exeext): gm2$(exeext)
118 -rm -f gm2-cross$(exeext)
119 cp gm2$(exeext) gm2-cross$(exeext)
120
121po-generated:
122
123# Build hooks:
124
ebc41f9a 125m2.all.cross: gm2-cross$(exeext) plugin/m2rte$(soext)
1eee94d3 126
ebc41f9a 127m2.start.encap: gm2$(exeext) plugin/m2rte$(soext)
1eee94d3
GM
128m2.rest.encap:
129
130
131m2.info: doc/m2.info
132
133m2.man: doc/m2.1
134
135m2.install-man: $(DESTDIR)$(man1dir)/$(GM2_INSTALL_NAME)$(man1ext)
136
137$(DESTDIR)$(man1dir)/$(GM2_INSTALL_NAME)$(man1ext): doc/m2.1 installdirs
138 -rm -f $@
139 -$(INSTALL_DATA) $< $@
140 -chmod a-x $@
141
e15e8d43 142m2.dvi: doc/m2.dvi
1eee94d3 143
8d2c5b61 144doc/m2.dvi: $(TEXISRC) $(objdir)/m2/images/gnu.eps
e15e8d43
IS
145 $(TEXI2DVI) -c -I $(objdir)/m2 -I $(srcdir)/doc/include -o $@ $(srcdir)/doc/gm2.texi
146
147doc/m2.ps: doc/m2.dvi
1eee94d3
GM
148 dvips -o $@ $<
149
e15e8d43
IS
150m2.pdf: doc/m2.pdf
151
8d2c5b61 152doc/m2.pdf: $(TEXISRC) $(objdir)/m2/images/gnu.eps
e15e8d43 153 $(TEXI2PDF) -I $(objdir)/m2 -I $(srcdir)/doc/include $(srcdir)/doc/gm2.texi -o $@
1eee94d3 154
8d2c5b61
GM
155M2_PDFFILES = doc/m2.pdf
156
157m2.install-pdf: $(M2_PDFFILES)
158 @$(NORMAL_INSTALL)
159 test -z "$(pdfdir)/gcc" || $(mkinstalldirs) "$(DESTDIR)$(pdfdir)/gcc"
160 @list='$(M2_PDFFILES)'; for p in $$list; do \
161 if test -f "$$p"; then d=; else d="$(srcdir)/"; fi; \
162 f=$(pdf__strip_dir) \
163 echo " $(INSTALL_DATA) '$$d$$p' '$(DESTDIR)$(pdfdir)/gcc/$$f'"; \
164 $(INSTALL_DATA) "$$d$$p" "$(DESTDIR)$(pdfdir)/gcc/$$f"; \
165 done
166
1eee94d3
GM
167.INTERMEDIATE: m2.pod
168
8d2c5b61 169m2.pod: $(TEXISRC) $(objdir)/m2/images/gnu.eps
1eee94d3
GM
170 -$(TEXI2POD) -I $(objdir)/m2 -D m2 < $< > $@
171
8d2c5b61 172doc/m2.info: $(TEXISRC) $(objdir)/m2/images/gnu.eps
1eee94d3
GM
173 if test "x$(BUILD_INFO)" = xinfo; then \
174 rm -f doc/m2.info*; \
175 $(MAKEINFO) -I$(objdir)/m2 -I$(srcdir)/doc/include \
176 -o $@ $(srcdir)/doc/gm2.texi ; \
177 else true; fi
178
179$(objdir)/m2/images/gnu.eps: $(srcdir)/m2/images/gnupng
8d2c5b61 180 -test -d $(@D) || $(mkinstalldirs) $(@D)
1eee94d3
GM
181 cp $(srcdir)/m2/images/gnu.eps $@
182
8d2c5b61
GM
183m2.html: $(build_htmldir)/m2/index.html
184
185$(build_htmldir)/m2/index.html: $(TEXISRC) $(objdir)/m2/images/gnu.eps
186 $(mkinstalldirs) $(@D)
187 rm -f $(@D)/*
188 $(TEXI2HTML) -I $(objdir)/m2 -I $(srcdir)/m2 -I $(gcc_docdir)/include -o $(@D) $<
189
1eee94d3
GM
190# gm2-libs.texi
191
192m2/gm2-libs.texi: gm2-libs.texi-check; @true
193
194ifeq ($(HAVE_PYTHON),yes)
195gm2-libs.texi-check: m2/SYSTEM-pim.texi m2/SYSTEM-iso.texi m2/Builtins.texi \
196 $(objdir)/m2/gm2-libs-coroutines/SYSTEM.def
8d2c5b61
GM
197 -test -d m2/gm2-libs-log || $(mkinstalldirs) m2/gm2-libs-log
198 -test -d m2/gm2-libs-iso || $(mkinstalldirs) m2/gm2-libs-iso
199 -test -d m2/gm2-libs || $(mkinstalldirs) m2/gm2-libs
1eee94d3
GM
200 $(PYTHON) $(srcdir)/m2/tools-src/def2doc.py -t -uLibraries -s$(srcdir)/m2 -b$(objdir)/m2 -o $(objdir)/m2/gm2-libs.texi
201else
202gm2-libs.texi-check:
af4f6816 203 cp $(srcdir)/m2/target-independent/m2/gm2-libs.texi $(objdir)/m2/gm2-libs.texi
1eee94d3
GM
204endif
205 $(STAMP) gm2-libs.texi-check
206
207# gm2-libs.rst
208
209m2/gm2-libs.rst: gm2-libs.rst-check; @true
210
211ifeq ($(HAVE_PYTHON),yes)
212gm2-libs.rst-check: m2/SYSTEM-pim.texi m2/SYSTEM-iso.texi m2/Builtins.texi \
213 $(objdir)/m2/gm2-libs-coroutines/SYSTEM.def
214 $(PYTHON) $(srcdir)/m2/tools-src/def2doc.py -x -uLibraries -s$(srcdir)/m2 -b$(objdir)/m2 -o $(objdir)/m2/gm2-libs.rst
215else
216gm2-libs.rst-check:
af4f6816 217 cp $(srcdir)/m2/target-independent/m2/gm2-libs.rst $(objdir)/m2/gm2-libs.rst
1eee94d3
GM
218endif
219 $(STAMP) gm2-libs.rst-check
220
221# gm2-ebnf.texi
222
223m2/gm2-ebnf.texi: gm2-ebnf.texi-check; @true
224
225gm2-ebnf.texi-check: $(PGE) $(srcdir)/m2/gm2-compiler/P0SyntaxCheck.bnf
226 $(PGE) -c -p -t -f $(srcdir)/m2/gm2-compiler/P0SyntaxCheck.bnf -o m2/gm2-ebnf.texi
227 $(STAMP) gm2-ebnf.texi-check
228
229# gm2-ebnf.rst
230
231m2/gm2-ebnf.rst: gm2-ebnf.rst-check; @true
232
233gm2-ebnf.rst-check: $(PGE) $(srcdir)/m2/gm2-compiler/P0SyntaxCheck.bnf
234 $(PGE) -c -p -t -f $(srcdir)/m2/gm2-compiler/P0SyntaxCheck.bnf -o m2/gm2-ebnf.rst
235 $(STAMP) gm2-ebnf.rst-check
236
237# SYSTEM-pim.texi
238
239m2/SYSTEM-pim.texi: SYSTEM-pim-texi-check; @true
240
241ifeq ($(HAVE_PYTHON),yes)
242SYSTEM-pim-texi-check: $(objdir)/m2/gm2-libs/SYSTEM.def
243 $(PYTHON) $(srcdir)/m2/tools-src/def2doc.py -t -b$(objdir)/m2 -f$(objdir)/m2/gm2-libs/SYSTEM.def -o $(objdir)/m2/SYSTEM-pim.texi
244else
245SYSTEM-pim-texi-check: $(objdir)/m2/gm2-libs/SYSTEM.def
af4f6816 246 cp $(srcdir)/m2/target-independent/m2/SYSTEM-pim.texi $(objdir)/m2/SYSTEM-pim.texi
1eee94d3
GM
247endif
248 $(STAMP) SYSTEM-pim-texi-check
249
250# SYSTEM-pim.rst
251
252m2/SYSTEM-pim.rst: SYSTEM-pim-rst-check; @true
253
254ifeq ($(HAVE_PYTHON),yes)
255SYSTEM-pim-rst-check: $(objdir)/m2/gm2-libs/SYSTEM.def
256 $(PYTHON) $(srcdir)/m2/tools-src/def2doc.py -x -b$(objdir)/m2 -f$(objdir)/m2/gm2-libs/SYSTEM.def -o $(objdir)/m2/SYSTEM-pim.rst
257else
258SYSTEM-pim-rst-check: $(objdir)/m2/gm2-libs/SYSTEM.def
af4f6816 259 cp $(srcdir)/m2/target-independent/m2/SYSTEM-pim.rst $(objdir)/m2/SYSTEM-pim.rst
1eee94d3
GM
260endif
261 $(STAMP) SYSTEM-pim-rst-check
262
263# SYSTEM-pim.texi
264
265m2/SYSTEM-iso.texi: SYSTEM-iso.texi-check; @true
266
267ifeq ($(HAVE_PYTHON),yes)
268SYSTEM-iso.texi-check: $(objdir)/m2/gm2-libs-iso/SYSTEM.def
269 $(PYTHON) $(srcdir)/m2/tools-src/def2doc.py -t -b$(objdir)/m2 -f$(objdir)/m2/gm2-libs-iso/SYSTEM.def -o $(objdir)/m2/SYSTEM-iso.texi
270else
271SYSTEM-iso.texi-check: $(objdir)/m2/gm2-libs-iso/SYSTEM.def
af4f6816 272 cp $(srcdir)/m2/target-independent/m2/SYSTEM-iso.texi $(objdir)/m2/SYSTEM-iso.texi
1eee94d3
GM
273endif
274 $(STAMP) SYSTEM-iso.texi-check
275
276# SYSTEM-pim.rst
277
278m2/SYSTEM-iso.rst: SYSTEM-iso.rst-check; @true
279
280ifeq ($(HAVE_PYTHON),yes)
281SYSTEM-iso.rst-check: $(objdir)/m2/gm2-libs-iso/SYSTEM.def
282 $(PYTHON) $(srcdir)/m2/tools-src/def2doc.py -x -b$(objdir)/m2 -f$(objdir)/m2/gm2-libs-iso/SYSTEM.def -o $(objdir)/m2/SYSTEM-iso.rst
283else
284SYSTEM-iso.rst-check: $(objdir)/m2/gm2-libs-iso/SYSTEM.def
af4f6816 285 cp $(srcdir)/m2/target-independent/m2/SYSTEM-iso.rst $(objdir)/m2/SYSTEM-iso.rst
1eee94d3
GM
286endif
287 $(STAMP) SYSTEM-iso.rst-check
288
289
290# m2/Builtins.texi
291
292m2/Builtins.texi: Builtins.texi-check; @true
293
294ifeq ($(HAVE_PYTHON),yes)
295Builtins.texi-check: m2/gm2-libs/Builtins.def
296 $(PYTHON) $(srcdir)/m2/tools-src/def2doc.py -t -b./ -f$(srcdir)/m2/gm2-libs/Builtins.def -o $(objdir)/m2/Builtins.texi
297else
298Builtins.texi-check: m2/gm2-libs/Builtins.def
af4f6816 299 cp $(srcdir)/m2/target-independent/m2/Builtins.texi $(objdir)/m2/Builtins.texi
1eee94d3
GM
300endif
301 $(STAMP) Builtins.texi-check
302
303# m2/Builtins.rst
304
305m2/Builtins.rst: Builtins.rst-check; @true
306
307ifeq ($(HAVE_PYTHON),yes)
308Builtins.rst-check: m2/gm2-libs/Builtins.def
309 $(PYTHON) $(srcdir)/m2/tools-src/def2doc.py -x -b./ -f$(srcdir)/m2/gm2-libs/Builtins.def -o $(objdir)/m2/Builtins.rst
310else
311Builtins.rst-check: m2/gm2-libs/Builtins.def
af4f6816 312 cp $(srcdir)/m2/target-independent/m2/Builtins.rst $(objdir)/m2/Builtins.rst
1eee94d3
GM
313endif
314 $(STAMP) Builtins.rst-check
315
8d2c5b61
GM
316m2/gpl_v3_without_node.texi: doc/include/gpl_v3.texi
317 grep -v "^@node" $< > $@
318
5b918b20
GM
319# Stage hooks:
320# The toplevel makefile has already created stage?/m2 at this point.
1eee94d3 321
5b918b20
GM
322m2.stage1: stage1-start
323 -mv m2/*$(objext) stage1/m2
324m2.stage2: stage2-start
325 -mv m2/*$(objext) stage2/m2
326m2.stage3: stage3-start
327 -mv m2/*$(objext) stage3/m2
328m2.stage4: stage4-start
329 -mv m2/*$(objext) stage4/m2
330m2.stageprofile: stageprofile-start
331 -mv m2/*$(objext) stageprofile/m2
332m2.stagefeedback: stageprofile-start
333 -mv m2/*$(objext) stagefeedback/m2
1eee94d3
GM
334
335# No gm2-specific selftests
336selftest-m2:
337
338# Install hooks:
339# cc1gm2 is installed elsewhere as part of $(COMPILERS).
340# $(COMPILERS) is defined in `config-lang.in'
341
342m2.install-common: installdirs
343 -rm -f $(DESTDIR)$(bindir)/$(GM2_INSTALL_NAME)$(exeext)
344 $(INSTALL_PROGRAM) gm2$(exeext) $(DESTDIR)$(bindir)/$(GM2_INSTALL_NAME)$(exeext)
345 -if test -f cc1gm2$(exeext); then \
346 if test -f gm2-cross$(exeext); then \
347 :; \
348 else \
349 rm -f $(DESTDIR)$(bindir)/$(GM2_TARGET_INSTALL_NAME)$(exeext); \
350 ( cd $(DESTDIR)$(bindir) && \
351 $(LN) $(GM2_INSTALL_NAME)$(exeext) $(GM2_TARGET_INSTALL_NAME)$(exeext) ); \
352 fi; \
353 fi
354 -for tool in cc1gm2$(exeext); do \
355 if [ -f $$tool ]; then \
356 rm -f $(DESTDIR)$(libexecsubdir)/$$tool; \
357 $(INSTALL_PROGRAM) $$tool $(DESTDIR)$(libexecsubdir)/$$tool; \
358 chmod a+x $(DESTDIR)$(libexecsubdir)/$$tool; \
359 else \
360 echo "cannot find $$tool" ; \
361 fi ; \
362 done
363
364m2.install-info: installdirs
365 if [ -d gm2$(exeext) ] ; then \
366 if [ -f $(objdir)/doc/gm2.info ]; then \
367 rm -f $(DESTDIR)$(infodir)/gm2.info*; \
368 for f in $(objdir)/doc/gm2.info*; do \
369 realfile=`echo $$f | sed -e 's|.*/\([^/]*\)$$|\1|'`; \
370 rm -f $(DESTDIR)$(infodir)/`basename $$realfile`; \
371 $(INSTALL_DATA) $$f $(DESTDIR)$(infodir)/`basename $$realfile`; \
372 done; \
373 chmod a-x $(DESTDIR)$(infodir)/gm2.info*; \
374 else true; fi; \
375 else true; fi
376 -if [ -f gm2$(exeext) ] && [ -f $(DESTDIR)$(infodir)/gm2.info ]; then \
377 if $(SHELL) -c 'install-info --version' >/dev/null 2>&1; then \
378 install-info --dir-file=$(infodir)/dir $(DESTDIR)$(infodir)/gm2.info; \
379 else true; fi; \
380 else true; fi
381
382m2.install-normal: m2.install-common m2.install-info m2.install-man
383
384# This target will install GM2 into an existing GCC installation,
385# without overwriting existing files.
386# The semicolon is to prevent the install.sh -> install default rule
387# from doing anything. Having it run true helps avoid problems and
388# noise from versions of make which don't like to have null commands.
389m2.install: m2.install-normal; @true
390
391gm2.install-with-gcc: $(INSTALL_HEADERS) gm2.install $(INSTALL_LIBGCC)
392 for file in $(GCC_PASSES); do \
393 if [ x"$$file" != x"xgcc$(exeext)" ]; then \
394 rm -f $(DESTDIR)$(libsubdir)/$$file; \
395 $(INSTALL_PROGRAM) $$file $(DESTDIR)$(libsubdir)/$$file || exit 1; \
396 fi; \
397 done; exit 0
398
399m2.uninstall:
400 -rm -rf $(bindir)/$(GM2_INSTALL_NAME)
401 -rm -rf $(bindir)/$(GM2_CROSS_NAME)
402
403m2.install-plugin: installdirs
404 $(mkinstalldirs) $(DESTDIR)$(plugin_resourcesdir)
ebc41f9a
RO
405 $(INSTALL_PROGRAM) plugin/m2rte$(soext) $(DESTDIR)$(plugin_resourcesdir)/m2rte$(soext)
406 chmod a+x $(DESTDIR)$(plugin_resourcesdir)/m2rte$(soext)
407
408override PLUGINCFLAGS := $(filter-out -mdynamic-no-pic,$(PLUGINCFLAGS))
1eee94d3 409
ebc41f9a 410plugin/m2rte$(soext): $(srcdir)/m2/plugin/m2rte.cc $(GCC_HEADER_DEPENDENCIES_FOR_M2) \
1eee94d3 411 insn-attr-common.h insn-flags.h $(generated_files)
8d2c5b61 412 -test -d $(@D) || $(mkinstalldirs) $(@D)
ebc41f9a
RO
413 $(PLUGINCC) $(PLUGINCFLAGS) -fno-rtti -I. -I$(srcdir) $(INCINTL) -I$(srcdir)/m2 -I$(srcdir)/m2/gm2-gcc -I$(srcdir)/../include -I$(srcdir)/../libcpp/include -Wall $(GMPINC) -Wno-literal-suffix -fPIC -c -o plugin/m2rte.o $(srcdir)/m2/plugin/m2rte.cc
414 $(PLUGINCC) $(PLUGINCFLAGS) $(PLUGINLDFLAGS) $(PLUGINLIBS) $(LIBINTL) -fno-rtti plugin/m2rte.o -shared -o $@
1eee94d3
GM
415
416
417# Clean hooks:
418# A lot of the ancillary files are deleted by the main makefile.
419# We just have to delete files specific to us.
420
421m2.mostlyclean:
422 -rm -f m2/*.o
423
424m2.clean:
425 -rm -f m2/*.o
426 -rm -f m2/gm2-libs/config.*
427 -rm m2/gm2-libs/gm2-libs-host.h m2/gm2config.h
428
429m2.extraclean:
430m2.realclean:
431
1eee94d3
GM
432quit: force
433 echo "calling exit"
434 exit 1
435
436# Rules to build the compiler, pge and mc.
437
438# MC_COPYRIGHT=--gpl-header --project="GNU Modula-2"
439MC_COPYRIGHT=
440
441MC_ARGS= --olang=c++ \
442 --h-file-prefix=$(SRC_PREFIX) \
443 -I$(srcdir)/m2/gm2-libs \
444 -I$(srcdir)/m2/gm2-compiler \
445 -I$(srcdir)/m2/gm2-libiberty \
446 -I$(srcdir)/m2/gm2-gcc \
447 --quiet \
448 $(MC_COPYRIGHT) \
449 --gcc-config-system
450
451MCDEPS=m2/boot-bin/mc$(exeext)
452
453MC=m2/boot-bin/mc$(exeext) $(MC_ARGS)
454
455MC_LIBS=m2/mc-boot-ch/Glibc.o m2/mc-boot-ch/Gmcrts.o
456
457M2LINK=m2/boot-bin/mklink$(exeext)
458GM2_O=
459GM2_O_S3=-O
460GM2_OS=-Os
461GM2_G=-g -fm2-g
462GM2_CPP=
463# GM2_DEBUG_STRMEM=-fcpp
464GM2_DEBUG_STRMEM=
9fadd8de
GM
465GM2_FLAGS=-Wunused-variable -fsoft-check-all \
466 -fno-return -Wreturn-type \
467 $(GM2_G) $(GM2_O) \
1eee94d3
GM
468 -funbounded-by-reference -fpim -fextended-opaque \
469 -Wpedantic-cast -Wpedantic-param-names -ffunction-sections \
470 -fdata-sections $(GM2_CPP) # -fauto-init
471GM2_ISO_FLAGS=-fsoft-check-all $(GM2_G) $(GM2_O) \
9fadd8de 472 -fno-return -Wreturn-type \
1eee94d3
GM
473 -funbounded-by-reference -fiso -fextended-opaque \
474 -Wpedantic-cast -Wpedantic-param-names -ffunction-sections \
475 -fdata-sections $(GM2_CPP)
476GM2_MIN_FLAGS=$(GM2_G) $(GM2_OS) \
477 -funbounded-by-reference -fextended-opaque \
478 -Wpedantic-cast -Wpedantic-param-names -fno-exceptions \
479 -ffunction-sections -fdata-sections $(GM2_CPP)
480
481O2=-O2 -g
482SO_O2=-O2 -g -fPIC
483SO=-O0 -g -fPIC
484
485# Language-specific object files for the gm2 compiler.
486
487GM2_C_OBJS = m2/gm2-lang.o \
488 m2/stor-layout.o \
489 m2/m2pp.o \
490 m2/gm2-gcc/m2assert.o \
491 m2/gm2-gcc/m2block.o \
492 m2/gm2-gcc/m2builtins.o \
493 m2/gm2-gcc/m2except.o \
494 m2/gm2-gcc/m2color.o \
495 m2/gm2-gcc/m2configure.o \
496 m2/gm2-gcc/m2convert.o \
497 m2/gm2-gcc/m2decl.o \
498 m2/gm2-gcc/m2expr.o \
499 m2/gm2-gcc/m2linemap.o \
500 m2/gm2-gcc/m2statement.o \
501 m2/gm2-gcc/m2type.o \
502 m2/gm2-gcc/m2tree.o \
503 m2/gm2-gcc/m2treelib.o \
504 m2/gm2-gcc/m2top.o \
505 m2/gm2-gcc/m2misc.o \
506 m2/gm2-gcc/init.o
507GM2_LIBS = m2/gm2-compiler/gm2.a \
508 ../$(target_subdir)/libgm2/libm2pim/.libs/libm2pim.a m2/gm2-libs-boot/choosetemp.o
509
510GM2_LIBS_BOOT = m2/gm2-compiler-boot/gm2.a \
511 m2/gm2-libs-boot/libgm2.a \
512 $(GM2-BOOT-O)
513
5b918b20 514cc1gm2$(exeext): m2/stage1/cc1gm2$(exeext) $(m2.prev)
1eee94d3
GM
515 cp -p $< $@
516
5b918b20 517m2/stage2/cc1gm2$(exeext): m2/stage1/cc1gm2$(exeext) m2/gm2-compiler/m2flex.o $(P) \
1eee94d3 518 $(GM2_C_OBJS) $(BACKEND) $(LIBDEPS) $(GM2_LIBS) \
ebc41f9a 519 m2/gm2-gcc/rtegraph.o plugin/m2rte$(soext) m2/gm2-libs-boot/M2LINK.o
8d2c5b61 520 -test -d $(@D) || $(mkinstalldirs) $(@D)
1eee94d3
GM
521 @$(call LINK_PROGRESS,$(INDEX.m2),start)
522 +$(LLINKER) $(ALL_CFLAGS) $(LDFLAGS) -o $@ $(GM2_C_OBJS) m2/gm2-compiler/m2flex.o \
523 attribs.o \
524 $(GM2_LIBS) \
525 $(BACKEND) $(LIBS) m2/gm2-gcc/rtegraph.o m2/gm2-libs-boot/M2LINK.o \
526 $(BACKENDLIBS) $(LIBSTDCXX) -lm
527 @$(call LINK_PROGRESS,$(INDEX.m2),end)
528
5b918b20 529m2/stage1/cc1gm2$(exeext): gm2$(exeext) m2/gm2-compiler-boot/m2flex.o \
1eee94d3
GM
530 $(P) $(GM2_C_OBJS) $(BACKEND) $(LIBDEPS) \
531 $(GM2_LIBS_BOOT) $(MC_LIBS) \
ebc41f9a 532 m2/gm2-gcc/rtegraph.o plugin/m2rte$(soext) \
1eee94d3
GM
533 m2/gm2-libs-boot/M2LINK.o \
534 $(m2.prev)
8d2c5b61 535 -test -d $(@D) || $(mkinstalldirs) $(@D)
1eee94d3
GM
536 @$(call LINK_PROGRESS,$(INDEX.m2),start)
537 +$(LLINKER) $(ALL_CFLAGS) $(LDFLAGS) -o $@ $(GM2_C_OBJS) m2/gm2-compiler-boot/m2flex.o \
538 attribs.o \
539 $(GM2_LIBS_BOOT) $(MC_LIBS) \
540 m2/gm2-gcc/rtegraph.o m2/gm2-libs-boot/M2LINK.o \
541 $(BACKEND) $(LIBS) $(BACKENDLIBS)
542 @$(call LINK_PROGRESS,$(INDEX.m2),end)
543
544# Compiling object files from source files.
545
546GCC_HEADER_DEPENDENCIES_FOR_M2 = $(BUILD-BOOT-H) $(TIMEVAR_H) m2/gm2config.h $(CONFIG_H) \
547 $(TREE_H) $(RTL_H) $(TARGET_H) $(PLUGIN_HEADERS) \
548 $(BCONFIG_H) $(CORETYPES_H) $(SYSTEM_H) \
549 $(srcdir)/flags.h gtype-m2.h \
550 $(generated_files) insn-attr-common.h
551
552m2/gm2-gcc/%.o: $(srcdir)/m2/gm2-gcc/%.cc $(GCC_HEADER_DEPENDENCIES_FOR_M2)
8d2c5b61 553 -test -d $(@D) || $(mkinstalldirs) $(@D)
1eee94d3
GM
554 $(COMPILER) -c -g $(ALL_COMPILERFLAGS) \
555 $(ALL_CPPFLAGS) $(INCLUDES) $< $(OUTPUT_OPTION)
556
557m2/gm2-gcc/m2configure.o: $(srcdir)/m2/gm2-gcc/m2configure.cc \
558 $(SYSTEM_H) $(GCC_H) $(CONFIG_H) \
559 m2/gm2config.h $(TARGET_H) $(PLUGIN_HEADERS) \
560 $(generated_files) $(C_TREE_H) insn-attr-common.h
8d2c5b61 561 -test -d $(@D) || $(mkinstalldirs) $(@D)
1eee94d3
GM
562 $(COMPILER) $(ALL_COMPILERFLAGS) $(ALL_CPPFLAGS) $(INCLUDES) \
563 $(DRIVER_DEFINES) \
564 -DLIBSUBDIR=\"$(libsubdir)\" \
565 -DPREFIX=\"$(prefix)\" \
566 -c $(srcdir)/m2/gm2-gcc/m2configure.cc $(OUTPUT_OPTION)
567
568m2/gm2-lang.o: $(srcdir)/m2/gm2-lang.cc gt-m2-gm2-lang.h $(GCC_HEADER_DEPENDENCIES_FOR_M2)
ebc41f9a 569 $(COMPILER) -c -g $(GM2GCC) $(ALL_COMPILERFLAGS) \
47b269ca 570 -DLIBSUBDIR=\"$(libsubdir)\" \
1eee94d3
GM
571 $(ALL_CPPFLAGS) $(INCLUDES) $< $(OUTPUT_OPTION)
572
573m2/stor-layout.o: $(srcdir)/stor-layout.cc $(GCC_HEADER_DEPENDENCIES_FOR_M2)
574 $(COMPILER) -c -DSET_WORD_SIZE=INT_TYPE_SIZE $(ALL_COMPILERFLAGS) \
575 $(ALL_CPPFLAGS) $(INCLUDES) $< $(OUTPUT_OPTION)
576
577m2/m2pp.o : $(srcdir)/m2/m2pp.cc $(GCC_HEADER_DEPENDENCIES_FOR_M2)
578 $(COMPILER) -c -g -DGM2 $(ALL_COMPILERFLAGS) \
579 $(ALL_CPPFLAGS) $(INCLUDES) $< $(OUTPUT_OPTION)
580
581m2/gm2-gcc/rtegraph.o: $(srcdir)/m2/gm2-gcc/rtegraph.cc $(GCC_HEADER_DEPENDENCIES_FOR_M2) \
582 gt-m2-rtegraph.h
8d2c5b61 583 -test -d $(@D) || $(mkinstalldirs) $(@D)
ebc41f9a 584 $(COMPILER) -c -g $(GM2GCC) $(ALL_COMPILERFLAGS) \
1eee94d3
GM
585 $(ALL_CPPFLAGS) $(INCLUDES) $< $(OUTPUT_OPTION)
586
587c-family/m2pp.o : $(srcdir)/m2/m2pp.cc $(GCC_HEADER_DEPENDENCIES_FOR_M2)
588 $(COMPILER) -c -g $(ALL_COMPILERFLAGS) \
589 $(ALL_CPPFLAGS) $(INCLUDES) $< $(OUTPUT_OPTION)
590
591m2/gm2-gcc/$(SRC_PREFIX)%.h: $(srcdir)/m2/gm2-gcc/%.def $(MCDEPS)
8d2c5b61 592 -test -d $(@D) || $(mkinstalldirs) $(@D)
1eee94d3
GM
593 $(MC) -o=$@ $(srcdir)/m2/gm2-gcc/$*.def
594
595# The following tables define the source files which are translated into C using mc
596# and defines the system interface C files.
597
598# Core library definition modules found in gm2-libs.
599
600GM2-LIBS-BOOT-DEFS = \
601 ASCII.def \
602 Args.def \
603 Assertion.def \
604 Break.def \
605 CmdArgs.def \
606 Debug.def \
607 DynamicStrings.def \
608 Environment.def \
609 FIO.def \
610 FormatStrings.def \
611 FpuIO.def \
612 IO.def \
613 Indexing.def \
614 M2Dependent.def \
615 M2EXCEPTION.def \
616 M2LINK.def \
617 M2RTS.def \
618 NumberIO.def \
619 PushBackInput.def \
620 RTExceptions.def \
621 SArgs.def \
622 SEnvironment.def \
623 SFIO.def \
624 SYSTEM.def \
625 Scan.def \
626 StdIO.def \
627 Storage.def \
628 StrCase.def \
629 StrIO.def \
630 StrLib.def \
631 StringConvert.def \
632 SysExceptions.def \
633 SysStorage.def \
634 TimeString.def \
635 UnixArgs.def \
636 dtoa.def \
637 errno.def \
638 ldtoa.def \
639 libc.def \
640 libm.def \
641 termios.def \
642 wrapc.def \
643
644# Core library implementation modules found in gm2-libs.
645
646GM2-LIBS-BOOT-MODS = \
647 ASCII.mod \
648 Args.mod \
649 Assertion.mod \
650 Break.mod \
651 CmdArgs.mod \
652 Debug.mod \
653 DynamicStrings.mod \
654 Environment.mod \
655 FIO.mod \
656 FormatStrings.mod \
657 FpuIO.mod \
658 IO.mod \
659 Indexing.mod \
660 M2Dependent.mod \
661 M2EXCEPTION.mod \
662 M2RTS.mod \
663 NumberIO.mod \
664 PushBackInput.mod \
665 RTExceptions.mod \
666 SArgs.mod \
667 SEnvironment.mod \
668 SFIO.mod \
669 Scan.mod \
670 Storage.mod \
671 StrCase.mod \
672 StrIO.mod \
673 StrLib.mod \
674 StringConvert.mod \
675 SysStorage.mod \
676 TimeString.mod \
677
678# Hand translated C files and C files for definition module for "C" modules
679# found in gm2-libs-ch.
680
681GM2-LIBS-BOOT-C = \
682 StdIO.c \
683 SysExceptions.c \
684 choosetemp.c \
685 errno.c \
686 termios.c \
687 wrapc.c \
688
689# C++ implemented modules found in gm2-libs-ch.
690
691GM2-LIBS-BOOT-CC = \
692 UnixArgs.cc \
693 dtoa.cc \
694 ldtoa.cc
695
696# Definition modules for the front end found in gm2-compiler.
697
698GM2-COMP-BOOT-DEFS = \
699 FifoQueue.def \
700 Lists.def \
701 M2ALU.def \
702 M2AsmUtil.def \
703 M2Base.def \
704 M2BasicBlock.def \
705 M2Batch.def \
706 M2Bitset.def \
707 M2CaseList.def \
708 M2Check.def \
709 M2Code.def \
710 M2ColorString.def \
711 M2Comp.def \
712 M2Const.def \
713 M2Debug.def \
714 M2DebugStack.def \
715 M2Defaults.def \
716 M2DriverOptions.def \
05652ac4
GM
717 DynamicPath.def \
718 PathName.def \
1eee94d3
GM
719 M2Emit.def \
720 M2Error.def \
721 M2EvalSym.def \
722 M2FileName.def \
723 M2GCCDeclare.def \
724 M2GenGCC.def \
725 M2Graph.def \
726 M2LexBuf.def \
727 M2MetaError.def \
728 M2Optimize.def \
729 M2Options.def \
730 M2Pass.def \
731 M2Preprocess.def \
732 M2Printf.def \
733 M2Quads.def \
734 M2Quiet.def \
735 M2Range.def \
736 M2Reserved.def \
737 M2SSA.def \
738 M2Scaffold.def \
739 M2Scope.def \
740 M2Search.def \
741 M2Size.def \
742 M2StackAddress.def \
743 M2StackWord.def \
744 M2Students.def \
745 M2Swig.def \
746 M2System.def \
747 NameKey.def \
748 ObjectFiles.def \
749 Output.def \
750 P0SymBuild.def \
751 P0SyntaxCheck.def \
752 P1Build.def \
753 P1SymBuild.def \
754 P2Build.def \
755 P2SymBuild.def \
756 P3Build.def \
757 P3SymBuild.def \
758 PCBuild.def \
759 PCSymBuild.def \
760 PHBuild.def \
761 Sets.def \
762 SymbolConversion.def \
763 SymbolKey.def \
764 SymbolTable.def \
765 bnflex.def \
766 m2flex.def \
767
768# Implementation modules for the front end found in gm2-compiler.
769
770GM2-COMP-BOOT-MODS = \
771 FifoQueue.mod \
772 Lists.mod \
773 Lists.mod \
774 M2ALU.mod \
775 M2AsmUtil.mod \
776 M2Base.mod \
777 M2BasicBlock.mod \
778 M2Batch.mod \
779 M2Bitset.mod \
780 M2CaseList.mod \
781 M2Check.mod \
782 M2Code.mod \
783 M2ColorString.mod \
784 M2Comp.mod \
785 M2Const.mod \
786 M2Debug.mod \
787 M2DebugStack.mod \
788 M2Defaults.mod \
789 M2DriverOptions.mod \
05652ac4
GM
790 DynamicPath.mod \
791 PathName.mod \
1eee94d3
GM
792 M2Emit.mod \
793 M2Error.mod \
794 M2FileName.mod \
795 M2GCCDeclare.mod \
796 M2GenGCC.mod \
797 M2Graph.mod \
798 M2LexBuf.mod \
799 M2MetaError.mod \
800 M2Optimize.mod \
801 M2Options.mod \
802 M2Pass.mod \
803 M2Preprocess.mod \
804 M2Printf.mod \
805 M2Quads.mod \
806 M2Quiet.mod \
807 M2Range.mod \
808 M2Reserved.mod \
809 M2SSA.mod \
810 M2Scaffold.mod \
811 M2Scope.mod \
812 M2Search.mod \
813 M2Size.mod \
814 M2StackAddress.mod \
815 M2StackWord.mod \
816 M2Students.mod \
817 M2Swig.mod \
818 M2System.mod \
819 NameKey.mod \
820 NameKey.mod \
821 ObjectFiles.mod \
822 Output.mod \
823 P0SymBuild.mod \
824 P1SymBuild.mod \
825 P2SymBuild.mod \
826 P3SymBuild.mod \
827 PCSymBuild.mod \
828 Sets.mod \
829 SymbolConversion.mod \
830 SymbolKey.mod \
831 SymbolKey.mod \
832 SymbolTable.mod \
833 bnflex.mod \
834
835# The interface between the modula-2 front end and gimple/trees found in directory gm2-gcc.
836
837GM2-GCC-DEFS = \
838 m2block.def \
839 m2builtins.def \
840 m2color.def \
841 m2configure.def \
842 m2convert.def \
843 m2decl.def \
844 m2except.def \
845 m2except.def \
846 m2expr.def \
847 m2linemap.def \
848 m2misc.def \
849 m2statement.def \
850 m2top.def \
851 m2tree.def \
852 m2treelib.def \
853 m2type.def \
854
855# The following lists define the source files used to build gm2 using Modula-2
856# sources directly.
857#
858# cc1gm2$(exeext) uses these definition modules from the core libraries.
859
860GM2-LIBS-DEFS = \
861 ASCII.def \
862 Args.def \
863 Assertion.def \
864 Break.def \
865 Builtins.def \
866 COROUTINES.def \
867 CmdArgs.def \
868 Debug.def \
869 DynamicStrings.def \
870 Environment.def \
871 FIO.def \
872 FormatStrings.def \
873 FpuIO.def \
874 GetOpt.def \
875 IO.def \
876 Indexing.def \
877 LMathLib0.def \
878 LegacyReal.def \
879 M2Dependent.def \
880 M2EXCEPTION.def \
881 M2LINK.def \
882 M2RTS.def \
883 MathLib0.def \
884 MemUtils.def \
885 NumberIO.def \
886 PushBackInput.def \
887 RTExceptions.def \
888 RTint.def \
889 SArgs.def \
890 SEnvironment.def \
891 SFIO.def \
892 SMathLib0.def \
893 SYSTEM.def \
894 Scan.def \
895 StdIO.def \
896 Storage.def \
897 StrCase.def \
898 StrIO.def \
899 StrLib.def \
900 StringConvert.def \
901 SysStorage.def \
902 TimeString.def \
903 UnixArgs.def \
904 cbuiltin.def \
905 dtoa.def \
906 ldtoa.def \
907 libc.def \
908 termios.def \
909 wrapc.def \
910
911# cc1gm2$(exeext) uses these implementation modules from the core libraries.
912
913GM2-LIBS-MODS = \
914 ASCII.mod \
915 Args.mod \
916 Assertion.mod \
917 Break.mod \
918 Builtins.mod \
919 COROUTINES.mod \
920 CmdArgs.mod \
921 Debug.mod \
922 DynamicStrings.mod \
923 Environment.mod \
924 FIO.mod \
925 FormatStrings.mod \
926 FpuIO.mod \
927 GetOpt.mod \
928 IO.mod \
929 Indexing.mod \
930 LMathLib0.mod \
931 LegacyReal.mod \
932 M2Dependent.mod \
933 M2EXCEPTION.mod \
934 M2RTS.mod \
935 MathLib0.mod \
936 MemUtils.mod \
937 NumberIO.mod \
938 PushBackInput.mod \
939 RTExceptions.mod \
940 RTint.mod \
941 SArgs.mod \
942 SEnvironment.mod \
943 SFIO.mod \
944 SMathLib0.mod \
945 SYSTEM.mod \
946 Scan.mod \
947 StdIO.mod \
948 Storage.mod \
949 StrCase.mod \
950 StrIO.mod \
951 StrLib.mod \
952 StringConvert.mod \
953 SysStorage.mod \
954 TimeString.mod \
955
956# cc1gm2$(exeext) uses these C modules from the core libraries.
957
958GM2-LIBS-C = \
959 Selective.c \
960 SysExceptions.c \
961 cgetopt.c \
962 choosetemp.c \
963 errno.c \
964 host.c \
965 termios.c \
966 wrapc.c \
967
968# cc1gm2$(exeext) uses these C++ modules from the core libraries.
969
970GM2-LIBS-CC = \
971 UnixArgs.cc \
972 dtoa.cc \
973 ldtoa.cc \
974
975# cc1gm2$(exeext) uses these definition modules found in the gm2-compiler directory.
976
977GM2-COMP-DEFS = \
978 FifoQueue.def \
979 Lists.def \
980 M2ALU.def \
981 M2AsmUtil.def \
982 M2Base.def \
983 M2BasicBlock.def \
984 M2Batch.def \
985 M2Bitset.def \
986 M2CaseList.def \
987 M2Check.def \
988 M2Code.def \
989 M2ColorString.def \
990 M2Comp.def \
991 M2Const.def \
992 M2Debug.def \
993 M2DebugStack.def \
994 M2Defaults.def \
995 M2DriverOptions.def \
05652ac4
GM
996 DynamicPath.def \
997 PathName.def \
1eee94d3
GM
998 M2Emit.def \
999 M2Error.def \
1000 M2FileName.def \
1001 M2GCCDeclare.def \
1002 M2GenGCC.def \
1003 M2Graph.def \
1004 M2LexBuf.def \
1005 M2MetaError.def \
1006 M2Optimize.def \
1007 M2Options.def \
1008 M2Pass.def \
1009 M2Preprocess.def \
1010 M2Printf.def \
1011 M2Quads.def \
1012 M2Quiet.def \
1013 M2Range.def \
1014 M2Reserved.def \
1015 M2SSA.def \
1016 M2Scaffold.def \
1017 M2Scope.def \
1018 M2Search.def \
1019 M2Size.def \
1020 M2StackAddress.def \
1021 M2StackWord.def \
1022 M2Students.def \
1023 M2Swig.def \
1024 M2System.def \
1025 NameKey.def \
1026 ObjectFiles.def \
1027 P0SymBuild.def \
1028 P0SyntaxCheck.def \
1029 P1Build.def \
1030 P1SymBuild.def \
1031 P2Build.def \
1032 P2SymBuild.def \
1033 P3Build.def \
1034 P3SymBuild.def \
1035 PCBuild.def \
1036 PCSymBuild.def \
1037 PHBuild.def \
1038 Sets.def \
1039 SymbolConversion.def \
1040 SymbolKey.def \
1041 SymbolTable.def \
1042 bnflex.def \
1043
1044# cc1gm2$(exeext) uses these implementation modules found in the gm2-compiler directory.
1045
1046GM2-COMP-MODS = \
1047 FifoQueue.mod \
1048 Lists.mod \
1049 M2ALU.mod \
1050 M2AsmUtil.mod \
1051 M2Base.mod \
1052 M2BasicBlock.mod \
1053 M2Batch.mod \
1054 M2Bitset.mod \
1055 M2CaseList.mod \
1056 M2Check.mod \
1057 M2Code.mod \
1058 M2ColorString.mod \
1059 M2Comp.mod \
1060 M2Const.mod \
1061 M2Debug.mod \
1062 M2DebugStack.mod \
1063 M2Defaults.mod \
1064 M2DriverOptions.mod \
05652ac4
GM
1065 DynamicPath.mod \
1066 PathName.mod \
1eee94d3
GM
1067 M2Emit.mod \
1068 M2Error.mod \
1069 M2FileName.mod \
1070 M2GCCDeclare.mod \
1071 M2GenGCC.mod \
1072 M2Graph.mod \
1073 M2LexBuf.mod \
1074 M2MetaError.mod \
1075 M2Optimize.mod \
1076 M2Options.mod \
1077 M2Pass.mod \
1078 M2Preprocess.mod \
1079 M2Printf.mod \
1080 M2Quads.mod \
1081 M2Quiet.mod \
1082 M2Range.mod \
1083 M2Reserved.mod \
1084 M2SSA.mod \
1085 M2Scaffold.mod \
1086 M2Scope.mod \
1087 M2Search.mod \
1088 M2Size.mod \
1089 M2StackAddress.mod \
1090 M2StackWord.mod \
1091 M2Students.mod \
1092 M2Swig.mod \
1093 M2System.mod \
1094 NameKey.mod \
1095 ObjectFiles.mod \
1096 Output.mod \
1097 P0SymBuild.mod \
1098 P1SymBuild.mod \
1099 P2SymBuild.mod \
1100 P3SymBuild.mod \
1101 PCSymBuild.mod \
1102 Sets.mod \
1103 SymbolConversion.mod \
1104 SymbolKey.mod \
1105 SymbolTable.mod \
1106 bnflex.mod \
1107
1108# Implementation modules created by the parser generator pge from .bnf files.
1109
1110GM2-AUTO-MODS = \
1111 P2Build.mod \
1112 P3Build.mod \
1113 PHBuild.mod \
1114 PCBuild.mod \
1115 P1Build.mod \
1116 P0SyntaxCheck.mod \
1117
1118# LIBIBERTY interface definition modules
1119
1120GM2-LIBIBERTY-DEFS = \
1121 choosetemp.def \
1122 pexecute.def
1123
1124BUILD-LIBS-BOOT-H = $(GM2-LIBS-BOOT-DEFS:%.def=m2/gm2-libs-boot/$(SRC_PREFIX)%.h)
1125
1126BUILD-LIBS-BOOT = $(BUILD-LIBS-BOOT-H) \
1127 $(GM2-LIBS-BOOT-MODS:%.mod=m2/gm2-libs-boot/%.o) \
1128 $(GM2-LIBS-BOOT-CC:%.cc=m2/gm2-libs-boot/%.o) \
1129 $(GM2-LIBS-BOOT-C:%.c=m2/gm2-libs-boot/%.o)
1130
1131BUILD-COMPILER-BOOT-H = $(GM2-COMP-BOOT-DEFS:%.def=m2/gm2-compiler-boot/$(SRC_PREFIX)%.h) \
1132 $(GM2-LIBIBERTY-DEFS:%.def=m2/gm2-libiberty/$(SRC_PREFIX)%.h) \
1133 $(GM2-GCC-DEFS:%.def=m2/gm2-gcc/$(SRC_PREFIX)%.h)
1134
1135BUILD-COMPILER-BOOT = $(BUILD-COMPILER-BOOT-H) \
1136 $(GM2-COMP-BOOT-DEFS:%.def=m2/gm2-compiler-boot/$(SRC_PREFIX)%.h) \
1137 $(GM2-AUTO-MODS:%.mod=m2/gm2-compiler-boot/%.o) \
1138 $(GM2-COMP-BOOT-MODS:%.mod=m2/gm2-compiler-boot/%.o) \
1139 m2/gm2-compiler-boot/m2flex.o
1140
1141BUILD-BOOT-H = m2/boot-bin/mc$(exeext) \
1142 $(BUILD-LIBS-BOOT-H) $(BUILD-COMPILER-BOOT-H) $(TARGET_H) $(PLUGIN_HEADERS)
1143
1144# Core library definition modules used by the modula-2 to C++ translator.
1145
1146MC-LIB-DEFS = \
1147 ASCII.def \
1148 Args.def \
1149 Assertion.def \
1150 Break.def \
1151 COROUTINES.def \
1152 CmdArgs.def \
1153 Debug.def \
1154 DynamicStrings.def \
1155 Environment.def \
1156 FIO.def \
1157 FormatStrings.def \
1158 FpuIO.def \
1159 IO.def \
1160 M2Dependent.def \
1161 M2EXCEPTION.def \
1162 M2LINK.def \
1163 M2RTS.def \
1164 MemUtils.def \
1165 NumberIO.def \
1166 PushBackInput.def \
1167 RTExceptions.def \
1168 RTco.def \
9fadd8de 1169 RTentity.def \
1eee94d3
GM
1170 RTint.def \
1171 SArgs.def \
1172 SFIO.def \
1173 SYSTEM.def \
1174 Selective.def \
1175 StdIO.def \
1176 Storage.def \
1177 StrCase.def \
1178 StrIO.def \
1179 StrLib.def \
1180 StringConvert.def \
1181 SysExceptions.def \
1182 SysStorage.def \
1183 TimeString.def \
1184 UnixArgs.def \
1185 dtoa.def \
1186 errno.def \
1187 ldtoa.def \
1188 libc.def \
1189 libm.def \
1190 termios.def \
1191 wrapc.def \
1192
1193# Core library implementation modules used by the modula-2 to C++ translator.
1194
1195MC-LIB-MODS = \
1196 ASCII.mod \
1197 Args.mod \
1198 Assertion.mod \
1199 Break.mod \
1200 CmdArgs.mod \
1201 Debug.mod \
1202 DynamicStrings.mod \
1203 Environment.mod \
1204 FIO.mod \
1205 FormatStrings.mod \
1206 FpuIO.mod \
1207 IO.mod \
1208 M2Dependent.mod \
1209 M2EXCEPTION.mod \
1210 M2RTS.mod \
1211 MemUtils.mod \
1212 NumberIO.mod \
1213 PushBackInput.mod \
1214 RTExceptions.mod \
1215 RTint.mod \
1216 SArgs.mod \
1217 SFIO.mod \
1218 StdIO.mod \
1219 Storage.mod \
1220 StrCase.mod \
1221 StrIO.mod \
1222 StrLib.mod \
1223 StringConvert.mod \
1224 SysStorage.mod \
1225 TimeString.mod \
1226
ab61100f 1227MC-LIB-BOOT-CC = $(MC-LIB-MODS:%.mod=%.cc)
1eee94d3
GM
1228
1229# Definition modules for the modula-2 to C++ translator found in mc.
1230
1231MC-DEFS = \
1232 Indexing.def \
1233 alists.def \
1234 decl.def \
1235 keyc.def \
1236 lists.def \
1237 mcComment.def \
1238 mcComp.def \
1239 mcDebug.def \
1240 mcError.def \
1241 mcFileName.def \
1242 mcLexBuf.def \
1243 mcMetaError.def \
1244 mcOptions.def \
1245 mcPreprocess.def \
1246 mcPretty.def \
1247 mcPrintf.def \
1248 mcQuiet.def \
1249 mcReserved.def \
1250 mcSearch.def \
1251 mcStack.def \
1252 mcStream.def \
1253 mcflex.def \
1254 mcp1.def \
1255 mcp2.def \
1256 mcp3.def \
1257 mcp4.def \
1258 mcp5.def \
1259 nameKey.def \
1260 symbolKey.def \
1261 varargs.def \
1262 wlists.def \
1263
1264# Implementation modules for the modula-2 to C++ translator found in mc.
1265
1266MC-MODS = \
1267 Indexing.mod \
1268 alists.mod \
1269 decl.mod \
1270 keyc.mod \
1271 lists.mod \
1272 mcComment.mod \
1273 mcComp.mod \
1274 mcDebug.mod \
1275 mcError.mod \
1276 mcFileName.mod \
1277 mcLexBuf.mod \
1278 mcMetaError.mod \
1279 mcOptions.mod \
1280 mcPreprocess.mod \
1281 mcPretty.mod \
1282 mcPrintf.mod \
1283 mcQuiet.mod \
1284 mcReserved.mod \
1285 mcSearch.mod \
1286 mcStack.mod \
1287 mcStream.mod \
1288 nameKey.mod \
1289 symbolKey.mod \
1290 top.mod \
1291 varargs.mod \
1292 wlists.mod \
1293
1294# Parser files generated by pge from .bnf files.
1295
1296MC-AUTO-MODS = \
1297 mcp1.mod \
1298 mcp2.mod \
1299 mcp3.mod \
1300 mcp4.mod \
1301 mcp5.mod
1302
ab61100f 1303MC-BOOT-CC = $(MC-MODS:%.mod=%.cc) $(MC-AUTO-MODS:%.mod=%.cc)
1eee94d3
GM
1304
1305# C interface files for mc.
1306
1307MC-INTERFACE-C = \
1308 M2LINK.c \
1309 SYSTEM.c \
1310 Selective.c \
1311 SysExceptions.c \
1312 abort.c \
1313 errno.c \
1314 libc.c \
1315 mcrts.c \
1316 termios.c \
1317 wrapc.c \
1318
1319# C++ interface files for mc.
1320
1321MC-INTERFACE-CC = \
1322 UnixArgs.cc \
1323 dtoa.cc \
1324 ldtoa.cc \
1325
1326BUILD-MC-BOOT-H = $(MC-LIB-DEFS:%.def=m2/mc-boot-gen/$(SRC_PREFIX)%.h) \
1327 $(MC-DEFS:%.def=m2/mc-boot-gen/$(SRC_PREFIX)%.h)
1328
ab61100f
GM
1329BUILD-MC-BOOT-CC = $(MC-LIB-MODS:%.mod=m2/mc-boot-gen/$(SRC_PREFIX)%.cc) \
1330 $(MC-MODS:%.mod=m2/mc-boot-gen/$(SRC_PREFIX)%.cc)
1eee94d3 1331
ab61100f 1332BUILD-MC-BOOT-AUTO-CC = $(MC-AUTO-MODS:%.mod=m2/mc-boot-gen/$(SRC_PREFIX)%.cc)
1eee94d3 1333
ab61100f
GM
1334BUILD-MC-BOOT-O = $(MC-LIB-BOOT-CC:%.cc=m2/mc-boot/$(SRC_PREFIX)%.o) \
1335 $(MC-BOOT-CC:%.cc=m2/mc-boot/$(SRC_PREFIX)%.o)
1eee94d3
GM
1336
1337BUILD-MC-INTERFACE-O = $(MC-INTERFACE-C:%.c=m2/mc-boot-ch/$(SRC_PREFIX)%.o) \
1338 $(MC-INTERFACE-CC:%.cc=m2/mc-boot-ch/$(SRC_PREFIX)%.o)
1339
1340GM2GCC = -I$(srcdir)/m2 -Im2 -I$(srcdir)/m2/gm2-gcc -Im2/gm2-gcc
1341
1342MCINCLUDES= -I$(srcdir)/m2/mc-boot-ch
1343LOCAL_INCLUDES = -I. -I$(srcdir)/../include -I$(srcdir)
1344
1345GCC_COLOR=m2/gm2-gcc/m2color.o diagnostic-color.o
1346
1347m2/boot-bin/mc$(exeext): $(BUILD-MC-BOOT-O) $(BUILD-MC-INTERFACE-O) \
1348 m2/mc-boot/main.o mcflex.o m2/gm2-libs-boot/RTcodummy.o
1349 +$(LINKER) $(ALL_LINKERFLAGS) $(LDFLAGS) -o $@ $(BUILD-MC-BOOT-O) \
1350 $(BUILD-MC-INTERFACE-O) m2/mc-boot/main.o \
1351 mcflex.o m2/gm2-libs-boot/RTcodummy.o -lm
1352
ab61100f 1353m2/mc-boot/$(SRC_PREFIX)%.o: m2/mc-boot/$(SRC_PREFIX)%.cc m2/gm2-libs/gm2-libs-host.h
8d2c5b61 1354 -test -d $(@D) || $(mkinstalldirs) $(@D)
76dda105 1355 $(CXX) $(CXX_FLAGS) -g -c -I. -I$(srcdir)/m2/mc-boot-ch -I$(srcdir)/m2/mc-boot -I$(srcdir)/../include -I$(srcdir) $(INCLUDES) $< -o $@
1eee94d3
GM
1356
1357m2/mc-boot-ch/$(SRC_PREFIX)%.o: m2/mc-boot-ch/$(SRC_PREFIX)%.c m2/gm2-libs/gm2-libs-host.h
8d2c5b61 1358 -test -d $(@D) || $(mkinstalldirs) $(@D)
76dda105 1359 $(CXX) $(CXX_FLAGS) -DHAVE_CONFIG_H -g -c -I. -Im2/gm2-libs -I$(srcdir)/../include -I$(srcdir) $(INCLUDES) -Im2/gm2-libs $< -o $@
1eee94d3
GM
1360
1361m2/mc-boot-ch/$(SRC_PREFIX)%.o: m2/mc-boot-ch/$(SRC_PREFIX)%.cc m2/gm2-libs/gm2-libs-host.h
8d2c5b61 1362 -test -d $(@D) || $(mkinstalldirs) $(@D)
76dda105 1363 $(CXX) $(CXX_FLAGS) -DHAVE_CONFIG_H -g -c -I. -Im2/gm2-libs -I$(srcdir)/../include -I$(srcdir) $(INCLUDES) -Im2/gm2-libs $< -o $@
1eee94d3
GM
1364
1365m2/mc-boot/main.o: $(M2LINK) $(srcdir)/m2/init/mcinit
8d2c5b61 1366 -test -d $(@D) || $(mkinstalldirs) $(@D)
ab61100f 1367 unset CC ; $(M2LINK) -s --langc++ --exit --name m2/mc-boot/main.cc $(srcdir)/m2/init/mcinit
76dda105 1368 $(CXX) $(CXX_FLAGS) -g -c -I. -I$(srcdir)/../include -I$(srcdir) $(INCLUDES) m2/mc-boot/main.cc -o $@
1eee94d3 1369
e9a39ad7 1370mcflex.o: mcflex.c m2/gm2-libs/gm2-libs-host.h
1eee94d3
GM
1371 $(CC) -I$(srcdir)/m2/mc -g -c $< -o $@ # remember that mcReserved.h is copied into m2/mc
1372
1373mcflex.c: $(srcdir)/m2/mc/mc.flex
1374 flex -t $< > $@
1375
62ed1066
GM
1376m2/gm2-libs-boot/M2RTS.o: $(srcdir)/m2/gm2-libs/M2RTS.mod $(MCDEPS) $(BUILD-BOOT-H)
1377 -test -d $(@D) || $(mkinstalldirs) $(@D)
1378 $(MC) --suppress-noreturn -o=m2/gm2-libs-boot/M2RTS.c $(srcdir)/m2/gm2-libs/M2RTS.mod
1379 $(COMPILER) -c -DIN_GCC $(CFLAGS) -I$(srcdir)/m2 -Im2 -I. -Im2/gm2-libs-boot $(MCINCLUDES) $(INCLUDES) m2/gm2-libs-boot/M2RTS.c -o $@
1380
1eee94d3 1381m2/gm2-libs-boot/%.o: $(srcdir)/m2/gm2-libs-boot/%.mod $(MCDEPS) $(BUILD-BOOT-H)
8d2c5b61 1382 -test -d $(@D) || $(mkinstalldirs) $(@D)
1eee94d3
GM
1383 $(MC) -o=m2/gm2-libs-boot/$*.c $(srcdir)/m2/gm2-libs-boot/$*.mod
1384 $(COMPILER) -c -DIN_GCC $(CFLAGS) $(MCINCLUDES) m2/gm2-libs-boot/$*.c -o $@
1385
1386m2/gm2-libs-boot/%.o: $(srcdir)/m2/gm2-libs/%.mod $(MCDEPS) $(BUILD-BOOT-H)
8d2c5b61 1387 -test -d $(@D) || $(mkinstalldirs) $(@D)
1eee94d3
GM
1388 $(MC) -o=m2/gm2-libs-boot/$*.c $(srcdir)/m2/gm2-libs/$*.mod
1389 $(COMPILER) -c -DIN_GCC $(CFLAGS) -I$(srcdir)/m2 -Im2 -I. -Im2/gm2-libs-boot $(MCINCLUDES) $(INCLUDES) m2/gm2-libs-boot/$*.c -o $@
1390
1391m2/gm2-libs-boot/$(SRC_PREFIX)%.h: $(srcdir)/m2/gm2-libs/%.def $(MCDEPS)
8d2c5b61 1392 -test -d $(@D) || $(mkinstalldirs) $(@D)
1eee94d3
GM
1393 $(MC) -o=$@ $(srcdir)/m2/gm2-libs/$*.def
1394
1395m2/gm2-libs-boot/RTcodummy.o: $(srcdir)/m2/gm2-libs-ch/RTcodummy.c m2/gm2-libs/gm2-libs-host.h
8d2c5b61 1396 -test -d $(@D) || $(mkinstalldirs) $(@D)
1eee94d3
GM
1397 $(CXX) -c -DIN_GCC $(CFLAGS) -Im2/gm2-libs -I$(srcdir)/m2 -Im2 -I. -Im2/gm2-libs-boot $(INCLUDES) $< -o $@
1398
1399m2/gm2-libs-boot/RTintdummy.o: $(srcdir)/m2/gm2-libs-ch/RTintdummy.c m2/gm2-libs/gm2-libs-host.h
8d2c5b61 1400 -test -d $(@D) || $(mkinstalldirs) $(@D)
1eee94d3
GM
1401 $(CXX) -c -DIN_GCC $(CFLAGS) -Im2/gm2-libs -I$(srcdir)/m2 -Im2 -I. -Im2/gm2-libs-boot $(INCLUDES) $< -o $@
1402
1403m2/gm2-libs-boot/wrapc.o: $(srcdir)/m2/gm2-libs-ch/wrapc.c m2/gm2-libs-boot/$(SRC_PREFIX)wrapc.h m2/gm2-libs/gm2-libs-host.h
8d2c5b61 1404 -test -d $(@D) || $(mkinstalldirs) $(@D)
1eee94d3
GM
1405 $(CXX) -c -DHAVE_CONFIG_H $(CFLAGS) -Im2/gm2-libs -I$(srcdir)/m2 -Im2 -I. -Im2/gm2-libs-boot -Im2/gm2-libs $(INCLUDES) $< -o $@
1406
1407m2/gm2-libs-boot/M2LINK.o: $(srcdir)/m2/gm2-libs-ch/M2LINK.c m2/gm2-libs-boot/$(SRC_PREFIX)M2LINK.h m2/gm2-libs/gm2-libs-host.h
8d2c5b61 1408 -test -d $(@D) || $(mkinstalldirs) $(@D)
1eee94d3
GM
1409 $(CXX) -c -DHAVE_CONFIG_H $(CFLAGS) -Im2/gm2-libs -I$(srcdir)/m2 -Im2 -I. -Im2/gm2-libs-boot -Im2/gm2-libs $(INCLUDES) $< -o $@
1410
1411m2/gm2-libs-boot/UnixArgs.o: $(srcdir)/m2/gm2-libs-ch/UnixArgs.cc m2/gm2-libs-boot/$(SRC_PREFIX)UnixArgs.h m2/gm2-libs/gm2-libs-host.h
8d2c5b61 1412 -test -d $(@D) || $(mkinstalldirs) $(@D)
1eee94d3
GM
1413 $(CXX) -c -DIN_GCC $(CFLAGS) -Im2/gm2-libs -I$(srcdir)/m2 -Im2 -I. -Im2/gm2-libs-boot $(INCLUDES) $< -o $@
1414
1415m2/gm2-libs-boot/choosetemp.o: m2/gm2-libs-ch/choosetemp.c m2/gm2-libiberty/Gchoosetemp.h m2/gm2-libs/gm2-libs-host.h
8d2c5b61 1416 -test -d $(@D) || $(mkinstalldirs) $(@D)
1eee94d3
GM
1417 $(CXX) -c $(CFLAGS) -Im2/gm2-libs -I$(srcdir)/m2 -Im2 -I. -Im2/gm2-libs-boot -Im2/gm2-libiberty -I$(srcdir)/m2/gm2-libiberty/ $(INCLUDES) $< -o $@
1418
1419m2/gm2-libs-boot/errno.o: $(srcdir)/m2/gm2-libs-ch/errno.c m2/gm2-libs-boot/$(SRC_PREFIX)errno.h m2/gm2-libs/gm2-libs-host.h
8d2c5b61 1420 -test -d $(@D) || $(mkinstalldirs) $(@D)
1eee94d3
GM
1421 $(CXX) -c $(CFLAGS) -Im2/gm2-libs -I$(srcdir)/m2 -Im2 -I. -Im2/gm2-libs-boot $(INCLUDES) $< -o $@
1422
1423m2/gm2-libs-boot/dtoa.o: $(srcdir)/m2/gm2-libs-ch/dtoa.cc m2/gm2-libs/gm2-libs-host.h
8d2c5b61 1424 -test -d $(@D) || $(mkinstalldirs) $(@D)
1eee94d3
GM
1425 $(CXX) -c $(CFLAGS) -Im2/gm2-libs -I$(srcdir)/m2 -Im2 -I. -Im2/gm2-libs-boot $(INCLUDES) $< -o $@
1426
1427m2/gm2-libs-boot/ldtoa.o: $(srcdir)/m2/gm2-libs-ch/ldtoa.cc m2/gm2-libs/gm2-libs-host.h
8d2c5b61 1428 -test -d $(@D) || $(mkinstalldirs) $(@D)
1eee94d3
GM
1429 $(CXX) -c $(CFLAGS) -Im2/gm2-libs -I$(srcdir)/m2 -Im2 -I. -Im2/gm2-libs-boot $(INCLUDES) $< -o $@
1430
1431m2/gm2-libs-boot/termios.o: $(srcdir)/m2/gm2-libs-ch/termios.c $(BUILD-LIBS-BOOT-H) m2/gm2-libs/gm2-libs-host.h
8d2c5b61 1432 -test -d $(@D) || $(mkinstalldirs) $(@D)
1eee94d3
GM
1433 $(CXX) -c $(CFLAGS) -Im2/gm2-libs -I$(srcdir)/m2 -Im2 -I. -Im2/gm2-libs-boot $(INCLUDES) $< -o $@
1434
1435m2/gm2-libs-boot/SysExceptions.o: $(srcdir)/m2/gm2-libs-ch/SysExceptions.c \
1436 m2/gm2-libs-boot/$(SRC_PREFIX)SysExceptions.h m2/gm2-libs/gm2-libs-host.h
8d2c5b61 1437 -test -d $(@D) || $(mkinstalldirs) $(@D)
1eee94d3
GM
1438 $(CXX) -c $(CFLAGS) -Im2/gm2-libs -I$(srcdir)/m2 -Im2 -I. -Im2/gm2-libs-boot $(INCLUDES) $< -o $@
1439
1440m2/gm2-libs-boot/SysStorage.o: $(srcdir)/m2/gm2-libs/SysStorage.mod $(MCDEPS) $(BUILD-BOOT-H)
8d2c5b61 1441 -test -d $(@D) || $(mkinstalldirs) $(@D)
1eee94d3
GM
1442 $(MC) -o=m2/gm2-libs-boot/SysStorage.c $(srcdir)/m2/gm2-libs/SysStorage.mod
1443 $(COMPILER) -DIN_GCC -c $(CFLAGS) \
1444 -I$(srcdir)/m2 -Im2 -I. -Im2/gm2-libs-boot $(MCINCLUDES) $(INCLUDES) \
1445 m2/gm2-libs-boot/SysStorage.c -o m2/gm2-libs-boot/SysStorage.o
1446
1447m2/gm2-compiler-boot/M2GCCDeclare.o: $(srcdir)/m2/gm2-compiler/M2GCCDeclare.mod $(MCDEPS) $(BUILD-BOOT-H)
8d2c5b61 1448 -test -d $(@D) || $(mkinstalldirs) $(@D)
1eee94d3
GM
1449 $(MC) --extended-opaque -o=m2/gm2-compiler-boot/M2GCCDeclare.c $<
1450 $(COMPILER) -c $(ALL_COMPILERFLAGS) $(ALL_CPPFLAGS) $(GM2GCC) \
1451 -I. -I$(srcdir)/../include -I$(srcdir) \
1452 -I. -Im2/gm2-libs-boot -Im2/gm2-compiler-boot \
1453 -I$(srcdir)/m2/gm2-libiberty $(MCINCLUDES) $(INCLUDES) m2/gm2-compiler-boot/M2GCCDeclare.c -o $@
1454
1455m2/gm2-compiler-boot/M2Error.o: $(srcdir)/m2/gm2-compiler/M2Error.mod $(MCDEPS) $(BUILD-BOOT-H)
8d2c5b61 1456 -test -d $(@D) || $(mkinstalldirs) $(@D)
1eee94d3
GM
1457 $(MC) --extended-opaque -o=m2/gm2-compiler-boot/M2Error.c $<
1458 $(COMPILER) -c $(ALL_COMPILERFLAGS) $(ALL_CPPFLAGS) $(GM2GCC) \
1459 -I. -I$(srcdir)/../include -I$(srcdir) \
1460 -I. -Im2/gm2-libs-boot -Im2/gm2-compiler-boot \
1461 -I$(srcdir)/m2/gm2-libiberty $(MCINCLUDES) $(INCLUDES) m2/gm2-compiler-boot/M2Error.c -o $@
1462
1463m2/gm2-compiler-boot/%.o: $(srcdir)/m2/gm2-compiler/%.mod $(BUILD-BOOT-H) $(MCDEPS) $(BUILD-BOOT-H)
8d2c5b61 1464 -test -d $(@D) || $(mkinstalldirs) $(@D)
1eee94d3
GM
1465 $(MC) -o=m2/gm2-compiler-boot/$*.c $(srcdir)/m2/gm2-compiler/$*.mod
1466 $(COMPILER) -c $(ALL_COMPILERFLAGS) $(ALL_CPPFLAGS) $(GM2GCC) \
1467 -I. -I$(srcdir)/../include -I$(srcdir) \
1468 -I. -Im2/gm2-libs-boot -Im2/gm2-compiler-boot -Im2/gm2-libiberty \
1469 -I$(srcdir)/m2/gm2-libiberty $(MCINCLUDES) $(INCLUDES) m2/gm2-compiler-boot/$*.c -o $@
1470
1471m2/gm2-compiler-boot/%.o: m2/gm2-compiler-boot/%.mod $(MCDEPS) $(BUILD-BOOT-H)
8d2c5b61 1472 -test -d $(@D) || $(mkinstalldirs) $(@D)
1eee94d3
GM
1473 $(MC) -o=m2/gm2-compiler-boot/$*.c m2/gm2-compiler-boot/$*.mod
1474 $(COMPILER) -c $(ALL_COMPILERFLAGS) $(ALL_CPPFLAGS) $(GM2GCC) \
1475 -I. -I$(srcdir)/../include -I$(srcdir) \
1476 -I. -Im2/gm2-libs-boot -Im2/gm2-compiler-boot \
1477 -I$(srcdir)/m2/gm2-libiberty $(MCINCLUDES) $(INCLUDES) m2/gm2-compiler-boot/$*.c -o $@
1478
1479m2/gm2-compiler-boot/$(SRC_PREFIX)%.h: $(srcdir)/m2/gm2-compiler/%.def $(MCDEPS)
8d2c5b61 1480 -test -d $(@D) || $(mkinstalldirs) $(@D)
1eee94d3
GM
1481 $(MC) -o=$@ $(srcdir)/m2/gm2-compiler/$*.def
1482
1483m2/gm2-compiler-boot/m2flex.o: m2/gm2-compiler/m2flex.c $(BUILD-BOOT-H) $(TIMEVAR_H) \
1484 $(BUILD-LIBS-BOOT-H) m2/gm2-compiler-boot/$(SRC_PREFIX)NameKey.h \
1485 $(CONFIG_H) m2/gm2config.h $(TARGET_H) $(PLUGIN_HEADERS)
8d2c5b61 1486 -test -d $(@D) || $(mkinstalldirs) $(@D)
1eee94d3
GM
1487 $(COMPILER) -c -g $(ALL_COMPILERFLAGS) $(ALL_CPPFLAGS) $(INCLUDES) \
1488 $(GM2GCC) $(INCLUDES) -I$(srcdir)/m2 \
1489 -Im2 -Im2/gm2-compiler-boot -Im2/gm2-libs-boot $< -o $@
1490
1491m2/gm2-compiler/m2flex.c: $(srcdir)/m2/m2.flex $(TIMEVAR_H) insn-attr-common.h
8d2c5b61 1492 -test -d $(@D) || $(mkinstalldirs) $(@D)
1eee94d3
GM
1493 flex -t $< | sed -e 's/ malloc/ xmalloc/' | sed -e 's/ realloc/ xrealloc/' > $@
1494
1495m2/gm2-libiberty/$(SRC_PREFIX)%.h: $(srcdir)/m2/gm2-libiberty/%.def $(MCDEPS)
8d2c5b61 1496 -test -d $(@D) || $(mkinstalldirs) $(@D)
1eee94d3
GM
1497 $(MC) -o=$@ $(srcdir)/m2/gm2-libiberty/$*.def
1498
1499# The rules to build objects in gm2-compiler and gm2-libs directories.
1500
1501m2/gm2-compiler/%.o: $(srcdir)/m2/gm2-compiler/%.mod
8d2c5b61 1502 -test -d $(@D) || $(mkinstalldirs) $(@D)
1eee94d3
GM
1503 $(GM2_1) $(GM2_FLAGS) -c -I$(srcdir)/m2/gm2-compiler -I$(srcdir)/m2/gm2-libs -I$(srcdir)/m2/gm2-gcc -I$(srcdir)/m2/gm2-libiberty $< -o $@
1504
1505m2/gm2-compiler/m2flex.o: m2/gm2-compiler/m2flex.c m2/gm2-libs/gm2-libs-host.h $(TIMEVAR_H)
8d2c5b61 1506 -test -d $(@D) || $(mkinstalldirs) $(@D)
1eee94d3
GM
1507 $(COMPILER) -c -g $(ALL_COMPILERFLAGS) $(ALL_CPPFLAGS) $(INCLUDES) \
1508 $(GM2GCC) -Im2/gm2-compiler-boot -Im2/gm2-libs-boot $< -o $@
1509
1510m2/gm2-compiler/%.o: m2/gm2-compiler/%.mod
8d2c5b61 1511 -test -d $(@D) || $(mkinstalldirs) $(@D)
1eee94d3
GM
1512 $(GM2_1) $(GM2_FLAGS) -c -I$(srcdir)/m2/gm2-compiler -I$(srcdir)/m2/gm2-libs -I$(srcdir)/m2/gm2-gcc -I$(srcdir)/m2/gm2-libiberty $< -o $@
1513
1514m2/gm2-libs-iso/%.o: $(srcdir)/m2/gm2-libs-iso/%.c m2/gm2-libs/gm2-libs-host.h
8d2c5b61 1515 -test -d $(@D) || $(mkinstalldirs) $(@D)
1eee94d3
GM
1516 $(CXX) -DBUILD_GM2_LIBS_TARGET -DBUILD_GM2_LIBS -c $(CFLAGS) -Im2/gm2-libs -I$(srcdir)/m2 -Im2/gm2-libs-boot $(INCLUDES) $< -o $@
1517
1518m2/gm2-libs-iso/%.o: $(srcdir)/m2/gm2-libs-iso/%.mod
8d2c5b61 1519 -test -d $(@D) || $(mkinstalldirs) $(@D)
1eee94d3
GM
1520 $(GM2_1) $(GM2_ISO_FLAGS) -c -B./ -Im2/gm2-libs-iso:$(srcdir)/m2/gm2-libs-iso -I$(srcdir)/m2/gm2-libs $< -o $@
1521
1522
1523# We build the cc1gm2$(exeext) from the boot stage and then proceed to build it
1524# again using itself.
1525
1526m2/gm2-libs/gm2-libs-host.h:
8d2c5b61 1527 -test -d $(@D) || $(mkinstalldirs) $(@D)
1eee94d3
GM
1528 echo "Configuring to build libraries using native compiler" ; \
1529 NEW_SRCDIR=`${srcdir}/m2/tools-src/calcpath ../../ ${srcdir} m2/gm2-libs` ; \
1530 export NEW_SRCDIR ; \
1531 cd m2/gm2-libs ; \
1532 $(SHELL) -c '$${NEW_SRCDIR}/config-host \
1533 --srcdir=$${NEW_SRCDIR} \
1534 --target=$(target) \
1535 --program-suffix=$(exeext)'
1536
1537# Autoconf inserts -DCROSS_DIRECTORY_STRUCTURE if we are building a
1538# cross compiler and the ../Makefile.in above appends this to INTERNAL_CFLAGS.
1539
66132b1f
GM
1540m2/gm2config.h: m2/gm2config.aci
1541 grep -v define\ PACKAGE_ $< > $@
1542
1543m2/gm2config.aci:
1eee94d3
GM
1544 NEW_SRCDIR=`${srcdir}/m2/tools-src/calcpath ../ ${srcdir} m2` ; \
1545 export NEW_SRCDIR ; \
1546 cd m2 ; \
1547 if echo $(INTERNAL_CFLAGS) | grep \\-DCROSS_DIRECTORY_STRUCTURE; then \
1548 AR=$(echo $(AR_FOR_TARGET) | sed -e "s/^ //") ; \
1549 export AR ; \
1550 RANLIB=$(echo $(RANLIB_FOR_TARGET) | sed -e "s/^ //") ; \
1551 export RANLIB ; \
1552 $(SHELL) -c '$${NEW_SRCDIR}/configure --srcdir=$${NEW_SRCDIR} \
1553 --target=$(target) --program-suffix=$(exeext) \
1554 --includedir=$(SYSTEM_HEADER_DIR) --libdir=$(libdir) \
1555 --libexecdir=$(libexecdir)' ; \
1556 else \
1557 $(SHELL) -c '$${NEW_SRCDIR}/configure --srcdir=$(NEW_SRCDIR) \
1558 --target=$(target) --program-suffix=$(exeext)' ; \
1559 fi
1560
1561$(objdir)/m2/gm2-libs-min/SYSTEM.def: $(GM2_PROG_DEP)
8d2c5b61 1562 -test -d $(@D) || $(mkinstalldirs) $(@D)
1eee94d3
GM
1563 $(SHELL) $(srcdir)/m2/tools-src/makeSystem -fpim \
1564 $(srcdir)/m2/gm2-libs-min/SYSTEM.def \
1565 $(srcdir)/m2/gm2-libs-min/SYSTEM.mod \
f235d695 1566 -I$(srcdir)/m2/gm2-libs-min -I$(srcdir)/m2/gm2-libs \
1eee94d3
GM
1567 "$(GM2_FOR_TARGET)" $@
1568
1569$(objdir)/m2/gm2-libs/SYSTEM.def: $(GM2_PROG_DEP)
8d2c5b61 1570 -test -d $(@D) || $(mkinstalldirs) $(@D)
1eee94d3
GM
1571 echo "GM2_FOR_TARGET $(GM2_FOR_TARGET)"
1572 echo "GCC_FOR_TARGET $(GCC_FOR_TARGET)"
1573 $(SHELL) $(srcdir)/m2/tools-src/makeSystem -fpim \
1574 $(srcdir)/m2/gm2-libs/SYSTEM.def \
1575 $(srcdir)/m2/gm2-libs/SYSTEM.mod \
1576 -I$(srcdir)/m2/gm2-libs \
1577 "$(GM2_FOR_TARGET)" $@
1578
1579$(objdir)/m2/gm2-libs-iso/SYSTEM.def: $(GM2_PROG_DEP)
8d2c5b61 1580 -test -d $(@D) || $(mkinstalldirs) $(@D)
1eee94d3
GM
1581 $(SHELL) $(srcdir)/m2/tools-src/makeSystem -fiso \
1582 $(srcdir)/m2/gm2-libs-iso/SYSTEM.def \
1583 $(srcdir)/m2/gm2-libs-iso/SYSTEM.mod \
f235d695 1584 -I$(srcdir)/m2/gm2-libs-iso -I$(srcdir)/m2/gm2-libs \
1eee94d3
GM
1585 "$(GM2_FOR_TARGET)" $@
1586
1587$(objdir)/m2/gm2-libs-coroutines/SYSTEM.def: $(GM2_PROG_DEP)
8d2c5b61 1588 -test -d $(@D) || $(mkinstalldirs) $(@D)
1eee94d3
GM
1589 $(SHELL) $(srcdir)/m2/tools-src/makeSystem -fpim \
1590 $(srcdir)/m2/gm2-libs-coroutines/SYSTEM.def \
1591 $(srcdir)/m2/gm2-libs-coroutines/SYSTEM.mod \
f235d695 1592 -I$(srcdir)/m2/gm2-libs-coroutines -I$(srcdir)/m2/gm2-libs-iso -I$(srcdir)/m2/gm2-libs \
1eee94d3
GM
1593 "$(GM2_FOR_TARGET)" $@
1594
1595build-compiler: $(GM2-COMP-MODS:%.mod=m2/gm2-compiler/%.o) \
1596 $(GM2-AUTO-MODS:%.mod=m2/gm2-compiler/%.o) \
1597 m2/gm2-compiler/m2flex.o
1598
1599m2/gm2-compiler/gm2.a: build-compiler gm2$(exeext)
8d2c5b61 1600 -test -d $(@D) || $(mkinstalldirs) $(@D)
1eee94d3
GM
1601 $(AR_FOR_TARGET) cr $@ $(GM2-COMP-MODS:%.mod=m2/gm2-compiler/%.o) \
1602 $(GM2-AUTO-MODS:%.mod=m2/gm2-compiler/%.o)
1603 $(RANLIB) $@
1604
1605m2/gm2-libs-boot/libgm2.a: m2/boot-bin/mc$(exeext) $(BUILD-LIBS-BOOT)
8d2c5b61 1606 -test -d $(@D) || $(mkinstalldirs) $(@D)
1eee94d3
GM
1607 $(AR) cr $@ $(GM2-LIBS-BOOT-MODS:%.mod=m2/gm2-libs-boot/%.o) \
1608 $(GM2-LIBS-BOOT-CC:%.cc=m2/gm2-libs-boot/%.o) \
1609 $(GM2-LIBS-BOOT-C:%.c=m2/gm2-libs-boot/%.o)
1610 $(RANLIB) $@
1611
1612m2/gm2-compiler-boot/gm2.a: m2/boot-bin/mc$(exeext) m2/boot-bin/mklink$(exeext) \
1613 $(BUILD-LIBS-BOOT) $(BUILD-COMPILER-BOOT)
8d2c5b61 1614 -test -d $(@D) || $(mkinstalldirs) $(@D)
1eee94d3
GM
1615 $(AR) cr $@ $(GM2-COMP-BOOT-MODS:%.mod=m2/gm2-compiler-boot/%.o) \
1616 $(GM2-AUTO-MODS:%.mod=m2/gm2-compiler-boot/%.o)
1617 $(RANLIB) $@
1618
1619m2/gm2-compiler-boot/gm2.a: m2/boot-bin/mc$(exeext)
1620
1621m2/boot-bin/mklink$(exeext): $(srcdir)/m2/tools-src/mklink.c
8d2c5b61 1622 -test -d $(@D) || $(mkinstalldirs) $(@D)
1eee94d3
GM
1623 $(CXX) $(CFLAGS) -I$(srcdir)/m2 -Im2/gm2-libs-boot -Im2/gm2-compiler-boot -I$(srcdir)/m2/mc-boot-ch $(INCLUDES) $< -o $@
1624
1625m2/gm2-compiler-boot/$(SRC_PREFIX)%.h: $(srcdir)/m2/gm2-compiler-boot/%.def $(MCDEPS)
8d2c5b61 1626 -test -d $(@D) || $(mkinstalldirs) $(@D)
1eee94d3
GM
1627 $(MC) --quiet -o=$@ $(srcdir)/m2/gm2-compiler-boot/$*.def
1628
1629m2/gm2-compiler/%.mod: $(srcdir)/m2/gm2-compiler/%.bnf $(PGE)
8d2c5b61 1630 -test -d $(@D) || $(mkinstalldirs) $(@D)
1eee94d3
GM
1631 $(PGE) -k -l $< -o $@
1632
1633m2/gm2-compiler-boot/%.mod: $(srcdir)/m2/gm2-compiler/%.bnf $(PGE)
8d2c5b61 1634 -test -d $(@D) || $(mkinstalldirs) $(@D)
1eee94d3
GM
1635 $(PGE) -k -l $< -o $@
1636
1637check-m2: check-gm2
1638check_m2: check-gm2
1639check_gm2: check-gm2
1640check-modula2: check-gm2
1641check_modula2: check-gm2
1642check-modula-2: check-gm2
1643check_modula-2: check-gm2
1644check_modula_2: check-gm2
1645
1646lang_checks += check-gm2
1647lang_checks_parallelized += check-gm2
1648# For description see the check_$lang_parallelize comment in gcc/Makefile.in.
1649check_gm2_parallelize = 10000
1650
1651check-gm2-local: $(GM2TESTSUITEDIR)/site.exp
1652 -(rootme=`${PWD_COMMAND}`; export rootme; \
1653 srcdir=`cd ${srcdir}; ${PWD_COMMAND}` ; export srcdir ; \
1654 cd $(TESTSUITEDIR); \
1655 EXPECT=${EXPECT} ; export EXPECT ; \
1656 if [ -f $${rootme}/../expect/expect ] ; then \
1657 TCL_LIBRARY=`cd .. ; cd ${srcdir}/../tcl/library ; ${PWD_COMMAND}` ; \
1658 export TCL_LIBRARY ; fi ; \
1659 $(RUNTEST) --tool gm2 --directory testsuite/m2/pim/pass)
1660
1661BUILD-PGE-O = \
1662 m2/pge-boot/GArgs.o \
1663 m2/pge-boot/GASCII.o \
1664 m2/pge-boot/GAssertion.o \
1665 m2/pge-boot/Gbnflex.o \
1666 m2/pge-boot/GDebug.o \
1667 m2/pge-boot/GDynamicStrings.o \
1668 m2/pge-boot/GFIO.o \
1669 m2/pge-boot/GIndexing.o \
1670 m2/pge-boot/GIO.o \
1671 m2/pge-boot/GLists.o \
1672 m2/pge-boot/GM2Dependent.o \
1673 m2/pge-boot/GM2EXCEPTION.o \
1674 m2/pge-boot/GM2RTS.o \
1675 m2/pge-boot/GNameKey.o \
1676 m2/pge-boot/GNumberIO.o \
1677 m2/pge-boot/GOutput.o \
1678 m2/pge-boot/Gpge.o \
1679 m2/pge-boot/GPushBackInput.o \
1680 m2/pge-boot/GRTExceptions.o \
1681 m2/pge-boot/GSFIO.o \
1682 m2/pge-boot/GStdIO.o \
1683 m2/pge-boot/GStorage.o \
1684 m2/pge-boot/GStrCase.o \
1685 m2/pge-boot/GStrIO.o \
1686 m2/pge-boot/GStrLib.o \
1687 m2/pge-boot/GSymbolKey.o \
1688 m2/pge-boot/GSysStorage.o \
1689 m2/pge-boot/Glibc.o \
1690 m2/pge-boot/Gerrno.o \
1691 m2/pge-boot/GUnixArgs.o \
1692 m2/pge-boot/GM2LINK.o \
1693 m2/pge-boot/Gtermios.o \
1694 m2/pge-boot/GSysExceptions.o \
1695 m2/pge-boot/Gabort.o \
1696 m2/pge-boot/Gmcrts.o \
1697 m2/pge-boot/main.o
1698
1699ifeq ($(M2_MAINTAINER),yes)
1700include m2/Make-maintainer
1701else
cb93c5f8 1702m2/pge-boot/%.o: m2/pge-boot/%.c m2/gm2-libs/gm2-libs-host.h m2/gm2config.h
8d2c5b61 1703 -test -d $(@D) || $(mkinstalldirs) $(@D)
1eee94d3
GM
1704 $(CXX) $(INCLUDES) -I$(srcdir)/m2/pge-boot -Im2/gm2-libs -g -c $< -o $@
1705
cb93c5f8 1706m2/pge-boot/%.o: m2/pge-boot/%.cc m2/gm2-libs/gm2-libs-host.h m2/gm2config.h
8d2c5b61 1707 -test -d $(@D) || $(mkinstalldirs) $(@D)
1eee94d3
GM
1708 $(CXX) $(INCLUDES) -I$(srcdir)/m2/pge-boot -Im2/gm2-libs -g -c $< -o $@
1709
1710$(PGE): $(BUILD-PGE-O)
1711 +$(LINKER) $(ALL_LINKERFLAGS) $(LDFLAGS) -o $@ $(BUILD-PGE-O) -lm
1712
1713endif