]> git.ipfire.org Git - thirdparty/gcc.git/blob - gcc/c/Make-lang.in
Update copyright years.
[thirdparty/gcc.git] / gcc / c / Make-lang.in
1 # Top level -*- makefile -*- fragment for GNU C - C language.
2 # Copyright (C) 1994-2024 Free Software Foundation, Inc.
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.
39 c: cc1$(exeext)
40 c.serial = cc1$(exeext)
41
42 # Tell GNU make to ignore these if they exist.
43 .PHONY: c gcc
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).
48 CFLAGS-c/gccspec.o += $(DRIVER_DEFINES)
49
50 # The C compiler itself.
51
52 # Language-specific object files for C and Objective C.
53 C_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 \
55 c/c-fold.o c/gimple-parser.o \
56 $(C_COMMON_OBJS) $(C_TARGET_OBJS)
57
58 # Language-specific object files for C.
59 C_OBJS = c/c-lang.o c-family/stub-objc.o $(C_AND_OBJC_OBJS)
60 c_OBJS = $(C_OBJS) cc1-checksum.o c/gccspec.o
61
62 # Use strict warnings for this front end.
63 c-warn = $(STRICT_WARN)
64
65 ifeq ($(if $(wildcard ../stage_current),$(shell cat \
66 ../stage_current)),stageautofeedback)
67 $(C_OBJS): ALL_COMPILERFLAGS += -fauto-profile=cc1.fda
68 $(C_OBJS): cc1.fda
69 endif
70
71 # compute checksum over all object files and the options
72 # re-use the checksum from the prev-final stage so it passes
73 # the bootstrap comparison and allows comparing of the cc1 binary
74 cc1-checksum.cc : build/genchecksum$(build_exeext) checksum-options \
75 $(C_OBJS) $(BACKEND) $(LIBDEPS)
76 if [ -f ../stage_final ] \
77 && cmp -s ../stage_current ../stage_final; then \
78 cp ../prev-gcc/cc1-checksum.cc cc1-checksum.cc; \
79 else \
80 build/genchecksum$(build_exeext) $(C_OBJS) $(BACKEND) $(LIBDEPS) \
81 checksum-options > cc1-checksum.cc.tmp && \
82 $(srcdir)/../move-if-change cc1-checksum.cc.tmp cc1-checksum.cc; \
83 fi
84
85 cc1$(exeext): $(C_OBJS) cc1-checksum.o $(BACKEND) $(LIBDEPS)
86 @$(call LINK_PROGRESS,$(INDEX.c),start)
87 +$(LLINKER) $(ALL_LINKERFLAGS) $(LDFLAGS) -o $@ $(C_OBJS) \
88 cc1-checksum.o $(BACKEND) $(LIBS) $(BACKENDLIBS)
89 @$(call LINK_PROGRESS,$(INDEX.c),end)
90
91 components_in_prev = "bfd opcodes binutils fixincludes gas gcc gmp mpfr mpc isl gold intl ld libbacktrace libcpp libcody libdecnumber libiberty libiberty-linker-plugin libiconv zlib lto-plugin libctf libsframe"
92 components_in_prev_target = "libstdc++-v3 libsanitizer libvtv libgcc libbacktrace libphobos zlib libgomp libatomic"
93
94 cc1.fda: create_fdas_for_cc1
95 $(PROFILE_MERGER) $(shell ls -ha cc1_*.fda) --output_file cc1.fda -gcov_version 2
96
97 create_fdas_for_cc1: ../stage1-gcc/cc1$(exeext) ../prev-gcc/$(PERF_DATA)
98 for component_in_prev in "$(components_in_prev)"; do \
99 perf_path=../prev-$$component_in_prev/$(PERF_DATA); \
100 echo "Perf path:"; \
101 echo $$perf_path; \
102 if [ -f $$perf_path ]; then \
103 profile_name=cc1_$$component_in_prev.fda; \
104 $(CREATE_GCOV) -binary ../stage1-gcc/cc1$(exeext) -gcov $$profile_name -profile $$perf_path -gcov_version 2; \
105 fi; \
106 done;
107
108 for component_in_prev_target in "$(components_in_prev_target)"; do \
109 perf_path=../prev-$(TARGET_SUBDIR)/$$component_in_prev_target/$(PERF_DATA); \
110 echo "Perf path:"; \
111 echo $$perf_path; \
112 if [ -f $$perf_path ]; then \
113 profile_name=cc1_$$component_in_prev_target.fda; \
114 $(CREATE_GCOV) -binary ../prev-gcc/cc1$(exeext) -gcov $$profile_name -profile $$perf_path -gcov_version 2; \
115 fi; \
116 done;
117
118 $(STAMP) $@
119 #
120 # Build hooks:
121
122 c.info:
123 c.dvi:
124 c.pdf:
125 c.html:
126 c.install-info:
127 c.install-dvi:
128 c.install-pdf:
129 c.install-html:
130 c.all.cross:
131 c.start.encap:
132 c.rest.encap:
133 c.srcinfo:
134 c.srcextra: gengtype-lex.cc
135 -cp -p $^ $(srcdir)
136 c.tags: force
137 cd $(srcdir)/c; $(ETAGS) -o TAGS.sub *.cc *.h; \
138 $(ETAGS) --include TAGS.sub --include ../TAGS.sub
139 c.man:
140 c.srcman:
141
142 # C selftests
143
144 # If C is enabled, require the selftests to be run for it
145 # at each stage of the build:
146 selftest-c: s-selftest-c
147
148 C_SELFTEST_FLAGS = -xc $(SELFTEST_FLAGS)
149 C_SELFTEST_DEPS = cc1$(exeext) $(SELFTEST_DEPS)
150
151 # Run the C selftests:
152 s-selftest-c: $(C_SELFTEST_DEPS)
153 $(GCC_FOR_TARGET) $(C_SELFTEST_FLAGS)
154 $(STAMP) $@
155
156 # Convenience methods for running C selftests under gdb:
157 .PHONY: selftest-c-gdb
158 selftest-c-gdb: $(C_SELFTEST_DEPS)
159 $(GCC_FOR_TARGET) $(C_SELFTEST_FLAGS) \
160 -wrapper gdb,--args
161
162 .PHONY: selftest-gdb
163 selftest-gdb: selftest-c-gdb
164
165 # Convenience methods for running C selftests under valgrind:
166 .PHONY: selftest-c-valgrind
167 selftest-c-valgrind: $(C_SELFTEST_DEPS)
168 $(GCC_FOR_TARGET) $(C_SELFTEST_FLAGS) \
169 -wrapper valgrind,--leak-check=full
170
171 .PHONY: selftest-valgrind
172 selftest-valgrind: selftest-c-valgrind
173
174 # List of targets that can use the generic check- rule and its // variant.
175 lang_checks += check-gcc
176 lang_checks_parallelized += check-gcc
177 # For description see the check_$lang_parallelize comment in gcc/Makefile.in.
178 check_gcc_parallelize=10000
179
180 # 'make check' in gcc/ looks for check-c. Redirect it to check-gcc.
181 check-c : check-gcc
182
183 #\f
184 # Install hooks:
185 # cc1 is installed elsewhere as part of $(COMPILERS).
186
187 c.install-common:
188 c.install-man:
189
190 c.install-plugin: installdirs
191 # Install import library.
192 ifeq ($(plugin_implib),yes)
193 $(mkinstalldirs) $(DESTDIR)$(plugin_resourcesdir)
194 $(INSTALL_DATA) cc1$(exeext).a $(DESTDIR)$(plugin_resourcesdir)/cc1$(exeext).a
195 endif
196
197 c.uninstall:
198
199 #\f
200 # Clean hooks:
201 # A lot of the ancillary files are deleted by the main makefile.
202 # We just have to delete files specific to us.
203
204 c.mostlyclean:
205 -rm -f cc1$(exeext)
206 -rm -f c/*$(objext)
207 -rm -f c/*$(coverageexts)
208 -rm -f cc1.fda
209 -rm -f cc1_*.fda
210 c.clean:
211 c.distclean:
212 -rm -f c/config.status c/Makefile
213 c.maintainer-clean:
214 #\f
215 # Stage hooks:
216 # The main makefile has already created stage?/cp.
217
218 c.stage1: stage1-start
219 -mv c/*$(objext) stage1/c
220 c.stage2: stage2-start
221 -mv c/*$(objext) stage2/c
222 c.stage3: stage3-start
223 -mv c/*$(objext) stage3/c
224 c.stage4: stage4-start
225 -mv c/*$(objext) stage4/c
226 c.stageprofile: stageprofile-start
227 -mv c/*$(objext) stageprofile/c
228 c.stagefeedback: stagefeedback-start
229 -mv c/*$(objext) stagefeedback/c
230 c.autostageprofile: autostageprofile-start
231 -mv c/*$(objext) autostageprofile/c
232 c.autostagefeedback: autostagefeedback-start
233 -mv c/*$(objext) autostagefeedback/c