summaryrefslogtreecommitdiff
path: root/dist/gcc/Make-lang.in
blob: 8aa15e9227031cf2ce89ed0e4760e45f53e38bf8 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
# Top level -*- makefile -*- fragment for vhdl (GHDL).
#   Copyright (C) 2002
#   Free Software Foundation, Inc.

#This file is part of GNU CC.

#GNU CC is free software; you can redistribute it and/or modify
#it under the terms of the GNU General Public License as published by
#the Free Software Foundation; either version 2, or (at your option)
#any later version.

#GNU CC 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 GNU CC; see the file COPYING.  If not, write to
#the Free Software Foundation, 59 Temple Place - Suite 330,
#Boston, MA 02111-1307, USA.

# This file provides the language dependent support in the main Makefile.
# Each language makefile fragment must provide the following targets:
#
# foo.all.build, foo.all.cross, foo.start.encap, foo.rest.encap,
# foo.info, foo.dvi,
# foo.install-normal, foo.install-common, foo.install-info, foo.install-man,
# foo.uninstall, foo.mostlyclean, foo.clean, foo.distclean, foo.extraclean,
# foo.maintainer-clean, foo.stage1, foo.stage2, foo.stage3, foo.stage4
#
# where `foo' is the name of the language.
#
# It should also provide rules for:
#
# - making any compiler driver (eg: g++)
# - the compiler proper (eg: cc1plus)
# - define the names for selecting the language in LANGUAGES.
# tool definitions
MV = mv
RM = rm -f

GHDLLIB_CFLAGS=-O2 -g
GHDLLIB_AFLAGS=-gnatpn

# Extra flags to pass to recursive makes.
GHDL_ADAFLAGS= -Wall -gnata
VHDL_LIB_DIR=$(libsubdir)/vhdl
GNATBIND = gnatbind
GNATMAKE = gnatmake
VHDL_FLAGS_TO_PASS = \
	"GHDL_ADAFLAGS=$(GHDL_ADAFLAGS)" \
	"GRT_FLAGS=$(GHDLLIB_CFLAGS)" \
	"GRT_ADAFLAGS=$(GHDLLIB_AFLAGS)" \
	"LIB_CFLAGS=$(GHDLLIB_CFLAGS)" \
	"GNATMAKE=$(GNATMAKE)" \
	"GNATBIND=$(GNATBIND)" \
	"CFLAGS=$(CFLAGS)" \
	"VHDL_LIB_DIR=$(VHDL_LIB_DIR)" \
	"INSTALL_DATA=$(INSTALL_DATA)" \
	"INSTALL_PROGRAM=$(INSTALL_PROGRAM)" \
        "libexecsubdir=$(libexecsubdir)"

# Command to run the Makefile in vhdl subdir.  Don't forget the dependency on
#  vhdl/Makefile
MAKE_IN_VHDL=$(MAKE) -C vhdl $(FLAGS_TO_PASS) $(VHDL_FLAGS_TO_PASS) ADAC="$(CC)" CC="$(CC)"

# Define the names for selecting vhdl in LANGUAGES.
vhdl VHDL: ghdl1$(exeext) ghdl$(exeext) vhdl/libgrt.a ghdllib

# Tell GNU Make to ignore these, if they exist.
.PHONY: vhdl VHDL ghdllib

#ortho-lang.o: $(agcc_srcdir)/ortho-lang.c \
# $(AGCC_GCCOBJ_DIR)gcc/gtype-vhdl.h \
# $(AGCC_GCCOBJ_DIR)gcc/gt-vhdl-ortho-lang.h
#	$(COMPILER) -c -o $@ $< $(AGCC_CFLAGS) $(INCLUDES)

GHDL1_OBJS = attribs.o vhdl/ortho-lang.o

# To be put in ALL_HOST_FRONTEND_OBJS, so that generated files are created
# before.
vhdl_OBJS=vhdl/ortho-lang.o

vhdl_srcdir := $(shell cd $(srcdir)/vhdl; pwd)

# The compiler proper.
# It is compiled into the vhdl/ subdirectory to avoid file name clashes but
# linked in in gcc directory to be able to access to gcc object files.
ghdl1$(exeext): force $(GHDL1_OBJS) $(BACKEND) $(LIBDEPS)
        # Create object file in vhdl/subdir
	cd vhdl; $(GNATMAKE) -c -aI$(vhdl_srcdir) ortho_gcc-main \
	 -cargs $(CFLAGS) $(GHDL_ADAFLAGS)
	$(GNATMAKE) -o $@ -aI$(srcdir)/vhdl -aOvhdl ortho_gcc-main \
	 -bargs -E -cargs $(CFLAGS) $(GHDL_ADAFLAGS) \
	 -largs --LINK=$(LLINKER) $(ALL_LINKERFLAGS) $(LDFLAGS) $(GHDL1_OBJS) \
	 $(filter-out main.o,$(BACKEND)) $(LIBS) $(BACKENDLIBS)
	if test $@ -nt s-ghdllib; then $(RM) -f s-ghdllib; fi

vhdl/default_pathes.ads: Makefile
	echo "--  DO NOT EDIT" > tmp-dpathes.ads
	echo "--  This file is created by Makefile" >> tmp-dpathes.ads
	echo "package Default_Pathes is" >> tmp-dpathes.ads
	echo "   --  Accept long lines."  >> tmp-dpathes.ads
	echo "   pragma Style_Checks (\"M999\");"  >> tmp-dpathes.ads
	echo "   Install_Prefix : constant String :=" >> tmp-dpathes.ads
	echo "     \"$(exec_prefix)\";" >> tmp-dpathes.ads
	suffix=`expr @"$(libexecdir)" : @"$(prefix)/\(.*\)"`; \
	if test x"$$suffix" = x; then suffix="$(libexecdir)"; fi; \
	echo "   Compiler_Gcc   : constant String :=" >> tmp-dpathes.ads; \
	echo "     \"$$suffix/gcc/$(target_noncanonical)/$(version)/ghdl1$(exeext)\";" >> tmp-dpathes.ads
	echo "   Compiler_Debug : constant String := \"\";" >> tmp-dpathes.ads
	echo "   Compiler_Mcode : constant String := \"\";" >> tmp-dpathes.ads
	echo "   Compiler_Llvm  : constant String := \"\";" >> tmp-dpathes.ads
	echo "   Post_Processor : constant String := \"\";" >> tmp-dpathes.ads
	echo "   Lib_Prefix     : constant String :=">> tmp-dpathes.ads
	echo "     \"lib/gcc/$(target_noncanonical)/$(version)/vhdl/\";" >> tmp-dpathes.ads
	echo "end Default_Pathes;" >> tmp-dpathes.ads
	$(srcdir)/../move-if-change tmp-dpathes.ads $@

# The driver for ghdl.  Depends on ghdl1 to use object files in vhdl/ subdir.
ghdl$(exeext): ghdl1$(exeext) vhdl/default_pathes.ads force
	$(GNATMAKE) -o $@ -aI$(srcdir)/vhdl -aI$(srcdir)/vhdl/ghdldrv \
	 -aIvhdl -aOvhdl ghdl_gcc \
	 -bargs -E -cargs $(ADA_CFLAGS) $(GHDL_ADAFLAGS) -largs $(LIBS)
	if test $@ -nt s-ghdllib; then $(RM) -f s-ghdllib; fi

# Ghdl libraries. Also depends on xgcc to build std_standard.o
s-ghdllib: ghdl$(exeext) ghdl1$(exeext) $(GCC_PASSES)
	$(MAKE_IN_VHDL) ghdllib
	touch $@

ghdllib: s-ghdllib

vhdl/libgrt.a: vhdl/Makefile force
	$(MAKE_IN_VHDL) libgrt.a grt.lst

vhdl/Makefile: config.status $(srcdir)/vhdl/Makefile.in
	CONFIG_HEADERS= CONFIG_LINKS= CONFIG_COMMANDS= \
	CONFIG_FILES=vhdl/Makefile $(SHELL) config.status

# Build hooks:

vhdl.all.build:

vhdl.all.cross:
	@echo "No support for building vhdl cross-compiler"
	exit 1

vhdl.start.encap:
vhdl.rest.encap:

# Documentation hooks
doc/ghdl.info: vhdl/ghdl.texi
	-rm -f doc/ghdl.info*
	$(MAKEINFO) $(MAKEINFOFLAGS) -o $@ $<

doc/ghdl.dvi: vhdl/ghdl.texi
	$(TEXI2DVI) -o $@ $<

vhdl.info: doc/ghdl.info

vhdl.man:

vhdl.dvi: doc/ghdl.dvi

vhdl.generated-manpages:

# Install hooks:
# ghdl1 is installed elsewhere as part of $(COMPILERS).

vhdl.install-normal:

vhdl.install-plugin:

# Install the driver program as ghdl.
vhdl.install-common: ghdl$(exeext) s-ghdllib vhdl/Makefile
	-mkdir $(DESTDIR)$(bindir)
	-$(RM) $(DESTDIR)$(bindir)/ghdl$(exeext)
	$(INSTALL_PROGRAM) ghdl$(exeext) $(DESTDIR)$(bindir)/ghdl$(exeext)
# Install the library
	$(MAKE_IN_VHDL) install-ghdllib

install-info:: $(DESTDIR)$(infodir)/ghdl.info

vhdl.install-info: $(DESTDIR)$(infodir)/ghdl.info

install-ghdllib: ghdl$(exeext) ghdl1$(exeext) vhdl/Makefile s-ghdllib
	$(MAKE_IN_VHDL) install-ghdllib

vhdl.install-man: $(DESTDIR)$(man1dir)/ghdl$(man1ext)

$(DESTDIR)$(man1dir)/ghdl$(man1ext): $(srcdir)/vhdl/ghdl.1
	-rm -f $@
	-$(INSTALL_DATA) $< $@
	-chmod a-x $@

vhdl.uninstall:
	-$(RM) $(DESTDIR)$(bindir)/ghdl$(exeext)


# Clean hooks:
# A lot of the ancillary files are deleted by the main makefile.
# We just have to delete files specific to us.

vhdl.mostlyclean:
	-$(RM) vhdl/*$(objext) vhdl/*.ali vhdl/b~*.ad?
	-$(RM) vhdl/default_pathes.ads
vhdl.clean:
	-$(RM) vhdl/*$(objext)
	-$(RM) vhdl/default_pathes.ads
vhdl.distclean:
	-$(RM) vhdl/Makefile
	-$(RM) ghdl$(exeext)
vhdl.extraclean:

vhdl.maintainer-clean:


# Stage hooks:
# The main makefile has already created stage?/vhdl

vhdl.stage1:
	-$(MV) vhdl/*$(objext) vhdl/*.ali vhdl/b_*.c stage1/vhdl
	-$(MV) vhdl/stamp-* stage1/vhdl
vhdl.stage2:
	-$(MV) vhdl/*$(objext) vhdl/*.ali vhdl/b_*.c stage2/vhdl
	-$(MV) vhdl/stamp-* stage2/vhdl
vhdl.stage3:
	-$(MV) vhdl/*$(objext) vhdl/*.ali vhdl/b_*.c stage3/vhdl
	-$(MV) vhdl/stamp-* stage3/vhdl
vhdl.stage4:
	-$(MV) vhdl/*$(objext) vhdl/*.ali vhdl/b_*.c stage4/vhdl
	-$(MV) vhdl/stamp-* stage4/vhdl