Newer
Older
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
# Top level -*- makefile -*- fragment for Cobol
# Copyright (C) 2016 Free Software Foundation, Inc.
# This file is part of GCC.
# GCC is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 3, or (at your option)
# any later version.
# GCC is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
# You should have received a copy of the GNU General Public License
# along with GCC; see the file COPYING3. If not see
# <http://www.gnu.org/licenses/>.
# This file provides the language dependent support in the main Makefile.
# Each language makefile fragment must provide the following targets:
#
# foo.all.cross, foo.start.encap, foo.rest.encap,
# foo.install-common, foo.install-man, foo.install-info, foo.install-pdf,
# foo.install-html, foo.info, foo.dvi, foo.pdf, foo.html, foo.uninstall,
# foo.mostlyclean, foo.clean, foo.distclean,
# foo.maintainer-clean, foo.stage1, foo.stage2, foo.stage3, foo.stage4
#
# where `foo' is the name of the language.
#
# It should also provide rules for:
#
# - making any compiler driver (eg: g++)
# - the compiler proper (eg: cc1plus)
# - define the names for selecting the language in LANGUAGES.
ifeq ("$(USER)","bob")
MAX_ERRORS := -fmax-errors=1
endif
gcobol_INSTALL_NAME := $(shell echo gcobol|sed '$(program_transform_name)')
gcobol_TARGET_INSTALL_NAME := $(target_noncanonical)-$(shell echo gcobol|sed '$(program_transform_name)')
cobol: cobol1$(exeext)
.PHONY: cobol
BINCLUDE ?= ./gcc
#
# At this point, as of 2022-10-21, CPPFLAGS is an empty string and can be
# altered. CFLAGS and CXXFLAGS are being established upstream, and thus
# cannot, at this point, be changed.
#
CPPFLAGS = \
$(MAX_ERRORS) \
-Iinclude \
-I$(BINCLUDE) \
-Wno-cpp \
-Wno-missing-field-initializers \
-DEXEC_LIB=\"$(DESTDIR)$(libdir)\"
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
$(END)
YACC = bison
YFLAGS = -Werror -Wmidrule-values -Wno-yacc \
--debug --token-table --verbose
LEX = flex
LFLAGS = -d -Ca
#
# These are the object files for creating the cobol1.exe compiler:
#
cobol_one_OBJS = \
cobol/cdf.o \
cobol/cdf-copy.o \
cobol/cobol1.o \
cobol/convert.o \
cobol/except.o \
cobol/genutil.o \
cobol/genapi.o \
cobol/genmath.o \
cobol/gengen.o \
cobol/lexio.o \
cobol/parse.o \
cobol/scan.o \
cobol/structs.o \
cobol/symbols.o \
cobol/symfind.o \
cobol/util.o \
cobol/valconv.o \
cobol/charmaps.o \
$(END)
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
#
# These are the object files for creating the gcobol.exe "driver"
#
GCOBOL_D_OBJS = $(GCC_OBJS) cobol/gcobolspec.o
#
# These get combined to provide a dependency relationship that ensures all
# of the "generated-files" are generated before we need them. See the root
# Makefile.in code that looks like this:
# ALL_HOST_FRONTEND_OBJS = $(foreach v,$(CONFIG_LANGUAGES),$($(v)_OBJS))
#
cobol_OBJS = \
$(cobol_one_OBJS) \
cobol/gcobolspec.o \
$(END)
#
# Frankly, I can't figure out what this does:
#
CFLAGS-cobol/gcobolspec.o += $(DRIVER_DEFINES)
#
# This controls the build of the gcobol.exe "driver"
#
gcobol$(exeext): \
$(GCOBOL_D_OBJS) \
$(EXTRA_GCC_OBJS) \
libcommon-target.a \
$(LIBDEPS)
+$(LINKER) $(ALL_LINKERFLAGS) $(LDFLAGS) -o $@ \
$(GCOBOL_D_OBJS) $(EXTRA_GCC_OBJS) libcommon-target.a \
$(EXTRA_GCC_LIBS) $(LIBS)
#
# These control the build of the cobol1.exe source-to-GENERIC converter
#
# First, files needed for parsing:
cobol/parse.c: cobol/parse.y cobol/genapi.h cobol/parse_ante.h
$(YACC) -o $@ $(YFLAGS) \
--defines=cobol/parse.h \
--report-file=cobol/parser.out $<
cobol/cdf.c: cobol/cdf.y cobol/genapi.h
$(YACC) -o $@ $(YFLAGS) \
--defines=cobol/cdf.h --report-file=cobol/cdf.out $<
cobol/scan.c: cobol/scan.l cobol/scan_ante.h cobol/scan_post.h
$(LEX) -o$@ $(LFLAGS) $<
cobol/scan.o: cobol/parse.c # cobol/parse.h # parse.h gets built along with parse.c
# And the cobol1.exe front end
cobol1$(exeext): $(cobol_one_OBJS) $(BACKEND) $(LIBDEPS) attribs.o
+$(LLINKER) $(ALL_LINKERFLAGS) $(LDFLAGS) attribs.o -o $@ \
$(cobol_one_OBJS) $(BACKEND) $(LIBS) $(BACKENDLIBS)
## Other dependencies
# mkdep cobol/*.cc; grep -E '^[[:alnum:]_][.]o|cobol/' .depend |
# awk '{gsub(/[/]usr[^ \n]+ ?/, ""); gsub(/cobol[^ ]+[.]cc/, ""); } 1' \
# > /tmp/depends && rm .depend
cdf-copy.o: cobol/copybook.h
symbols.o: cobol/genapi.h cobol/symbols.h cobol/inspect.h cobol/io.h
# FIXME
cobol.all.cross:
cobol.start.encap: gcobol$(exeext)
cobol.rest.encap:
cobol.install-common: installdirs
$(DESTDIR)$(bindir)/$(gcobol_INSTALL_NAME)$(exeext)
$(INSTALL_PROGRAM) -v $(srcdir)/cobol/gcobc $(DESTDIR)$(bindir)/
$(INSTALL_DATA) -v $(srcdir)/cobol/udf/* $(udfdir)/
cobol.install-man: installdirs
$(INSTALL_DATA) -v $(srcdir)/cobol/gcobol.1 $(DESTDIR)$(man1dir)/
$(INSTALL_DATA) -v $(srcdir)/cobol/gcobol.3 $(DESTDIR)$(man3dir)/
cobol.install-info:
cobol.install-pdf:
cobol.install-plugin:
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
cobol.install-html:
cobol.info:
cobol.dvi:
cobol.pdf:
cobol.html:
cobol.uninstall:
-rm -f gcobol$(exeext) cobol1$(exeext)
-rm -f $(cobol_OBJS)
cobol.man:
cobol.mostlyclean:
cobol.clean:
rm -fr cobol1 cobol/* ../*/libgcobol/*
cobol.distclean:
cobol.maintainer-clean:
# The main makefile has already created stage?/cobol.
cobol.stage1: stage1-start
-mv cobol/*$(objext) stage1/cobol
cobol.stage2: stage2-start
-mv cobol/*$(objext) stage2/cobol
cobol.stage3: stage3-start
-mv cobol/*$(objext) stage3/cobol
cobol.stage4: stage4-start
-mv cobol/*$(objext) stage4/cobol
cobol.stageprofile: stageprofile-start
-mv cobol/*$(objext) stageprofile/cobol
cobol.stagefeedback: stagefeedback-start
-mv cobol/*$(objext) stagefeedback/cobol
selftest-cobol: