]> git.ipfire.org Git - thirdparty/gcc.git/blame - gcc/c/Make-lang.in
Update copyright years.
[thirdparty/gcc.git] / gcc / c / Make-lang.in
CommitLineData
d4a10d0a 1# Top level -*- makefile -*- fragment for GNU C - C language.
7adcbafe 2# Copyright (C) 1994-2022 Free Software Foundation, Inc.
d4a10d0a
SB
3
4#This file is part of GCC.
5
6#GCC is free software; you can redistribute it and/or modify
7#it under the terms of the GNU General Public License as published by
8#the Free Software Foundation; either version 3, or (at your option)
9#any later version.
10
11#GCC is distributed in the hope that it will be useful,
12#but WITHOUT ANY WARRANTY; without even the implied warranty of
13#MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14#GNU General Public License for more details.
15
16# You should have received a copy of the GNU General Public License
17# along with GCC; see the file COPYING3. If not see
18# <http://www.gnu.org/licenses/>.
19
20# This file provides the language dependent support in the main Makefile.
21# Each language makefile fragment must provide the following targets:
22#
23# foo.all.cross, foo.start.encap, foo.rest.encap,
24# foo.install-common, foo.install-man, foo.install-info, foo.install-pdf,
25# foo.install-html, foo.info, foo.dvi, foo.pdf, foo.html, foo.uninstall,
26# foo.mostlyclean, foo.clean, foo.distclean,
27# foo.maintainer-clean, foo.stage1, foo.stage2, foo.stage3, foo.stage4
28#
29# where `foo' is the name of the language.
30#
31# It should also provide rules for:
32#
33# - making any compiler driver (eg: gcc)
34# - the compiler proper (eg: cc1)
35# - define the names for selecting the language in LANGUAGES.
36
37#\f
38# Define the names for selecting c in LANGUAGES.
39c: cc1$(exeext)
a774a6a2 40c.serial = cc1$(exeext)
d4a10d0a
SB
41
42# Tell GNU make to ignore these if they exist.
a774a6a2 43.PHONY: c gcc
d4a10d0a
SB
44
45# The C front end driver. This is different from the drivers for other
46# front ends, because there is no C language specific driver (i.e. nothing
47# is to cc1 as e.g. g++ is to cc1plus, or gfortran is to f951).
0a6c2227 48CFLAGS-c/gccspec.o += $(DRIVER_DEFINES)
d4a10d0a
SB
49
50# The C compiler itself.
51
52# Language-specific object files for C and Objective C.
53C_AND_OBJC_OBJS = attribs.o c/c-errors.o c/c-decl.o c/c-typeck.o \
54 c/c-convert.o c/c-aux-info.o c/c-objc-common.o c/c-parser.o \
5e9d6aa4 55 c/c-fold.o c/gimple-parser.o \
1ee62b92 56 $(C_COMMON_OBJS) $(C_TARGET_OBJS)
d4a10d0a
SB
57
58# Language-specific object files for C.
59C_OBJS = c/c-lang.o c-family/stub-objc.o $(C_AND_OBJC_OBJS)
60c_OBJS = $(C_OBJS) cc1-checksum.o c/gccspec.o
61
62# Use strict warnings for this front end.
63c-warn = $(STRICT_WARN)
64
e9ac1f86
JJ
65ifeq ($(if $(wildcard ../stage_current),$(shell cat \
66 ../stage_current)),stageautofeedback)
277d7ee0
AK
67$(C_OBJS): ALL_COMPILERFLAGS += -fauto-profile=cc1.fda
68$(C_OBJS): cc1.fda
69endif
70
d4a10d0a 71# compute checksum over all object files and the options
fb2647aa
RB
72# re-use the checksum from the prev-final stage so it passes
73# the bootstrap comparison and allows comparing of the cc1 binary
d4a10d0a
SB
74cc1-checksum.c : build/genchecksum$(build_exeext) checksum-options \
75 $(C_OBJS) $(BACKEND) $(LIBDEPS)
fb2647aa
RB
76 if [ -f ../stage_final ] \
77 && cmp -s ../stage_current ../stage_final; then \
78 cp ../prev-gcc/cc1-checksum.c cc1-checksum.c; \
79 else \
80 build/genchecksum$(build_exeext) $(C_OBJS) $(BACKEND) $(LIBDEPS) \
d4a10d0a 81 checksum-options > cc1-checksum.c.tmp && \
fb2647aa
RB
82 $(srcdir)/../move-if-change cc1-checksum.c.tmp cc1-checksum.c; \
83 fi
d4a10d0a 84
d4a10d0a 85cc1$(exeext): $(C_OBJS) cc1-checksum.o $(BACKEND) $(LIBDEPS)
d326ebc9 86 @$(call LINK_PROGRESS,$(INDEX.c),start)
427b248d 87 +$(LLINKER) $(ALL_LINKERFLAGS) $(LDFLAGS) -o $@ $(C_OBJS) \
d4a10d0a 88 cc1-checksum.o $(BACKEND) $(LIBS) $(BACKENDLIBS)
d326ebc9 89 @$(call LINK_PROGRESS,$(INDEX.c),end)
277d7ee0
AK
90
91cc1.fda: ../stage1-gcc/cc1$(exeext) ../prev-gcc/$(PERF_DATA)
92 $(CREATE_GCOV) -binary ../stage1-gcc/cc1$(exeext) -gcov cc1.fda -profile ../prev-gcc/$(PERF_DATA) -gcov_version 1
93
d4a10d0a
SB
94#\f
95# Build hooks:
96
97c.info:
98c.dvi:
99c.pdf:
100c.html:
101c.install-info:
c3e80a16 102c.install-dvi:
d4a10d0a
SB
103c.install-pdf:
104c.install-html:
105c.all.cross:
106c.start.encap:
107c.rest.encap:
108c.srcinfo:
109c.srcextra: gengtype-lex.c
110 -cp -p $^ $(srcdir)
111c.tags: force
909b30a1
EG
112 cd $(srcdir)/c; $(ETAGS) -o TAGS.sub *.c *.h; \
113 $(ETAGS) --include TAGS.sub --include ../TAGS.sub
d4a10d0a
SB
114c.man:
115c.srcman:
116
033eb567
DM
117# C selftests
118
119# If C is enabled, require the selftests to be run for it
120# at each stage of the build:
121selftest-c: s-selftest-c
122
123C_SELFTEST_FLAGS = -xc $(SELFTEST_FLAGS)
124C_SELFTEST_DEPS = cc1$(exeext) $(SELFTEST_DEPS)
125
126# Run the C selftests:
127s-selftest-c: $(C_SELFTEST_DEPS)
128 $(GCC_FOR_TARGET) $(C_SELFTEST_FLAGS)
129 $(STAMP) $@
130
131# Convenience methods for running C selftests under gdb:
132.PHONY: selftest-c-gdb
133selftest-c-gdb: $(C_SELFTEST_DEPS)
134 $(GCC_FOR_TARGET) $(C_SELFTEST_FLAGS) \
135 -wrapper gdb,--args
136
137.PHONY: selftest-gdb
138selftest-gdb: selftest-c-gdb
139
140# Convenience methods for running C selftests under valgrind:
141.PHONY: selftest-c-valgrind
142selftest-c-valgrind: $(C_SELFTEST_DEPS)
143 $(GCC_FOR_TARGET) $(C_SELFTEST_FLAGS) \
144 -wrapper valgrind,--leak-check=full
145
146.PHONY: selftest-valgrind
147selftest-valgrind: selftest-c-valgrind
148
d4a10d0a
SB
149# List of targets that can use the generic check- rule and its // variant.
150lang_checks += check-gcc
151lang_checks_parallelized += check-gcc
a95492ab
JW
152# For description see the check_$lang_parallelize comment in gcc/Makefile.in.
153check_gcc_parallelize=10000
d4a10d0a
SB
154
155# 'make check' in gcc/ looks for check-c. Redirect it to check-gcc.
156check-c : check-gcc
157
158#\f
159# Install hooks:
160# cc1 is installed elsewhere as part of $(COMPILERS).
161
162c.install-common:
163c.install-man:
8c7dbea9
BK
164
165c.install-plugin: installdirs
166# Install import library.
167ifeq ($(plugin_implib),yes)
168 $(mkinstalldirs) $(DESTDIR)$(plugin_resourcesdir)
c83027f3 169 $(INSTALL_DATA) cc1$(exeext).a $(DESTDIR)$(plugin_resourcesdir)/cc1$(exeext).a
8c7dbea9
BK
170endif
171
d4a10d0a
SB
172c.uninstall:
173
174#\f
175# Clean hooks:
176# A lot of the ancillary files are deleted by the main makefile.
177# We just have to delete files specific to us.
178
179c.mostlyclean:
180 -rm -f cc1$(exeext)
181 -rm -f c/*$(objext)
182 -rm -f c/*$(coverageexts)
277d7ee0 183 -rm -f cc1.fda
d4a10d0a
SB
184c.clean:
185c.distclean:
186 -rm -f c/config.status c/Makefile
187c.maintainer-clean:
188#\f
189# Stage hooks:
190# The main makefile has already created stage?/cp.
191
192c.stage1: stage1-start
193 -mv c/*$(objext) stage1/c
194c.stage2: stage2-start
195 -mv c/*$(objext) stage2/c
196c.stage3: stage3-start
197 -mv c/*$(objext) stage3/c
198c.stage4: stage4-start
199 -mv c/*$(objext) stage4/c
200c.stageprofile: stageprofile-start
201 -mv c/*$(objext) stageprofile/c
202c.stagefeedback: stagefeedback-start
203 -mv c/*$(objext) stagefeedback/c
277d7ee0
AK
204c.autostageprofile: autostageprofile-start
205 -mv c/*$(objext) autostageprofile/c
206c.autostagefeedback: autostagefeedback-start
207 -mv c/*$(objext) autostagefeedback/c