libstdc++: Include cstdarg in freestanding
[official-gcc.git] / gcc / m2 / Make-maintainer.in
blobc94d15bf5b27b36e3e339e29561753577918298d
1 # Make-maintainer.in subsidiary -*- makefile -*- build support for GNU M2 tools.
3 # Copyright (C) 2022-2023 Free Software Foundation, Inc.
5 #This file is part of GCC.
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.
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.
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/>.
21 # QUIAT=@
22 XGCC = ./xgcc -B./
23 GM2_2 = ./gm2 -B./m2/m2obj2 -g -fm2-g
25 # m2/ppg$(exeext)  is the recursive descent parser generator.
27 PPG-INTERFACE-C = libc.c mcrts.c Selective.c termios.c \
28                   SysExceptions.c wrapc.c \
29                   SYSTEM.c errno.c
31 PPG-INTERFACE-CC = UnixArgs.cc ldtoa.cc dtoa.cc
33 # Implementation modules found in the gm2-compiler directory.
35 PPG-MODS         = SymbolKey.mod   NameKey.mod  Lists.mod  bnflex.mod  Output.mod
37 PPG-DEFS         = SymbolKey.def   NameKey.def  Lists.def  bnflex.def  Output.def
39 # Core library definition modules used by ppg found in the gm2-libs directory.
41 PPG-LIB-DEFS     = Args.def Assertion.def ASCII.def Debug.def \
42                    DynamicStrings.def FIO.def Indexing.def IO.def \
43                    NumberIO.def PushBackInput.def \
44                    M2Dependent.def \
45                    M2EXCEPTION.def M2RTS.def \
46                    RTExceptions.def \
47                    StdIO.def SFIO.def StrIO.def StrLib.def \
48                    Storage.def StrCase.def SysStorage.def
50 # Core library implementation modules used by ppg found in the gm2-libs directory.
52 PPG-LIB-MODS     = ASCII.mod \
53                    Args.mod \
54                    Assertion.mod \
55                    Debug.mod \
56                    DynamicStrings.mod \
57                    FIO.mod \
58                    IO.mod \
59                    Indexing.mod \
60                    M2Dependent.mod \
61                    M2EXCEPTION.mod \
62                    M2RTS.mod \
63                    NumberIO.mod \
64                    PushBackInput.mod \
65                    RTExceptions.mod \
66                    SFIO.mod \
67                    StdIO.mod \
68                    Storage.mod \
69                    StrCase.mod \
70                    StrIO.mod \
71                    StrLib.mod \
72                    SysStorage.mod
74 # Program module ppg.mod from which pge.mod is created.  ppg.mod is
75 # where changes should be made and then you should run pge-maintainer
76 # to recreate the C++ version of pge.
78 PPG-SRC          = ppg.mod
80 BUILD-PPG-O = $(PPG-INTERFACE-C:%.c=m2/gm2-ppg-boot/$(SRC_PREFIX)%.o) \
81               $(PPG-INTERFACE-CC:%.cc=m2/gm2-ppg-boot/$(SRC_PREFIX)%.o) \
82               $(PPG-MODS:%.mod=m2/gm2-ppg-boot/$(SRC_PREFIX)%.o) \
83               $(PPG-LIB-MODS:%.mod=m2/gm2-ppg-boot/$(SRC_PREFIX)%.o) \
84               $(PPG-SRC:%.mod=m2/gm2-ppg-boot/$(SRC_PREFIX)%.o)
86 MCC_ARGS= --olang=c++ \
87  --quiet \
88  --h-file-prefix=$(SRC_PREFIX) \
89  -I$(srcdir)/m2/gm2-libs \
90  -I$(srcdir)/m2/gm2-compiler \
91  -I$(srcdir)/m2/gm2-libiberty \
92  -I$(srcdir)/m2/gm2-gcc
94 MCC=m2/boot-bin/mc$(exeext) $(MCC_ARGS)
96 BUILD-PPG-LIBS-H = $(PPG-LIB-DEFS:%.def=m2/gm2-ppg-boot/$(SRC_PREFIX)%.h)
98 BUILD-PPG-H = m2/boot-bin/mc$(exeext) $(BUILD-PPG-LIBS-H)
100 BUILD-BOOT-PPG-H: $(BUILD-BOOT-H) \
101                  m2/gm2-ppg-boot/$(SRC_PREFIX)M2RTS.h \
102                  m2/gm2-ppg-boot/$(SRC_PREFIX)M2Dependent.h \
103                  $(PPG-DEFS:%.def=m2/gm2-ppg-boot/$(SRC_PREFIX)%.h)
105 m2/gm2-ppg-boot/$(SRC_PREFIX)%.h: $(srcdir)/m2/gm2-libs/%.def $(MCDEPS)
106         -test -d m2/gm2-ppg-boot || $(mkinstalldirs) m2/gm2-ppg-boot
107         $(MCC) -o=$@ $(srcdir)/m2/gm2-libs/$*.def
109 m2/gm2-ppg-boot/$(SRC_PREFIX)%.o: m2/mc-boot-ch/$(SRC_PREFIX)%.c m2/gm2-libs/gm2-libs-host.h $(BUILD-BOOT-PPG-H)
110         -test -d m2/gm2-ppg-boot || $(mkinstalldirs) m2/gm2-ppg-boot
111         $(CXX) -I. -I$(srcdir)/../include -I$(srcdir) -I$(srcdir)/m2/mc-boot-ch -Im2/gm2-libs $(INCLUDES) -g -c $< -o $@
113 m2/gm2-ppg-boot/$(SRC_PREFIX)%.o: m2/mc-boot-ch/$(SRC_PREFIX)%.cc m2/gm2-libs/gm2-libs-host.h $(BUILD-BOOT-PPG-H)
114         -test -d m2/gm2-ppg-boot || $(mkinstalldirs) m2/gm2-ppg-boot
115         $(CXX) -I. -I$(srcdir)/../include -I$(srcdir) -I$(srcdir)/m2/mc-boot-ch -Im2/gm2-libs $(INCLUDES) -g -c $< -o $@
117 m2/gm2-ppg-boot/$(SRC_PREFIX)M2RTS.o: $(srcdir)/m2/gm2-libs/M2RTS.mod $(MCDEPS) $(BUILD-BOOT-PPG-H)
118         -test -d m2/gm2-ppg-boot || $(mkinstalldirs) m2/gm2-ppg-boot
119         $(MCC) --suppress-noreturn -o=m2/gm2-ppg-boot/$(SRC_PREFIX)M2RTS.cc $(srcdir)/m2/gm2-libs/M2RTS.mod
120         $(CXX) -I. -I$(srcdir)/../include -I$(srcdir) \
121               -Im2/gm2-ppg-boot -I$(srcdir)/m2/mc-boot -Im2/gm2-libs-boot \
122               -I$(srcdir)/m2/mc-boot-ch $(INCLUDES) -g -c m2/gm2-ppg-boot/$(SRC_PREFIX)M2RTS.cc -o $@
124 m2/gm2-ppg-boot/$(SRC_PREFIX)%.o: $(srcdir)/m2/gm2-libs/%.mod $(MCDEPS) $(BUILD-BOOT-PPG-H)
125         -test -d m2/gm2-ppg-boot || $(mkinstalldirs) m2/gm2-ppg-boot
126         $(MCC) -o=m2/gm2-ppg-boot/$(SRC_PREFIX)$*.cc $(srcdir)/m2/gm2-libs/$*.mod
127         $(CXX) -I. -I$(srcdir)/../include -I$(srcdir) \
128               -Im2/gm2-ppg-boot -I$(srcdir)/m2/mc-boot -Im2/gm2-libs-boot \
129               -I$(srcdir)/m2/mc-boot-ch $(INCLUDES) -g -c m2/gm2-ppg-boot/$(SRC_PREFIX)$*.cc -o $@
131 m2/gm2-ppg-boot/$(SRC_PREFIX)%.o: $(srcdir)/m2/gm2-compiler/%.mod $(MCDEPS) $(BUILD-BOOT-PPG-H)
132         -test -d m2/gm2-ppg-boot || $(mkinstalldirs) m2/gm2-ppg-boot
133         $(MCC) -o=m2/gm2-ppg-boot/$(SRC_PREFIX)$*.cc $(srcdir)/m2/gm2-compiler/$*.mod
134         $(CXX) -I. -I$(srcdir)/../include -I$(srcdir) \
135               -Im2/mc-boot -Im2/gm2-compiler-boot -Im2/gm2-libs-boot \
136               -I$(srcdir)/m2/mc-boot-ch $(INCLUDES) -g -c m2/gm2-ppg-boot/$(SRC_PREFIX)$*.cc -o $@
138 m2/ppg$(exeext): m2/boot-bin/mc $(BUILD-PPG-O) $(BUILD-MC-INTERFACE-O) m2/gm2-ppg-boot/main.o \
139                  m2/gm2-libs-boot/RTcodummy.o m2/mc-boot-ch/$(SRC_PREFIX)abort.o
140         -test -d m2 || $(mkinstalldirs) m2
141         +$(LINKER) $(ALL_LINKERFLAGS) $(LDFLAGS) -o $@ $(BUILD-PPG-O) m2/gm2-ppg-boot/main.o \
142                  m2/gm2-libs-boot/RTcodummy.o m2/mc-boot-ch/$(SRC_PREFIX)abort.o -lm
144 m2/gm2-ppg-boot/main.o: $(M2LINK) $(srcdir)/m2/init/mcinit
145         -test -d m2/gm2-ppg-boot || $(mkinstalldirs) m2/gm2-ppg-boot
146         unset CC ; $(M2LINK) -s --langc++ --exit --name mainppginit.cc $(srcdir)/m2/init/ppginit
147         mv mainppginit.cc m2/gm2-ppg-boot/main.cc
148         $(CXX) $(INCLUDES) -g -c -o $@ m2/gm2-ppg-boot/main.cc
150 m2/gm2-auto:
151         -test -d $@ || $(mkinstalldirs) $@
153 c-family/m2pp.o : $(srcdir)/m2/m2pp.cc $(GCC_HEADER_DEPENDENCIES_FOR_M2)
154         $(COMPILER) -c -g $(ALL_COMPILERFLAGS) \
155             $(ALL_CPPFLAGS) $(INCLUDES) $< $(OUTPUT_OPTION)
157 # m2/pg$(exext) is the 2nd generation parser generator built from ebnf
158 # without error recovery
160 PG-SRC = pg.mod
161 PGE-DEF = ASCII.def \
162    Args.def \
163    Assertion.def \
164    Break.def  \
165    COROUTINES.def \
166    CmdArgs.def \
167    Debug.def \
168    DynamicStrings.def \
169    Environment.def \
170    FIO.def \
171    FormatStrings.def \
172    FpuIO.def \
173    IO.def \
174    M2Dependent.def \
175    M2EXCEPTION.def \
176    M2RTS.def \
177    MemUtils.def \
178    NumberIO.def \
179    PushBackInput.def \
180    RTExceptions.def \
181    RTco.def \
182    RTentity.def \
183    RTint.def \
184    SArgs.def \
185    SFIO.def \
186    SYSTEM.def \
187    Selective.def \
188    StdIO.def \
189    Storage.def \
190    StrCase.def \
191    StrIO.def \
192    StrLib.def \
193    StringConvert.def \
194    SysExceptions.def \
195    SysStorage.def \
196    TimeString.def \
197    UnixArgs.def \
198    dtoa.def \
199    errno.def \
200    ldtoa.def \
201    libc.def \
202    libm.def \
203    termios.def \
204    wrapc.def \
206 PGE-DEPS = Gabort.cc \
207    GArgs.cc \
208    GArgs.h \
209    GASCII.cc \
210    GASCII.h \
211    GAssertion.cc \
212    GAssertion.h \
213    Gbnflex.cc \
214    Gbnflex.h \
215    GBreak.h \
216    GBuiltins.cc \
217    Gcbuiltin.cc \
218    GCmdArgs.h \
219    GDebug.cc \
220    GDebug.h \
221    Gdtoa.cc \
222    Gdtoa.h \
223    GDynamicStrings.cc \
224    GDynamicStrings.h \
225    GEnvironment.h \
226    Gerrno.cc \
227    Gerrno.h \
228    GFIO.cc \
229    GFIO.h \
230    GFormatStrings.h \
231    GFpuIO.h \
232    GIndexing.cc \
233    GIndexing.h \
234    GIO.cc \
235    GIO.h \
236    Gldtoa.cc \
237    Gldtoa.h \
238    Glibc.cc \
239    Glibc.h \
240    Glibm.cc \
241    Glibm.h \
242    GLists.cc \
243    GLists.h \
244    GM2Dependent.cc \
245    GM2Dependent.h \
246    GM2EXCEPTION.cc \
247    GM2EXCEPTION.h \
248    GM2RTS.cc \
249    GM2RTS.h \
250    Gmcrts.cc \
251    Gmcrts.h \
252    GNameKey.cc \
253    GNameKey.h \
254    Gnetwork.h \
255    GNumberIO.cc \
256    GNumberIO.h \
257    GOutput.cc \
258    GOutput.h \
259    Gpge.cc \
260    GPushBackInput.cc \
261    GPushBackInput.h \
262    GRTco.cc \
263    GRTExceptions.cc \
264    GRTExceptions.h \
265    GSArgs.h \
266    GScan.h \
267    GSelective.cc \
268    GSEnvironment.h \
269    GSFIO.cc \
270    GSFIO.h \
271    GStdIO.cc \
272    GStdIO.h \
273    GStorage.cc \
274    GStorage.h \
275    GStrCase.cc \
276    GStrCase.h \
277    GStringConvert.h \
278    GStrIO.cc \
279    GStrIO.h \
280    GStrLib.cc \
281    GStrLib.h \
282    GSymbolKey.cc \
283    GSymbolKey.h \
284    GSysExceptions.cc \
285    GSysExceptions.h \
286    GSysStorage.cc \
287    GSysStorage.h \
288    GSYSTEM.cc \
289    GSYSTEM.h \
290    Gtermios.cc \
291    Gtermios.h \
292    GTimeString.h \
293    GUnixArgs.cc \
294    GUnixArgs.h \
295    Gwrapc.cc \
296    Gwrapc.h
298 BUILD-PG-O = $(PPG-INTERFACE-C:%.c=m2/gm2-pg-boot/$(SRC_PREFIX)%.o) \
299              $(PPG-INTERFACE-CC:%.cc=m2/gm2-pg-boot/$(SRC_PREFIX)%.o) \
300              $(PPG-MODS:%.mod=m2/gm2-pg-boot/$(SRC_PREFIX)%.o) \
301              $(PPG-LIB-MODS:%.mod=m2/gm2-pg-boot/$(SRC_PREFIX)%.o) \
302              $(PG-SRC:%.mod=m2/gm2-pg-boot/$(SRC_PREFIX)%.o)
304 BUILD-BOOT-PG-H: $(BUILD-BOOT-H) \
305                  m2/gm2-pg-boot/$(SRC_PREFIX)M2RTS.h \
306                  m2/gm2-pg-boot/$(SRC_PREFIX)M2Dependent.h
308 m2/gm2-pg-boot/$(SRC_PREFIX)%.h: $(srcdir)/m2/gm2-libs/%.def $(MCDEPS)
309         -test -d m2/gm2-pg-boot || $(mkinstalldirs) m2/gm2-pg-boot
310         $(MCC) -o=$@ $(srcdir)/m2/gm2-libs/$*.def
312 m2/gm2-pg-boot/$(SRC_PREFIX)%.o: m2/mc-boot-ch/$(SRC_PREFIX)%.c m2/gm2-libs/gm2-libs-host.h $(BUILD-BOOT-PG-H)
313         -test -d m2/gm2-pg-boot || $(mkinstalldirs) m2/gm2-pg-boot
314         $(CXX) -I. -I$(srcdir)/../include -I$(srcdir) -I$(srcdir)/m2/mc-boot-ch -Im2/gm2-libs $(INCLUDES) -g -c $< -o $@
316 m2/gm2-pg-boot/$(SRC_PREFIX)%.o: m2/mc-boot-ch/$(SRC_PREFIX)%.cc m2/gm2-libs/gm2-libs-host.h $(BUILD-BOOT-PG-H)
317         -test -d m2/gm2-pg-boot || $(mkinstalldirs) m2/gm2-pg-boot
318         $(CXX) -I. -I$(srcdir)/../include -I$(srcdir) -I$(srcdir)/m2/mc-boot-ch -Im2/gm2-libs $(INCLUDES) -g -c $< -o $@
320 m2/gm2-pg-boot/$(SRC_PREFIX)M2RTS.o: $(srcdir)/m2/gm2-libs/M2RTS.mod $(MCDEPS) $(BUILD-BOOT-PG-H)
321         -test -d m2/gm2-pg-boot || $(mkinstalldirs) m2/gm2-pg-boot
322         $(MCC) --suppress-noreturn -o=m2/gm2-pg-boot/$(SRC_PREFIX)M2RTS.c $(srcdir)/m2/gm2-libs/M2RTS.mod
323         $(CXX) -I. -I$(srcdir)/../include -I$(srcdir) -Im2/gm2-pg-boot  -I$(srcdir)/m2/mc-boot \
324                -I$(srcdir)/m2/mc-boot-ch \
325                -Im2/gm2-libs-boot $(INCLUDES) \
326               -g -c m2/gm2-pg-boot/$(SRC_PREFIX)M2RTS.c -o $@
328 m2/gm2-pg-boot/$(SRC_PREFIX)%.o: $(srcdir)/m2/gm2-libs/%.mod $(MCDEPS) $(BUILD-BOOT-PG-H)
329         -test -d m2/gm2-pg-boot || $(mkinstalldirs) m2/gm2-pg-boot
330         $(MCC) -o=m2/gm2-pg-boot/$(SRC_PREFIX)$*.c $(srcdir)/m2/gm2-libs/$*.mod
331         $(CXX) -I. -I$(srcdir)/../include -I$(srcdir) -Im2/gm2-pg-boot  -I$(srcdir)/m2/mc-boot \
332                -I$(srcdir)/m2/mc-boot-ch \
333                -Im2/gm2-libs-boot $(INCLUDES) \
334               -g -c m2/gm2-pg-boot/$(SRC_PREFIX)$*.c -o $@
336 m2/gm2-pg-boot/$(SRC_PREFIX)%.o: $(srcdir)/m2/gm2-compiler/%.mod $(MCDEPS) $(BUILD-BOOT-PG-H)
337         -test -d m2/gm2-pg-boot || $(mkinstalldirs) m2/gm2-pg-boot
338         $(MCC) -o=m2/gm2-pg-boot/$(SRC_PREFIX)$*.c $(srcdir)/m2/gm2-compiler/$*.mod
339         $(CXX) -I. -I$(srcdir)/../include -I$(srcdir) -I$(srcdir)/m2/mc-boot -Im2/gm2-compiler-boot -Im2/gm2-libs-boot \
340               -I$(srcdir)/m2/mc-boot-ch $(INCLUDES) -g -c m2/gm2-pg-boot/$(SRC_PREFIX)$*.c -o $@
342 m2/gm2-pg-boot/$(SRC_PREFIX)pg.o:  m2/gm2-auto/pg.mod $(MCDEPS) $(BUILD-BOOT-PG-H)
343         -test -d m2/gm2-pg-boot || $(mkinstalldirs) m2/gm2-pg-boot
344         $(MCC) -o=m2/gm2-pg-boot/$(SRC_PREFIX)pg.c m2/gm2-auto/pg.mod
345         $(CXX) -I. -I$(srcdir)/../include -I$(srcdir) -I$(srcdir)/m2/mc-boot -Im2/gm2-compiler-boot -Im2/gm2-libs-boot \
346               -I$(srcdir)/m2/mc-boot-ch $(INCLUDES) -g -c m2/gm2-pg-boot/$(SRC_PREFIX)pg.c -o $@
348 m2/pg$(exeext): m2/boot-bin/mc \
349     $(BUILD-PG-O) $(GM2-PPG-MODS:%.mod=m2/gm2-pg-boot/%.o) \
350     $(BUILD-MC-INTERFACE-O) m2/gm2-pg-boot/main.o m2/gm2-libs-boot/RTcodummy.o \
351     m2/mc-boot-ch/$(SRC_PREFIX)abort.o
352         -test -d m2 || $(mkinstalldirs) m2
353         +$(LINKER) $(ALL_LINKERFLAGS) $(LDFLAGS) -o $@ $(BUILD-PG-O) \
354          m2/gm2-pg-boot/main.o m2/gm2-libs-boot/RTcodummy.o \
355          m2/mc-boot-ch/$(SRC_PREFIX)abort.o -lm
357 m2/gm2-auto/pginit:
358         -test -d m2/gm2-auto || $(mkinstalldirs) m2/gm2-auto
359         sed -e 's/ppg/pg/' < $(srcdir)/m2/init/ppginit > $@
361 m2/gm2-pg-boot/main.o: m2/gm2-auto/pginit $(M2LINK)
362         -test -d m2/gm2-pg-boot || $(mkinstalldirs) m2/gm2-pg-boot
363         unset CC ; $(M2LINK) -s --langc++ --exit --name mainpginit.cc m2/gm2-auto/pginit
364         mv mainpginit.cc m2/gm2-pg-boot/main.cc
365         $(CXX) $(INCLUDES) -g -c -o $@ m2/gm2-pg-boot/main.cc
367 m2/pg-e$(exeext): m2/pg$(exeext)
368         -test -d m2 || $(mkinstalldirs) m2
369         $(CP) m2/pg$(exeext) m2/pg-e$(exeext)
370         $(SHELL) $(srcdir)/m2/tools-src/buildpg $(srcdir)/m2/gm2-compiler/ppg.mod pg -e > m2/gm2-auto/t.bnf
371         ./m2/pg-e$(exeext) -e -l m2/gm2-auto/t.bnf | sed -e 's/t\.bnf/pg\.bnf/' > m2/gm2-auto/t.mod
372         $(QUIAT)if ! diff m2/gm2-auto/t.mod m2/gm2-auto/pg.mod > /dev/null ; then \
373            echo "pg failed during self build" ; \
374            exit 1 ; \
375         fi
376         $(RM) m2/gm2-auto/t.bnf m2/gm2-auto/t.mod
378 m2/gm2-auto/pg.mod: m2/ppg$(exeext)
379         -test -d m2/gm2-auto || $(mkinstalldirs) m2/gm2-auto
380         $(SHELL) $(srcdir)/m2/tools-src/buildpg $(srcdir)/m2/gm2-compiler/ppg.mod pg -e > m2/gm2-auto/pg.bnf
381         ./m2/ppg$(exeext) -e -l m2/gm2-auto/pg.bnf > m2/gm2-auto/pg.mod
383 # pge is the recursive descent parser with first/followset error recovery.
385 PGE-SRC = pge.mod
387 BUILD-PGE-O = $(PPG-INTERFACE-C:%.c=m2/gm2-pge-boot/$(SRC_PREFIX)%.o) \
388               $(PPG-INTERFACE-CC:%.cc=m2/gm2-pge-boot/$(SRC_PREFIX)%.o) \
389               $(PPG-MODS:%.mod=m2/gm2-pge-boot/$(SRC_PREFIX)%.o) \
390               $(PPG-LIB-MODS:%.mod=m2/gm2-pge-boot/$(SRC_PREFIX)%.o) \
391               $(PGE-SRC:%.mod=m2/gm2-pge-boot/$(SRC_PREFIX)%.o)
393 BUILD-BOOT-PGE-H: $(BUILD-BOOT-H) $(PGE-DEF:%.def=m2/gm2-pge-boot/$(SRC_PREFIX)%.h) \
394                   m2/gm2-pge-boot/GM2RTS.h m2/gm2-pge-boot/GM2Dependent.h
396 m2/gm2-auto/pge.mod: m2/pg$(exeext)
397         -test -d m2/gm2-auto || $(mkinstalldirs) m2/gm2-auto
398         $(SHELL) $(srcdir)/m2/tools-src/buildpg $(srcdir)/m2/gm2-compiler/ppg.mod pge > m2/gm2-auto/pge.bnf
399         ./m2/pg$(exeext) -l m2/gm2-auto/pge.bnf -o m2/gm2-auto/pge.mod
401 m2/gm2-pge-boot/$(SRC_PREFIX)%.h: $(srcdir)/m2/gm2-libs/%.def $(MCDEPS)
402         -test -d m2/gm2-pge-boot || $(mkinstalldirs) m2/gm2-pge-boot
403         $(MCC) -o=$@ $(srcdir)/m2/gm2-libs/$*.def
405 m2/gm2-pge-boot/$(SRC_PREFIX)libc.o: $(srcdir)/m2/mc-boot-ch/Glibc.c m2/gm2-libs/gm2-libs-host.h
406         -test -d m2/gm2-pge-boot || $(mkinstalldirs) m2/gm2-pge-boot
407         $(CXX) -I. -I$(srcdir)/../include -I$(srcdir) $(INCLUDES) -I$(srcdir)/m2/mc-boot-ch -Im2/gm2-libs -g -c $< -o $@
409 m2/gm2-pge-boot/$(SRC_PREFIX)mcrts.o:  $(srcdir)/m2/mc-boot-ch/Gmcrts.c m2/gm2-libs/gm2-libs-host.h
410         -test -d m2/gm2-pge-boot || $(mkinstalldirs) m2/gm2-pge-boot
411         $(CXX) -I. -I$(srcdir)/../include -I$(srcdir) $(INCLUDES) -I$(srcdir)/m2/mc-boot-ch -Im2/gm2-libs -g -c $< -o $@
413 m2/gm2-pge-boot/$(SRC_PREFIX)UnixArgs.o:  $(srcdir)/m2/mc-boot-ch/GUnixArgs.cc
414         -test -d m2/gm2-pge-boot || $(mkinstalldirs) m2/gm2-pge-boot
415         $(CXX) -I. -I$(srcdir)/../include -I$(srcdir) -I$(srcdir)/m2/mc-boot-ch $(INCLUDES) -g -c $< -o $@
417 m2/gm2-pge-boot/$(SRC_PREFIX)Selective.o:  $(srcdir)/m2/mc-boot-ch/GSelective.c m2/gm2-libs/gm2-libs-host.h
418         -test -d m2/gm2-pge-boot || $(mkinstalldirs) m2/gm2-pge-boot
419         $(CXX) -I. -I$(srcdir)/../include -I$(srcdir) -I$(srcdir)/m2/mc-boot-ch $(INCLUDES) -Im2/gm2-libs -g -c $< -o $@
421 m2/gm2-pge-boot/$(SRC_PREFIX)termios.o:  $(srcdir)/m2/mc-boot-ch/Gtermios.cc m2/gm2-libs/gm2-libs-host.h
422         -test -d m2/gm2-pge-boot || $(mkinstalldirs) m2/gm2-pge-boot
423         $(CXX) -I. -I$(srcdir)/../include -I$(srcdir) -I$(srcdir)/m2/mc-boot-ch -Im2/gm2-libs $(INCLUDES) -g -c $< -o $@
425 m2/gm2-pge-boot/$(SRC_PREFIX)SysExceptions.o:  $(srcdir)/m2/mc-boot-ch/GSysExceptions.c m2/gm2-libs/gm2-libs-host.h
426         -test -d m2/gm2-pge-boot || $(mkinstalldirs) m2/gm2-pge-boot
427         $(CXX) -I. -I$(srcdir)/../include -I$(srcdir) -I$(srcdir)/m2/mc-boot-ch -Im2/gm2-libs $(INCLUDES) -g -c $< -o $@
429 m2/gm2-pge-boot/$(SRC_PREFIX)ldtoa.o:  $(srcdir)/m2/mc-boot-ch/Gldtoa.cc m2/gm2-libs/gm2-libs-host.h
430         -test -d m2/gm2-pge-boot || $(mkinstalldirs) m2/gm2-pge-boot
431         $(CXX) -I. -I$(srcdir)/../include -I$(srcdir) -I$(srcdir)/m2/mc-boot-ch -Im2/gm2-libs $(INCLUDES) -g -c $< -o $@
433 m2/gm2-pge-boot/$(SRC_PREFIX)dtoa.o:  $(srcdir)/m2/mc-boot-ch/Gdtoa.cc m2/gm2-libs/gm2-libs-host.h
434         -test -d m2/gm2-pge-boot || $(mkinstalldirs) m2/gm2-pge-boot
435         $(CXX) -I. -I$(srcdir)/../include -I$(srcdir) -I$(srcdir)/m2/mc-boot-ch -Im2/gm2-libs $(INCLUDES) -g -c $< -o $@
437 m2/gm2-pge-boot/$(SRC_PREFIX)wrapc.o:  $(srcdir)/m2/mc-boot-ch/Gwrapc.c m2/gm2-libs/gm2-libs-host.h
438         -test -d m2/gm2-pge-boot || $(mkinstalldirs) m2/gm2-pge-boot
439         $(CXX) -I. -I$(srcdir)/../include -I$(srcdir) -I$(srcdir)/m2/mc-boot-ch -Im2/gm2-libs $(INCLUDES) -g -c $< -o $@
441 m2/gm2-pge-boot/$(SRC_PREFIX)SYSTEM.o:  $(srcdir)/m2/mc-boot-ch/GSYSTEM.c $(BUILD-BOOT-PGE-H)
442         -test -d m2/gm2-pge-boot || $(mkinstalldirs) m2/gm2-pge-boot
443         $(CXX) -I. -I$(srcdir)/../include -I$(srcdir) -I$(srcdir)/m2/mc-boot-ch $(INCLUDES) -g -c $< -o $@
445 m2/gm2-pge-boot/$(SRC_PREFIX)errno.o:  $(srcdir)/m2/mc-boot-ch/Gerrno.cc
446         -test -d m2/gm2-pge-boot || $(mkinstalldirs) m2/gm2-pge-boot
447         $(CXX) -I. -I$(srcdir)/../include -I$(srcdir) -I$(srcdir)/m2/mc-boot-ch $(INCLUDES) -g -c $< -o $@
449 m2/gm2-pge-boot/$(SRC_PREFIX)M2RTS.o: $(srcdir)/m2/gm2-libs/M2RTS.mod $(MCDEPS) $(BUILD-BOOT-PGE-H)
450         -test -d m2/gm2-pge-boot || $(mkinstalldirs) m2/gm2-pge-boot
451         $(MCC) --suppress-noreturn -o=m2/gm2-pge-boot/$(SRC_PREFIX)M2RTS.cc $(srcdir)/m2/gm2-libs/M2RTS.mod
452         $(CXX) -I. -I$(srcdir)/../include -I$(srcdir) -I$(srcdir)/m2/gm2-pge-boot -I$(srcdir)/m2/mc-boot \
453               -I$(srcdir)/m2/mc-boot-ch -Im2/gm2-libs-boot \
454               $(INCLUDES) -g -c m2/gm2-pge-boot/$(SRC_PREFIX)M2RTS.cc -o $@
456 m2/gm2-pge-boot/$(SRC_PREFIX)%.o: $(srcdir)/m2/gm2-libs/%.mod $(MCDEPS) $(BUILD-BOOT-PGE-H)
457         -test -d m2/gm2-pge-boot || $(mkinstalldirs) m2/gm2-pge-boot
458         $(MCC) -o=m2/gm2-pge-boot/$(SRC_PREFIX)$*.cc $(srcdir)/m2/gm2-libs/$*.mod
459         $(CXX) -I. -I$(srcdir)/../include -I$(srcdir) -I$(srcdir)/m2/gm2-pge-boot -I$(srcdir)/m2/mc-boot \
460               -I$(srcdir)/m2/mc-boot-ch -Im2/gm2-libs-boot \
461               $(INCLUDES) -g -c m2/gm2-pge-boot/$(SRC_PREFIX)$*.cc -o $@
463 m2/gm2-pge-boot/$(SRC_PREFIX)%.o: $(srcdir)/m2/gm2-compiler/%.mod $(MCDEPS) $(BUILD-BOOT-PGE-H)
464         -test -d m2/gm2-pge-boot || $(mkinstalldirs) m2/gm2-pge-boot
465         $(MCC) -o=m2/gm2-pge-boot/$(SRC_PREFIX)$*.cc $(srcdir)/m2/gm2-compiler/$*.mod
466         $(CXX) -I. -I$(srcdir)/../include -I$(srcdir) -I$(srcdir)/m2/mc-boot -Im2/gm2-compiler-boot \
467               -Im2/gm2-libs-boot -Im2/gm2-pge-boot \
468               -I$(srcdir)/m2/mc-boot-ch $(INCLUDES) -g -c m2/gm2-pge-boot/$(SRC_PREFIX)$*.cc -o $@
470 m2/gm2-pge-boot/$(SRC_PREFIX)pge.o:  m2/gm2-auto/pge.mod $(MCDEPS) $(BUILD-BOOT-PGE-H)
471         -test -d m2/gm2-pge-boot || $(mkinstalldirs) m2/gm2-pge-boot
472         $(MCC) -o=m2/gm2-pge-boot/$(SRC_PREFIX)pge.cc m2/gm2-auto/pge.mod
473         $(CXX) -I. -I$(srcdir)/../include -I$(srcdir) \
474               -I$(srcdir)/m2/mc-boot -Im2/gm2-compiler-boot -Im2/gm2-libs-boot \
475               -I$(srcdir)/m2/mc-boot-ch $(INCLUDES) -g -c m2/gm2-pge-boot/$(SRC_PREFIX)pge.cc -o $@
477 m2/pge$(exeext): m2/boot-bin/mc \
478     $(BUILD-PGE-O) $(GM2-PPG-MODS:%.mod=m2/gm2-pge-boot/%.o) \
479     $(BUILD-MC-INTERFACE-O) m2/gm2-pge-boot/main.o m2/gm2-libs-boot/RTcodummy.o \
480     m2/mc-boot-ch/$(SRC_PREFIX)abort.o
481         -test -d m2 || $(mkinstalldirs) m2
482         +$(LINKER) $(ALL_LINKERFLAGS) $(LDFLAGS) -o $@ $(BUILD-PGE-O) \
483          m2/gm2-pge-boot/main.o m2/gm2-libs-boot/RTcodummy.o \
484          m2/mc-boot-ch/$(SRC_PREFIX)abort.o -lm
485         $(SHELL) $(srcdir)/m2/tools-src/buildpg $(srcdir)/m2/gm2-compiler/ppg.mod t > m2/gm2-auto/t.bnf
486         ./m2/pge$(exeext) m2/gm2-auto/t.bnf -o m2/gm2-auto/t1.mod
487         ./m2/pg$(exeext) m2/gm2-auto/t.bnf -o m2/gm2-auto/t2.mod
488         $(QUIAT)if ! diff m2/gm2-auto/t1.mod m2/gm2-auto/t2.mod > /dev/null ; then \
489            echo "failure: pg (with error recovery) failed" ; \
490            $(RM) m2/pge$(exeext) ; \
491            exit 1 ; \
492         fi
493         $(RM) m2/gm2-auto/t.mod m2/gm2-auto/t1.mod m2/gm2-auto/t2.mod
495 m2/gm2-auto/pgeinit:
496         -test -d m2/gm2-auto || $(mkinstalldirs) m2/gm2-auto
497         sed -e 's/ppg/pge/' < $(srcdir)/m2/init/ppginit > $@
499 m2/gm2-pge-boot/main.o: m2/gm2-auto/pgeinit $(M2LINK)
500         -test -d m2/gm2-pge-boot || $(mkinstalldirs) m2/gm2-pge-boot
501         unset CC ; $(M2LINK) -s --langc++ --exit --name mainpgeinit.cc m2/gm2-auto/pgeinit
502         mv mainpgeinit.cc m2/gm2-pge-boot/main.cc
503         $(CXX) $(INCLUDES) -g -c -o $@ m2/gm2-pge-boot/main.cc
505 $(objdir)/m2/gm2-ppg-boot:
506         -test -d $@ || $(mkinstalldirs) $@
508 $(objdir)/m2/gm2-pg-boot:
509         -test -d $@ || $(mkinstalldirs) $@
511 $(objdir)/m2/gm2-pge-boot:
512         -test -d $@ || $(mkinstalldirs) $@
514 m2/gm2-auto/pg.o: m2/gm2-auto/pg.mod $(MCDEPS)
515         -test -d m2/gm2-pge-boot || $(mkinstalldirs) m2/gm2-pge-boot
516         $(MC) --quiet -o=m2/gm2-auto/pg.c m2/gm2-auto/pg.mod
517         $(COMPILER) -c $(CFLAGS) -I. -I$(srcdir)/../include -I$(srcdir) -I$(srcdir)/m2 -Im2/gm2-libs-boot -Im2/gm2-compiler-boot -I$(srcdir)/m2/mc-boot-ch $(INCLUDES) m2/gm2-auto/pg.c -o $@
519 m2/gm2-auto/pge.o: m2/gm2-auto/pge.mod $(MCDEPS)
520         -test -d m2/gm2-auto || $(mkinstalldirs) m2/gm2-auto
521         $(MC) --quiet -o=m2/gm2-auto/pge.c m2/gm2-auto/pge.mod
522         $(COMPILER) -c $(CFLAGS) -I. -I$(srcdir)/../include -I$(srcdir) -I$(srcdir)/m2 -Im2/gm2-libs-boot -Im2/gm2-compiler-boot -I$(srcdir)/m2/mc-boot-ch $(INCLUDES) m2/gm2-auto/pge.c -o $@
524 pge-help: force
525         @echo "The pge maintainer commands are:"
526         @echo " "
527         @echo " make pge-maintainer"
528         @echo " make pge-verify"
529         @echo " make pge-push       # copy pge C++ sources (app and libs) into srcdir/m2/pge-boot"
530         @echo " make pge-libs-push  # copy C++ libraries which pge uses into srcdir/m2/pge-boot"
531         @echo " make pge-app-push   # copy pge C++ application modules into srcdir/m2/pge-boot"
532         @echo " make pge-clean"
534 # pge-maintainer: $(PGE)
535 pge-maintainer: pge-clean $(PGE) pge-verify pge-push
537 # Copy the C++ sources for ppe.mod into $(srcdir)/pge-boot.
539 pge-push: pge-libs-push pge-app-push
541 pge-libs-push: force
542         for i in ${PGE-DEPS} ; do \
543             if [ -f ${srcdir}/m2/gm2-libs-ch/$${i} ] ; then \
544                echo cp ${srcdir}/m2/gm2-libs-ch/$${i} ${srcdir}/m2/pge-boot ; \
545                cp ${srcdir}/m2/gm2-libs-ch/$${i} ${srcdir}/m2/pge-boot ; \
546             elif [ -f m2/gm2-pge-boot/$${i} ] ; then \
547                echo cp m2/gm2-pge-boot/$${i} ${srcdir}/m2/pge-boot ; \
548                cp m2/gm2-pge-boot/$${i} ${srcdir}/m2/pge-boot ; \
549             elif [ -f m2/gm2-compiler-boot/$${i} ] ; then \
550                echo cp m2/gm2-compiler-boot/$${i} ${srcdir}/m2/pge-boot ; \
551                cp m2/gm2-compiler-boot/$${i} ${srcdir}/m2/pge-boot ; \
552             elif [ -f m2/gm2-libs-boot/$${i} ] ; then \
553                echo cp m2/gm2-libs-boot/$${i} ${srcdir}/m2/pge-boot ; \
554                cp m2/gm2-libs-boot/$${i} ${srcdir}/m2/pge-boot ; \
555             else \
556                echo "not found $${i}" ; \
557             fi ; \
558         done
560 pge-app-push: force
561         cp m2/gm2-pge-boot/*.c* $(srcdir)/m2/pge-boot
563 # Perform sanity checks.
565 pge-verify: force
567 # Remove pge build files.
569 pge-clean: force
570         $(RM) -f m2/gm2-pg-boot/* m2/gm2-ppg-boot/* m2/gm2-pge-boot/*
573 # The rest of the Make-lang.in handles the bootstrap tool (maintained
574 # mode) and also provides testing between the bootstrapped and the
575 # non-bootstrapped compilers.
577 # Rules for mc
579 # The default rule used generate mc, eventually it will be replaced by mc-bootstrap.
581 BOOTGM2=gm2
583 MCOPTIONS=-g -c -fsources -fsoft-check-all -fm2-g # -fauto-init
584 MCLINK=-g     # use -g -fmodules -c if you are debugging and wish to see missing modules.
586 # This is only needed in maintainer mode by 'make mc-maintainer' when regenerating the C
587 # version of mc.  We need a working Modula-2 compiler to run mc-maintainer.
589 # GM2SYS=${HOME}/opt/lib/gcc/x86_64-pc-linux-gnu/13.0.0/m2/m2pim
590 GM2PATH=-I$(srcdir)/m2/mc \
591         -I$(srcdir)/m2 -Im2/gm2-auto \
592         -fm2-pathname=m2pim -I$(srcdir)/m2/gm2-libs -I$(srcdir)/m2/gm2-libs-ch \
593         -fm2-pathname=m2iso -I$(srcdir)/m2/gm2-libs-iso -fm2-pathname=-
595 mc: mc-clean mc-devel
597 mc-push: force
598         cp -p m2/mc-boot-gen/*.cc $(srcdir)/m2/mc-boot/
599         cp -p m2/mc-boot-gen/*.h $(srcdir)/m2/mc-boot/
601 mc-clean: force m2/mc-obj
602         $(RM) m2/mc-boot-gen/*.{cc,h} m2/boot-bin/* m2/mc-boot/* m2/mc-boot-ch/*
604 mc-maintainer: mc-clean mc-autogen mc-push mc-clean mc-bootstrap
606 mc-clean-libs: force
607         $(RM) m2/gm2-libs-boot/*
609 mc-continue:  mc-clean mc-bootstrap mc-clean-libs mc-fresh $(BUILD-MC-INTERFACE-O) $(BUILD-LIBS-BOOT) $(BUILD-COMPILER-BOOT)
611 mc-fresh: force
612         $(RM) m2/gm2-auto/* m2/gm2-compiler-boot/* m2/gm2-libs-boot/*
614 mc-help:  force
615         @echo "mc-maintainer   produces a new mc C version in the source tree (takes longer)"
616         @echo "mc-continue     builds the mc from the C version and attempts to build gm2 libraries and gm2 compiler"
617         @echo "mc-verify       builds mc from Modula-2 sources and mc from C sources and run both on all sources diffing the output"
618         @echo "mc              builds mc from Modula-2 sources, quickly"
619         @echo "m2/pge          build the parser generator (needed by mc-maintainer)"
621 m2/mc-obj:
622         $(mkinstalldirs) $@
624 mc-verify:  mc-clean mc-bootstrap mc
625         mv mc m2/boot-bin/mc.m2
626         @echo "verifying the two generations of mc"
627         for i in $(GM2-VERIFY-MODS) ; do \
628            echo -n "$$i " ; \
629            m2/boot-bin/mc $(MC_ARGS) -o=mcout.cc $(srcdir)/m2/gm2-compiler/$$i > /dev/null ; \
630            echo -n "[1]" ; \
631            m2/boot-bin/mc.m2 $(MC_ARGS) -o=mcout.m2 $(srcdir)/m2/gm2-compiler/$$i > /dev/null ; \
632            echo -n "[2]" ; \
633            $(RM) $$i.mc-diff ; \
634            if [ -f mcout.cc -a -f mcout.m2 ] ; then \
635               if diff mcout.cc mcout.m2 > /dev/null ; then \
636                  echo "[passed]" ; \
637               else \
638                  echo "[*** failed ***]" ; \
639                  diff mcout.cc mcout.m2 > $$i.mc-diff ; \
640               fi \
641            fi ; \
642            $(RM) mcout.cc mcout.m2 ; \
643         done
645 mc-stage2:  force
646         m2/boot-bin/mc$(exeext) -I$(srcdir)/m2/mc:$(srcdir)/m2/gm2-libs:$(srcdir)/m2/gm2-libs-iso $(EXTENDED_OPAQUE) --h-file-prefix=$(SRC_PREFIX) -o=m2/mc-boot-gen/GmcStream.cc $(srcdir)/m2/mc/mcStream.mod
647         m2/boot-bin/mc$(exeext) -I$(srcdir)/m2/mc:$(srcdir)/m2/gm2-libs:$(srcdir)/m2/gm2-libs-iso $(EXTENDED_OPAQUE) --h-file-prefix=$(SRC_PREFIX) -o=m2/mc-boot-gen/Gdecl.cc $(srcdir)/m2/mc/decl.mod
648         if diff m2/mc-boot-gen/Gdecl.cc $(srcdir)/m2/mc-boot/Gdecl.cc ; then echo "passed" ; else echo "failed" ; fi
652 #  mc-devel - compiles mc using gm2
654 mc-devel: m2/boot-bin/mc-devel$(exeext)
656 m2/boot-bin/mc-devel$(exeext): m2/mc-obj/mcp1.mod \
657                                m2/mc-obj/mcp2.mod \
658                                m2/mc-obj/mcp3.mod \
659                                m2/mc-obj/mcp4.mod \
660                                m2/mc-obj/mcp5.mod \
661                                mcflex.c \
662                                m2/mc-boot-ch/Gabort.o \
663                                m2/mc-boot-ch/Gm2rtsdummy.o
664         $(RM) -rf mc-obj
665         $(mkinstalldirs) mc-obj
666         $(CC) -I$(srcdir)/m2/mc -c -g mcflex.c -o mc-obj/mcflex.o
667         $(BOOTGM2) $(MCOPTIONS) $(GM2PATH) $(srcdir)/m2/mc/decl.mod -o mc-obj/decl.o
668         $(BOOTGM2) $(MCOPTIONS) $(GM2PATH) $(srcdir)/m2/mc/mcStream.mod -o mc-obj/mcStream.o
669         $(BOOTGM2) $(MCOPTIONS) $(GM2PATH) $(srcdir)/m2/mc/mcPretty.mod -o mc-obj/mcPretty.o
670         $(BOOTGM2) $(MCOPTIONS) $(GM2PATH) $(srcdir)/m2/mc/mcStack.mod -o mc-obj/mcStack.o
671         $(BOOTGM2) $(MCOPTIONS) $(GM2PATH) $(srcdir)/m2/mc/varargs.mod -o mc-obj/varargs.o
672         $(BOOTGM2) $(MCOPTIONS) $(GM2PATH) $(srcdir)/m2/mc/mcMetaError.mod -o mc-obj/mcMetaError.o
673         $(BOOTGM2) $(MCOPTIONS) $(GM2PATH) $(srcdir)/m2/mc/mcOptions.mod -o mc-obj/mcOptions.o
674         $(BOOTGM2) $(MCOPTIONS) $(GM2PATH) $(srcdir)/m2/mc/mcComp.mod -o mc-obj/mcComp.o
675         $(BOOTGM2) $(MCOPTIONS) $(GM2PATH) m2/mc-obj/mcp1.mod -o mc-obj/mcp1.o
676         $(BOOTGM2) $(MCOPTIONS) $(GM2PATH) m2/mc-obj/mcp2.mod -o mc-obj/mcp2.o
677         $(BOOTGM2) $(MCOPTIONS) $(GM2PATH) m2/mc-obj/mcp3.mod -o mc-obj/mcp3.o
678         $(BOOTGM2) $(MCOPTIONS) $(GM2PATH) m2/mc-obj/mcp4.mod -o mc-obj/mcp4.o
679         $(BOOTGM2) $(MCOPTIONS) $(GM2PATH) m2/mc-obj/mcp5.mod -o mc-obj/mcp5.o
680         $(BOOTGM2) $(MCOPTIONS) $(GM2PATH) $(srcdir)/m2/mc/wlists.mod -o mc-obj/wlists.o
681         $(BOOTGM2) $(MCOPTIONS) $(GM2PATH) $(srcdir)/m2/mc/alists.mod -o mc-obj/alists.o
682         $(BOOTGM2) $(MCOPTIONS) $(GM2PATH) $(srcdir)/m2/mc/symbolKey.mod -o mc-obj/symbolKey.o
683         $(BOOTGM2) $(MCOPTIONS) $(GM2PATH) $(srcdir)/m2/mc/mcReserved.mod -o mc-obj/mcReserved.o
684         $(BOOTGM2) $(MCOPTIONS) $(GM2PATH) $(srcdir)/m2/mc/nameKey.mod -o mc-obj/nameKey.o
685         $(BOOTGM2) $(MCOPTIONS) $(GM2PATH) $(srcdir)/m2/mc/mcSearch.mod -o mc-obj/mcSearch.o
686         $(BOOTGM2) $(MCOPTIONS) $(GM2PATH) $(srcdir)/m2/mc/mcFileName.mod -o mc-obj/mcFileName.o
687         $(BOOTGM2) $(MCOPTIONS) $(GM2PATH) $(srcdir)/m2/mc/mcLexBuf.mod -o mc-obj/mcLexBuf.o
688         $(BOOTGM2) $(MCOPTIONS) $(GM2PATH) $(srcdir)/m2/mc/mcQuiet.mod -o mc-obj/mcQuiet.o
689         $(BOOTGM2) $(MCOPTIONS) $(GM2PATH) $(srcdir)/m2/mc/mcError.mod -o mc-obj/mcError.o
690         $(BOOTGM2) $(MCOPTIONS) $(GM2PATH) $(srcdir)/m2/mc/mcDebug.mod -o mc-obj/mcDebug.o
691         $(BOOTGM2) $(MCOPTIONS) $(GM2PATH) $(srcdir)/m2/mc/mcPrintf.mod -o mc-obj/mcPrintf.o
692         $(BOOTGM2) $(MCOPTIONS) $(GM2PATH) $(srcdir)/m2/mc/Indexing.mod -o mc-obj/Indexing.o
693         $(BOOTGM2) $(MCOPTIONS) $(GM2PATH) $(srcdir)/m2/mc/mcPreprocess.mod -o mc-obj/mcPreprocess.o
694         $(BOOTGM2) $(MCOPTIONS) $(GM2PATH) $(srcdir)/m2/mc/keyc.mod -o mc-obj/keyc.o
695         $(BOOTGM2) $(MCOPTIONS) $(GM2PATH) $(srcdir)/m2/mc/mcComment.mod -o mc-obj/mcComment.o
696         $(BOOTGM2) $(MCLINK) -I. -fscaffold-static -fscaffold-main $(GM2PATH) \
697             -fuse-list=$(srcdir)/m2/init/mcinit $(srcdir)/m2/mc/top.mod -o mc \
698             m2/gm2-libs-boot/RTcodummy.o \
699             m2/gm2-libs-boot/dtoa.o m2/gm2-libs-boot/ldtoa.o mc-obj/*o \
700             m2/mc-boot-ch/Gabort.o m2/mc-boot-ch/Gm2rtsdummy.o
702 m2/boot-bin/mc-opt$(exeext): m2/mc-obj/mcp1.mod \
703                              m2/mc-obj/mcp2.mod \
704                              m2/mc-obj/mcp3.mod \
705                              m2/mc-obj/mcp4.mod \
706                              m2/mc-obj/mcp5.mod \
707                              mcflex.c
708         -test -d m2/boot-bin || $(mkinstalldirs) m2/boot-bin
709         g++ -I$(srcdir)/m2/mc -c -g mcflex.c
710         $(BOOTGM2) -fsources -fm2-whole-program -g -I$(srcdir)/m2/mc -I$(objdir)/m2/mc-obj -I$(srcdir)/m2/gm2-libs -I$(srcdir)/m2/mc $(srcdir)/m2/mc/top.mod
712 m2/mc/decl.o:  $(srcdir)/m2/mc/decl.mod
713         -test -d m2/mc || $(mkinstalldirs) m2/mc
714         $(BOOTGM2) $(MCOPTIONS) $(GM2PATH) -o $@ $(srcdir)/m2/mc/decl.mod
716 m2/mc-obj/%.mod: $(srcdir)/m2/mc/%.bnf $(PGE)
717         -test -d m2/mc-obj || $(mkinstalldirs) m2/mc-obj
718         $(PGE) -l $< -o $@
720 gm2-bootstrap: mc-devel
721         for i in $(srcdir)/m2/gm2-libs/*.def ; do echo $$i ; ./mc --gcc-config-system -I$(srcdir)/m2/gm2-libs $$i ; done
722         for i in $(srcdir)/m2/gm2-compiler/*.def ; do echo $$i ; ./mc --gcc-config-system -I$(srcdir)/m2/gm2-libs -I$(srcdir)/m2/gm2-compiler -I$(srcdir)/m2/gm2-gcc $$i ; done
723         for i in $(srcdir)/m2/gm2-libs/*.mod ; do echo $$i ; ./mc --gcc-config-system -I$(srcdir)/m2/gm2-libs -I$(srcdir)/m2/gm2-compiler -I$(srcdir)/m2/gm2-gcc $$i ; done
726 $(objdir)/plugin:
727         -test -d $@ || $(mkinstalldirs) $@
729 $(objdir)/m2/mc-boot:
730         -test -d $@ || $(mkinstalldirs) $@
732 $(objdir)/m2/mc-boot-ch:
733         -test -d $@ || $(mkinstalldirs) $@
735 $(objdir)/m2/mc-boot-gen:
736         -test -d $@ || $(mkinstalldirs) $@
738 mc-autogen: mc-clean mc-devel \
739             $(BUILD-MC-BOOT-H) $(BUILD-MC-BOOT-CC) \
740             $(BUILD-MC-BOOT-AUTO-CC)
741         for i in m2/mc-boot-gen/*.cc ; do \
742            echo $(CXX) -g -c -I. -I$(srcdir)/../include -I$(srcdir) -I$(srcdir)/m2/mc-boot-ch -Im2/mc-boot-gen/ $$i -o m2/mc-boot-gen/`basename $$i .cc`.o ; \
743                 $(CXX) -g -c -I. -I$(srcdir)/../include -I$(srcdir) -I$(srcdir)/m2/mc-boot-ch -Im2/mc-boot-gen/ $$i -o m2/mc-boot-gen/`basename $$i .cc`.o ; done
744         @echo -n "built "
745         @cd m2/mc-boot-gen ; ls *.o | wc -l
746         @echo -n "out of "
747         @cd m2/mc-boot-gen ; ls *.cc | wc -l
748         @echo "modules"
750 # EXTENDED_OPAQUE = --extended-opaque
751 EXTENDED_OPAQUE =
752 MC_OPTIONS = $(MC_COPYRIGHT) --gcc-config-system --olang=c++
754 m2/mc-boot-gen/$(SRC_PREFIX)%.h: $(srcdir)/m2/mc/%.def
755         -test -d m2/mc-boot-gen || $(mkinstalldirs) m2/mc-boot-gen
756         ./mc $(MC_OPTIONS) -I$(srcdir)/m2/mc -I$(srcdir)/m2/gm2-libs -I$(srcdir)/m2/gm2-libs-iso $(EXTENDED_OPAQUE) --h-file-prefix=$(SRC_PREFIX) -o=$@ $<
758 m2/mc-boot-gen/$(SRC_PREFIX)%.h: $(srcdir)/m2/gm2-libs-iso/%.def
759         -test -d m2/mc-boot-gen || $(mkinstalldirs) m2/mc-boot-gen
760         ./mc $(MC_OPTIONS) -I$(srcdir)/m2/mc -I$(srcdir)/m2/gm2-libs -I$(srcdir)/m2/gm2-libs-iso $(EXTENDED_OPAQUE) --h-file-prefix=$(SRC_PREFIX) -o=$@ $<
762 m2/mc-boot-gen/$(SRC_PREFIX)%.h: $(srcdir)/m2/gm2-libs/%.def
763         -test -d m2/mc-boot-gen || $(mkinstalldirs) m2/mc-boot-gen
764         ./mc $(MC_OPTIONS) -I$(srcdir)/m2/mc -I$(srcdir)/m2/gm2-libs -I$(srcdir)/m2/gm2-libs-iso $(EXTENDED_OPAQUE) --h-file-prefix=$(SRC_PREFIX) -o=$@ $<
766 m2/mc-boot-gen/$(SRC_PREFIX)decl.cc: $(srcdir)/m2/mc/decl.mod
767         -test -d m2/mc-boot-gen || $(mkinstalldirs) m2/mc-boot-gen
768         ./mc $(MC_OPTIONS) --extended-opaque -I$(srcdir)/m2/mc -I$(srcdir)/m2/gm2-libs -I$(srcdir)/m2/gm2-libs-iso --h-file-prefix=$(SRC_PREFIX) -o=$@ $<
770 m2/mc-boot-gen/$(SRC_PREFIX)%.cc: $(srcdir)/m2/mc/%.mod
771         -test -d m2/mc-boot-gen || $(mkinstalldirs) m2/mc-boot-gen
772         ./mc $(MC_OPTIONS) -I$(srcdir)/m2/mc -I$(srcdir)/m2/gm2-libs -I$(srcdir)/m2/gm2-libs-iso $(EXTENDED_OPAQUE) --h-file-prefix=$(SRC_PREFIX) -o=$@ $<
774 m2/mc-boot-gen/$(SRC_PREFIX)%.cc: $(srcdir)/m2/gm2-libs/%.mod
775         -test -d m2/mc-boot-gen || $(mkinstalldirs) m2/mc-boot-gen
776         ./mc $(MC_OPTIONS) -I$(srcdir)/m2/mc -I$(srcdir)/m2/gm2-libs -I$(srcdir)/m2/gm2-libs-iso $(EXTENDED_OPAQUE) --h-file-prefix=$(SRC_PREFIX) -o=$@ $<
778 m2/mc-boot-gen/$(SRC_PREFIX)%.cc: $(srcdir)/m2/gm2-libs-iso/%.mod
779         -test -d m2/mc-boot-gen || $(mkinstalldirs) m2/mc-boot-gen
780         ./mc $(MC_OPTIONS) -I$(srcdir)/m2/mc -I$(srcdir)/m2/gm2-libs -I$(srcdir)/m2/gm2-libs-iso $(EXTENDED_OPAQUE) --h-file-prefix=$(SRC_PREFIX) -o=$@ $<
782 m2/mc-boot-gen/$(SRC_PREFIX)%.h: $(srcdir)/m2/gm2-libs-iso/%.def
783         -test -d m2/mc-boot-gen || $(mkinstalldirs) m2/mc-boot-gen
784         ./mc $(MC_OPTIONS) -I$(srcdir)/m2/mc -I$(srcdir)/m2/gm2-libs -I$(srcdir)/m2/gm2-libs-iso $(EXTENDED_OPAQUE) --h-file-prefix=$(SRC_PREFIX) -o=$@ $<
786 m2/mc-boot-gen/$(SRC_PREFIX)%.cc: m2/mc-obj/%.mod
787         -test -d m2/mc-boot-gen || $(mkinstalldirs) m2/mc-boot-gen
788         ./mc $(MC_OPTIONS) -I$(srcdir)/m2/mc -I$(srcdir)/m2/gm2-libs -I$(srcdir)/m2/gm2-libs-iso $(EXTENDED_OPAQUE) --h-file-prefix=$(SRC_PREFIX) -o=$@ $<
790 # mc-bootstrap compiles mc using the C version previously generated by mc-autogen.
791 # These autogenerated files will be checked into git by the maintainer.
793 mc-bootstrap: mc-clean m2/boot-bin/mc$(exeext)
795 gm2.maintainer-reconfigure: force
796         autoconf $(srcdir)/m2/gm2-libs/config-host.in > $(srcdir)/m2/gm2-libs/config-host
797         ( cd $(srcdir)/m2/gm2-libs ; autoheader config-host.in )
798         ( cd $(srcdir)/m2 ; autoconf configure.in > configure )
800 gm2.maintainer-help: force
801         @echo "make knows about:"
802         @echo " "
803         @echo "make gm2.maintainer-help           this command"
804         @echo "make gm2.maintainer-reconfigure    rebuild the configure scripts"
805         @echo "make gm2.maintainer-tools          rebuild mc and ppg bootstrap tools"
806         @echo "     note gm2.maintainer-tools     requires a working gm2 to be in your path"
807         @echo "make gm2.maintainer-doc            rebuild target independent documentation sections"
808         @echo "make pge-help                      sub commands to build pge"
809         @echo "make mc-help                       sub commands to build mc"
811 gm2.maintainer-tools: mc-maintainer pge-maintainer
813 gm2.maintainer-doc: m2-target-independent-doc
816 #  verify the compiler can be built across three generations of cc1gm2 diffing assembly output.
817 #  m2/stage1/cc1gm2 built by translating all M2 sources into C++.
818 #  m2/m2obj2/cc1gm2 built from m2/stage1/cc1gm2.
819 #  m2/m2obj3/cc1gm2 built from m2/m2obj2/cc1gm2.
821 #  This test only makes sense if host = target = build
823 # GM2-VERIFY-MODS is a list of modules which have no __DATE__ stamp inside them
824 #                 and thus they can be built by the different versions of gm2.
825 #                 This list is used for testing only.
827 GM2-VERIFY-MODS    = FifoQueue.mod     M2AsmUtil.mod                   M2Optimize.mod  \
828                      M2StackWord.mod                   M2Pass.mod      M2Batch.mod     \
829                      M2Quads.mod       M2Comp.mod      M2Reserved.mod  \
830                      M2Debug.mod       M2Defaults.mod  NameKey.mod     \
831                      M2FileName.mod    P0SymBuild.mod  P1SymBuild.mod  P2SymBuild.mod  \
832                      P3SymBuild.mod  \
833                      SymbolKey.mod     SymbolTable.mod                 M2Error.mod     \
834                      M2StackAddress.mod \
835                      M2Students.mod  \
836                      M2BasicBlock.mod  M2Code.mod      M2GenGCC.mod    M2GCCDeclare.mod\
837                      M2ALU.mod         M2System.mod    M2Base.mod      Lists.mod       \
838                      M2Search.mod      bnflex.mod      ppg.mod         Output.mod      \
839                      SymbolConversion.mod \
840                      M2Preprocess.mod  M2Printf.mod    M2LexBuf.mod    M2Quiet.mod     \
841                      M2Bitset.mod      M2Size.mod      CLexBuf.mod     M2Scope.mod     \
842                      M2Range.mod       M2Swig.mod      M2MetaError.mod Sets.mod        \
843                      M2CaseList.mod    PCSymBuild.mod  M2Const.mod     \
844                      M2DebugStack.mod  ObjectFiles.mod M2ColorString.mod M2Emit.mod
846 GM2-VERIFY-AUTO    = P1Build.mod       P2Build.mod     PCBuild.mod     P3Build.mod     \
847                      PHBuild.mod       pg.mod          P0SyntaxCheck.mod
849 GM2_LIBS_PARANOID = m2/gm2-compiler-paranoid/gm2.a \
850                     m2/gm2-libs-paranoid/libgm2.a                       # build it again using GM2_LIBS
852 gm2.paranoid: m2/m2obj3/cc1gm2$(exeext) gm2.verifyparanoid
854 m2/m2obj3/cc1gm2$(exeext): m2/m2obj2/cc1gm2$(exeext) m2/gm2-compiler-paranoid/m2flex.o \
855                             $(GM2_C_OBJS) $(BACKEND) $(LIBDEPS) $(GM2_LIBS_PARANOID) \
856                             m2/gm2-gcc/rtegraph.o plugin/m2rte$(exeext).so
857         -test -d m2/m2obj3 || $(mkinstalldirs) m2/m2obj3
858         @$(call LINK_PROGRESS,$(INDEX.m2),start)
859         +$(LLINKER) $(ALL_CFLAGS) $(LDFLAGS) -o $@ $(GM2_C_OBJS) m2/gm2-compiler-paranoid/m2flex.o \
860                             attribs.o \
861                               $(GM2_LIBS_PARANOID) \
862                               $(BACKEND) $(LIBS) m2/gm2-gcc/rtegraph.o \
863                               $(BACKENDLIBS) $(LIBSTDCXX) -lm
864         @$(call LINK_PROGRESS,$(INDEX.m2),end)
867 # gm2.verifyparanoid diffs the output of all three compilers with the compiler source code
869 gm2.verifyparanoid: m2/stage1/cc1gm2$(exeext) m2/m2obj2/cc1gm2$(exeext) m2/m2obj3/cc1gm2$(exeext) force
870         @echo "verifying the three generations of GNU Modula-2 compilers - it may take some time.."
871         $(QUIAT)for i in $(GM2-VERIFY-MODS) ; do \
872            echo -n "$$i " ; \
873            ./gm2 -S $(GM2_FLAGS) -c -B./stage1/m2 -I$(srcdir)/m2/gm2-compiler -I$(srcdir)/m2/gm2-libs -I$(srcdir)/m2/gm2-gcc -I$(srcdir)/m2/gm2-libiberty $(srcdir)/m2/gm2-compiler/$$i -o m2/gm2-compiler-verify/1.s ; \
874            echo -n "[1]" ; \
875            ./gm2 -S $(GM2_FLAGS) -c -B./stage2/m2 -I$(srcdir)/m2/gm2-compiler -I$(srcdir)/m2/gm2-libs -I$(srcdir)/m2/gm2-gcc -I$(srcdir)/m2/gm2-libiberty $(srcdir)/m2/gm2-compiler/$$i -o m2/gm2-compiler-verify/2.s ; \
876            echo -n "[2]" ; \
877            ./gm2 -S $(GM2_FLAGS) -c -B./stage3/m2 -I$(srcdir)/m2/gm2-compiler -I$(srcdir)/m2/gm2-libs -I$(srcdir)/m2/gm2-gcc -I$(srcdir)/m2/gm2-libiberty $(srcdir)/m2/gm2-compiler/$$i -o m2/gm2-compiler-verify/3.s ; \
878            echo -n "[3]" ; \
879            if ! diff m2/gm2-compiler-verify/1.s m2/gm2-compiler-verify/2.s > m2/gm2-compiler-verify/1_2.diff 2>&1 ; then \
880                echo -n " [stage 1 and stage 2 differ]" ; \
881                cp m2/gm2-compiler-verify/1.s m2/gm2-compiler-verify/t.s | as -ahl m2/gm2-compiler-verify/t.s > m2/gm2-compiler-verify/$$i.1.lst ; \
882                cp m2/gm2-compiler-verify/2.s m2/gm2-compiler-verify/t.s | as -ahl m2/gm2-compiler-verify/t.s > m2/gm2-compiler-verify/$$i.2.lst ; \
883                echo " " ; \
884                exit 1 ; \
885            fi ; \
886            if ! diff m2/gm2-compiler-verify/2.s m2/gm2-compiler-verify/3.s > m2/gm2-compiler-verify/2_3.diff 2>&1 ; then \
887                echo -n " [stage 2 and stage 3 differ]" ; \
888                cp m2/gm2-compiler-verify/2.s m2/gm2-compiler-verify/t.s | as -ahl m2/gm2-compiler-verify/t.s > m2/gm2-compiler-verify/$$i.2.lst ; \
889                cp m2/gm2-compiler-verify/3.s m2/gm2-compiler-verify/t.s | as -ahl m2/gm2-compiler-verify/t.s > m2/gm2-compiler-verify/$$i.3.lst ; \
890            fi ; \
891            echo " " ; \
892         done
893         $(QUIAT)echo "now verifying automatically built modules"
894         $(QUIAT)for i in x $(GM2-VERIFY-AUTO) ; do \
895            if [ -f m2/gm2-auto/$$i ] ; then \
896               echo -n "$$i " ; \
897               ./gm2 -S $(GM2_FLAGS) -c -B./m2/stage1 -I$(srcdir)/m2/gm2-compiler -I$(srcdir)/m2/gm2-libs -I$(srcdir)/m2/gm2-gcc -I$(srcdir)/m2/gm2-libiberty m2/gm2-auto/$$i -o m2/gm2-compiler-verify/1.s ; \
898               echo -n "[1]" ; \
899               ./gm2 -S $(GM2_FLAGS) -c -B./m2/m2obj2 -I$(srcdir)/m2/gm2-compiler -I$(srcdir)/m2/gm2-libs -I$(srcdir)/m2/gm2-gcc -I$(srcdir)/m2/gm2-libiberty m2/gm2-auto/$$i -o m2/gm2-compiler-verify/2.s ; \
900               echo -n "[2]" ; \
901               ./gm2 -S $(GM2_FLAGS) -c -B./m2/m2obj3 -I$(srcdir)/m2/gm2-compiler -I$(srcdir)/m2/gm2-libs -I$(srcdir)/m2/gm2-gcc -I$(srcdir)/m2/gm2-libiberty m2/gm2-auto/$$i -o m2/gm2-compiler-verify/3.s ; \
902               echo -n "[3]" ; \
903               if ! diff m2/gm2-compiler-verify/1.s m2/gm2-compiler-verify/2.s > m2/gm2-compiler-verify/1_2.diff 2>&1 ; then \
904                   echo -n " [stage 1 and stage 2 differ]" ; \
905                   cp m2/gm2-compiler-verify/1.s m2/gm2-compiler-verify/t.s | as -ahl m2/gm2-compiler-verify/t.s > m2/gm2-compiler-verify/$$i.1.lst ; \
906                   cp m2/gm2-compiler-verify/2.s m2/gm2-compiler-verify/t.s | as -ahl m2/gm2-compiler-verify/t.s > m2/gm2-compiler-verify/$$i.2.lst ; \
907                   echo " " ; \
908                   exit 1 ; \
909               fi ; \
910               if ! diff m2/gm2-compiler-verify/2.s m2/gm2-compiler-verify/3.s > m2/gm2-compiler-verify/2_3.diff 2>&1 ; then \
911                   echo -n " [stage 2 and stage 3 differ]" ; \
912                   cp m2/gm2-compiler-verify/2.s m2/gm2-compiler-verify/t.s | as -ahl m2/gm2-compiler-verify/t.s > m2/gm2-compiler-verify/$$i.2.lst ; \
913                   cp m2/gm2-compiler-verify/3.s m2/gm2-compiler-verify/t.s | as -ahl m2/gm2-compiler-verify/t.s > m2/gm2-compiler-verify/$$i.3.lst ; \
914               fi ; \
915               echo " " ; \
916            fi ; \
917         done ; \
918         $(RM) -f m2/gm2-compiler-verify/1.s m2/gm2-compiler-verify/2.s m2/gm2-compiler-verify/3.s m2/gm2-compiler-verify/2_3.diff m2/gm2-compiler-verify/1_2.diff
921 # gm2.verifystage12 diffs the output of the stage1 and stage2 compilers with the compiler source code
923 gm2.verifystage12: force m2/stage1/cc1gm2$(exeext) m2/m2obj2/cc1gm2$(exeext)
924         @echo "verifying stage1 and stage2 generations of GNU Modula-2 compilers - it may take some time.."
925         $(QUIAT)for i in $(GM2-VERIFY-MODS) ; do \
926            echo -n "$$i " ; \
927            ./gm2 -S $(GM2_FLAGS) -c -B./stage1/m2 -I$(srcdir)/m2/gm2-compiler -I$(srcdir)/m2/gm2-libs -I$(srcdir)/m2/gm2-gcc -I$(srcdir)/m2/gm2-libiberty $(srcdir)/m2/gm2-compiler/$$i -o m2/gm2-compiler-verify/1.s ; \
928            echo -n "[1]" ; \
929            ./gm2 -S $(GM2_FLAGS) -c -B./stage2/m2 -I$(srcdir)/m2/gm2-compiler -I$(srcdir)/m2/gm2-libs -I$(srcdir)/m2/gm2-gcc -I$(srcdir)/m2/gm2-libiberty $(srcdir)/m2/gm2-compiler/$$i -o m2/gm2-compiler-verify/2.s ; \
930            echo -n "[2]" ; \
931            if ! diff m2/gm2-compiler-verify/1.s m2/gm2-compiler-verify/2.s > m2/gm2-compiler-verify/1_2.diff 2>&1 ; then \
932                echo -n " [stage 1 and stage 2 differ]" ; \
933                cp m2/gm2-compiler-verify/1.s m2/gm2-compiler-verify/t.s | as -ahl m2/gm2-compiler-verify/t.s > m2/gm2-compiler-verify/$$i.1.lst ; \
934                cp m2/gm2-compiler-verify/2.s m2/gm2-compiler-verify/t.s | as -ahl m2/gm2-compiler-verify/t.s > m2/gm2-compiler-verify/$$i.2.lst ; \
935                echo " " ; \
936            fi ; \
937            echo " " ; \
938         done
939         $(QUIAT)echo "now verifying automatically built modules"
940         $(QUIAT)for i in x $(GM2-VERIFY-AUTO) ; do \
941            if [ -f m2/gm2-auto/$$i ] ; then \
942               echo -n "$$i " ; \
943               ./gm2 -S $(GM2_FLAGS) -c -B./m2/stage1 -I$(srcdir)/m2/gm2-compiler -I$(srcdir)/m2/gm2-libs -I$(srcdir)/m2/gm2-gcc -I$(srcdir)/m2/gm2-libiberty m2/gm2-auto/$$i -o m2/gm2-compiler-verify/1.s ; \
944               echo -n "[1]" ; \
945               ./gm2 -S $(GM2_FLAGS) -c -B./m2/m2obj2 -I$(srcdir)/m2/gm2-compiler -I$(srcdir)/m2/gm2-libs -I$(srcdir)/m2/gm2-gcc -I$(srcdir)/m2/gm2-libiberty m2/gm2-auto/$$i -o m2/gm2-compiler-verify/2.s ; \
946               echo -n "[2]" ; \
947               if ! diff m2/gm2-compiler-verify/1.s m2/gm2-compiler-verify/2.s > m2/gm2-compiler-verify/1_2.diff 2>&1 ; then \
948                   echo -n " [stage 1 and stage 2 differ]" ; \
949                   cp m2/gm2-compiler-verify/1.s m2/gm2-compiler-verify/t.s | as -ahl m2/gm2-compiler-verify/t.s > m2/gm2-compiler-verify/$$i.1.lst ; \
950                   cp m2/gm2-compiler-verify/2.s m2/gm2-compiler-verify/t.s | as -ahl m2/gm2-compiler-verify/t.s > m2/gm2-compiler-verify/$$i.2.lst ; \
951                   echo " " ; \
952               fi ; \
953               echo " " ; \
954            fi ; \
955         done ; \
956         $(RM) -f m2/gm2-compiler-verify/1.s m2/gm2-compiler-verify/2.s m2/gm2-compiler-verify/3.s m2/gm2-compiler-verify/2_3.diff m2/gm2-compiler-verify/1_2.diff
959 # The rules which build objects in the gm2-compiler-paranoid gm2-libs-paranoid directories.
961 m2/gm2-libs-paranoid/%.o: m2/gm2-libs-ch/%.c
962         -test -d m2/gm2-libs-paranoid || $(mkinstalldirs) m2/gm2-libs-paranoid
963         $(XGCC) -c -g $(GM2_O_S3) $(GM2_O) -I./ -Im2/gm2-libs -Wall $(INCLUDES) $< -o $@
965 m2/gm2-libs-paranoid/%.o: $(srcdir)/m2/gm2-libs/%.mod
966         -test -d m2/gm2-libs-paranoid || $(mkinstalldirs) m2/gm2-libs-paranoid
967         $(GM2_2) $(GM2_O_S3) $(GM2_FLAGS) -c -I$(srcdir)/m2/gm2-compiler -I$(srcdir)/m2/gm2-libs -I$(srcdir)/m2/gm2-libs-iso -I$(srcdir)/m2/gm2-libiberty $< -o $@
969 m2/gm2-compiler-paranoid/%.o: $(srcdir)/m2/gm2-compiler/%.mod
970         -test -d m2/gm2-compiler-paranoid || $(mkinstalldirs) m2/gm2-compiler-paranoid
971         $(GM2_2) $(GM2_O_S3) $(GM2_FLAGS) -c -I$(srcdir)/m2/gm2-compiler -I$(srcdir)/m2/gm2-libs -I$(srcdir)/m2/gm2-gcc -I$(srcdir)/m2/gm2-libiberty $< -o $@
973 m2/gm2-compiler-paranoid/%.o: m2/gm2-compiler-paranoid/%.mod
974         -test -d m2/gm2-compiler-paranoid || $(mkinstalldirs) m2/gm2-compiler-paranoid
975         $(GM2_2) $(GM2_O_S3) $(GM2_FLAGS) -c -I$(srcdir)/m2/gm2-compiler -I$(srcdir)/m2/gm2-libs -I$(srcdir)/m2/gm2-gcc -I$(srcdir)/m2/gm2-libiberty $< -o $@
977 m2/gm2-compiler-paranoid/P0SyntaxCheck.o: m2/gm2-compiler-paranoid/P0SyntaxCheck.mod
978         -test -d m2/gm2-compiler-paranoid || $(mkinstalldirs) m2/gm2-compiler-paranoid
979         $(GM2_2) $(GM2_O_S3) $(GM2_FLAGS) -c -I$(srcdir)/m2/gm2-compiler -I$(srcdir)/m2/gm2-libs -I$(srcdir)/m2/gm2-gcc -I$(srcdir)/m2/gm2-libiberty $< -o $@
981 m2/gm2-compiler-paranoid/P1Build.o: m2/gm2-compiler-paranoid/P1Build.mod
982         -test -d m2/gm2-compiler-paranoid || $(mkinstalldirs) m2/gm2-compiler-paranoid
983         $(GM2_2) $(GM2_O_S3) $(GM2_FLAGS) -c -I$(srcdir)/m2/gm2-compiler -I$(srcdir)/m2/gm2-libs -I$(srcdir)/m2/gm2-gcc -I$(srcdir)/m2/gm2-libiberty $< -o $@
985 m2/gm2-compiler-paranoid/P2Build.o: m2/gm2-compiler-paranoid/P2Build.mod
986         -test -d m2/gm2-compiler-paranoid || $(mkinstalldirs) m2/gm2-compiler-paranoid
987         $(GM2_2) $(GM2_O_S3) $(GM2_FLAGS) -c -I$(srcdir)/m2/gm2-compiler -I$(srcdir)/m2/gm2-libs -I$(srcdir)/m2/gm2-gcc -I$(srcdir)/m2/gm2-libiberty $< -o $@
989 m2/gm2-compiler-paranoid/P3Build.o: m2/gm2-compiler-paranoid/P3Build.mod
990         -test -d m2/gm2-compiler-paranoid || $(mkinstalldirs) m2/gm2-compiler-paranoid
991         $(GM2_2) $(GM2_O_S3) $(GM2_FLAGS) -c -I$(srcdir)/m2/gm2-compiler -I$(srcdir)/m2/gm2-libs -I$(srcdir)/m2/gm2-gcc -I$(srcdir)/m2/gm2-libiberty $< -o $@
993 m2/gm2-compiler-paranoid/PHBuild.o: m2/gm2-compiler-paranoid/PHBuild.mod
994         -test -d m2/gm2-compiler-paranoid || $(mkinstalldirs) m2/gm2-compiler-paranoid
995         $(GM2_2) $(GM2_O_S3) $(GM2_FLAGS) -c -I$(srcdir)/m2/gm2-compiler -I$(srcdir)/m2/gm2-libs -I$(srcdir)/m2/gm2-gcc -I$(srcdir)/m2/gm2-libiberty $< -o $@
997 m2/gm2-compiler-paranoid/PCBuild.o: m2/gm2-compiler-paranoid/PCBuild.mod
998         -test -d m2/gm2-compiler-paranoid || $(mkinstalldirs) m2/gm2-compiler-paranoid
999         $(GM2_2) $(GM2_O_S3) $(GM2_FLAGS) -c -I$(srcdir)/m2/gm2-compiler -I$(srcdir)/m2/gm2-libs -I$(srcdir)/m2/gm2-gcc -I$(srcdir)/m2/gm2-libiberty $< -o $@
1001 m2/gm2-libs-paranoid/host.o: $(srcdir)/m2/gm2-libs-ch/host.c m2/gm2-libs/gm2-libs-host.h
1002         -test -d m2/gm2-libs-paranoid || $(mkinstalldirs) m2/gm2-libs-paranoid
1003         $(CXX) -c $(GM2_O_S3) $(CFLAGS) -Im2/gm2-libs -I$(srcdir)/m2 -Im2 -I. -Im2/gm2-libs-boot $(INCLUDES) $< -o $@
1005 m2/gm2-libs-paranoid/wrapc.o: $(srcdir)/m2/gm2-libs-ch/wrapc.c m2/gm2-libs-boot/$(SRC_PREFIX)wrapc.h m2/gm2-libs/gm2-libs-host.h
1006         -test -d m2/gm2-libs-paranoid || $(mkinstalldirs) m2/gm2-libs-paranoid
1007         $(CXX) -c -DIN_GCC $(GM2_O_S3) $(CFLAGS) -Im2/gm2-libs -I$(srcdir)/m2 -Im2 -I. -Im2/gm2-libs-boot $(INCLUDES) $< -o $@
1009 m2/gm2-libs-paranoid/UnixArgs.o: $(srcdir)/m2/gm2-libs-ch/UnixArgs.cc \
1010                                   m2/gm2-libs-boot/$(SRC_PREFIX)UnixArgs.h
1011         -test -d m2/gm2-libs-paranoid || $(mkinstalldirs) m2/gm2-libs-paranoid
1012         $(CXX) -c -DIN_GCC $(GM2_O_S3) $(CFLAGS) -Im2/gm2-libs -I$(srcdir)/m2 -Im2 -I. -Im2/gm2-libs-boot $(INCLUDES) $< -o $@
1014 m2/gm2-libs-paranoid/errno.o: $(srcdir)/m2/gm2-libs-ch/errno.c \
1015                                    m2/gm2-libs-boot/$(SRC_PREFIX)errno.h
1016         -test -d m2/gm2-libs-paranoid || $(mkinstalldirs) m2/gm2-libs-paranoid
1017         $(CXX) -c -DIN_GCC $(GM2_O_S3) $(CFLAGS) -Im2/gm2-libs -I$(srcdir)/m2 -Im2 -I. -Im2/gm2-libs-boot $(INCLUDES) $< -o $@
1019 m2/gm2-libs-paranoid/Selective.o: $(srcdir)/m2/gm2-libs-ch/Selective.c \
1020                                    m2/gm2-libs-boot/$(SRC_PREFIX)Selective.h
1021         -test -d m2/gm2-libs-paranoid || $(mkinstalldirs) m2/gm2-libs-paranoid
1022         $(COMPILER) -c -DIN_GCC $(GM2_O_S3) $(CFLAGS) -Im2/gm2-libs -I$(srcdir)/m2 -Im2 -I. -Im2/gm2-libs-boot $(INCLUDES) $< -o $@
1024 m2/gm2-libs-paranoid/choosetemp.o: $(srcdir)/m2/gm2-libs-ch/choosetemp.c \
1025                                     m2/gm2-libiberty/$(SRC_PREFIX)choosetemp.h
1026         -test -d m2/gm2-libs-paranoid || $(mkinstalldirs) m2/gm2-libs-paranoid
1027         $(CXX) -c -DIN_GCC $(GM2_O_S3) $(CFLAGS) -Im2/gm2-libs -I$(srcdir)/m2 -Im2 -I. -Im2/gm2-libs-boot -Im2/gm2-libiberty $(INCLUDES) $< -o $@
1029 m2/gm2-libs-paranoid/SysExceptions.o: $(srcdir)/m2/gm2-libs-ch/SysExceptions.c \
1030                                   m2/gm2-libs-boot/$(SRC_PREFIX)SysExceptions.h
1031         -test -d m2/gm2-libs-paranoid || $(mkinstalldirs) m2/gm2-libs-paranoid
1032         $(CXX) -c -DIN_GCC $(GM2_O_S3) $(CFLAGS) -Im2/gm2-libs -I$(srcdir)/m2 -Im2 -I. -Im2/gm2-libs-boot $(INCLUDES) $< -o $@
1034 m2/gm2-compiler-paranoid/m2flex.o: m2/gm2-compiler/m2flex.c $(TIMEVAR_H)
1035         -test -d m2/gm2-compiler-paranoid || $(mkinstalldirs) m2/gm2-compiler-paranoid
1036         $(COMPILER) -c $(GM2_O_S3) -g $(ALL_COMPILERFLAGS) $(ALL_CPPFLAGS) $(INCLUDES) \
1037           $(GM2GCC) -Im2/gm2-compiler-boot -Im2/gm2-libs-boot $< -o $@
1039 m2/gm2-libs-paranoid/dtoa.o: $(srcdir)/m2/gm2-libs-ch/dtoa.cc \
1040                               m2/gm2-libs-boot/$(SRC_PREFIX)dtoa.h \
1041                               m2/gm2-libs/gm2-libs-host.h
1042         -test -d m2/gm2-libs-paranoid || $(mkinstalldirs) m2/gm2-libs-paranoid
1043         $(CXX) -c $(GM2_O_S3) $(CFLAGS) -I$(srcdir)/m2 -Im2/gm2-libs-boot -Im2/gm2-libs $(INCLUDES) $< -o $@
1045 m2/gm2-libs-paranoid/ldtoa.o: $(srcdir)/m2/gm2-libs-ch/ldtoa.cc \
1046                                m2/gm2-libs-boot/$(SRC_PREFIX)ldtoa.h \
1047                                m2/gm2-libs/gm2-libs-host.h
1048         -test -d m2/gm2-libs-paranoid || $(mkinstalldirs) m2/gm2-libs-paranoid
1049         $(CXX) -c $(GM2_O_S3) $(CFLAGS) -I$(srcdir)/m2 -Im2/gm2-libs-boot -Im2/gm2-libs $(INCLUDES) $< -o $@
1051 m2/gm2-libs-paranoid/termios.o: $(srcdir)/m2/gm2-libs-ch/termios.c \
1052                                m2/gm2-libs-boot/$(SRC_PREFIX)termios.h \
1053                                m2/gm2-libs/gm2-libs-host.h
1054         -test -d m2/gm2-libs-paranoid || $(mkinstalldirs) m2/gm2-libs-paranoid
1055         $(CXX) -c $(GM2_O_S3) $(CFLAGS) -I$(srcdir)/m2 -Im2/gm2-libs-boot -Im2/gm2-libs $(INCLUDES) $< -o $@
1058 # The rules which build the paranoid version of gm2.
1060 BUILD-LIBS-PARANOID-H = $(GM2-LIBS-BOOT-DEFS:%.def=m2/gm2-libs-boot/$(SRC_PREFIX)%.h)
1062 BUILD-LIBS-PARANOID = $(BUILD-LIBS-PARANOID-H) \
1063                       $(GM2-LIBS-MODS:%.mod=m2/gm2-libs-paranoid/%.o) \
1064                       $(GM2-LIBS-CC:%.cc=m2/gm2-libs-paranoid/%.o) \
1065                       $(GM2-LIBS-C:%.c=m2/gm2-libs-paranoid/%.o)
1067 m2/gm2-libs-paranoid/libgm2.a: m2/boot-bin/mc$(exeext) $(BUILD-LIBS-PARANOID)
1068         $(AR) cr $@ $(GM2-LIBS-MODS:%.mod=m2/gm2-libs-paranoid/%.o) \
1069                     $(GM2-LIBS-CC:%.cc=m2/gm2-libs-paranoid/%.o) \
1070                     $(GM2-LIBS-C:%.c=m2/gm2-libs-paranoid/%.o)
1071         $(RANLIB) $@
1073 m2/gm2-compiler-paranoid/gm2.a: \
1074                              $(GM2-COMP-MODS:%.mod=m2/gm2-compiler-paranoid/%.o) \
1075                              $(GM2-AUTO-MODS:%.mod=m2/gm2-compiler-paranoid/%.o) \
1076                              m2/gm2-compiler-paranoid/M2Version.o \
1077                              m2/gm2-compiler-paranoid/m2flex.o
1078         $(AR) cr $@ $(GM2-COMP-MODS:%.mod=m2/gm2-compiler-paranoid/%.o) \
1079                     $(GM2-AUTO-MODS:%.mod=m2/gm2-compiler-paranoid/%.o) \
1080                     m2/gm2-compiler-paranoid/M2Version.o
1081         $(RANLIB) $@
1083 m2/gm2-compiler-paranoid/M2Version.mod:
1084         -test -d m2/gm2-compiler-paranoid || $(mkinstalldirs) m2/gm2-compiler-paranoid
1085         $(SHELL) $(srcdir)/m2/tools-src/makeversion -m $(srcdir) m2/gm2-compiler-paranoid
1087 m2/gm2-compiler-paranoid/M2Version.o: m2/gm2-compiler-paranoid/M2Version.mod
1088         -test -d m2/gm2-compiler-paranoid || $(mkinstalldirs) m2/gm2-compiler-paranoid
1089         $(GM2_2) $(GM2_FLAGS) -c -I$(srcdir)/m2/gm2-compiler -I$(srcdir)/m2/gm2-libs -I$(srcdir)/m2/gm2-gcc $< -o $@
1091 m2/gm2-compiler-paranoid/%.mod: $(srcdir)/m2/gm2-compiler/%.bnf $(PGE)
1092         -test -d m2/gm2-compiler-paranoid || $(mkinstalldirs) m2/gm2-compiler-paranoid
1093         $(PGE) -k -l $< -o $@
1095 # Recreate the target independent copies of the documentation which is
1096 # used during the build if Python3 is unavailable.
1098 # m2-target-independent-doc-rst should be enabled once
1099 # tools-src/def2doc.py is completed (module hyperlinks need rst
1100 # treatment).
1102 m2-target-independent-doc: m2-target-independent-doc-texi # m2-target-independent-doc-rst
1104 m2-target-independent-doc-texi: force
1105 ifeq ($(HAVE_PYTHON),yes)
1106         python3 $(srcdir)/m2/tools-src/def2doc.py -t -b$(srcdir)/m2 -f$(srcdir)/m2/gm2-libs-iso/SYSTEM.def -o $(srcdir)/m2/target-independent/m2/SYSTEM-iso.texi
1107         python3 $(srcdir)/m2/tools-src/def2doc.py -t -b$(srcdir)/m2 -f$(srcdir)/m2/gm2-libs/SYSTEM.def -o $(srcdir)/m2/target-independent/m2/SYSTEM-pim.texi
1108         python3 $(srcdir)/m2/tools-src/def2doc.py -t -b$(srcdir)/m2 -f$(srcdir)/m2/gm2-libs/Builtins.def -o $(srcdir)/m2/target-independent/m2/Builtins.texi
1109         python3 $(srcdir)/m2/tools-src/def2doc.py -t -uLibraries -s$(srcdir)/m2 -b$(srcdir)/m2 -o $(srcdir)/m2/target-independent/m2/gm2-libs.texi
1110 else
1111         echo "m2-target-independent-doc-texi will only work if Python3 was detected during configure"
1112 endif
1114 m2-target-independent-doc-rst: force
1115 ifeq ($(HAVE_PYTHON),yes)
1116         python3 $(srcdir)/m2/tools-src/def2doc.py -x -b$(srcdir)/m2 -f$(srcdir)/m2/gm2-libs-iso/SYSTEM.def -o $(srcdir)/m2/target-independent/m2/SYSTEM-iso.rst
1117         python3 $(srcdir)/m2/tools-src/def2doc.py -x -b$(srcdir)/m2 -f$(srcdir)/m2/gm2-libs/SYSTEM.def -o $(srcdir)/m2/target-independent/m2/SYSTEM-pim.rst
1118         python3 $(srcdir)/m2/tools-src/def2doc.py -x -b$(srcdir)/m2 -f$(srcdir)/m2/gm2-libs/Builtins.def -o $(srcdir)/m2/target-independent/m2/Builtins.rst
1119         python3 $(srcdir)/m2/tools-src/def2doc.py -x -uLibraries -s$(srcdir)/m2 -b$(srcdir)/m2 -o $(srcdir)/m2/target-independent/m2/gm2-libs.rst
1120 else
1121         echo "m2-target-independent-doc-rst will only work if Python3 was detected during configure"
1122 endif