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