1 # Top level -*- makefile -*- fragment for GNU C - C language.
2 # Copyright (C) 1994-2014 Free Software Foundation, Inc.
4 #This file is part of GCC.
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)
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.
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/>.
20 # This file provides the language dependent support in the main Makefile.
21 # Each language makefile fragment must provide the following targets:
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
29 # where `foo' is the name of the language.
31 # It should also provide rules for:
33 # - making any compiler driver (eg: gcc)
34 # - the compiler proper (eg: cc1)
35 # - define the names for selecting the language in LANGUAGES.
38 # Define the names for selecting c in LANGUAGES.
39 c: cc1$(exeext) gupc$(exeext)
41 # Tell GNU make to ignore these if they exist.
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)
49 # The UPC compiler driver: gupc.
51 GUPC_INSTALL_NAME := $(shell echo gupc|sed '$(program_transform_name)')
52 UPC_INSTALL_NAME := $(shell echo upc|sed '$(program_transform_name)')
53 GUPC_TARGET_INSTALL_NAME := $(target_noncanonical)-$(shell echo gupc|sed '$(program_transform_name)')
55 gupcspec.o: $(srcdir)/c/gupcspec.c $(SYSTEM_H) $(TM_H) $(GCC_H) \
56 $(CONFIG_H) coretypes.h intl.h $(OPTS_H)
58 $(COMPILER) -c $(ALL_COMPILERFLAGS) $(ALL_CPPFLAGS) $(DRIVER_DEFINES) \
59 $(INCLUDES) $(srcdir)/c/gupcspec.c)
61 GUPC_D_OBJS = gupcspec.o $(GCC_OBJS)
62 gupc$(exeext): $(GUPC_D_OBJS) $(EXTRA_GCC_OBJS) \
63 libcommon-target.a $(LIBDEPS)
64 $(LINKER) $(ALL_LINKERFLAGS) $(LDFLAGS) -o $@ \
65 $(GUPC_D_OBJS) $(EXTRA_GCC_OBJS) libcommon-target.a \
66 $(EXTRA_GCC_LIBS) $(LIBS)
68 # The C compiler itself.
70 # Language-specific object files for C and Objective C.
71 C_AND_OBJC_OBJS = attribs.o c/c-errors.o c/c-decl.o c/c-typeck.o \
72 c/c-convert.o c/c-aux-info.o c/c-objc-common.o c/c-parser.o \
73 c/c-array-notation.o c/c-upc-lang.o $(C_COMMON_OBJS) $(C_TARGET_OBJS)
75 # Language-specific object files for C.
76 C_OBJS = c/c-lang.o c-family/stub-objc.o $(C_AND_OBJC_OBJS)
77 c_OBJS = $(C_OBJS) cc1-checksum.o c/gccspec.o
79 # Use strict warnings for this front end.
80 c-warn = $(STRICT_WARN)
82 # compute checksum over all object files and the options
83 cc1-checksum.c : build/genchecksum$(build_exeext) checksum-options \
84 $(C_OBJS) $(BACKEND) $(LIBDEPS)
85 build/genchecksum$(build_exeext) $(C_OBJS) $(BACKEND) $(LIBDEPS) \
86 checksum-options > cc1-checksum.c.tmp && \
87 $(srcdir)/../move-if-change cc1-checksum.c.tmp cc1-checksum.c
89 cc1$(exeext): $(C_OBJS) cc1-checksum.o $(BACKEND) $(LIBDEPS)
90 +$(LLINKER) $(ALL_LINKERFLAGS) $(LDFLAGS) -o $@ $(C_OBJS) \
91 cc1-checksum.o $(BACKEND) $(LIBS) $(BACKENDLIBS)
106 c.srcextra: gengtype-lex.c
109 cd $(srcdir)/c; etags -o TAGS.sub *.c *.h; \
110 etags --include TAGS.sub --include ../TAGS.sub
114 # List of targets that can use the generic check- rule and its // variant.
115 lang_checks += check-gcc
116 lang_checks_parallelized += check-gcc
118 # 'make check' in gcc/ looks for check-c. Redirect it to check-gcc.
123 # cc1 is installed elsewhere as part of $(COMPILERS).
125 c.install-common: gupc$(exeext) installdirs
126 -rm -f $(DESTDIR)$(bindir)/$(GUPC_INSTALL_NAME)$(exeext)
127 $(INSTALL_PROGRAM) -m 755 gupc$(exeext) $(DESTDIR)$(bindir)/$(GUPC_INSTALL_NAME)$(exeext)
128 -rm -f $(DESTDIR)$(bindir)/$(GUPC_TARGET_INSTALL_NAME)$(exeext)
129 cd $(DESTDIR)$(bindir) && \
130 $(LN) $(GUPC_INSTALL_NAME)$(exeext) $(GUPC_TARGET_INSTALL_NAME)$(exeext)
131 -rm -f $(DESTDIR)$(bindir)/$(UPC_INSTALL_NAME)$(exeext)
132 cd $(DESTDIR)$(bindir) && $(LN_S) $(GUPC_INSTALL_NAME)$(exeext) $(UPC_INSTALL_NAME)$(exeext)
139 # A lot of the ancillary files are deleted by the main makefile.
140 # We just have to delete files specific to us.
145 -rm -f c/*$(coverageexts)
148 -rm -f c/config.status c/Makefile
152 # The main makefile has already created stage?/cp.
154 c.stage1: stage1-start
155 -mv c/*$(objext) stage1/c
156 c.stage2: stage2-start
157 -mv c/*$(objext) stage2/c
158 c.stage3: stage3-start
159 -mv c/*$(objext) stage3/c
160 c.stage4: stage4-start
161 -mv c/*$(objext) stage4/c
162 c.stageprofile: stageprofile-start
163 -mv c/*$(objext) stageprofile/c
164 c.stagefeedback: stagefeedback-start
165 -mv c/*$(objext) stagefeedback/c