111
|
1 # Top level -*- makefile -*- fragment for GNU C - C language.
|
131
|
2 # Copyright (C) 1994-2018 Free Software Foundation, Inc.
|
111
|
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 #
|
|
38 # Define the names for selecting c in LANGUAGES.
|
|
39 c: cc1$(exeext)
|
|
40
|
|
41 # Tell GNU make to ignore these if they exist.
|
|
42 .PHONY: c gcc
|
|
43
|
|
44 # The C front end driver. This is different from the drivers for other
|
|
45 # front ends, because there is no C language specific driver (i.e. nothing
|
|
46 # is to cc1 as e.g. g++ is to cc1plus, or gfortran is to f951).
|
|
47 CFLAGS-c/gccspec.o += $(DRIVER_DEFINES)
|
|
48
|
|
49 # The C compiler itself.
|
|
50
|
|
51 # Language-specific object files for C and Objective C.
|
|
52 C_AND_OBJC_OBJS = attribs.o c/c-errors.o c/c-decl.o c/c-typeck.o \
|
|
53 c/c-convert.o c/c-aux-info.o c/c-objc-common.o c/c-parser.o \
|
131
|
54 c/c-fold.o c/gimple-parser.o \
|
111
|
55 $(C_COMMON_OBJS) $(C_TARGET_OBJS)
|
|
56
|
|
57 # Language-specific object files for C.
|
|
58 C_OBJS = c/c-lang.o c-family/stub-objc.o $(C_AND_OBJC_OBJS)
|
|
59 c_OBJS = $(C_OBJS) cc1-checksum.o c/gccspec.o
|
|
60
|
|
61 # Use strict warnings for this front end.
|
|
62 c-warn = $(STRICT_WARN)
|
|
63
|
|
64 ifeq ($(if $(wildcard ../stage_current),$(shell cat \
|
|
65 ../stage_current)),stageautofeedback)
|
|
66 $(C_OBJS): ALL_COMPILERFLAGS += -fauto-profile=cc1.fda
|
|
67 $(C_OBJS): cc1.fda
|
|
68 endif
|
|
69
|
|
70 # compute checksum over all object files and the options
|
|
71 # re-use the checksum from the prev-final stage so it passes
|
|
72 # the bootstrap comparison and allows comparing of the cc1 binary
|
|
73 cc1-checksum.c : build/genchecksum$(build_exeext) checksum-options \
|
|
74 $(C_OBJS) $(BACKEND) $(LIBDEPS)
|
|
75 if [ -f ../stage_final ] \
|
|
76 && cmp -s ../stage_current ../stage_final; then \
|
|
77 cp ../prev-gcc/cc1-checksum.c cc1-checksum.c; \
|
|
78 else \
|
|
79 build/genchecksum$(build_exeext) $(C_OBJS) $(BACKEND) $(LIBDEPS) \
|
|
80 checksum-options > cc1-checksum.c.tmp && \
|
|
81 $(srcdir)/../move-if-change cc1-checksum.c.tmp cc1-checksum.c; \
|
|
82 fi
|
|
83
|
|
84 cc1$(exeext): $(C_OBJS) cc1-checksum.o $(BACKEND) $(LIBDEPS)
|
|
85 +$(LLINKER) $(ALL_LINKERFLAGS) $(LDFLAGS) -o $@ $(C_OBJS) \
|
|
86 cc1-checksum.o $(BACKEND) $(LIBS) $(BACKENDLIBS)
|
|
87
|
|
88 cc1.fda: ../stage1-gcc/cc1$(exeext) ../prev-gcc/$(PERF_DATA)
|
|
89 $(CREATE_GCOV) -binary ../stage1-gcc/cc1$(exeext) -gcov cc1.fda -profile ../prev-gcc/$(PERF_DATA) -gcov_version 1
|
|
90
|
|
91 #
|
|
92 # Build hooks:
|
|
93
|
|
94 c.info:
|
|
95 c.dvi:
|
|
96 c.pdf:
|
|
97 c.html:
|
|
98 c.install-info:
|
|
99 c.install-pdf:
|
|
100 c.install-html:
|
|
101 c.all.cross:
|
|
102 c.start.encap:
|
|
103 c.rest.encap:
|
|
104 c.srcinfo:
|
|
105 c.srcextra: gengtype-lex.c
|
|
106 -cp -p $^ $(srcdir)
|
|
107 c.tags: force
|
|
108 cd $(srcdir)/c; etags -o TAGS.sub *.c *.h; \
|
|
109 etags --include TAGS.sub --include ../TAGS.sub
|
|
110 c.man:
|
|
111 c.srcman:
|
|
112
|
131
|
113 # C selftests
|
|
114
|
|
115 # If C is enabled, require the selftests to be run for it
|
|
116 # at each stage of the build:
|
|
117 selftest-c: s-selftest-c
|
|
118
|
|
119 C_SELFTEST_FLAGS = -xc $(SELFTEST_FLAGS)
|
|
120 C_SELFTEST_DEPS = cc1$(exeext) $(SELFTEST_DEPS)
|
|
121
|
|
122 # Run the C selftests:
|
|
123 s-selftest-c: $(C_SELFTEST_DEPS)
|
|
124 $(GCC_FOR_TARGET) $(C_SELFTEST_FLAGS)
|
|
125 $(STAMP) $@
|
|
126
|
|
127 # Convenience methods for running C selftests under gdb:
|
|
128 .PHONY: selftest-c-gdb
|
|
129 selftest-c-gdb: $(C_SELFTEST_DEPS)
|
|
130 $(GCC_FOR_TARGET) $(C_SELFTEST_FLAGS) \
|
|
131 -wrapper gdb,--args
|
|
132
|
|
133 .PHONY: selftest-gdb
|
|
134 selftest-gdb: selftest-c-gdb
|
|
135
|
|
136 # Convenience methods for running C selftests under valgrind:
|
|
137 .PHONY: selftest-c-valgrind
|
|
138 selftest-c-valgrind: $(C_SELFTEST_DEPS)
|
|
139 $(GCC_FOR_TARGET) $(C_SELFTEST_FLAGS) \
|
|
140 -wrapper valgrind,--leak-check=full
|
|
141
|
|
142 .PHONY: selftest-valgrind
|
|
143 selftest-valgrind: selftest-c-valgrind
|
|
144
|
111
|
145 # List of targets that can use the generic check- rule and its // variant.
|
|
146 lang_checks += check-gcc
|
|
147 lang_checks_parallelized += check-gcc
|
|
148 # For description see the check_$lang_parallelize comment in gcc/Makefile.in.
|
|
149 check_gcc_parallelize=10000
|
|
150
|
|
151 # 'make check' in gcc/ looks for check-c. Redirect it to check-gcc.
|
|
152 check-c : check-gcc
|
|
153
|
|
154 #
|
|
155 # Install hooks:
|
|
156 # cc1 is installed elsewhere as part of $(COMPILERS).
|
|
157
|
|
158 c.install-common:
|
|
159 c.install-man:
|
131
|
160
|
|
161 c.install-plugin: installdirs
|
|
162 # Install import library.
|
|
163 ifeq ($(plugin_implib),yes)
|
|
164 $(mkinstalldirs) $(DESTDIR)$(plugin_resourcesdir)
|
|
165 $(INSTALL_DATA) cc1$(exeext).a $(DESTDIR)/$(plugin_resourcesdir)/cc1$(exeext).a
|
|
166 endif
|
|
167
|
111
|
168 c.uninstall:
|
|
169
|
|
170 #
|
|
171 # Clean hooks:
|
|
172 # A lot of the ancillary files are deleted by the main makefile.
|
|
173 # We just have to delete files specific to us.
|
|
174
|
|
175 c.mostlyclean:
|
|
176 -rm -f cc1$(exeext)
|
|
177 -rm -f c/*$(objext)
|
|
178 -rm -f c/*$(coverageexts)
|
|
179 -rm -f cc1.fda
|
|
180 c.clean:
|
|
181 c.distclean:
|
|
182 -rm -f c/config.status c/Makefile
|
|
183 c.maintainer-clean:
|
|
184 #
|
|
185 # Stage hooks:
|
|
186 # The main makefile has already created stage?/cp.
|
|
187
|
|
188 c.stage1: stage1-start
|
|
189 -mv c/*$(objext) stage1/c
|
|
190 c.stage2: stage2-start
|
|
191 -mv c/*$(objext) stage2/c
|
|
192 c.stage3: stage3-start
|
|
193 -mv c/*$(objext) stage3/c
|
|
194 c.stage4: stage4-start
|
|
195 -mv c/*$(objext) stage4/c
|
|
196 c.stageprofile: stageprofile-start
|
|
197 -mv c/*$(objext) stageprofile/c
|
|
198 c.stagefeedback: stagefeedback-start
|
|
199 -mv c/*$(objext) stagefeedback/c
|
|
200 c.autostageprofile: autostageprofile-start
|
|
201 -mv c/*$(objext) autostageprofile/c
|
|
202 c.autostagefeedback: autostagefeedback-start
|
|
203 -mv c/*$(objext) autostagefeedback/c
|