llvm.org GIT mirror llvm / caeade4
Remove autoconf support Summary: This patch is provided in preparation for removing autoconf on 1/26. The proposal to remove autoconf on 1/26 was discussed on the llvm-dev thread here: http://lists.llvm.org/pipermail/llvm-dev/2016-January/093875.html "I felt a great disturbance in the [build system], as if millions of [makefiles] suddenly cried out in terror and were suddenly silenced. I fear something [amazing] has happened." - Obi Wan Kenobi Reviewers: chandlerc, grosbach, bob.wilson, tstellarAMD, echristo, whitequark Subscribers: chfast, simoncook, emaste, jholewinski, tberghammer, jfb, danalbert, srhines, arsenm, dschuff, jyknight, dsanders, joker.eph, llvm-commits Differential Revision: http://reviews.llvm.org/D16471 git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@258861 91177308-0d34-0410-b5e6-96231b3b80d8 Chris Bieneman 3 years ago
300 changed file(s) with 1532 addition(s) and 36539 deletion(s). Raw diff Collapse all Expand all
+0
-295
Makefile less more
None #===- ./Makefile -------------------------------------------*- Makefile -*--===#
1 #
2 # The LLVM Compiler Infrastructure
3 #
4 # This file is distributed under the University of Illinois Open Source
5 # License. See LICENSE.TXT for details.
6 #
7 #===------------------------------------------------------------------------===#
8
9 LEVEL := .
10
11 # Top-Level LLVM Build Stages:
12 # 1. Build lib/Support and lib/TableGen, which are used by utils (tblgen).
13 # 2. Build utils, which is used by IR.
14 # 3. Build IR, which builds the Intrinsics.inc file used by libs.
15 # 4. Build libs, which are needed by llvm-config.
16 # 5. Build llvm-config, which determines inter-lib dependencies for tools.
17 # 6. Build tools, docs, and cmake modules.
18 #
19 # When cross-compiling, there are some things (tablegen) that need to
20 # be build for the build system first.
21
22 # If "RC_ProjectName" exists in the environment, and its value is
23 # "llvmCore", then this is an "Apple-style" build; search for
24 # "Apple-style" in the comments for more info. Anything else is a
25 # normal build.
26 ifneq ($(findstring llvmCore, $(RC_ProjectName)),llvmCore) # Normal build (not "Apple-style").
27
28 ifeq ($(BUILD_DIRS_ONLY),1)
29 DIRS := lib/Support lib/TableGen utils tools/llvm-config
30 OPTIONAL_DIRS := tools/clang/utils/TableGen
31 else
32 DIRS := lib/Support lib/TableGen utils lib/IR lib tools/llvm-shlib \
33 tools/llvm-config tools docs cmake unittests
34 OPTIONAL_DIRS := projects bindings
35 endif
36
37 ifeq ($(BUILD_EXAMPLES),1)
38 OPTIONAL_DIRS += examples
39 endif
40
41 EXTRA_DIST := test unittests llvm.spec include win32 Xcode
42
43 include $(LEVEL)/Makefile.config
44
45 ifneq ($(ENABLE_SHARED),1)
46 DIRS := $(filter-out tools/llvm-shlib, $(DIRS))
47 endif
48
49 ifneq ($(ENABLE_DOCS),1)
50 DIRS := $(filter-out docs, $(DIRS))
51 endif
52
53 ifeq ($(MAKECMDGOALS),libs-only)
54 DIRS := $(filter-out tools docs, $(DIRS))
55 OPTIONAL_DIRS :=
56 endif
57
58 ifeq ($(MAKECMDGOALS),install-libs)
59 DIRS := $(filter-out tools docs, $(DIRS))
60 OPTIONAL_DIRS := $(filter bindings, $(OPTIONAL_DIRS))
61 endif
62
63 ifeq ($(MAKECMDGOALS),tools-only)
64 DIRS := $(filter-out docs, $(DIRS))
65 OPTIONAL_DIRS :=
66 endif
67
68 ifeq ($(MAKECMDGOALS),install-clang)
69 DIRS := tools/clang/tools/driver tools/clang/lib/Headers \
70 tools/clang/tools/libclang \
71 tools/clang/tools/c-index-test \
72 tools/clang/include/clang-c \
73 tools/clang/runtime tools/clang/docs \
74 tools/lto
75 OPTIONAL_DIRS :=
76 NO_INSTALL = 1
77 endif
78
79 ifeq ($(MAKECMDGOALS),clang-only)
80 DIRS := $(filter-out tools docs unittests, $(DIRS)) \
81 tools/clang tools/lto
82 OPTIONAL_DIRS :=
83 endif
84
85 ifeq ($(MAKECMDGOALS),unittests)
86 DIRS := $(filter-out tools docs, $(DIRS)) utils unittests
87 OPTIONAL_DIRS :=
88 endif
89
90 # Use NO_INSTALL define of the Makefile of each directory for deciding
91 # if the directory is installed or not
92 ifeq ($(MAKECMDGOALS),install)
93 OPTIONAL_DIRS := $(filter bindings, $(OPTIONAL_DIRS))
94 endif
95
96 # Don't build unittests when ONLY_TOOLS is set.
97 ifneq ($(ONLY_TOOLS),)
98 DIRS := $(filter-out unittests, $(DIRS))
99 endif
100
101 # If we're cross-compiling, build the build-hosted tools first
102 ifeq ($(LLVM_CROSS_COMPILING),1)
103 all:: cross-compile-build-tools
104
105 clean::
106 $(Verb) rm -rf BuildTools
107
108 cross-compile-build-tools:
109 $(Verb) if [ ! -f BuildTools/Makefile ]; then \
110 $(MKDIR) BuildTools; \
111 cd BuildTools ; \
112 unset CFLAGS ; \
113 unset CXXFLAGS ; \
114 AR=$(BUILD_AR) ; \
115 AS=$(BUILD_AS) ; \
116 LD=$(BUILD_LD) ; \
117 CC=$(BUILD_CC) ; \
118 CXX=$(BUILD_CXX) ; \
119 unset SDKROOT ; \
120 unset UNIVERSAL_SDK_PATH ; \
121 configure_opts= ; \
122 if test "$(ENABLE_LIBCPP)" -ne 0 ; then \
123 configure_opts="$$configure_opts --enable-libcpp"; \
124 fi; \
125 $(PROJ_SRC_DIR)/configure --build=$(BUILD_TRIPLE) \
126 --host=$(BUILD_TRIPLE) --target=$(BUILD_TRIPLE) \
127 --disable-polly $$configure_opts; \
128 cd .. ; \
129 fi; \
130 ($(MAKE) -C BuildTools \
131 BUILD_DIRS_ONLY=1 \
132 UNIVERSAL= \
133 UNIVERSAL_SDK_PATH= \
134 SDKROOT= \
135 TARGET_NATIVE_ARCH="$(TARGET_NATIVE_ARCH)" \
136 TARGETS_TO_BUILD="$(TARGETS_TO_BUILD)" \
137 TARGET_LIBS="$(LIBS)" \
138 ENABLE_OPTIMIZED=$(ENABLE_OPTIMIZED) \
139 ENABLE_PROFILING=$(ENABLE_PROFILING) \
140 ENABLE_COVERAGE=$(ENABLE_COVERAGE) \
141 DISABLE_ASSERTIONS=$(DISABLE_ASSERTIONS) \
142 ENABLE_EXPENSIVE_CHECKS=$(ENABLE_EXPENSIVE_CHECKS) \
143 ENABLE_LIBCPP=$(ENABLE_LIBCPP) \
144 CFLAGS= \
145 CXXFLAGS= \
146 ) || exit 1;
147 endif
148
149 # Include the main makefile machinery.
150 include $(LLVM_SRC_ROOT)/Makefile.rules
151
152 # Specify options to pass to configure script when we're
153 # running the dist-check target
154 DIST_CHECK_CONFIG_OPTIONS = --with-llvmgccdir=$(LLVMGCCDIR)
155
156 .PHONY: debug-opt-prof
157 debug-opt-prof:
158 $(Echo) Building Debug Version
159 $(Verb) $(MAKE)
160 $(Echo)
161 $(Echo) Building Optimized Version
162 $(Echo)
163 $(Verb) $(MAKE) ENABLE_OPTIMIZED=1
164 $(Echo)
165 $(Echo) Building Profiling Version
166 $(Echo)
167 $(Verb) $(MAKE) ENABLE_PROFILING=1
168
169 dist-hook::
170 $(Echo) Eliminating files constructed by configure
171 $(Verb) $(RM) -f \
172 $(TopDistDir)/include/llvm/Config/config.h \
173 $(TopDistDir)/include/llvm/Support/DataTypes.h
174
175 clang-only: all
176 tools-only: all
177 libs-only: all
178 install-clang: install
179 install-libs: install
180
181 # If SHOW_DIAGNOSTICS is enabled, clear the diagnostics file first.
182 ifeq ($(SHOW_DIAGNOSTICS),1)
183 clean-diagnostics:
184 $(Verb) rm -f $(LLVM_OBJ_ROOT)/$(BuildMode)/diags
185 .PHONY: clean-diagnostics
186
187 all-local:: clean-diagnostics
188 endif
189
190 #------------------------------------------------------------------------
191 # Make sure the generated files are up-to-date. This must be kept in
192 # sync with the AC_CONFIG_HEADER and AC_CONFIG_FILE invocations in
193 # autoconf/configure.ac.
194 # Note that Makefile.config is covered by its own separate rule
195 # in Makefile.rules where it can be reused by sub-projects.
196 #------------------------------------------------------------------------
197 FilesToConfig := \
198 bindings/ocaml/llvm/META.llvm \
199 docs/doxygen.cfg \
200 llvm.spec \
201 include/llvm/Config/config.h \
202 include/llvm/Config/llvm-config.h \
203 include/llvm/Config/Targets.def \
204 include/llvm/Config/AsmPrinters.def \
205 include/llvm/Config/AsmParsers.def \
206 include/llvm/Config/Disassemblers.def \
207 include/llvm/Support/DataTypes.h
208 FilesToConfigPATH := $(addprefix $(LLVM_OBJ_ROOT)/,$(FilesToConfig))
209
210 all-local:: $(FilesToConfigPATH)
211 $(FilesToConfigPATH) : $(LLVM_OBJ_ROOT)/% : $(LLVM_SRC_ROOT)/%.in
212 $(Echo) Regenerating $*
213 $(Verb) cd $(LLVM_OBJ_ROOT) && $(ConfigStatusScript) $*
214 .PRECIOUS: $(FilesToConfigPATH)
215
216 # NOTE: This needs to remain as the last target definition in this file so
217 # that it gets executed last.
218 ifneq ($(BUILD_DIRS_ONLY),1)
219 all::
220 $(Echo) '*****' Completed $(BuildMode) Build
221 ifneq ($(ENABLE_OPTIMIZED),1)
222 $(Echo) '*****' Note: Debug build can be 10 times slower than an
223 $(Echo) '*****' optimized build. Use 'make ENABLE_OPTIMIZED=1' to
224 $(Echo) '*****' make an optimized build. Alternatively you can
225 $(Echo) '*****' configure with --enable-optimized.
226 ifeq ($(SHOW_DIAGNOSTICS),1)
227 $(Verb) if test -s $(LLVM_OBJ_ROOT)/$(BuildMode)/diags; then \
228 $(LLVM_SRC_ROOT)/utils/clang-parse-diagnostics-file -a \
229 $(LLVM_OBJ_ROOT)/$(BuildMode)/diags; \
230 fi
231 endif
232 endif
233 endif
234
235 check-llvm2cpp:
236 $(Verb)$(MAKE) check TESTSUITE=Feature RUNLLVM2CPP=1
237
238 srpm: $(LLVM_OBJ_ROOT)/llvm.spec
239 rpmbuild -bs $(LLVM_OBJ_ROOT)/llvm.spec
240
241 rpm: $(LLVM_OBJ_ROOT)/llvm.spec
242 rpmbuild -bb --target $(TARGET_TRIPLE) $(LLVM_OBJ_ROOT)/llvm.spec
243
244 show-footprint:
245 $(Verb) du -sk $(LibDir)
246 $(Verb) du -sk $(ToolDir)
247 $(Verb) du -sk $(ExmplDir)
248 $(Verb) du -sk $(ObjDir)
249
250 build-for-llvm-top:
251 $(Verb) if test ! -f ./config.status ; then \
252 ./configure --prefix="$(LLVM_TOP)/install" \
253 --with-llvm-gcc="$(LLVM_TOP)/llvm-gcc" ; \
254 fi
255 $(Verb) $(MAKE) tools-only
256
257 SVN = svn
258 SVN-UPDATE-OPTIONS =
259 AWK = awk
260
261 # Multiline variable defining a recursive function for finding svn repos rooted at
262 # a given path. svnup() requires one argument: the root to search from.
263 define SUB_SVN_DIRS
264 svnup() {
265 dirs=`svn status --no-ignore $$1 | awk '/^(I|\?) / {print $$2}' | LC_ALL=C xargs svn info 2>/dev/null | awk '/^Path:\ / {print $$2}'`;
266 if [ "$$dirs" = "" ]; then
267 return;
268 fi;
269 for f in $$dirs; do
270 echo $$f;
271 svnup $$f;
272 done
273 }
274 endef
275 export SUB_SVN_DIRS
276
277 update:
278 $(SVN) $(SVN-UPDATE-OPTIONS) update $(LLVM_SRC_ROOT)
279 @eval $$SUB_SVN_DIRS; $(SVN) status --no-ignore $(LLVM_SRC_ROOT) | svnup $(LLVM_SRC_ROOT) | xargs $(SVN) $(SVN-UPDATE-OPTIONS) update
280
281 happiness: update all check-all
282
283 .PHONY: srpm rpm update happiness
284
285 # declare all targets at this level to be serial:
286
287 .NOTPARALLEL:
288
289 else # Building "Apple-style."
290 # In an Apple-style build, once configuration is done, lines marked
291 # "Apple-style" are removed with sed! Please don't remove these!
292 # Look for the string "Apple-style" in utils/buildit/build_llvm.
293 include $(shell find . -name GNUmakefile) # Building "Apple-style."
294 endif # Building "Apple-style."
+0
-69
Makefile.common less more
None #===-- Makefile.common - Common make rules for LLVM --------*- Makefile -*--===#
1 #
2 # The LLVM Compiler Infrastructure
3 #
4 # This file is distributed under the University of Illinois Open Source
5 # License. See LICENSE.TXT for details.
6 #
7 #===------------------------------------------------------------------------===#
8 #
9 # This file is included by all of the LLVM makefiles. This file defines common
10 # rules to do things like compile a .cpp file or generate dependency info.
11 # These are platform dependent, so this is the file used to specify these
12 # system dependent operations.
13 #
14 # The following functionality can be set by setting incoming variables.
15 # The variable $(LEVEL) *must* be set:
16 #
17 # 1. LEVEL - The level of the current subdirectory from the top of the
18 # source directory. This level should be expressed as a path, for
19 # example, ../.. for two levels deep.
20 #
21 # 2. DIRS - A list of subdirectories to be built. Fake targets are set up
22 # so that each of the targets "all", "install", and "clean" each build
23 # the subdirectories before the local target. DIRS are guaranteed to be
24 # built in order.
25 #
26 # 3. PARALLEL_DIRS - A list of subdirectories to be built, but that may be
27 # built in any order. All DIRS are built in order before PARALLEL_DIRS are
28 # built, which are then built in any order.
29 #
30 # 4. SOURCES - If specified, this sets the source code filenames. If this
31 # is not set, it defaults to be all of the .cpp, .c, .y, and .l files
32 # in the current directory.
33 #
34 # 5. SourceDir - If specified, this specifies a directory that the source files
35 # are in, if they are not in the current directory. This should include a
36 # trailing / character.
37 #
38 # 6. LLVM_SRC_ROOT - If specified, points to the top of the LLVM source tree.
39 #
40 # 8. PROJ_SRC_DIR - The directory which contains the current set of Makefiles
41 # and usually the source code too (unless SourceDir is set).
42 #
43 # 9. PROJ_SRC_ROOT - The root directory of the source code being compiled.
44 #
45 # 10. PROJ_OBJ_DIR - The directory where object code should be placed.
46 #
47 # 11. PROJ_OBJ_ROOT - The root directory for where object code should be
48 # placed.
49 #
50 # For building,
51 # LLVM, LLVM_SRC_ROOT = PROJ_SRC_ROOT
52 #
53 #===-----------------------------------------------------------------------====
54
55 #
56 # Configuration file to set paths specific to local installation of LLVM
57 #
58 ifndef LLVM_OBJ_ROOT
59 include $(LEVEL)/Makefile.config
60 else
61 include $(LLVM_OBJ_ROOT)/Makefile.config
62 endif
63
64 #
65 # Include all of the build rules used for making LLVM
66 #
67 include $(LLVM_SRC_ROOT)/Makefile.rules
68
+0
-435
Makefile.config.in less more
None #===-- Makefile.config - Local configuration for LLVM ------*- Makefile -*--===#
1 #
2 # The LLVM Compiler Infrastructure
3 #
4 # This file is distributed under the University of Illinois Open Source
5 # License. See LICENSE.TXT for details.
6 #
7 #===------------------------------------------------------------------------===#
8 #
9 # This file is included by Makefile.common. It defines paths and other
10 # values specific to a particular installation of LLVM.
11 #
12 #===------------------------------------------------------------------------===#
13
14 # Define LLVM specific info and directories based on the autoconf variables
15 LLVMPackageName := @PACKAGE_TARNAME@
16 LLVMVersion := @PACKAGE_VERSION@
17 LLVM_VERSION_MAJOR := @LLVM_VERSION_MAJOR@
18 LLVM_VERSION_MINOR := @LLVM_VERSION_MINOR@
19 LLVM_VERSION_PATCH := @LLVM_VERSION_PATCH@
20 LLVM_VERSION_SUFFIX := @LLVM_VERSION_SUFFIX@
21 LLVM_CONFIGTIME := @LLVM_CONFIGTIME@
22
23 ###########################################################################
24 # Directory Configuration
25 # This section of the Makefile determines what is where. To be
26 # specific, there are several locations that need to be defined:
27 #
28 # o LLVM_SRC_ROOT : The root directory of the LLVM source code.
29 # o LLVM_OBJ_ROOT : The root directory containing the built LLVM code.
30 #
31 # o PROJ_SRC_DIR : The directory containing the code to build.
32 # o PROJ_SRC_ROOT : The root directory of the code to build.
33 #
34 # o PROJ_OBJ_DIR : The directory in which compiled code will be placed.
35 # o PROJ_OBJ_ROOT : The root directory in which compiled code is placed.
36 #
37 ###########################################################################
38
39 PWD := @BINPWD@
40 # Set the project name to LLVM if its not defined
41 ifndef PROJECT_NAME
42 PROJECT_NAME := $(LLVMPackageName)
43 endif
44
45 # The macro below is expanded when 'realpath' is not built-in.
46 # Built-in 'realpath' is available on GNU Make 3.81.
47 realpath = $(shell cd $(1); $(PWD))
48
49 PROJ_OBJ_DIR := $(call realpath, .)
50 PROJ_OBJ_ROOT := $(call realpath, $(PROJ_OBJ_DIR)/$(LEVEL))
51
52 CLANG_SRC_ROOT := @CLANG_SRC_ROOT@
53
54 ifeq ($(PROJECT_NAME),$(LLVMPackageName))
55 LLVM_SRC_ROOT := $(call realpath, @abs_top_srcdir@)
56 LLVM_OBJ_ROOT := $(call realpath, @abs_top_builddir@)
57 PROJ_SRC_ROOT := $(LLVM_SRC_ROOT)
58 PROJ_SRC_DIR := $(LLVM_SRC_ROOT)$(patsubst $(PROJ_OBJ_ROOT)%,%,$(PROJ_OBJ_DIR))
59
60 # See: http://lists.llvm.org/pipermail/llvm-commits/Week-of-Mon-20150323/268067.html
61 ifeq ($(LLVM_SRC_ROOT), $(LLVM_OBJ_ROOT))
62 $(error In-source builds are not allowed. Please configure from a separate build directory!)
63 endif
64
65 ifneq ($(CLANG_SRC_ROOT),)
66 CLANG_SRC_ROOT:= $(call realpath, $(CLANG_SRC_ROOT))
67 PROJ_SRC_DIR := $(patsubst $(LLVM_SRC_ROOT)/tools/clang%,$(CLANG_SRC_ROOT)%,$(PROJ_SRC_DIR))
68 endif
69
70 prefix := @prefix@
71 PROJ_prefix := $(prefix)
72 program_prefix := @program_prefix@
73 PROJ_VERSION := $(LLVMVersion)
74 else
75 ifndef PROJ_SRC_ROOT
76 $(error Projects must define PROJ_SRC_ROOT)
77 endif
78 ifndef PROJ_OBJ_ROOT
79 $(error Projects must define PROJ_OBJ_ROOT)
80 endif
81 ifndef PROJ_INSTALL_ROOT
82 $(error Projects must define PROJ_INSTALL_ROOT)
83 endif
84 ifndef LLVM_SRC_ROOT
85 $(error Projects must define LLVM_SRC_ROOT)
86 endif
87 ifndef LLVM_OBJ_ROOT
88 $(error Projects must define LLVM_OBJ_ROOT)
89 endif
90 PROJ_SRC_DIR := $(call realpath, $(PROJ_SRC_ROOT)/$(patsubst $(PROJ_OBJ_ROOT)%,%,$(PROJ_OBJ_DIR)))
91 prefix := $(PROJ_INSTALL_ROOT)
92 PROJ_prefix := $(prefix)
93 ifndef PROJ_VERSION
94 PROJ_VERSION := 1.0
95 endif
96 endif
97
98 INTERNAL_PREFIX := @INTERNAL_PREFIX@
99 ifneq ($(INTERNAL_PREFIX),)
100 PROJ_internal_prefix := $(INTERNAL_PREFIX)
101 else
102 PROJ_internal_prefix := $(prefix)
103 endif
104
105 PROJ_bindir := $(PROJ_prefix)/bin
106 PROJ_libdir := $(PROJ_prefix)/lib
107 PROJ_datadir := $(PROJ_prefix)/share
108 PROJ_docsdir := $(PROJ_prefix)/docs/llvm
109 PROJ_etcdir := $(PROJ_prefix)/etc/llvm
110 PROJ_includedir := $(PROJ_prefix)/include
111 PROJ_infodir := $(PROJ_prefix)/info
112 PROJ_mandir := $(PROJ_prefix)/share/man
113
114 # Determine if we're on a unix type operating system
115 LLVM_ON_UNIX:=@LLVM_ON_UNIX@
116 LLVM_ON_WIN32:=@LLVM_ON_WIN32@
117
118 # Host operating system for which LLVM will be run.
119 OS=@OS@
120 HOST_OS=@HOST_OS@
121 # Target operating system for which LLVM will compile for.
122 TARGET_OS=@TARGET_OS@
123
124 # Host hardware architecture
125 HOST_ARCH=@HOST_ARCH@
126 # Target hardware architecture
127 ARCH=@ARCH@
128 TARGET_NATIVE_ARCH := $(ARCH)
129 LLVM_NATIVE_ARCH := @LLVM_NATIVE_ARCH@
130
131 # Indicates, whether we're cross-compiling LLVM or not
132 LLVM_CROSS_COMPILING=@LLVM_CROSS_COMPILING@
133
134 # Executable file extension for build platform (mainly for
135 # tablegen call if we're cross-compiling).
136 BUILD_EXEEXT=@BUILD_EXEEXT@
137
138 # Compilers for the build platflorm (mainly for tablegen
139 # call if we're cross-compiling).
140 BUILD_CC=@BUILD_CC@
141 BUILD_CXX=@BUILD_CXX@
142
143 # Triple for configuring build tools when cross-compiling
144 BUILD_TRIPLE=@build@
145
146 # Target triple (cpu-vendor-os) which LLVM is compiled for
147 HOST_TRIPLE=@host@
148
149 # Target triple (cpu-vendor-os) for which we should generate code
150 TARGET_TRIPLE=@target@
151
152 # Extra options to compile LLVM with
153 EXTRA_OPTIONS=@EXTRA_OPTIONS@
154
155 # Extra options to link LLVM with
156 EXTRA_LD_OPTIONS=@EXTRA_LD_OPTIONS@
157
158 # Endian-ness of the target
159 ENDIAN=@ENDIAN@
160
161 # Path to the C++ compiler to use. This is an optional setting, which defaults
162 # to whatever your gmake defaults to.
163 CXX = @CXX@
164
165 # Path to the CC binary, which use used by testcases for native builds.
166 CC := @CC@
167
168 # C/C++ preprocessor flags.
169 CPPFLAGS += @CPPFLAGS@
170
171 # C compiler flags.
172 CFLAGS += @CFLAGS@
173
174 # C++ compiler flags.
175 CXXFLAGS += @CXXFLAGS@
176
177 # Linker flags.
178 LDFLAGS += @LDFLAGS@
179
180 # Path to the library archiver program.
181 AR_PATH = @AR@
182 AR = @AR@
183
184 # Path to the nm program
185 NM_PATH = @NM@
186
187 # The pathnames of the programs we require to build
188 CMP := @CMP@
189 CP := @CP@
190 DATE := @DATE@
191 FIND := @FIND@
192 GREP := @GREP@
193 INSTALL := @INSTALL@
194 MKDIR := $(LLVM_SRC_ROOT)/autoconf/mkinstalldirs
195 MV := @MV@
196 RANLIB := @RANLIB@
197 RM := @RM@
198 SED := @SED@
199 TAR := @TAR@
200 PYTHON := @PYTHON@
201
202 # Paths to miscellaneous programs we hope are present but might not be
203 BZIP2 := @BZIP2@
204 CAT := @CAT@
205 DOT := @DOT@
206 DOXYGEN := @DOXYGEN@
207 GROFF := @GROFF@
208 GZIPBIN := @GZIPBIN@
209 GO := @GO@
210 OCAMLFIND := @OCAMLFIND@
211 GAS := @GAS@
212 POD2HTML := @POD2HTML@
213 POD2MAN := @POD2MAN@
214 PDFROFF := @PDFROFF@
215 ZIP := @ZIP@
216
217 HAVE_LIBZ := @HAVE_LIBZ@
218 HAVE_DLOPEN := @HAVE_DLOPEN@
219 HAVE_PTHREAD := @HAVE_PTHREAD@
220 HAVE_TERMINFO := @HAVE_TERMINFO@
221
222 HAVE_OCAMLOPT := @HAVE_OCAMLOPT@
223 HAVE_OCAML_OUNIT := @HAVE_OCAML_OUNIT@
224
225 LIBS := @LIBS@
226
227 # Targets that are possible to build
228 ALL_TARGETS := @ALL_TARGETS@
229
230 # Targets that we should build
231 TARGETS_TO_BUILD=@TARGETS_TO_BUILD@
232
233 # Targets supporting JIT
234 TARGETS_WITH_JIT := @TARGETS_WITH_JIT@
235
236 # Path to directory where object files should be stored during a build.
237 # Set OBJ_ROOT to "." if you do not want to use a separate place for
238 # object files.
239 OBJ_ROOT := .
240
241 # What to pass as rpath flag to g++
242 RPATH := @RPATH@
243
244 # What to pass as -rdynamic flag to g++
245 RDYNAMIC := @RDYNAMIC@
246
247 # These are options that can either be enabled here, or can be enabled on the
248 # make command line (ie, make ENABLE_PROFILING=1):
249
250 # When ENABLE_LIBCPP is enabled, LLVM uses libc++ by default to build.
251 #ENABLE_LIBCPP = 0
252 ENABLE_LIBCPP = @ENABLE_LIBCPP@
253
254 # When ENABLE_CXX1Y is enabled, LLVM uses c++1y mode by default to build.
255 # Otherwise it uses the baseline c++11.
256 ENABLE_CXX1Y = @ENABLE_CXX1Y@
257
258 # When ENABLE_SPLIT_DWARF is enabled, LLVM uses -gfission to build in debug mode.
259 ENABLE_SPLIT_DWARF = @ENABLE_SPLIT_DWARF@
260
261 # When enabled, clang will have plugin support.
262 CLANG_PLUGIN_SUPPORT = @CLANG_PLUGIN_SUPPORT@
263
264 # When ENABLE_CLANG_ARCMT is enabled, clang will have ARCMigrationTool.
265 ENABLE_CLANG_ARCMT = @ENABLE_CLANG_ARCMT@
266
267 # When ENABLE_CLANG_STATIC_ANALYZER is enabled, clang will have StaticAnalyzer.
268 ENABLE_CLANG_STATIC_ANALYZER = @ENABLE_CLANG_STATIC_ANALYZER@
269
270 # When ENABLE_WERROR is enabled, we'll pass -Werror on the command line
271 ENABLE_WERROR = @ENABLE_WERROR@
272
273 # When ENABLE_TERMINFO is enabled, we use terminfo.
274 ENABLE_TERMINFO = @ENABLE_TERMINFO@
275
276 # When ENABLE_OPTIMIZED is enabled, LLVM code is optimized and output is put
277 # into the "Release" directories. Otherwise, LLVM code is not optimized and
278 # output is put in the "Debug" directories.
279 #ENABLE_OPTIMIZED = 1
280 @ENABLE_OPTIMIZED@
281
282 # When ENABLE_PROFILING is enabled, profile instrumentation is done
283 # and output is put into the "+Profile" directories, where
284 # is either Debug or Release depending on how other build
285 # flags are set. Otherwise, output is put in the
286 # directories.
287 #ENABLE_PROFILING = 1
288 @ENABLE_PROFILING@
289
290 # When DISABLE_ASSERTIONS is enabled, builds of all of the LLVM code will
291 # exclude assertion checks, otherwise they are included.
292 #DISABLE_ASSERTIONS = 1
293 @DISABLE_ASSERTIONS@
294
295 # When ENABLE_EXPENSIVE_CHECKS is enabled, builds of all of the LLVM
296 # code will include expensive checks, otherwise they are excluded.
297 #ENABLE_EXPENSIVE_CHECKS = 0
298 @ENABLE_EXPENSIVE_CHECKS@
299
300 # --enable-abi-breaking-checks : decide whether we should compile in asserts and
301 # checks that make the build ABI incompatible with an llvm built without these
302 # checks enabled.
303 ENABLE_ABI_BREAKING_CHECKS = @ENABLE_ABI_BREAKING_CHECKS@
304
305 # When DEBUG_RUNTIME is enabled, the runtime libraries will retain debug
306 # symbols.
307 #DEBUG_RUNTIME = 1
308 @DEBUG_RUNTIME@
309
310 # When DEBUG_SYMBOLS is enabled, the compiler libraries will retain debug
311 # symbols.
312 #DEBUG_SYMBOLS = 1
313 @DEBUG_SYMBOLS@
314
315 # When KEEP_SYMBOLS is enabled, installed executables will never have their
316 # symbols stripped.
317 #KEEP_SYMBOLS = 1
318 @KEEP_SYMBOLS@
319
320 # The compiler flags to use for optimized builds.
321 OPTIMIZE_OPTION := @OPTIMIZE_OPTION@
322
323 # When ENABLE_PROFILING is enabled, the llvm source base is built with profile
324 # information to allow gprof to be used to get execution frequencies.
325 #ENABLE_PROFILING = 1
326
327 # When ENABLE_DOCS is disabled, docs/ will not be built.
328 ENABLE_DOCS = @ENABLE_DOCS@
329
330 # When ENABLE_DOXYGEN is enabled, the doxygen documentation will be built
331 ENABLE_DOXYGEN = @ENABLE_DOXYGEN@
332
333 # Do we want to enable threads?
334 ENABLE_THREADS := @LLVM_ENABLE_THREADS@
335
336 # Do we want to enable zlib?
337 ENABLE_ZLIB := @LLVM_ENABLE_ZLIB@
338
339 # Do we want to build with position independent code?
340 ENABLE_PIC := @ENABLE_PIC@
341
342 # Do we want to build a shared library and link the tools with it?
343 ENABLE_SHARED := @ENABLE_SHARED@
344
345 # Do we want to link the stdc++ into a shared library? (Cygming)
346 ENABLE_EMBED_STDCXX := @ENABLE_EMBED_STDCXX@
347
348 # Use -fvisibility-inlines-hidden?
349 ENABLE_VISIBILITY_INLINES_HIDDEN := @ENABLE_VISIBILITY_INLINES_HIDDEN@
350
351 # Do we want to allow timestamping information into builds?
352 ENABLE_TIMESTAMPS := @ENABLE_TIMESTAMPS@
353
354 # This option tells the Makefiles to produce verbose output.
355 # It essentially prints the commands that make is executing
356 #VERBOSE = 1
357
358 # Enable JIT for this platform
359 TARGET_HAS_JIT = @TARGET_HAS_JIT@
360
361 # Shared library extension for host platform.
362 SHLIBEXT = @SHLIBEXT@
363
364 # Executable file extension for host platform.
365 EXEEXT = @EXEEXT@
366
367 # Things we just assume are "there"
368 ECHO := echo
369
370 # Get the options for causing archives to link all their content instead of
371 # just missing symbols, and the inverse of that. This is used for certain LLVM
372 # tools that permit loadable modules. It ensures that the LLVM symbols will be
373 # available to those loadable modules.
374 LINKALL := @LINKALL@
375 NOLINKALL := @NOLINKALL@
376
377 # Get the value of HUGE_VAL_SANITY which will be either "yes" or "no" depending
378 # on the check.
379 HUGE_VAL_SANITY = @HUGE_VAL_SANITY@
380
381 # Bindings that we should build
382 BINDINGS_TO_BUILD := @BINDINGS_TO_BUILD@
383 OCAML_LIBDIR := @OCAML_LIBDIR@
384
385 # When compiling under Mingw/Cygwin, executables such as tblgen
386 # expect Windows paths, whereas the build system uses Unix paths.
387 # The function SYSPATH transforms Unix paths into Windows paths.
388 ifneq (,$(findstring -mno-cygwin, $(CXX)))
389 SYSPATH = $(shell echo $(1) | cygpath -m -f -)
390 else
391 SYSPATH = $(1)
392 endif
393
394 # Location of the plugin header file for gold.
395 BINUTILS_INCDIR := @BINUTILS_INCDIR@
396
397 # Optional flags supported by the compiler
398 # -Wmissing-field-initializers
399 MISSING_FIELD_INITIALIZERS = @MISSING_FIELD_INITIALIZERS@
400 # -Wno-variadic-macros
401 NO_VARIADIC_MACROS = @NO_VARIADIC_MACROS@
402 # -Wcovered-switch-default
403 COVERED_SWITCH_DEFAULT = @COVERED_SWITCH_DEFAULT@
404 # -Wno-uninitialized
405 NO_UNINITIALIZED = @NO_UNINITIALIZED@
406 # -Wno-maybe-uninitialized
407 NO_MAYBE_UNINITIALIZED = @NO_MAYBE_UNINITIALIZED@
408 # -Wno-comment
409 NO_COMMENT = @NO_COMMENT@
410
411 # Was polly found in tools/polly?
412 LLVM_HAS_POLLY = @LLVM_HAS_POLLY@
413 # Flags supported by the linker.
414 # bfd ld / gold --version-script=file
415 HAVE_LINK_VERSION_SCRIPT = @HAVE_LINK_VERSION_SCRIPT@
416
417 # Flags to control using libxml2
418 LIBXML2_LIBS := @LIBXML2_LIBS@
419 LIBXML2_INC := @LIBXML2_INC@
420
421 # Flags to control building support for Intel JIT Events API
422 USE_INTEL_JITEVENTS := @USE_INTEL_JITEVENTS@
423 INTEL_JITEVENTS_INCDIR := @INTEL_JITEVENTS_INCDIR@
424 INTEL_JITEVENTS_LIBDIR := @INTEL_JITEVENTS_LIBDIR@
425
426 # Flags to control building support for OProfile JIT API
427 USE_OPROFILE := @USE_OPROFILE@
428
429 ifeq ($(USE_INTEL_JITEVENTS), 1)
430 OPTIONAL_COMPONENTS += IntelJITEvents
431 endif
432 ifeq ($(USE_OPROFILE), 1)
433 OPTIONAL_COMPONENTS += OProfileJIT
434 endif
+0
-2176
Makefile.rules less more
None #===-- Makefile.rules - Common make rules for LLVM ---------*- Makefile -*--===#
1 #
2 # The LLVM Compiler Infrastructure
3 #
4 # This file is distributed under the University of Illinois Open Source
5 # License. See LICENSE.TXT for details.
6 #
7 #===------------------------------------------------------------------------===#
8 #
9 # This file is included by all of the LLVM makefiles. For details on how to use
10 # it properly, please see the document MakefileGuide.html in the docs directory.
11 #
12 #===-----------------------------------------------------------------------====#
13
14 ################################################################################
15 # TARGETS: Define standard targets that can be invoked
16 ################################################################################
17
18 #--------------------------------------------------------------------
19 # Define the various target sets
20 #--------------------------------------------------------------------
21 RecursiveTargets := all clean clean-all install uninstall install-bytecode \
22 unitcheck
23 LocalTargets := all-local clean-local clean-all-local check-local \
24 install-local printvars uninstall-local \
25 install-bytecode-local
26 TopLevelTargets := check dist dist-check dist-clean dist-gzip dist-bzip2 \
27 dist-zip unittests
28 UserTargets := $(RecursiveTargets) $(LocalTargets) $(TopLevelTargets)
29 InternalTargets := preconditions distdir dist-hook
30
31 ################################################################################
32 # INITIALIZATION: Basic things the makefile needs
33 ################################################################################
34
35 #--------------------------------------------------------------------
36 # Set the VPATH so that we can find source files.
37 #--------------------------------------------------------------------
38 VPATH=$(PROJ_SRC_DIR)
39
40 #--------------------------------------------------------------------
41 # Reset the list of suffixes we know how to build.
42 #--------------------------------------------------------------------
43 .SUFFIXES:
44 .SUFFIXES: .c .cpp .cc .h .hpp .o .a .td .ps .dot .m .mm
45 .SUFFIXES: $(SHLIBEXT) $(SUFFIXES)
46
47 #--------------------------------------------------------------------
48 # Mark all of these targets as phony to avoid implicit rule search
49 #--------------------------------------------------------------------
50 .PHONY: $(UserTargets) $(InternalTargets)
51
52 #--------------------------------------------------------------------
53 # Make sure all the user-target rules are double colon rules and
54 # they are defined first.
55 #--------------------------------------------------------------------
56
57 $(UserTargets)::
58
59 #------------------------------------------------------------------------
60 # LLVMBuild Integration
61 #------------------------------------------------------------------------
62 #
63 # We use llvm-build to generate all the data required by the Makefile based
64 # build system in one swoop:
65 #
66 # - We generate a file (a Makefile fragment) in the object root which contains
67 # all the definitions that are required by Makefiles across the entire
68 # project.
69 #
70 # - We generate the library table used by llvm-config.
71 #
72 # - We generate the dependencies for the Makefile fragment, so that we will
73 # automatically reconfigure outselves.
74
75 # The path to the llvm-build tool itself.
76 LLVMBuildTool := $(PROJ_SRC_ROOT)/utils/llvm-build/llvm-build
77
78 # The files we are going to generate using llvm-build.
79 LLVMBuildMakeFrag := $(PROJ_OBJ_ROOT)/Makefile.llvmbuild
80 LLVMBuildCMakeFrag := $(PROJ_OBJ_ROOT)/LLVMBuild.cmake
81 LLVMBuildCMakeExportsFrag := $(PROJ_OBJ_ROOT)/cmake/modules/LLVMBuildExports.cmake
82 LLVMBuildMakeFrags := \
83 $(LLVMBuildMakeFrag) \
84 $(LLVMBuildCMakeFrag) \
85 $(LLVMBuildCMakeExportsFrag)
86 LLVMConfigLibraryDependenciesInc := \
87 $(PROJ_OBJ_ROOT)/tools/llvm-config/LibraryDependencies.inc
88
89 # This is for temporary backwards compatibility.
90 ifndef TARGET_NATIVE_ARCH
91 TARGET_NATIVE_ARCH := $(ARCH)
92 endif
93
94 # The rule to create the LLVMBuild Makefile fragment as well as the llvm-config
95 # library table.
96 #
97 # Note that this target gets its real dependencies generated for us by
98 # llvm-build.
99 #
100 # We include a dependency on this Makefile to ensure that changes to the
101 # generation command get picked up.
102 $(LLVMBuildMakeFrags): $(PROJ_SRC_ROOT)/Makefile.rules \
103 $(PROJ_OBJ_ROOT)/Makefile.config
104 $(Echo) Constructing LLVMBuild project information.
105 $(Verb)$(PYTHON) $(LLVMBuildTool) \
106 --native-target "$(TARGET_NATIVE_ARCH)" \
107 --enable-targets "$(TARGETS_TO_BUILD)" \
108 --enable-optional-components "$(OPTIONAL_COMPONENTS)" \
109 --write-library-table $(LLVMConfigLibraryDependenciesInc) \
110 --write-make-fragment $(LLVMBuildMakeFrag) \
111 --write-cmake-fragment $(LLVMBuildCMakeFrag) \
112 --write-cmake-exports-fragment $(LLVMBuildCMakeExportsFrag)
113
114 # For completeness, let Make know how the extra files are generated.
115 $(LLVMConfigLibraryDependenciesInc): $(LLVMBuildMakeFrags)
116
117 # Include the generated Makefile fragment.
118 #
119 # We currently only include the dependencies for the fragment itself if we are
120 # at the top-level. Otherwise, recursive invocations would ends up doing
121 # substantially more redundant stat'ing.
122 #
123 # This means that we won't properly regenerate things for developers used to
124 # building from a subdirectory, but that is always somewhat unreliable.
125 ifeq ($(LEVEL),.)
126 LLVMBUILD_INCLUDE_DEPENDENCIES := 1
127
128 # Clean the generated makefile fragment at the top-level.
129 clean-local::
130 -$(Verb) $(RM) -f $(LLVMBuildMakeFrags)
131 endif
132 -include $(LLVMBuildMakeFrag)
133
134 ################################################################################
135 # PRECONDITIONS: that which must be built/checked first
136 ################################################################################
137
138 SrcMakefiles := $(filter %Makefile %Makefile.tests,\
139 $(wildcard $(PROJ_SRC_DIR)/Makefile*))
140 ObjMakefiles := $(subst $(PROJ_SRC_DIR),$(PROJ_OBJ_DIR),$(SrcMakefiles))
141 ConfigureScript := $(PROJ_SRC_ROOT)/configure
142 ConfigStatusScript := $(PROJ_OBJ_ROOT)/config.status
143 MakefileConfigIn := $(strip $(wildcard $(PROJ_SRC_ROOT)/Makefile.config.in))
144 MakefileCommonIn := $(strip $(wildcard $(PROJ_SRC_ROOT)/Makefile.common.in))
145 MakefileConfig := $(PROJ_OBJ_ROOT)/Makefile.config
146 MakefileCommon := $(PROJ_OBJ_ROOT)/Makefile.common
147 PreConditions := $(ConfigStatusScript) $(ObjMakefiles)
148 ifneq ($(MakefileCommonIn),)
149 PreConditions += $(MakefileCommon)
150 endif
151
152 ifneq ($(MakefileConfigIn),)
153 PreConditions += $(MakefileConfig)
154 endif
155
156 preconditions: $(PreConditions)
157
158 #------------------------------------------------------------------------
159 # Make sure the BUILT_SOURCES are built first
160 #------------------------------------------------------------------------
161 $(filter-out clean clean-local,$(UserTargets)):: $(BUILT_SOURCES)
162
163 clean-all-local::
164 ifneq ($(strip $(BUILT_SOURCES)),)
165 -$(Verb) $(RM) -f $(BUILT_SOURCES)
166 endif
167
168 ifneq ($(PROJ_OBJ_ROOT),$(PROJ_SRC_ROOT))
169 spotless:
170 $(Verb) if test -x config.status ; then \
171 $(EchoCmd) Wiping out $(PROJ_OBJ_ROOT) ; \
172 $(MKDIR) .spotless.save ; \
173 $(MV) config.status .spotless.save ; \
174 $(MV) mklib .spotless.save ; \
175 $(MV) projects .spotless.save ; \
176 $(RM) -rf * ; \
177 $(MV) .spotless.save/config.status . ; \
178 $(MV) .spotless.save/mklib . ; \
179 $(MV) .spotless.save/projects . ; \
180 $(RM) -rf .spotless.save ; \
181 $(EchoCmd) Rebuilding configuration of $(PROJ_OBJ_ROOT) ; \
182 $(ConfigStatusScript) --recheck $(ConfigureScriptFLAGS) && \
183 $(ConfigStatusScript) ; \
184 else \
185 $(EchoCmd) "make spotless" can only be run from $(PROJ_OBJ_ROOT); \
186 fi
187 else
188 spotless:
189 $(EchoCmd) "spotless target not supported for objdir == srcdir"
190 endif
191
192 $(BUILT_SOURCES) : $(ObjMakefiles)
193
194 #------------------------------------------------------------------------
195 # Make sure we're not using a stale configuration
196 #------------------------------------------------------------------------
197 reconfigure:
198 $(Echo) Reconfiguring $(PROJ_OBJ_ROOT)
199 $(Verb) cd $(PROJ_OBJ_ROOT) && \
200 $(ConfigStatusScript) --recheck $(ConfigureScriptFLAGS) && \
201 $(ConfigStatusScript)
202
203 .PRECIOUS: $(ConfigStatusScript)
204 $(ConfigStatusScript): $(ConfigureScript)
205 $(Echo) Reconfiguring with $<
206 $(Verb) cd $(PROJ_OBJ_ROOT) && \
207 $(ConfigStatusScript) --recheck $(ConfigureScriptFLAGS) && \
208 $(ConfigStatusScript)
209
210 #------------------------------------------------------------------------
211 # Make sure the configuration makefile is up to date
212 #------------------------------------------------------------------------
213 ifneq ($(MakefileConfigIn),)
214 $(MakefileConfig): $(MakefileConfigIn) $(ConfigStatusScript)
215 $(Echo) Regenerating $@
216 $(Verb) cd $(PROJ_OBJ_ROOT) ; $(ConfigStatusScript) Makefile.config
217 endif
218
219 ifneq ($(MakefileCommonIn),)
220 $(MakefileCommon): $(MakefileCommonIn) $(ConfigStatusScript)
221 $(Echo) Regenerating $@
222 $(Verb) cd $(PROJ_OBJ_ROOT) ; $(ConfigStatusScript) Makefile.common
223 endif
224
225 #------------------------------------------------------------------------
226 # If the Makefile in the source tree has been updated, copy it over into the
227 # build tree. But, only do this if the source and object makefiles differ
228 #------------------------------------------------------------------------
229 ifndef PROJ_MAKEFILE
230 PROJ_MAKEFILE := $(PROJ_SRC_DIR)/Makefile
231 endif
232
233 ifneq ($(PROJ_OBJ_DIR),$(PROJ_SRC_DIR))
234
235 Makefile: $(PROJ_MAKEFILE) $(ExtraMakefiles)
236 $(Echo) "Updating Makefile"
237 $(Verb) $(MKDIR) $(@D)
238 $(Verb) $(CP) -f $< $@
239
240 # Copy the Makefile.* files unless we're in the root directory which avoids
241 # the copying of Makefile.config.in or other things that should be explicitly
242 # taken care of.
243 $(PROJ_OBJ_DIR)/Makefile% : $(PROJ_MAKEFILE)%
244 @case '$?' in \
245 *Makefile.rules) ;; \
246 *.in) ;; \
247 *) $(EchoCmd) "Updating $(@F)" ; \
248 $(MKDIR) $(@D) ; \
249 $(CP) -f $< $@ ;; \
250 esac
251
252 endif
253
254 #------------------------------------------------------------------------
255 # Set up the basic dependencies
256 #------------------------------------------------------------------------
257 $(UserTargets):: $(PreConditions)
258
259 all:: all-local
260 clean:: clean-local
261 clean-all:: clean-local clean-all-local
262 install:: install-local
263 uninstall:: uninstall-local
264 install-local:: all-local
265 install-bytecode:: install-bytecode-local
266
267 ###############################################################################
268 # VARIABLES: Set up various variables based on configuration data
269 ###############################################################################
270
271 # Variable for if this make is for a "cleaning" target
272 ifneq ($(strip $(filter clean clean-local dist-clean,$(MAKECMDGOALS))),)
273 IS_CLEANING_TARGET=1
274 endif
275
276 #--------------------------------------------------------------------
277 # Variables derived from configuration we are building
278 #--------------------------------------------------------------------
279
280 CPP.Defines :=
281 ifeq ($(ENABLE_OPTIMIZED),1)
282 BuildMode := Release
283 # Don't use -fomit-frame-pointer on Darwin or FreeBSD.
284 ifneq ($(HOST_OS), $(filter $(HOST_OS), Cygwin Darwin DragonFly FreeBSD GNU/kFreeBSD))
285 OmitFramePointer := -fomit-frame-pointer
286 endif
287
288 CXX.Flags += $(OPTIMIZE_OPTION) $(OmitFramePointer)
289 C.Flags += $(OPTIMIZE_OPTION) $(OmitFramePointer)
290 LD.Flags += $(OPTIMIZE_OPTION)
291 ifdef DEBUG_SYMBOLS
292 BuildMode := $(BuildMode)+Debug
293 CXX.Flags += -g
294 C.Flags += -g
295 KEEP_SYMBOLS := 1
296 endif
297 else
298 ifdef NO_DEBUG_SYMBOLS
299 BuildMode := Unoptimized
300 CXX.Flags +=
301 C.Flags +=
302 KEEP_SYMBOLS := 1
303 else
304 BuildMode := Debug
305 ifeq ($(ENABLE_SPLIT_DWARF), 1)
306 CXX.Flags += -gsplit-dwarf
307 C.Flags += -gsplit-dwarf
308 else
309 CXX.Flags += -g
310 C.Flags += -g
311 endif
312 KEEP_SYMBOLS := 1
313 endif
314 endif
315
316 ifeq ($(ENABLE_LIBCPP),1)
317 CXX.Flags += -stdlib=libc++
318 LD.Flags += -stdlib=libc++
319 endif
320
321 ifeq ($(ENABLE_CXX1Y),1)
322 CXX.Flags += -std=c++1y
323 else
324 ifeq ($(HOST_OS), $(filter $(HOST_OS), Cygwin MingW))
325 # MinGW and Cygwin are a bit stricter and lack things like
326 # 'strdup', 'stricmp', etc in c++11 mode.
327 CXX.Flags += -std=gnu++11
328 else
329 CXX.Flags += -std=c++11
330 endif
331 endif
332
333 ifeq ($(ENABLE_WERROR),1)
334 CXX.Flags += -Werror
335 C.Flags += -Werror
336 endif
337
338 ifeq ($(ENABLE_PROFILING),1)
339 BuildMode := $(BuildMode)+Profile
340 CXX.Flags := $(filter-out -fomit-frame-pointer,$(CXX.Flags)) -pg -g
341 C.Flags := $(filter-out -fomit-frame-pointer,$(C.Flags)) -pg -g
342 LD.Flags := $(filter-out -fomit-frame-pointer,$(LD.Flags)) -pg
343 KEEP_SYMBOLS := 1
344 endif
345
346 ifeq ($(ENABLE_VISIBILITY_INLINES_HIDDEN),1)
347 CXX.Flags += -fvisibility-inlines-hidden
348 endif
349
350 ifdef ENABLE_EXPENSIVE_CHECKS
351 # GNU libstdc++ uses RTTI if you define _GLIBCXX_DEBUG, which we did above.
352 # See http://gcc.gnu.org/bugzilla/show_bug.cgi?id=40160
353 REQUIRES_RTTI := 1
354 endif
355
356 # IF REQUIRES_EH=1 is specified then don't disable exceptions
357 ifndef REQUIRES_EH
358 CXX.Flags += -fno-exceptions
359 else
360 # If the library requires EH, it also requires RTTI.
361 REQUIRES_RTTI := 1
362 endif
363
364 ifdef REQUIRES_FRAME_POINTER
365 CXX.Flags := $(filter-out -fomit-frame-pointer,$(CXX.Flags))
366 C.Flags := $(filter-out -fomit-frame-pointer,$(C.Flags))
367 LD.Flags := $(filter-out -fomit-frame-pointer,$(LD.Flags))
368 endif
369
370 # If REQUIRES_RTTI=1 is specified then don't disable run-time type id.
371 ifneq ($(REQUIRES_RTTI), 1)
372 CXX.Flags += -fno-rtti
373 endif
374
375 ifeq ($(ENABLE_COVERAGE),1)
376 BuildMode := $(BuildMode)+Coverage
377 CXX.Flags += -ftest-coverage -fprofile-arcs
378 C.Flags += -ftest-coverage -fprofile-arcs
379 LD.Flags += -ftest-coverage -fprofile-arcs
380 endif
381
382 # If DISABLE_ASSERTIONS=1 is specified (make command line or configured),
383 # then disable assertions by defining the appropriate preprocessor symbols.
384 ifeq ($(DISABLE_ASSERTIONS),1)
385 CPP.Defines += -DNDEBUG
386 else
387 BuildMode := $(BuildMode)+Asserts
388 CPP.Defines += -D_DEBUG
389 endif
390
391 # If ENABLE_EXPENSIVE_CHECKS=1 is specified (make command line or
392 # configured), then enable expensive checks by defining the
393 # appropriate preprocessor symbols.
394 ifeq ($(ENABLE_EXPENSIVE_CHECKS),1)
395 BuildMode := $(BuildMode)+Checks
396 CPP.Defines += -D_GLIBCXX_DEBUG -DXDEBUG
397 endif
398
399 # LOADABLE_MODULE implies several other things so we force them to be
400 # defined/on.
401 ifdef LOADABLE_MODULE
402 SHARED_LIBRARY := 1
403 LINK_LIBS_IN_SHARED := 1
404 endif
405
406 ifdef SHARED_LIBRARY
407 ENABLE_PIC := 1
408 PIC_FLAG = "(PIC)"
409 endif
410
411 ifeq ($(ENABLE_PIC),1)
412 ifeq ($(HOST_OS), $(filter $(HOST_OS), Cygwin MingW))
413 # Nothing. Win32 defaults to PIC and warns when given -fPIC
414 else
415 ifeq ($(HOST_OS),Darwin)
416 # Common symbols not allowed in dylib files
417 CXX.Flags += -fno-common
418 C.Flags += -fno-common
419 else
420 # Linux and others; pass -fPIC
421 CXX.Flags += -fPIC
422 C.Flags += -fPIC
423 endif
424 endif
425 else
426 ifeq ($(HOST_OS),Darwin)
427 CXX.Flags += -mdynamic-no-pic
428 C.Flags += -mdynamic-no-pic
429 endif
430 endif
431
432 # Support makefile variable to disable any kind of timestamp/non-deterministic
433 # info from being used in the build.
434 ifeq ($(ENABLE_TIMESTAMPS),1)
435 DOTDIR_TIMESTAMP_COMMAND := $(DATE)
436 else
437 DOTDIR_TIMESTAMP_COMMAND := echo 'Created.'
438 endif
439
440 ifeq ($(HOST_OS),MingW)
441 # Work around PR4957
442 CPP.Defines += -D__NO_CTYPE_INLINE
443 ifeq ($(LLVM_CROSS_COMPILING),1)
444 # Work around http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=525016
445 ifdef TOOLNAME
446 LD.Flags += -Wl,--allow-multiple-definition
447 endif
448 endif
449 endif
450
451 CPP.BaseFlags += $(CPP.Defines)
452 AR.Flags := cru
453
454 # Make Floating point IEEE compliant on Alpha.
455 ifeq ($(ARCH),Alpha)
456 CXX.Flags += -mieee
457 CPP.BaseFlags += -mieee
458 ifeq ($(ENABLE_PIC),0)
459 CXX.Flags += -fPIC
460 CPP.BaseFlags += -fPIC
461 endif
462
463 LD.Flags += -Wl,--no-relax
464 endif
465
466 # GNU ld/PECOFF accepts but ignores them below;
467 # --version-script
468 # --export-dynamic
469 # --rpath
470 # FIXME: autoconf should be aware of them.
471 ifneq (,$(filter $(HOST_OS),Cygwin MingW))
472 HAVE_LINK_VERSION_SCRIPT := 0
473 RPATH :=
474 RDYNAMIC := -Wl,--export-all-symbols
475 endif
476
477 #--------------------------------------------------------------------
478 # Directory locations
479 #--------------------------------------------------------------------
480 TargetMode :=
481 ifeq ($(LLVM_CROSS_COMPILING),1)
482 BuildLLVMToolDir := $(LLVM_OBJ_ROOT)/BuildTools/$(BuildMode)/bin
483 endif
484
485 ObjRootDir := $(PROJ_OBJ_DIR)/$(BuildMode)
486 ObjDir := $(ObjRootDir)
487 LibDir := $(PROJ_OBJ_ROOT)/$(BuildMode)/lib
488 LibexecDir := $(PROJ_OBJ_ROOT)/$(BuildMode)/libexec
489 ShareDir := $(PROJ_OBJ_ROOT)/$(BuildMode)/share
490 ToolDir := $(PROJ_OBJ_ROOT)/$(BuildMode)/bin
491 ExmplDir := $(PROJ_OBJ_ROOT)/$(BuildMode)/examples
492 LLVMLibDir := $(LLVM_OBJ_ROOT)/$(BuildMode)/lib
493 LLVMToolDir := $(LLVM_OBJ_ROOT)/$(BuildMode)/bin
494 LLVMExmplDir:= $(LLVM_OBJ_ROOT)/$(BuildMode)/examples
495
496 #--------------------------------------------------------------------
497 # Locations of shared libraries
498 #--------------------------------------------------------------------
499
500 SharedPrefix := lib
501 SharedLibDir := $(LibDir)
502 LLVMSharedLibDir := $(LLVMLibDir)
503
504 # Win32.DLL prefers to be located on the "PATH" of binaries.
505 ifeq ($(HOST_OS), $(filter $(HOST_OS), Cygwin MingW))
506 SharedLibDir := $(ToolDir)
507 LLVMSharedLibDir := $(LLVMToolDir)
508
509 ifeq ($(HOST_OS),Cygwin)
510 SharedPrefix := cyg
511 else
512 SharedPrefix :=
513 endif
514 endif
515
516 #--------------------------------------------------------------------
517 # Full Paths To Compiled Tools and Utilities
518 #--------------------------------------------------------------------
519 EchoCmd := $(ECHO) llvm[$(MAKELEVEL)]:
520 ifdef BUILD_DIRS_ONLY
521 EchoCmd := $(EchoCmd) "(build tools)":
522 endif
523
524 Echo := @$(EchoCmd)
525 ifndef LLVMAS
526 LLVMAS := $(LLVMToolDir)/llvm-as$(EXEEXT)
527 endif
528 ifndef LLVM_TBLGEN
529 ifeq ($(LLVM_CROSS_COMPILING),1)
530 LLVM_TBLGEN := $(BuildLLVMToolDir)/llvm-tblgen$(BUILD_EXEEXT)
531 else
532 LLVM_TBLGEN := $(LLVMToolDir)/llvm-tblgen$(EXEEXT)
533 endif
534 endif
535 ifeq ($(LLVM_CROSS_COMPILING),1)
536 LLVM_CONFIG := $(BuildLLVMToolDir)/llvm-config$(BUILD_EXEEXT)
537 else
538 LLVM_CONFIG := $(LLVMToolDir)/llvm-config$(EXEEXT)
539 endif
540 ifndef LLVMDIS
541 LLVMDIS := $(LLVMToolDir)/llvm-dis$(EXEEXT)
542 endif
543 ifndef LLI
544 LLI := $(LLVMToolDir)/lli$(EXEEXT)
545 endif
546 ifndef LLC
547 LLC := $(LLVMToolDir)/llc$(EXEEXT)
548 endif
549 ifndef LOPT
550 LOPT := $(LLVMToolDir)/opt$(EXEEXT)
551 endif
552 ifndef LBUGPOINT
553 LBUGPOINT := $(LLVMToolDir)/bugpoint$(EXEEXT)
554 endif
555 ifndef LLVMLINK
556 LLVMLINK := $(LLVMToolDir)/llvm-link$(EXEEXT)
557 endif
558
559 #--------------------------------------------------------------------
560 # Adjust to user's request
561 #--------------------------------------------------------------------
562
563 ifeq ($(HOST_OS),Darwin)
564 ifdef MACOSX_DEPLOYMENT_TARGET
565 DARWIN_VERSION := $(MACOSX_DEPLOYMENT_TARGET)
566 else
567 DARWIN_VERSION := `sw_vers -productVersion`
568 endif
569 # Strip a number like 10.4.7 to 10.4
570 DARWIN_VERSION := $(shell echo $(DARWIN_VERSION)| sed -E 's/(10.[0-9]+).*/\1/')
571 # Get "4" out of 10.4 for later pieces in the makefile.
572 DARWIN_MAJVERS := $(shell echo $(DARWIN_VERSION)| sed -E 's/10.([0-9]+).*/\1/')
573
574 LoadableModuleOptions := -Wl,-flat_namespace -Wl,-undefined,suppress
575 SharedLinkOptions := -dynamiclib
576 ifdef DEPLOYMENT_TARGET
577 SharedLinkOptions += $(DEPLOYMENT_TARGET)
578 else
579 ifneq ($(ARCH),ARM)
580 SharedLinkOptions += -mmacosx-version-min=$(DARWIN_VERSION)
581 endif
582 endif
583 else
584 SharedLinkOptions=-shared
585 endif
586
587 ifeq ($(TARGET_OS),Darwin)
588 ifdef DEPLOYMENT_TARGET
589 TargetCommonOpts += $(DEPLOYMENT_TARGET)
590 else
591 ifneq ($(ARCH),ARM)
592 TargetCommonOpts += -mmacosx-version-min=$(DARWIN_VERSION)
593 endif
594 endif
595 endif
596
597 ifdef SHARED_LIBRARY
598 ifneq ($(HOST_OS), $(filter $(HOST_OS), Cygwin MingW))
599 ifneq ($(HOST_OS),Darwin)
600 LD.Flags += $(RPATH) -Wl,'$$ORIGIN'
601 else
602 LD.Flags += -Wl,-install_name -Wl,"@rpath/lib$(LIBRARYNAME)$(SHLIBEXT)"
603 endif
604 endif
605 endif
606
607 ifdef TOOL_VERBOSE
608 C.Flags += -v
609 CXX.Flags += -v
610 LD.Flags += -v
611 VERBOSE := 1
612 endif
613
614 # Adjust settings for verbose mode
615 ifndef VERBOSE
616 Verb := @
617 AR.Flags += >/dev/null 2>/dev/null
618 ConfigureScriptFLAGS += >$(PROJ_OBJ_DIR)/configure.out 2>&1
619 else
620 ConfigureScriptFLAGS :=
621 endif
622
623 # By default, strip symbol information from executable
624 ifndef KEEP_SYMBOLS
625 Strip := $(PLATFORMSTRIPOPTS)
626 StripWarnMsg := "(without symbols)"
627 Install.StripFlag += -s
628 endif
629
630 # By default, strip dead symbols at link time
631 ifneq ($(HOST_OS), $(filter $(HOST_OS), Cygwin MingW))
632 ifneq ($(HOST_OS),Darwin)
633 ifneq ($(HOST_ARCH),Mips)
634 CXX.Flags += -ffunction-sections -fdata-sections
635 ifeq ($(HOST_OS),SunOS)
636 CXX.Flags += -falign-functions=8
637 endif
638 endif
639 endif
640 endif
641 ifndef NO_DEAD_STRIP
642 ifeq ($(HOST_OS),Darwin)
643 LD.Flags += -Wl,-dead_strip
644 else
645 ifeq ($(HOST_OS),SunOS)
646 LD.Flags += -Wl,-z -Wl,discard-unused=sections
647 else
648 ifneq ($(HOST_OS), $(filter $(HOST_OS), Cygwin MingW))
649 LD.Flags += -Wl,--gc-sections
650 endif
651 endif
652 endif
653 endif
654
655 # Adjust linker flags for building an executable
656 ifneq ($(HOST_OS), $(filter $(HOST_OS), Cygwin MingW))
657 ifndef TOOL_NO_EXPORTS
658 LD.Flags += $(RDYNAMIC)
659 endif
660 ifneq ($(HOST_OS), Darwin)
661 ifdef TOOLNAME
662 LD.Flags += $(RPATH) -Wl,'$$ORIGIN/../lib'
663 endif
664 else
665 ifneq ($(DARWIN_MAJVERS),4)
666 LD.Flags += $(RPATH) -Wl,@executable_path/../lib
667 endif
668 ifeq ($(RC_XBS),YES)
669 TempFile := $(shell mkdir -p ${OBJROOT}/dSYMs ; mktemp ${OBJROOT}/dSYMs/llvm-lto.XXXXXX)
670 LD.Flags += -Wl,-object_path_lto -Wl,$(TempFile)
671 endif
672 endif
673 endif
674
675
676 #----------------------------------------------------------
677 # Options To Invoke Tools
678 #----------------------------------------------------------
679
680 ifdef EXTRA_LD_OPTIONS
681 LD.Flags += $(EXTRA_LD_OPTIONS)
682 endif
683
684 ifndef NO_PEDANTIC
685 CompileCommonOpts += -pedantic -Wno-long-long
686 endif
687 CompileCommonOpts += -Wall -W -Wno-unused-parameter -Wwrite-strings \
688 $(EXTRA_OPTIONS) $(COVERED_SWITCH_DEFAULT) \
689 $(NO_UNINITIALIZED) $(NO_MAYBE_UNINITIALIZED) \
690 $(MISSING_FIELD_INITIALIZERS) $(NO_COMMENT)
691 # Enable cast-qual for C++; the workaround is to use const_cast.
692 CXX.Flags += -Wcast-qual
693
694 ifeq ($(HOST_OS),HP-UX)
695 CompileCommonOpts := -D_REENTRANT -D_HPUX_SOURCE
696 endif
697
698 # If we are building a universal binary on Mac OS X, pass extra options. This
699 # is useful to people that want to link the LLVM libraries into their universal
700 # apps.
701 #
702 # The following can be optionally specified:
703 # UNIVERSAL_SDK_PATH variable can be specified as a path to the SDK to use.
704 # For Mac OS X 10.4 Intel machines, the traditional one is:
705 # UNIVERSAL_SDK_PATH=/Developer/SDKs/MacOSX10.4u.sdk/
706 # UNIVERSAL_ARCH can be optionally specified to be a list of architectures
707 # to build for, e.g. UNIVERSAL_ARCH="i386 ppc ppc64". This defaults to
708 # i386/ppc only.
709 ifdef UNIVERSAL
710 ifndef UNIVERSAL_ARCH
711 UNIVERSAL_ARCH := i386 ppc
712 endif
713 UNIVERSAL_ARCH_OPTIONS := $(UNIVERSAL_ARCH:%=-arch %)
714 TargetCommonOpts += $(UNIVERSAL_ARCH_OPTIONS)
715 ifdef UNIVERSAL_SDK_PATH
716 TargetCommonOpts += -isysroot $(UNIVERSAL_SDK_PATH)
717 endif
718
719 # Building universal cannot compute dependencies automatically.
720 DISABLE_AUTO_DEPENDENCIES=1
721 else
722 ifeq ($(TARGET_OS),Darwin)
723 ifeq ($(ARCH),x86_64)
724 TargetCommonOpts = -m64
725 else
726 ifeq ($(ARCH),x86)
727 TargetCommonOpts = -m32
728 endif
729 endif
730 endif
731 endif
732
733 ifeq ($(HOST_OS),SunOS)
734 CPP.BaseFlags += -include llvm/Support/Solaris.h
735 endif
736
737 # On Windows, SharedLibDir != LibDir. The order is important.
738 ifeq ($(HOST_OS), $(filter $(HOST_OS), Cygwin MingW))
739 LD.Flags += -L$(SharedLibDir) -L$(LibDir) -L$(LLVMToolDir) -L$(LLVMLibDir)
740 else
741 LD.Flags += -L$(LibDir) -L$(LLVMLibDir)
742 endif
743
744 CPP.BaseFlags += -D_GNU_SOURCE -D__STDC_CONSTANT_MACROS -D__STDC_FORMAT_MACROS -D__STDC_LIMIT_MACROS
745 # All -I flags should go here, so that they don't confuse llvm-config.
746 CPP.Flags += $(sort -I$(PROJ_OBJ_DIR) -I$(PROJ_SRC_DIR) \
747 $(patsubst %,-I%/include,\
748 $(PROJ_OBJ_ROOT) $(PROJ_SRC_ROOT) \
749 $(LLVM_OBJ_ROOT) $(LLVM_SRC_ROOT))) \
750 $(CPP.BaseFlags)
751
752 ifeq ($(INCLUDE_BUILD_DIR),1)
753 CPP.Flags += -I$(ObjDir)
754 endif
755
756 # SHOW_DIAGNOSTICS support.
757 ifeq ($(SHOW_DIAGNOSTICS),1)
758 Compile.Wrapper := env CC_LOG_DIAGNOSTICS=1 \
759 CC_LOG_DIAGNOSTICS_FILE="$(LLVM_OBJ_ROOT)/$(BuildMode)/diags"
760 else
761 Compile.Wrapper :=
762 endif
763
764 Compile.C = $(Compile.Wrapper) \
765 $(CC) $(CPP.Flags) $(C.Flags) $(CFLAGS) $(CPPFLAGS) \
766 $(TargetCommonOpts) $(CompileCommonOpts) -c
767 Compile.CXX = $(Compile.Wrapper) \
768 $(CXX) $(CPP.Flags) $(CXX.Flags) $(CXXFLAGS) $(CPPFLAGS) \
769 $(TargetCommonOpts) $(CompileCommonOpts) -c
770 Preprocess.CXX= $(Compile.Wrapper) \
771 $(CXX) $(CPP.Flags) $(TargetCommonOpts) $(CPPFLAGS) \
772 $(CompileCommonOpts) $(CXX.Flags) -E
773 Link = $(Compile.Wrapper) \
774 $(CXX) $(CXXFLAGS) $(LD.Flags) $(LDFLAGS) \
775 $(TargetCommonOpts) $(Strip)
776
777 Preprocess.C = $(CC) $(CPP.Flags) $(C.Flags) $(CPPFLAGS) \
778 $(TargetCommonOpts) $(CompileCommonOpts) -E
779
780 ProgInstall = $(INSTALL) $(Install.StripFlag) -m 0755
781 ScriptInstall = $(INSTALL) -m 0755
782 DataInstall = $(INSTALL) -m 0644
783
784 # When compiling under Mingw/Cygwin, the tblgen tool expects Windows
785 # paths. In this case, the SYSPATH function (defined in
786 # Makefile.config) transforms Unix paths into Windows paths.
787 TableGen.Flags= -I $(call SYSPATH, $(PROJ_SRC_DIR)) \
788 -I $(call SYSPATH, $(LLVM_SRC_ROOT)/include) \
789 -I $(call SYSPATH, $(PROJ_SRC_ROOT)/include) \
790 -I $(call SYSPATH, $(PROJ_SRC_ROOT)/lib/Target)
791 LLVMTableGen = $(LLVM_TBLGEN) $(TableGen.Flags)
792
793 Archive = $(AR) $(AR.Flags)
794 ifdef RANLIB
795 Ranlib = $(RANLIB)
796 else
797 Ranlib = ranlib
798 endif
799
800 AliasTool = ln -sf
801
802 #----------------------------------------------------------
803 # Get the list of source files and compute object file
804 # names from them.
805 #----------------------------------------------------------
806
807 ifndef SOURCES
808 Sources := $(notdir $(wildcard $(PROJ_SRC_DIR)/*.cpp \
809 $(PROJ_SRC_DIR)/*.cc $(PROJ_SRC_DIR)/*.c))
810 else
811 Sources := $(SOURCES)
812 endif
813
814 ifdef BUILT_SOURCES
815 Sources += $(filter %.cpp %.c %.cc,$(BUILT_SOURCES))
816 endif
817
818 BaseNameSources := $(sort $(basename $(Sources)))
819 SourceDirs := $(sort $(dir $(Sources)))
820
821 ObjectsO := $(BaseNameSources:%=$(ObjDir)/%.o)
822 ObjectDirs := $(SourceDirs:%=$(ObjDir)/%)
823
824 #----------------------------------------------------------
825 # For Mingw MSYS bash and Python/w32:
826 #
827 # $(ECHOPATH) prints DOSish pathstring.
828 # ex) $(ECHOPATH) /include/sys/types.h
829 # --> C:/mingw/include/sys/types.h
830 # built-in "echo" does not transform path to DOSish path.
831 #
832 # FIXME: It would not be needed when MSYS's python
833 # were provided.
834 #----------------------------------------------------------
835
836 ifeq (-mingw32,$(findstring -mingw32,$(BUILD_TRIPLE)))
837 ECHOPATH := $(Verb)$(PYTHON) -u -c "import sys;print ' '.join(sys.argv[1:])"
838 else
839 ECHOPATH := $(Verb)$(ECHO)
840 endif
841
842 ###############################################################################
843 # DIRECTORIES: Handle recursive descent of directory structure
844 ###############################################################################
845
846 #---------------------------------------------------------
847 # Provide rules to make install dirs. This must be early
848 # in the file so they get built before dependencies
849 #---------------------------------------------------------
850
851 $(DESTDIR)$(PROJ_bindir) $(DESTDIR)$(PROJ_libdir) $(DESTDIR)$(PROJ_includedir) $(DESTDIR)$(PROJ_etcdir)::
852 $(Verb) $(MKDIR) $@
853
854 # To create other directories, as needed, and timestamp their creation
855 %/.dir:
856 $(Verb) $(MKDIR) $* > /dev/null
857 $(Verb) $(DOTDIR_TIMESTAMP_COMMAND) > $@
858
859 .PRECIOUS: $(LibDir)/.dir $(ToolDir)/.dir $(ExmplDir)/.dir
860 .PRECIOUS: $(LLVMLibDir)/.dir $(LLVMToolDir)/.dir $(LLVMExmplDir)/.dir
861 .PRECIOUS: $(LibexecDir)/.dir $(ShareDir)/.dir
862
863 #---------------------------------------------------------
864 # Collect the object directories (as there may be more
865 # than one if the source code is spread across
866 # subdirectories).
867 #---------------------------------------------------------
868
869 OBJECT_DIRS := $(ObjDir)/.dir $(ObjectDirs:%=%/.dir)
870 .PRECIOUS: $(OBJECT_DIRS)
871
872 #---------------------------------------------------------
873 # Handle the DIRS options for sequential construction
874 #---------------------------------------------------------
875
876 SubDirs :=
877 ifdef DIRS
878 SubDirs += $(DIRS)
879
880 ifneq ($(PROJ_SRC_ROOT),$(PROJ_OBJ_ROOT))
881 $(RecursiveTargets)::
882 $(Verb) for dir in $(DIRS); do \
883 if ([ ! -f $$dir/Makefile ] || \
884 command test $$dir/Makefile -ot $(PROJ_SRC_DIR)/$$dir/Makefile ); then \
885 $(MKDIR) $$dir; \
886 $(CP) $(PROJ_SRC_DIR)/$$dir/Makefile $$dir/Makefile; \
887 fi; \
888 ($(MAKE) -C $$dir $@ ) || exit 1; \
889 done
890 else
891 $(RecursiveTargets)::
892 $(Verb) for dir in $(DIRS); do \
893 ($(MAKE) -C $$dir $@ ) || exit 1; \
894 done
895 endif
896
897 endif
898
899 #---------------------------------------------------------
900 # Handle the EXPERIMENTAL_DIRS options ensuring success
901 # after each directory is built.
902 #---------------------------------------------------------
903 ifdef EXPERIMENTAL_DIRS
904 $(RecursiveTargets)::
905 $(Verb) for dir in $(EXPERIMENTAL_DIRS); do \
906 if ([ ! -f $$dir/Makefile ] || \
907 command test $$dir/Makefile -ot $(PROJ_SRC_DIR)/$$dir/Makefile ); then \
908 $(MKDIR) $$dir; \
909 $(CP) $(PROJ_SRC_DIR)/$$dir/Makefile $$dir/Makefile; \
910 fi; \
911 ($(MAKE) -C $$dir $@ ) || exit 0; \
912 done
913 endif
914
915 #-----------------------------------------------------------
916 # Handle the OPTIONAL_PARALLEL_DIRS options for optional parallel construction
917 #-----------------------------------------------------------
918 ifdef OPTIONAL_PARALLEL_DIRS
919 PARALLEL_DIRS += $(foreach T,$(OPTIONAL_PARALLEL_DIRS),$(shell test -d $(PROJ_SRC_DIR)/$(T) -o -f $(T)/Makefile && echo "$(T)"))
920 endif
921
922 #-----------------------------------------------------------
923 # Handle the PARALLEL_DIRS options for parallel construction
924 #-----------------------------------------------------------
925 ifdef PARALLEL_DIRS
926
927 SubDirs += $(PARALLEL_DIRS)
928
929 # Unfortunately, this list must be maintained if new recursive targets are added
930 all :: $(addsuffix /.makeall ,$(PARALLEL_DIRS))
931 clean :: $(addsuffix /.makeclean ,$(PARALLEL_DIRS))
932 clean-all:: $(addsuffix /.makeclean-all,$(PARALLEL_DIRS))
933 install :: $(addsuffix /.makeinstall ,$(PARALLEL_DIRS))
934 uninstall:: $(addsuffix /.makeuninstall,$(PARALLEL_DIRS))
935 install-bytecode :: $(addsuffix /.makeinstall-bytecode,$(PARALLEL_DIRS))
936 unitcheck:: $(addsuffix /.makeunitcheck,$(PARALLEL_DIRS))
937
938 ParallelTargets := $(foreach T,$(RecursiveTargets),%/.make$(T))
939
940 $(ParallelTargets) :
941 $(Verb) \
942 SD=$(PROJ_SRC_DIR)/$(@D); \
943 DD=$(@D); \
944 if [ ! -f $$SD/Makefile ]; then \
945 SD=$(@D); \
946 DD=$(notdir $(@D)); \
947 fi; \
948 if ([ ! -f $$DD/Makefile ] || \
949 command test $$DD/Makefile -ot \
950 $$SD/Makefile ); then \
951 $(MKDIR) $$DD; \
952 $(CP) $$SD/Makefile $$DD/Makefile; \
953 fi; \
954 $(MAKE) -C $$DD $(subst $(@D)/.make,,$@)
955 endif
956
957 #---------------------------------------------------------
958 # Handle the OPTIONAL_DIRS options for directores that may
959 # or may not exist.
960 #---------------------------------------------------------
961 ifdef OPTIONAL_DIRS
962
963 SubDirs += $(OPTIONAL_DIRS)
964
965 ifneq ($(PROJ_SRC_ROOT),$(PROJ_OBJ_ROOT))
966 $(RecursiveTargets)::
967 $(Verb) for dir in $(OPTIONAL_DIRS); do \
968 if [ -d $(PROJ_SRC_DIR)/$$dir ]; then\
969 if ([ ! -f $$dir/Makefile ] || \
970 command test $$dir/Makefile -ot $(PROJ_SRC_DIR)/$$dir/Makefile ); then \
971 $(MKDIR) $$dir; \
972 $(CP) $(PROJ_SRC_DIR)/$$dir/Makefile $$dir/Makefile; \
973 fi; \
974 ($(MAKE) -C$$dir $@ ) || exit 1; \
975 fi \
976 done
977 else
978 $(RecursiveTargets)::
979 $(Verb) for dir in $(OPTIONAL_DIRS); do \
980 if [ -d $(PROJ_SRC_DIR)/$$dir ]; then\
981 ($(MAKE) -C$$dir $@ ) || exit 1; \
982 fi \
983 done
984 endif
985 endif
986
987 #---------------------------------------------------------
988 # Handle the CONFIG_FILES options
989 #---------------------------------------------------------
990 ifdef CONFIG_FILES
991
992 ifdef NO_INSTALL
993 install-local::
994 $(Echo) Install circumvented with NO_INSTALL
995 uninstall-local::
996 $(Echo) UnInstall circumvented with NO_INSTALL
997 else
998 install-local:: $(DESTDIR)$(PROJ_etcdir) $(CONFIG_FILES)
999 $(Echo) Installing Configuration Files To $(DESTDIR)$(PROJ_etcdir)
1000 $(Verb)for file in $(CONFIG_FILES); do \
1001 if test -f $(PROJ_OBJ_DIR)/$${file} ; then \
1002 $(DataInstall) $(PROJ_OBJ_DIR)/$${file} $(DESTDIR)$(PROJ_etcdir) ; \
1003 elif test -f $(PROJ_SRC_DIR)/$${file} ; then \
1004 $(DataInstall) $(PROJ_SRC_DIR)/$${file} $(DESTDIR)$(PROJ_etcdir) ; \
1005 else \
1006 $(ECHO) Error: cannot find config file $${file}. ; \
1007 fi \
1008 done
1009
1010 uninstall-local::
1011 $(Echo) Uninstalling Configuration Files From $(DESTDIR)$(PROJ_etcdir)
1012 $(Verb)for file in $(CONFIG_FILES); do \
1013 $(RM) -f $(DESTDIR)$(PROJ_etcdir)/$${file} ; \
1014 done
1015 endif
1016
1017 endif
1018
1019 ###############################################################################
1020 # Set up variables for building libraries
1021 ###############################################################################
1022
1023 #---------------------------------------------------------
1024 # Define various command line options pertaining to the
1025 # libraries needed when linking. There are "Proj" libs
1026 # (defined by the user's project) and "LLVM" libs (defined
1027 # by the LLVM project).
1028 #---------------------------------------------------------
1029
1030 ifdef USEDLIBS
1031 ProjLibsOptions := $(patsubst %.a.o, -l%, $(addsuffix .o, $(USEDLIBS)))
1032 ProjLibsOptions := $(patsubst %.o, $(LibDir)/%.o, $(ProjLibsOptions))
1033 ProjUsedLibs := $(patsubst %.a.o, lib%.a, $(addsuffix .o, $(USEDLIBS)))
1034 ProjLibsPaths := $(addprefix $(LibDir)/,$(ProjUsedLibs))
1035 endif
1036
1037 ifdef LLVMLIBS
1038 LLVMLibsOptions := $(patsubst %.a.o, -l%, $(addsuffix .o, $(LLVMLIBS)))
1039 LLVMLibsOptions := $(patsubst %.o, $(LLVMLibDir)/%.o, $(LLVMLibsOptions))
1040 LLVMUsedLibs := $(patsubst %.a.o, lib%.a, $(addsuffix .o, $(LLVMLIBS)))
1041 LLVMLibsPaths := $(addprefix $(LLVMLibDir)/,$(LLVMUsedLibs))
1042 endif
1043
1044 # Loadable module for Win32 requires all symbols resolved for linking.
1045 # Then all symbols in LLVM.dll will be available.
1046 ifeq ($(ENABLE_SHARED),1)
1047 ifdef LOADABLE_MODULE
1048 ifneq (,$(filter $(HOST_OS),Cygwin MingW))
1049 LINK_COMPONENTS += all
1050 endif
1051 endif
1052 endif
1053
1054 ifndef IS_CLEANING_TARGET
1055 ifdef LINK_COMPONENTS
1056
1057 # If LLVM_CONFIG doesn't exist, build it. This can happen if you do a make
1058 # clean in tools, then do a make in tools (instead of at the top level).
1059 $(LLVM_CONFIG):
1060 @echo "*** llvm-config doesn't exist - rebuilding it."
1061 @$(MAKE) -C $(PROJ_OBJ_ROOT)/tools/llvm-config
1062
1063 $(ToolDir)/$(strip $(TOOLNAME))$(EXEEXT): $(LLVM_CONFIG)
1064
1065 ifeq ($(ENABLE_SHARED), 1)
1066 # We can take the "auto-import" feature to get rid of using dllimport.
1067 ifeq ($(HOST_OS), $(filter $(HOST_OS), Cygwin MingW))
1068 LLVMLibsOptions += -Wl,--enable-auto-import,--enable-runtime-pseudo-reloc \
1069 -L $(SharedLibDir)
1070 endif
1071 LLVM_SO_NAME = LLVM-$(LLVM_VERSION_MAJOR).$(LLVM_VERSION_MINOR)$(LLVM_VERSION_SUFFIX)
1072 LLVMLibsOptions += -l$(LLVM_SO_NAME)
1073 LLVMLibsPaths += $(SharedLibDir)/$(SharedPrefix)$(LLVM_SO_NAME)$(SHLIBEXT)
1074 else
1075
1076 ifndef NO_LLVM_CONFIG
1077 LLVMConfigLibs := $(shell $(LLVM_CONFIG) --libs $(LINK_COMPONENTS) || echo Error)
1078 ifeq ($(LLVMConfigLibs),Error)
1079 $(error llvm-config --libs failed)
1080 endif
1081 LLVMLibsOptions += $(LLVMConfigLibs)
1082 LLVMConfigLibfiles := $(shell $(LLVM_CONFIG) --libfiles $(LINK_COMPONENTS) || echo Error)
1083 ifeq ($(LLVMConfigLibfiles),Error)
1084 $(error llvm-config --libfiles failed)
1085 endif
1086 LLVMLibsPaths += $(LLVM_CONFIG) $(LLVMConfigLibfiles)
1087 endif
1088
1089 endif
1090 endif
1091 endif
1092
1093 # Set up the library exports file.
1094 ifdef EXPORTED_SYMBOL_FILE
1095
1096 # First, set up the native export file, which may differ from the source
1097 # export file.
1098
1099 ifeq ($(HOST_OS),Darwin)
1100 # Darwin convention prefixes symbols with underscores.
1101 NativeExportsFile := $(ObjDir)/$(notdir $(EXPORTED_SYMBOL_FILE)).sed
1102 $(NativeExportsFile): $(EXPORTED_SYMBOL_FILE) $(ObjDir)/.dir
1103 $(Verb) sed -e 's/^/_/' < $< > $@
1104 clean-local::
1105 -$(Verb) $(RM) -f $(NativeExportsFile)
1106 else
1107 ifeq ($(HAVE_LINK_VERSION_SCRIPT),1)
1108 # Gold and BFD ld require a version script rather than a plain list.
1109 NativeExportsFile := $(ObjDir)/$(notdir $(EXPORTED_SYMBOL_FILE)).map
1110 $(NativeExportsFile): $(EXPORTED_SYMBOL_FILE) $(ObjDir)/.dir
1111 $(Verb) echo "{" > $@
1112 $(Verb) grep -q '[[:alnum:]_]' $< && echo " global:" >> $@ || :
1113 $(Verb) sed -e 's/$$/;/' -e 's/^/ /' < $< >> $@
1114 ifneq ($(HOST_OS),OpenBSD)
1115 $(Verb) echo " local: *;" >> $@
1116 endif
1117 $(Verb) echo "};" >> $@
1118 clean-local::
1119 -$(Verb) $(RM) -f $(NativeExportsFile)
1120 else
1121 ifeq ($(HOST_OS), $(filter $(HOST_OS), Cygwin MingW))
1122 # GNU ld Win32 accepts .DEF files that contain "DATA" entries.
1123 NativeExportsFile := $(ObjDir)/$(notdir $(EXPORTED_SYMBOL_FILE:.exports=.def))
1124 $(NativeExportsFile): $(EXPORTED_SYMBOL_FILE) $(ObjDir)/.dir
1125 $(Echo) Generating $(notdir $@)
1126 $(Verb) $(ECHO) "EXPORTS" > $@
1127 $(Verb) $(CAT) $< >> $@
1128 clean-local::
1129 -$(Verb) $(RM) -f $(NativeExportsFile)
1130 else
1131 # Default behavior: just use the exports file verbatim.
1132 NativeExportsFile := $(EXPORTED_SYMBOL_FILE)
1133 endif
1134 endif
1135 endif
1136
1137 # Now add the linker command-line options to use the native export file.
1138
1139 # Darwin
1140 ifeq ($(HOST_OS),Darwin)
1141 LLVMLibsOptions += -Wl,-exported_symbols_list,$(NativeExportsFile)
1142 endif
1143
1144 # gold, bfd ld, etc.
1145 ifeq ($(HAVE_LINK_VERSION_SCRIPT),1)
1146 LLVMLibsOptions += -Wl,--version-script,$(NativeExportsFile)
1147 endif
1148
1149 # Windows
1150 ifeq ($(HOST_OS), $(filter $(HOST_OS), Cygwin MingW))
1151 # LLVMLibsOptions is invalidated at processing tools/llvm-shlib.
1152 SharedLinkOptions += $(NativeExportsFile)
1153 endif
1154
1155 endif
1156
1157 ###############################################################################
1158 # Library Build Rules: Four ways to build a library
1159 ###############################################################################
1160
1161 # if we're building a library ...
1162 ifdef LIBRARYNAME
1163
1164 # Make sure there isn't any extraneous whitespace on the LIBRARYNAME option
1165 LIBRARYNAME := $(strip $(LIBRARYNAME))
1166 LIBRARYALIASNAME := $(strip $(LIBRARYALIASNAME))
1167 ifdef LOADABLE_MODULE
1168 BaseLibName.A := $(LIBRARYNAME).a
1169 BaseLibName.SO := $(LIBRARYNAME)$(SHLIBEXT)
1170 BaseAliasName.SO := $(LIBRARYALIASNAME)$(SHLIBEXT)
1171 else
1172 BaseLibName.A := lib$(LIBRARYNAME).a
1173 BaseLibName.SO := $(SharedPrefix)$(LIBRARYNAME)$(SHLIBEXT)
1174 BaseAliasName.SO := $(SharedPrefix)$(LIBRARYALIASNAME)$(SHLIBEXT)
1175 endif
1176 LibName.A := $(LibDir)/$(BaseLibName.A)
1177 LibName.SO := $(SharedLibDir)/$(BaseLibName.SO)
1178 AliasName.SO := $(SharedLibDir)/$(BaseAliasName.SO)
1179 LibName.O := $(LibDir)/$(LIBRARYNAME).o
1180
1181 #---------------------------------------------------------
1182 # Shared Library Targets:
1183 # If the user asked for a shared library to be built
1184 # with the SHARED_LIBRARY variable, then we provide
1185 # targets for building them.
1186 #---------------------------------------------------------
1187 ifdef SHARED_LIBRARY
1188
1189 all-local:: $(AliasName.SO)
1190
1191 $(AliasName.SO): $(LibName.SO)
1192 ifdef SHARED_ALIAS
1193 $(Verb) $(AliasTool) $(BaseLibName.SO) $(AliasName.SO)
1194 endif
1195
1196 ifdef EXPORTED_SYMBOL_FILE
1197 $(LibName.SO): $(NativeExportsFile)
1198 endif
1199
1200 ifdef LINK_LIBS_IN_SHARED
1201 ifdef LOADABLE_MODULE
1202 SharedLibKindMessage := "Loadable Module"
1203 SharedLinkOptions := $(LoadableModuleOptions) $(SharedLinkOptions)
1204 else
1205 SharedLibKindMessage := "Shared Library"
1206 endif
1207 $(LibName.SO): $(ObjectsO) $(ProjLibsPaths) $(LLVMLibsPaths) $(SharedLibDir)/.dir
1208 $(Echo) Linking $(BuildMode) $(SharedLibKindMessage) \
1209 $(notdir $@)
1210 $(Verb) $(Link) $(SharedLinkOptions) -o $@ $(ObjectsO) \
1211 $(ProjLibsOptions) $(LLVMLibsOptions) $(LIBS)
1212 else
1213 $(LibName.SO): $(ObjectsO) $(SharedLibDir)/.dir
1214 $(Echo) Linking $(BuildMode) Shared Library $(notdir $@)
1215 $(Verb) $(Link) $(SharedLinkOptions) -o $@ $(ObjectsO)
1216 endif
1217
1218 clean-local::
1219 ifneq ($(strip $(LibName.SO)),)
1220 -$(Verb) $(RM) -f $(LibName.SO)
1221 endif
1222
1223 ifdef NO_INSTALL
1224 install-local::
1225 $(Echo) Install circumvented with NO_INSTALL
1226 uninstall-local::
1227 $(Echo) Uninstall circumvented with NO_INSTALL
1228 else
1229
1230 # Win32.DLL prefers to be located on the "PATH" of binaries.
1231 ifeq ($(HOST_OS), $(filter $(HOST_OS), Cygwin MingW))
1232 DestSharedLibDir := $(DESTDIR)$(PROJ_bindir)
1233 else
1234 DestSharedLibDir := $(DESTDIR)$(PROJ_libdir)
1235 endif
1236 DestSharedLib := $(DestSharedLibDir)/$(BaseLibName.SO)
1237 DestSharedAlias := $(DestSharedLibDir)/$(BaseAliasName.SO)
1238
1239 install-local:: $(DestSharedLib)
1240
1241 $(DestSharedLib): $(LibName.SO) $(DestSharedLibDir)
1242 $(Echo) Installing $(BuildMode) Shared Library $(DestSharedLib)
1243 $(Verb) $(INSTALL) $(LibName.SO) $(DestSharedLib)
1244 ifdef SHARED_ALIAS
1245 $(Echo) Creating alias from $(DestSharedLib) to $(DestSharedAlias)
1246 $(Verb) $(AliasTool) $(BaseLibName.SO) $(DestSharedAlias)
1247 endif
1248
1249 uninstall-local::
1250 $(Echo) Uninstalling $(BuildMode) Shared Library $(DestSharedLib)
1251 -$(Verb) $(RM) -f $(DestSharedLib)
1252 ifdef SHARED_ALIAS
1253 -$(Verb) $(RM) -f $(DestSharedAlias)
1254 endif
1255 endif
1256 endif
1257
1258 #---------------------------------------------------------
1259 # Library Targets:
1260 # If neither BUILD_ARCHIVE or LOADABLE_MODULE are specified, default to
1261 # building an archive.
1262 #---------------------------------------------------------
1263 ifndef NO_BUILD_ARCHIVE
1264 ifndef BUILD_ARCHIVE
1265 ifndef LOADABLE_MODULE
1266 BUILD_ARCHIVE = 1
1267 endif
1268 endif
1269 endif
1270
1271 #---------------------------------------------------------
1272 # Archive Library Targets:
1273 # If the user wanted a regular archive library built,
1274 # then we provide targets for building them.
1275 #---------------------------------------------------------
1276 ifdef BUILD_ARCHIVE
1277
1278 all-local:: $(LibName.A)
1279
1280 $(LibName.A): $(ObjectsO) $(LibDir)/.dir
1281 $(Echo) Building $(BuildMode) Archive Library $(notdir $@)
1282 -$(Verb) $(RM) -f $@
1283 $(Verb) $(Archive) $@ $(ObjectsO)
1284 $(Verb) $(Ranlib) $@
1285
1286 clean-local::
1287 ifneq ($(strip $(LibName.A)),)
1288 -$(Verb) $(RM) -f $(LibName.A)
1289 endif
1290
1291 ifdef NO_INSTALL
1292 install-local::
1293 $(Echo) Install circumvented with NO_INSTALL
1294 uninstall-local::
1295 $(Echo) Uninstall circumvented with NO_INSTALL
1296 else
1297 ifdef NO_INSTALL_ARCHIVES
1298 install-local::
1299 $(Echo) Install circumvented with NO_INSTALL
1300 uninstall-local::
1301 $(Echo) Uninstall circumvented with NO_INSTALL
1302 else
1303 DestArchiveLib := $(DESTDIR)$(PROJ_libdir)/lib$(LIBRARYNAME).a
1304
1305 install-local:: $(DestArchiveLib)
1306
1307 $(DestArchiveLib): $(LibName.A) $(DESTDIR)$(PROJ_libdir)
1308 $(Echo) Installing $(BuildMode) Archive Library $(DestArchiveLib)
1309 $(Verb) $(MKDIR) $(DESTDIR)$(PROJ_libdir)
1310 $(Verb) $(INSTALL) $(LibName.A) $(DestArchiveLib)
1311
1312 uninstall-local::
1313 $(Echo) Uninstalling $(BuildMode) Archive Library $(DestArchiveLib)
1314 -$(Verb) $(RM) -f $(DestArchiveLib)
1315 endif
1316 endif
1317 endif
1318
1319 # endif LIBRARYNAME
1320 endif
1321
1322 ###############################################################################
1323 # Tool Build Rules: Build executable tool based on TOOLNAME option
1324 ###############################################################################
1325
1326 ifdef TOOLNAME
1327
1328 #---------------------------------------------------------
1329 # Set up variables for building a tool.
1330 #---------------------------------------------------------
1331 TOOLEXENAME := $(strip $(TOOLNAME))$(EXEEXT)
1332 ifdef EXAMPLE_TOOL
1333 ToolBuildPath := $(ExmplDir)/$(TOOLEXENAME)
1334 else
1335 ToolBuildPath := $(ToolDir)/$(TOOLEXENAME)
1336 endif
1337
1338 # TOOLALIAS is a name to symlink (or copy) the tool to.
1339 ifdef TOOLALIAS
1340 ifdef EXAMPLE_TOOL
1341 ToolAliasBuildPath := $(ExmplDir)/$(strip $(TOOLALIAS))$(EXEEXT)
1342 else
1343 ToolAliasBuildPath := $(ToolDir)/$(strip $(TOOLALIAS))$(EXEEXT)
1344 endif
1345 endif
1346
1347 #---------------------------------------------------------
1348 # Prune Exports
1349 #---------------------------------------------------------
1350
1351 # If the tool opts in with TOOL_NO_EXPORTS, optimize startup time of the app by
1352 # not exporting all of the weak symbols from the binary. This reduces dyld
1353 # startup time by 4x on darwin in some cases.
1354 ifdef TOOL_NO_EXPORTS
1355 ifeq ($(HOST_OS),Darwin)
1356
1357 # Tiger tools don't support this.
1358 ifneq ($(DARWIN_MAJVERS),4)
1359 LD.Flags += -Wl,-exported_symbol,_main
1360 endif
1361 endif
1362
1363 ifeq ($(HOST_OS), $(filter $(HOST_OS), DragonFly Linux NetBSD FreeBSD GNU/kFreeBSD GNU))
1364 ifneq ($(ARCH), Mips)
1365 LD.Flags += -Wl,--version-script=$(LLVM_SRC_ROOT)/autoconf/ExportMap.map
1366 endif
1367 endif
1368 endif
1369
1370 #---------------------------------------------------------
1371 # Tool Order File Support
1372 #---------------------------------------------------------
1373
1374 ifeq ($(HOST_OS),Darwin)
1375 ifdef TOOL_ORDER_FILE
1376
1377 LD.Flags += -Wl,-order_file,$(TOOL_ORDER_FILE)
1378
1379 endif
1380 endif
1381
1382 #---------------------------------------------------------
1383 # Tool Version Info Support
1384 #---------------------------------------------------------
1385
1386 ifeq ($(HOST_OS),Darwin)
1387 ifdef TOOL_INFO_PLIST
1388
1389 LD.Flags += -Wl,-sectcreate,__TEXT,__info_plist,$(ObjDir)/$(TOOL_INFO_PLIST)
1390
1391 $(ToolBuildPath): $(ObjDir)/$(TOOL_INFO_PLIST)
1392
1393 $(ObjDir)/$(TOOL_INFO_PLIST): $(PROJ_SRC_DIR)/$(TOOL_INFO_PLIST).in $(ObjDir)/.dir
1394 $(Echo) "Creating $(TOOLNAME) '$(TOOL_INFO_PLIST)' file..."
1395 $(Verb)sed -e "s#@TOOL_INFO_UTI@#$(TOOL_INFO_UTI)#g" \
1396 -e "s#@TOOL_INFO_NAME@#$(TOOL_INFO_NAME)#g" \
1397 -e "s#@TOOL_INFO_VERSION@#$(TOOL_INFO_VERSION)#g" \
1398 -e "s#@TOOL_INFO_BUILD_VERSION@#$(TOOL_INFO_BUILD_VERSION)#g" \
1399 $< > $@
1400
1401 endif
1402 endif
1403
1404 #---------------------------------------------------------
1405 # Provide targets for building the tools
1406 #---------------------------------------------------------
1407 all-local:: $(ToolBuildPath) $(ToolAliasBuildPath)
1408
1409 clean-local::
1410 ifneq ($(strip $(ToolBuildPath)),)
1411 -$(Verb) $(RM) -f $(ToolBuildPath)
1412 endif
1413 ifneq ($(strip $(ToolAliasBuildPath)),)
1414 -$(Verb) $(RM) -f $(ToolAliasBuildPath)
1415 endif
1416
1417 ifdef EXAMPLE_TOOL
1418 $(ToolBuildPath): $(ExmplDir)/.dir
1419 else
1420 $(ToolBuildPath): $(ToolDir)/.dir
1421 endif
1422
1423 ifdef CODESIGN_TOOLS
1424 TOOL_CODESIGN_IDENTITY ?= -
1425
1426 $(ToolBuildPath): $(ObjectsO) $(ProjLibsPaths) $(LLVMLibsPaths)
1427 $(Echo) Linking $(BuildMode) executable $(TOOLNAME) $(StripWarnMsg)
1428 $(Verb) $(Link) -o $@ $(TOOLLINKOPTS) $(ObjectsO) $(ProjLibsOptions) \
1429 $(LLVMLibsOptions) $(ExtraLibs) $(TOOLLINKOPTSB) $(LIBS)
1430 $(Echo) ======= Finished Linking $(BuildMode) Executable $(TOOLNAME) \
1431 $(StripWarnMsg)
1432 $(Echo) ======= Code-Signing $(BuildMode) Executable $(TOOLNAME)
1433 $(Verb) codesign -s $(TOOL_CODESIGN_IDENTITY) $@
1434 else
1435 $(ToolBuildPath): $(ObjectsO) $(ProjLibsPaths) $(LLVMLibsPaths)
1436 $(Echo) Linking $(BuildMode) executable $(TOOLNAME) $(StripWarnMsg)
1437 $(Verb) $(Link) -o $@ $(TOOLLINKOPTS) $(ObjectsO) $(ProjLibsOptions) \
1438 $(LLVMLibsOptions) $(ExtraLibs) $(TOOLLINKOPTSB) $(LIBS)
1439 $(Echo) ======= Finished Linking $(BuildMode) Executable $(TOOLNAME) \
1440 $(StripWarnMsg)
1441 endif
1442
1443 ifneq ($(strip $(ToolAliasBuildPath)),)
1444 $(ToolAliasBuildPath): $(ToolBuildPath)
1445 $(Echo) Creating $(BuildMode) Alias $(TOOLALIAS) $(StripWarnMsg)
1446 $(Verb) $(RM) -f $(ToolAliasBuildPath)
1447 $(Verb) $(AliasTool) $(notdir $(ToolBuildPath)) $(ToolAliasBuildPath)
1448 $(Echo) ======= Finished Creating $(BuildMode) Alias $(TOOLALIAS) \
1449 $(StripWarnMsg)
1450 endif
1451
1452 ifdef NO_INSTALL
1453 install-local::
1454 $(Echo) Install circumvented with NO_INSTALL
1455 uninstall-local::
1456 $(Echo) Uninstall circumvented with NO_INSTALL
1457 else
1458
1459 ifdef INTERNAL_TOOL
1460 ToolBinDir = $(DESTDIR)$(PROJ_internal_prefix)/bin
1461 else
1462 ToolBinDir = $(DESTDIR)$(PROJ_bindir)
1463 endif
1464 DestTool = $(ToolBinDir)/$(program_prefix)$(TOOLEXENAME)
1465
1466 install-local:: $(DestTool)
1467
1468 $(DestTool): $(ToolBuildPath)
1469 $(Echo) Installing $(BuildMode) $(DestTool)
1470 $(Verb) $(MKDIR) $(ToolBinDir)
1471 $(Verb) $(ProgInstall) $(ToolBuildPath) $(DestTool)
1472
1473 uninstall-local::
1474 $(Echo) Uninstalling $(BuildMode) $(DestTool)
1475 -$(Verb) $(RM) -f $(DestTool)
1476
1477 # TOOLALIAS install.
1478 ifdef TOOLALIAS
1479 DestToolAlias = $(ToolBinDir)/$(program_prefix)$(TOOLALIAS)$(EXEEXT)
1480
1481 install-local:: $(DestToolAlias)
1482
1483 $(DestToolAlias): $(DestTool)
1484 $(Echo) Installing $(BuildMode) $(DestToolAlias)
1485 $(Verb) $(RM) -f $(DestToolAlias)
1486 $(Verb) $(AliasTool) $(notdir $(DestTool)) $(DestToolAlias)
1487
1488 uninstall-local::
1489 $(Echo) Uninstalling $(BuildMode) $(DestToolAlias)
1490 -$(Verb) $(RM) -f $(DestToolAlias)
1491 endif
1492
1493 endif
1494 endif
1495
1496 ###############################################################################
1497 # Object Build Rules: Build object files based on sources
1498 ###############################################################################
1499
1500 # FIXME: This should be checking for "if not GCC or ICC", not for "if HP-UX"
1501 ifeq ($(HOST_OS),HP-UX)
1502 DISABLE_AUTO_DEPENDENCIES=1
1503 endif
1504
1505 COMPILE_DEPS = $(OBJECT_DIRS) $(BUILT_SOURCES) $(PROJ_MAKEFILE)
1506
1507 # Provide rule sets for when dependency generation is enabled
1508 ifndef DISABLE_AUTO_DEPENDENCIES
1509
1510 #---------------------------------------------------------
1511 # Create .o files in the ObjDir directory from the .cpp and .c files...
1512 #---------------------------------------------------------
1513
1514 DEPEND_OPTIONS = -MMD -MP -MF "$(ObjDir)/$*.d.tmp" \
1515 -MT "$(ObjDir)/$*.o" -MT "$(ObjDir)/$*.d"
1516
1517 # If the build succeeded, move the dependency file over, otherwise
1518 # remove it.
1519 DEPEND_MOVEFILE = then $(MV) -f "$(ObjDir)/$*.d.tmp" "$(ObjDir)/$*.d"; \
1520 else $(RM) "$(ObjDir)/$*.d.tmp"; exit 1; fi
1521
1522 $(ObjDir)/%.o: %.cpp $(COMPILE_DEPS)
1523 $(Echo) "Compiling $*.cpp for $(BuildMode) build" $(PIC_FLAG)
1524 $(Verb) if $(Compile.CXX) $(DEPEND_OPTIONS) $< -o $(ObjDir)/$*.o ; \
1525 $(DEPEND_MOVEFILE)
1526
1527 $(ObjDir)/%.o: %.mm $(COMPILE_DEPS)
1528 $(Echo) "Compiling $*.mm for $(BuildMode) build" $(PIC_FLAG)
1529 $(Verb) if $(Compile.CXX) $(DEPEND_OPTIONS) $< -o $(ObjDir)/$*.o ; \
1530 $(DEPEND_MOVEFILE)
1531
1532 $(ObjDir)/%.o: %.cc $(COMPILE_DEPS)
1533 $(Echo) "Compiling $*.cc for $(BuildMode) build" $(PIC_FLAG)
1534 $(Verb) if $(Compile.CXX) $(DEPEND_OPTIONS) $< -o $(ObjDir)/$*.o ; \
1535 $(DEPEND_MOVEFILE)
1536
1537 $(ObjDir)/%.o: %.c $(COMPILE_DEPS)
1538 $(Echo) "Compiling $*.c for $(BuildMode) build" $(PIC_FLAG)
1539 $(Verb) if $(Compile.C) $(DEPEND_OPTIONS) $< -o $(ObjDir)/$*.o ; \
1540 $(DEPEND_MOVEFILE)
1541
1542 $(ObjDir)/%.o: %.m $(COMPILE_DEPS)
1543 $(Echo) "Compiling $*.m for $(BuildMode) build" $(PIC_FLAG)
1544 $(Verb) if $(Compile.C) $(DEPEND_OPTIONS) $< -o $(ObjDir)/$*.o ; \
1545 $(DEPEND_MOVEFILE)
1546
1547 # Provide alternate rule sets if dependencies are disabled
1548 else
1549
1550 $(ObjDir)/%.o: %.cpp $(COMPILE_DEPS)
1551 $(Echo) "Compiling $*.cpp for $(BuildMode) build" $(PIC_FLAG)
1552 $(Compile.CXX) $< -o $@
1553
1554 $(ObjDir)/%.o: %.mm $(COMPILE_DEPS)
1555 $(Echo) "Compiling $*.mm for $(BuildMode) build" $(PIC_FLAG)
1556 $(Compile.CXX) $< -o $@
1557
1558 $(ObjDir)/%.o: %.cc $(COMPILE_DEPS)
1559 $(Echo) "Compiling $*.cc for $(BuildMode) build" $(PIC_FLAG)
1560 $(Compile.CXX) $< -o $@
1561
1562 $(ObjDir)/%.o: %.c $(COMPILE_DEPS)
1563 $(Echo) "Compiling $*.c for $(BuildMode) build" $(PIC_FLAG)
1564 $(Compile.C) $< -o $@
1565
1566 $(ObjDir)/%.o: %.m $(COMPILE_DEPS)
1567 $(Echo) "Compiling $*.m for $(BuildMode) build" $(PIC_FLAG)
1568 $(Compile.C) $< -o $@
1569 endif
1570
1571
1572 ## Rules for building preprocessed (.i/.ii) outputs.
1573 $(BuildMode)/%.ii: %.cpp $(COMPILE_DEPS)
1574 $(Echo) "Compiling $*.cpp for $(BuildMode) build to .ii file"
1575 $(Verb) $(Preprocess.CXX) $< -o $@
1576
1577 $(BuildMode)/%.ii: %.mm $(COMPILE_DEPS)
1578 $(Echo) "Compiling $*.mm for $(BuildMode) build to .ii file"
1579 $(Verb) $(Preprocess.CXX) $< -o $@
1580
1581 $(BuildMode)/%.ii: %.cc $(COMPILE_DEPS)
1582 $(Echo) "Compiling $*.cc for $(BuildMode) build to .ii file"
1583 $(Verb) $(Preprocess.CXX) $< -o $@
1584
1585 $(BuildMode)/%.i: %.c $(COMPILE_DEPS)
1586 $(Echo) "Compiling $*.c for $(BuildMode) build to .i file"
1587 $(Verb) $(Preprocess.C) $< -o $@
1588
1589 $(BuildMode)/%.i: %.m $(COMPILE_DEPS)
1590 $(Echo) "Compiling $*.m for $(BuildMode) build to .i file"
1591 $(Verb) $(Preprocess.C) $< -o $@
1592
1593
1594 $(ObjDir)/%.s: %.cpp $(COMPILE_DEPS)
1595 $(Echo) "Compiling $*.cpp to asm for $(BuildMode) build" $(PIC_FLAG)
1596 $(Compile.CXX) $< -o $@ -S
1597
1598 $(ObjDir)/%.s: %.mm $(COMPILE_DEPS)
1599 $(Echo) "Compiling $*.mm to asm for $(BuildMode) build" $(PIC_FLAG)
1600 $(Compile.CXX) $< -o $@ -S
1601
1602 $(ObjDir)/%.s: %.cc $(COMPILE_DEPS)
1603 $(Echo) "Compiling $*.cc to asm for $(BuildMode) build" $(PIC_FLAG)
1604 $(Compile.CXX) $< -o $@ -S
1605
1606 $(ObjDir)/%.s: %.c $(COMPILE_DEPS)
1607 $(Echo) "Compiling $*.c to asm for $(BuildMode) build" $(PIC_FLAG)
1608 $(Compile.C) $< -o $@ -S
1609
1610 $(ObjDir)/%.s: %.m $(COMPILE_DEPS)
1611 $(Echo) "Compiling $*.m to asm for $(BuildMode) build" $(PIC_FLAG)
1612 $(Compile.C) $< -o $@ -S
1613
1614 ###############################################################################
1615 # TABLEGEN: Provide rules for running tblgen to produce *.inc files
1616 ###############################################################################
1617
1618 ifdef TARGET
1619 TABLEGEN_INC_FILES_COMMON = 1
1620 endif
1621
1622 ifdef TABLEGEN_INC_FILES_COMMON
1623
1624 INCFiles := $(filter %.inc,$(BUILT_SOURCES))
1625 INCTMPFiles := $(INCFiles:%=$(ObjDir)/%.tmp)
1626 .PRECIOUS: $(INCTMPFiles) $(INCFiles)
1627
1628 # INCFiles rule: All of the tblgen generated files are emitted to
1629 # $(ObjDir)/%.inc.tmp, instead of emitting them directly to %.inc. This allows
1630 # us to only "touch" the real file if the contents of it change. IOW, if
1631 # tblgen is modified, all of the .inc.tmp files are regenerated, but no
1632 # dependencies of the .inc files are, unless the contents of the .inc file
1633 # changes.
1634 $(INCFiles) : %.inc : $(ObjDir)/%.inc.tmp
1635 $(Verb) $(CMP) -s $@ $< || $(CP) $< $@
1636
1637 endif # TABLEGEN_INC_FILES_COMMON
1638
1639 ifdef TARGET
1640
1641 TDFiles := $(strip $(wildcard $(PROJ_SRC_DIR)/*.td) \
1642 $(LLVM_SRC_ROOT)/include/llvm/Target/Target.td \
1643 $(LLVM_SRC_ROOT)/include/llvm/Target/TargetCallingConv.td \
1644 $(LLVM_SRC_ROOT)/include/llvm/Target/TargetSchedule.td \
1645 $(LLVM_SRC_ROOT)/include/llvm/Target/TargetSelectionDAG.td \
1646 $(LLVM_SRC_ROOT)/include/llvm/CodeGen/ValueTypes.td) \
1647 $(wildcard $(LLVM_SRC_ROOT)/include/llvm/IR/Intrinsics*.td)
1648
1649 # All .inc.tmp files depend on the .td files.
1650 $(INCTMPFiles) : $(TDFiles)
1651
1652 $(TARGET:%=$(ObjDir)/%GenRegisterInfo.inc.tmp): \
1653 $(ObjDir)/%GenRegisterInfo.inc.tmp : %.td $(ObjDir)/.dir $(LLVM_TBLGEN)
1654 $(Echo) "Building $(
1655 $(Verb) $(LLVMTableGen) -gen-register-info -o $(call SYSPATH, $@) $<
1656
1657 $(TARGET:%=$(ObjDir)/%GenInstrInfo.inc.tmp): \
1658 $(ObjDir)/%GenInstrInfo.inc.tmp : %.td $(ObjDir)/.dir $(LLVM_TBLGEN)
1659 $(Echo) "Building $(
1660 $(Verb) $(LLVMTableGen) -gen-instr-info -o $(call SYSPATH, $@) $<
1661
1662 $(TARGET:%=$(ObjDir)/%GenAsmWriter.inc.tmp): \
1663 $(ObjDir)/%GenAsmWriter.inc.tmp : %.td $(ObjDir)/.dir $(LLVM_TBLGEN)
1664 $(Echo) "Building $(
1665 $(Verb) $(LLVMTableGen) -gen-asm-writer -o $(call SYSPATH, $@) $<
1666
1667 $(TARGET:%=$(ObjDir)/%GenAsmWriter1.inc.tmp): \
1668 $(ObjDir)/%GenAsmWriter1.inc.tmp : %.td $(ObjDir)/.dir $(LLVM_TBLGEN)
1669 $(Echo) "Building $(
1670 $(Verb) $(LLVMTableGen) -gen-asm-writer -asmwriternum=1 -o $(call SYSPATH, $@) $<
1671
1672 $(TARGET:%=$(ObjDir)/%GenAsmMatcher.inc.tmp): \
1673 $(ObjDir)/%GenAsmMatcher.inc.tmp : %.td $(ObjDir)/.dir $(LLVM_TBLGEN)
1674 $(Echo) "Building $(
1675 $(Verb) $(LLVMTableGen) -gen-asm-matcher -o $(call SYSPATH, $@) $<
1676
1677 $(TARGET:%=$(ObjDir)/%GenMCCodeEmitter.inc.tmp): \
1678 $(ObjDir)/%GenMCCodeEmitter.inc.tmp: %.td $(ObjDir)/.dir $(LLVM_TBLGEN)
1679 $(Echo) "Building $(
1680 $(Verb) $(LLVMTableGen) -gen-emitter -o $(call SYSPATH, $@) $<
1681
1682 $(TARGET:%=$(ObjDir)/%GenMCPseudoLowering.inc.tmp): \
1683 $(ObjDir)/%GenMCPseudoLowering.inc.tmp: %.td $(ObjDir)/.dir $(LLVM_TBLGEN)
1684 $(Echo) "Building $(
1685 $(Verb) $(LLVMTableGen) -gen-pseudo-lowering -o $(call SYSPATH, $@) $<
1686
1687 $(TARGET:%=$(ObjDir)/%GenDAGISel.inc.tmp): \
1688 $(ObjDir)/%GenDAGISel.inc.tmp : %.td $(ObjDir)/.dir $(LLVM_TBLGEN)
1689 $(Echo) "Building $(
1690 $(Verb) $(LLVMTableGen) -gen-dag-isel -o $(call SYSPATH, $@) $<
1691
1692 $(TARGET:%=$(ObjDir)/%GenDisassemblerTables.inc.tmp): \
1693 $(ObjDir)/%GenDisassemblerTables.inc.tmp : %.td $(ObjDir)/.dir $(LLVM_TBLGEN)
1694 $(Echo) "Building $(
1695 $(Verb) $(LLVMTableGen) -gen-disassembler -o $(call SYSPATH, $@) $<
1696
1697 $(TARGET:%=$(ObjDir)/%GenFastISel.inc.tmp): \
1698 $(ObjDir)/%GenFastISel.inc.tmp : %.td $(ObjDir)/.dir $(LLVM_TBLGEN)
1699 $(Echo) "Building $(
1700 $(Verb) $(LLVMTableGen) -gen-fast-isel -o $(call SYSPATH, $@) $<
1701
1702 $(TARGET:%=$(ObjDir)/%GenSubtargetInfo.inc.tmp): \
1703 $(ObjDir)/%GenSubtargetInfo.inc.tmp : %.td $(ObjDir)/.dir $(LLVM_TBLGEN)
1704 $(Echo) "Building $(
1705 $(Verb) $(LLVMTableGen) -gen-subtarget -o $(call SYSPATH, $@) $<
1706
1707 $(TARGET:%=$(ObjDir)/%GenCallingConv.inc.tmp): \
1708 $(ObjDir)/%GenCallingConv.inc.tmp : %.td $(ObjDir)/.dir $(LLVM_TBLGEN)
1709 $(Echo) "Building $(
1710 $(Verb) $(LLVMTableGen) -gen-callingconv -o $(call SYSPATH, $@) $<
1711
1712 $(TARGET:%=$(ObjDir)/%GenIntrinsics.inc.tmp): \
1713 $(ObjDir)/%GenIntrinsics.inc.tmp : %.td $(ObjDir)/.dir $(LLVM_TBLGEN)
1714 $(Echo) "Building $(
1715 $(Verb) $(LLVMTableGen) -gen-tgt-intrinsic -o $(call SYSPATH, $@) $<
1716
1717 $(ObjDir)/ARMGenDecoderTables.inc.tmp : ARM.td $(ObjDir)/.dir $(LLVM_TBLGEN)
1718 $(Echo) "Building $(
1719 $(Verb) $(LLVMTableGen) -gen-arm-decoder -o $(call SYSPATH, $@) $<
1720
1721 $(ObjDir)/%GenDFAPacketizer.inc.tmp : %.td $(ObjDir)/.dir $(LLVM_TBLGEN)
1722 $(Echo) "Building $(
1723 $(Verb) $(LLVMTableGen) -gen-dfa-packetizer -o $(call SYSPATH, $@) $<
1724
1725 # Dump all the records to .td.expanded. This is useful for debugging.
1726 $(TARGET:%=%.td.expanded): \
1727 %.td.expanded : %.td $(LLVM_TBLGEN) $(TDFiles)
1728 $(Echo) "Building a fully expanded version of $(
1729 $(Verb) $(LLVMTableGen) -o $(call SYSPATH, $@) $<
1730
1731 clean-local::
1732 -$(Verb) $(RM) -f $(INCFiles) $(TARGET).td.expanded
1733
1734 endif # TARGET
1735
1736 ###############################################################################
1737 # OTHER RULES: Other rules needed
1738 ###############################################################################
1739
1740 # To create postscript files from dot files...
1741 ifneq ($(DOT),false)
1742 %.ps: %.dot
1743 $(DOT) -Tps < $< > $@
1744 else
1745 %.ps: %.dot
1746 $(Echo) "Cannot build $@: The program dot is not installed"
1747 endif
1748
1749 # This rules ensures that header files that are removed still have a rule for
1750 # which they can be "generated." This allows make to ignore them and
1751 # reproduce the dependency lists.
1752 %.h:: ;
1753 %.hpp:: ;
1754
1755 # Define clean-local to clean the current directory. Note that this uses a
1756 # very conservative approach ensuring that empty variables do not cause
1757 # errors or disastrous removal.
1758 clean-local::
1759 ifneq ($(strip $(ObjRootDir)),)
1760 -$(Verb) $(RM) -rf $(ObjRootDir)
1761 endif
1762 ifneq ($(strip $(SHLIBEXT)),) # Extra paranoia - make real sure SHLIBEXT is set
1763 -$(Verb) $(RM) -f *$(SHLIBEXT)
1764 endif
1765
1766 clean-all-local::
1767 -$(Verb) $(RM) -rf Debug Release Profile
1768
1769
1770 ###############################################################################
1771 # DEPENDENCIES: Include the dependency files if we should
1772 ###############################################################################
1773 ifndef DISABLE_AUTO_DEPENDENCIES
1774
1775 # If its not one of the cleaning targets
1776 ifndef IS_CLEANING_TARGET
1777
1778 # Get the list of dependency files
1779 DependSourceFiles := $(basename $(filter %.cpp %.c %.cc %.m %.mm, $(Sources)))
1780 DependFiles := $(DependSourceFiles:%=$(PROJ_OBJ_DIR)/$(BuildMode)/%.d)
1781
1782 -include $(DependFiles) ""
1783
1784 endif
1785
1786 endif
1787
1788 ###############################################################################
1789 # CHECK: Running the test suite
1790 ###############################################################################
1791
1792 check::
1793 $(Verb) if test -d "$(PROJ_OBJ_ROOT)/test" ; then \
1794 if test -f "$(PROJ_OBJ_ROOT)/test/Makefile" ; then \
1795 $(EchoCmd) Running test suite ; \
1796 $(MAKE) -C $(PROJ_OBJ_ROOT)/test check-local \
1797 TESTSUITE=$(TESTSUITE) ; \
1798 else \
1799 $(EchoCmd) No Makefile in test directory ; \
1800 fi ; \
1801 else \
1802 $(EchoCmd) No test directory ; \
1803 fi
1804
1805 # An alias dating from when both lit and DejaGNU test runners were used.
1806 check-lit:: check
1807
1808 check-all::
1809 $(Verb) if test -d "$(PROJ_OBJ_ROOT)/test" ; then \
1810 if test -f "$(PROJ_OBJ_ROOT)/test/Makefile" ; then \
1811 $(EchoCmd) Running test suite ; \
1812 $(MAKE) -C $(PROJ_OBJ_ROOT)/test check-local-all ; \
1813 else \
1814 $(EchoCmd) No Makefile in test directory ; \
1815 fi ; \
1816 else \
1817 $(EchoCmd) No test directory ; \
1818 fi
1819
1820 ###############################################################################
1821 # UNITTESTS: Running the unittests test suite
1822 ###############################################################################
1823
1824 unittests::
1825 $(Verb) if test -d "$(PROJ_OBJ_ROOT)/unittests" ; then \
1826 if test -f "$(PROJ_OBJ_ROOT)/unittests/Makefile" ; then \
1827 $(EchoCmd) Running unittests test suite ; \
1828 $(MAKE) -C $(PROJ_OBJ_ROOT)/unittests unitcheck; \
1829 else \
1830 $(EchoCmd) No Makefile in unittests directory ; \
1831 fi ; \
1832 else \
1833 $(EchoCmd) No unittests directory ; \
1834 fi
1835
1836 ###############################################################################
1837 # DISTRIBUTION: Handle construction of a distribution tarball
1838 ###############################################################################
1839
1840 #------------------------------------------------------------------------
1841 # Define distribution related variables
1842 #------------------------------------------------------------------------
1843 DistName := $(PROJECT_NAME)-$(PROJ_VERSION)
1844 DistDir := $(PROJ_OBJ_ROOT)/$(DistName)
1845 TopDistDir := $(PROJ_OBJ_ROOT)/$(DistName)
1846 DistTarGZip := $(PROJ_OBJ_ROOT)/$(DistName).tar.gz
1847 DistZip := $(PROJ_OBJ_ROOT)/$(DistName).zip
1848 DistTarBZ2 := $(PROJ_OBJ_ROOT)/$(DistName).tar.bz2
1849 DistAlways := CREDITS.TXT LICENSE.TXT README.txt README AUTHORS COPYING \
1850 ChangeLog INSTALL NEWS Makefile Makefile.common Makefile.rules \
1851 Makefile.config.in configure autoconf
1852 DistOther := $(notdir $(wildcard \
1853 $(PROJ_SRC_DIR)/*.h \
1854 $(PROJ_SRC_DIR)/*.td \
1855 $(PROJ_SRC_DIR)/*.def \
1856 $(PROJ_SRC_DIR)/*.ll \
1857 $(PROJ_SRC_DIR)/*.in))
1858 DistSubDirs := $(SubDirs)
1859 DistSources = $(Sources) $(EXTRA_DIST)
1860 DistFiles = $(DistAlways) $(DistSources) $(DistOther)
1861
1862 #------------------------------------------------------------------------
1863 # We MUST build distribution with OBJ_DIR != SRC_DIR
1864 #------------------------------------------------------------------------
1865 ifeq ($(PROJ_SRC_DIR),$(PROJ_OBJ_DIR))
1866 dist dist-check dist-clean dist-gzip dist-bzip2 dist-zip ::
1867 $(Echo) ERROR: Target $@ only available with OBJ_DIR != SRC_DIR
1868
1869 else
1870
1871 #------------------------------------------------------------------------
1872 # Prevent attempt to run dist targets from anywhere but the top level
1873 #------------------------------------------------------------------------
1874 ifneq ($(LEVEL),.)
1875 dist dist-check dist-clean dist-gzip dist-bzip2 dist-zip ::
1876 $(Echo) ERROR: You must run $@ from $(PROJ_OBJ_ROOT)
1877 else
1878
1879 #------------------------------------------------------------------------
1880 # Provide the top level targets
1881 #------------------------------------------------------------------------
1882
1883 dist-gzip:: $(DistTarGZip)
1884
1885 $(DistTarGZip) : $(TopDistDir)/.makedistdir
1886 $(Echo) Packing gzipped distribution tar file.
1887 $(Verb) cd $(PROJ_OBJ_ROOT) ; $(TAR) chf - "$(DistName)" | \
1888 $(GZIP) -c > "$(DistTarGZip)"
1889
1890 dist-bzip2:: $(DistTarBZ2)
1891
1892 $(DistTarBZ2) : $(TopDistDir)/.makedistdir
1893 $(Echo) Packing bzipped distribution tar file.
1894 $(Verb) cd $(PROJ_OBJ_ROOT) ; $(TAR) chf - $(DistName) | \
1895 $(BZIP2) -c >$(DistTarBZ2)
1896
1897 dist-zip:: $(DistZip)
1898
1899 $(DistZip) : $(TopDistDir)/.makedistdir
1900 $(Echo) Packing zipped distribution file.
1901 $(Verb) rm -f $(DistZip)
1902 $(Verb) cd $(PROJ_OBJ_ROOT) ; $(ZIP) -rq $(DistZip) $(DistName)
1903
1904 dist :: $(DistTarGZip) $(DistTarBZ2) $(DistZip)
1905 $(Echo) ===== DISTRIBUTION PACKAGING SUCCESSFUL =====
1906
1907 DistCheckDir := $(PROJ_OBJ_ROOT)/_distcheckdir
1908
1909 dist-check:: $(DistTarGZip)
1910 $(Echo) Checking distribution tar file.
1911 $(Verb) if test -d $(DistCheckDir) ; then \
1912 $(RM) -rf $(DistCheckDir) ; \
1913 fi
1914 $(Verb) $(MKDIR) $(DistCheckDir)
1915 $(Verb) cd $(DistCheckDir) && \
1916 $(MKDIR) $(DistCheckDir)/build && \
1917 $(MKDIR) $(DistCheckDir)/install && \
1918 gunzip -c $(DistTarGZip) | $(TAR) xf - && \
1919 cd build && \
1920 ../$(DistName)/configure --prefix="$(DistCheckDir)/install" \
1921 --srcdir=../$(DistName) $(DIST_CHECK_CONFIG_OPTIONS) && \
1922 $(MAKE) all && \
1923 $(MAKE) check && \
1924 $(MAKE) unittests && \
1925 $(MAKE) install && \
1926 $(MAKE) uninstall && \
1927 $(MAKE) dist-clean && \
1928 $(EchoCmd) ===== $(DistTarGZip) Ready For Distribution =====
1929
1930 dist-clean::
1931 $(Echo) Cleaning distribution files
1932 -$(Verb) $(RM) -rf $(DistTarGZip) $(DistTarBZ2) $(DistZip) $(DistName) \
1933 $(DistCheckDir)
1934
1935 endif
1936
1937 #------------------------------------------------------------------------
1938 # Provide the recursive distdir target for building the distribution directory
1939 #------------------------------------------------------------------------
1940 distdir: $(DistDir)/.makedistdir
1941 $(DistDir)/.makedistdir: $(DistSources)
1942 $(Verb) if test "$(DistDir)" = "$(TopDistDir)" ; then \
1943 if test -d "$(DistDir)" ; then \
1944 find $(DistDir) -type d ! -perm -200 -exec chmod u+w {} ';' || \
1945 exit 1 ; \
1946 fi ; \
1947 $(EchoCmd) Removing old $(DistDir) ; \
1948 $(RM) -rf $(DistDir); \
1949 $(EchoCmd) Making 'all' to verify build ; \
1950 $(MAKE) ENABLE_OPTIMIZED=1 all ; \
1951 fi
1952 $(Echo) Building Distribution Directory $(DistDir)
1953 $(Verb) $(MKDIR) $(DistDir)
1954 $(Verb) srcdirstrip=`echo "$(PROJ_SRC_DIR)" | sed 's|.|.|g'`; \
1955 srcrootstrip=`echo "$(PROJ_SRC_ROOT)" | sed 's|.|.|g'`; \
1956 for file in $(DistFiles) ; do \
1957 case "$$file" in \
1958 $(PROJ_SRC_DIR)/*) \
1959 file=`echo "$$file" | sed "s#^$$srcdirstrip/##"` \
1960 ;; \
1961 $(PROJ_SRC_ROOT)/*) \
1962 file=`echo "$$file" | \
1963 sed "s#^$$srcrootstrip/##"` \
1964 ;; \
1965 esac; \
1966 if test -f "$(PROJ_SRC_DIR)/$$file" || \
1967 test -d "$(PROJ_SRC_DIR)/$$file" ; then \
1968 from_dir="$(PROJ_SRC_DIR)" ; \
1969 elif test -f "$$file" || test -d "$$file" ; then \
1970 from_dir=. ; \
1971 fi ; \
1972 to_dir=`echo "$$file" | sed -e 's#/[^/]*$$##'` ; \
1973 if test "$$to_dir" != "$$file" && test "$$to_dir" != "."; then \
1974 to_dir="$(DistDir)/$$dir"; \
1975 $(MKDIR) "$$to_dir" ; \
1976 else \
1977 to_dir="$(DistDir)"; \
1978 fi; \
1979 mid_dir=`echo "$$file" | sed -n -e 's#^\(.*\)/[^/]*$$#\1#p'`; \
1980 if test -n "$$mid_dir" ; then \
1981 $(MKDIR) "$$to_dir/$$mid_dir" || exit 1; \
1982 fi ; \
1983 if test -d "$$from_dir/$$file"; then \
1984 if test -d "$(PROJ_SRC_DIR)/$$file" && \
1985 test "$$from_dir" != "$(PROJ_SRC_DIR)" ; then \
1986 cd $(PROJ_SRC_DIR) ; \
1987 $(TAR) cf - $$file --exclude .svn --exclude CVS | \
1988 ( cd $$to_dir ; $(TAR) xf - ) ; \
1989 cd $(PROJ_OBJ_DIR) ; \
1990 else \
1991 cd $$from_dir ; \
1992 $(TAR) cf - $$file --exclude .svn --exclude CVS | \
1993 ( cd $$to_dir ; $(TAR) xf - ) ; \
1994 cd $(PROJ_OBJ_DIR) ; \
1995 fi; \
1996 elif test -f "$$from_dir/$$file" ; then \
1997 $(CP) -p "$$from_dir/$$file" "$(DistDir)/$$file" || exit 1; \
1998 elif test -L "$$from_dir/$$file" ; then \
1999 $(CP) -pd "$$from_dir/$$file" $(DistDir)/$$file || exit 1; \
2000 elif echo "$(DistAlways)" | grep -v "$$file" >/dev/null ; then \
2001 $(EchoCmd) "===== WARNING: Distribution Source " \
2002 "$$from_dir/$$file Not Found!" ; \
2003 elif test "$(Verb)" != '@' ; then \
2004 $(EchoCmd) "Skipping non-existent $$from_dir/$$file" ; \
2005 fi; \
2006 done
2007 $(Verb) for subdir in $(DistSubDirs) ; do \
2008 if test "$$subdir" \!= "." ; then \
2009 new_distdir="$(DistDir)/$$subdir" ; \
2010 test -d "$$new_distdir" || $(MKDIR) "$$new_distdir" || exit 1; \
2011 ( cd $$subdir && $(MAKE) ENABLE_OPTIMIZED=1 \
2012 DistDir="$$new_distdir" distdir ) || exit 1; \
2013 fi; \
2014 done
2015 $(Verb) if test "$(DistDir)" = "$(TopDistDir)" ; then \
2016 $(EchoCmd) Eliminating CVS/.svn directories from distribution ; \
2017 $(RM) -rf `find $(TopDistDir) -type d \( -name CVS -o \
2018 -name .svn \) -print` ;\
2019 $(MAKE) dist-hook ; \
2020 $(FIND) $(TopDistDir) -type d ! -perm -777 -exec chmod a+rwx {} \; \
2021 -o ! -type d ! -perm -444 -links 1 -exec chmod a+r {} \; \
2022 -o ! -type d ! -perm -400 -exec chmod a+r {} \; \
2023 -o ! -type d ! -perm -444 -exec \
2024 $(SHELL) $(INSTALL_SH) -c -m a+r {} {} \; \
2025 || chmod -R a+r $(DistDir) ; \
2026 fi
2027
2028 # This is invoked by distdir target, define it as a no-op to avoid errors if not
2029 # defined by user.
2030 dist-hook::
2031
2032 endif
2033
2034 ###############################################################################
2035 # TOP LEVEL - targets only to apply at the top level directory
2036 ###############################################################################
2037
2038 ifeq ($(LEVEL),.)
2039
2040 #------------------------------------------------------------------------
2041 # Install support for the project's include files:
2042 #------------------------------------------------------------------------
2043 ifdef NO_INSTALL
2044 install-local::
2045 $(Echo) Install circumvented with NO_INSTALL
2046 uninstall-local::
2047 $(Echo) Uninstall circumvented with NO_INSTALL
2048 else
2049 install-local::
2050 $(Echo) Installing include files
2051 $(Verb) $(MKDIR) $(DESTDIR)$(PROJ_includedir)
2052 $(Verb) if test -d "$(PROJ_SRC_ROOT)/include" ; then \
2053 cd $(PROJ_SRC_ROOT)/include && \
2054 for hdr in `find . -type f \
2055 '(' -name LICENSE.TXT \
2056 -o -name '*.def' \
2057 -o -name '*.h' \
2058 -o -name '*.inc' \
2059 -o -name '*.td' \
2060 ')' -print | grep -v CVS | \
2061 grep -v .svn` ; do \
2062 instdir=`dirname "$(DESTDIR)$(PROJ_includedir)/$$hdr"` ; \
2063 if test \! -d "$$instdir" ; then \
2064 $(EchoCmd) Making install directory $$instdir ; \
2065 $(MKDIR) $$instdir ;\
2066 fi ; \
2067 $(DataInstall) $$hdr $(DESTDIR)$(PROJ_includedir)/$$hdr ; \
2068 done ; \
2069 fi
2070 ifneq ($(PROJ_SRC_ROOT),$(PROJ_OBJ_ROOT))
2071 $(Verb) if test -d "$(PROJ_OBJ_ROOT)/include" ; then \
2072 cd $(PROJ_OBJ_ROOT)/include && \
2073 for hdr in `find . -type f \
2074 '(' -name LICENSE.TXT \
2075 -o -name '*.def' \
2076 -o -name '*.h' \
2077 -o -name '*.inc' \
2078 -o -name '*.td' \
2079 ')' -print | grep -v CVS | \
2080 grep -v .svn` ; do \
2081 instdir=`dirname "$(DESTDIR)$(PROJ_includedir)/$$hdr"` ; \
2082 if test \! -d "$$instdir" ; then \
2083 $(EchoCmd) Making install directory $$instdir ; \
2084 $(MKDIR) $$instdir ;\
2085 fi ; \
2086 $(DataInstall) $$hdr $(DESTDIR)$(PROJ_includedir)/$$hdr ; \
2087 done ; \
2088 fi
2089 endif
2090
2091 uninstall-local::
2092 $(Echo) Uninstalling include files
2093 $(Verb) if [ -d "$(PROJ_SRC_ROOT)/include" ] ; then \
2094 cd $(PROJ_SRC_ROOT)/include && \
2095 $(RM) -f `find . -path '*/Internal' -prune -o '(' -type f \
2096 '!' '(' -name '*~' -o -name '.#*' \
2097 -o -name '*.in' ')' -print ')' | \
2098 grep -v CVS | sed 's#^#$(DESTDIR)$(PROJ_includedir)/#'` ; \
2099 cd $(PROJ_SRC_ROOT)/include && \
2100 $(RM) -f `find . -path '*/Internal' -prune -o '(' -type f -name '*.in' \
2101 -print ')' | sed 's#\.in$$##;s#^#$(DESTDIR)$(PROJ_includedir)/#'` ; \
2102 fi
2103 endif
2104 endif
2105
2106 check-line-length:
2107 @echo searching for overlength lines in files: $(Sources)
2108 @echo
2109 @echo
2110 egrep -n '.{81}' $(Sources) /dev/null
2111
2112 check-for-tabs:
2113 @echo searching for tabs in files: $(Sources)
2114 @echo
2115 @echo
2116 egrep -n ' ' $(Sources) /dev/null
2117
2118 check-footprint:
2119 @ls -l $(LibDir) | awk '\
2120 BEGIN { sum = 0; } \
2121 { sum += $$5; } \
2122 END { printf("Libraries: %6.3f MBytes\n", sum/(1024.0*1024.0)); }'
2123 @ls -l $(ToolDir) | awk '\
2124 BEGIN { sum = 0; } \
2125 { sum += $$5; } \
2126 END { printf("Programs: %6.3f MBytes\n", sum/(1024.0*1024.0)); }'
2127 #------------------------------------------------------------------------
2128 # Print out the directories used for building
2129 #------------------------------------------------------------------------
2130 printvars::
2131 $(Echo) "BuildMode : " '$(BuildMode)'
2132 $(Echo) "PROJ_SRC_ROOT: " '$(PROJ_SRC_ROOT)'
2133 $(Echo) "PROJ_SRC_DIR : " '$(PROJ_SRC_DIR)'
2134 $(Echo) "PROJ_OBJ_ROOT: " '$(PROJ_OBJ_ROOT)'
2135 $(Echo) "PROJ_OBJ_DIR : " '$(PROJ_OBJ_DIR)'
2136 $(Echo) "LLVM_SRC_ROOT: " '$(LLVM_SRC_ROOT)'
2137 $(Echo) "LLVM_OBJ_ROOT: " '$(LLVM_OBJ_ROOT)'
2138 $(Echo) "PROJ_prefix : " '$(PROJ_prefix)'
2139 $(Echo) "PROJ_internal_prefix : " '$(PROJ_internal_prefix)'
2140 $(Echo) "PROJ_bindir : " '$(PROJ_bindir)'
2141 $(Echo) "PROJ_libdir : " '$(PROJ_libdir)'
2142 $(Echo) "PROJ_etcdir : " '$(PROJ_etcdir)'
2143 $(Echo) "PROJ_includedir : " '$(PROJ_includedir)'
2144 $(Echo) "UserTargets : " '$(UserTargets)'
2145 $(Echo) "ObjMakefiles : " '$(ObjMakefiles)'
2146 $(Echo) "SrcMakefiles : " '$(SrcMakefiles)'
2147 $(Echo) "ObjDir : " '$(ObjDir)'
2148 $(Echo) "LibDir : " '$(LibDir)'
2149 $(Echo) "LibexecDir : " '$(LibexecDir)'
2150 $(Echo) "ShareDir : " '$(ShareDir)'
2151 $(Echo) "ToolDir : " '$(ToolDir)'
2152 $(Echo) "ExmplDir : " '$(ExmplDir)'
2153 $(Echo) "Sources : " '$(Sources)'
2154 $(Echo) "TDFiles : " '$(TDFiles)'
2155 $(Echo) "INCFiles : " '$(INCFiles)'
2156 $(Echo) "INCTMPFiles : " '$(INCTMPFiles)'
2157 $(Echo) "PreConditions: " '$(PreConditions)'
2158 $(Echo) "Compile.CXX : " '$(Compile.CXX)'
2159 $(Echo) "Compile.C : " '$(Compile.C)'
2160 $(Echo) "Archive : " '$(Archive)'
2161 $(Echo) "YaccFiles : " '$(YaccFiles)'
2162 $(Echo) "LexFiles : " '$(LexFiles)'
2163 $(Echo) "Module : " '$(Module)'
2164 $(Echo) "FilesToConfig: " '$(FilesToConfigPATH)'
2165 $(Echo) "SubDirs : " '$(SubDirs)'
2166 $(Echo) "ProjLibsPaths: " '$(ProjLibsPaths)'
2167 $(Echo) "ProjLibsOptions: " '$(ProjLibsOptions)'
2168
2169 ###
2170 # Debugging
2171
2172 # General debugging rule, use 'make dbg-print-XXX' to print the
2173 # definition, value and origin of XXX.
2174 make-print-%:
2175 $(error PRINT: $(value $*) = "$($*)" (from $(origin $*)))
+0
-54
autoconf/AutoRegen.sh less more
None #!/bin/bash
1
2 die() {
3 echo "$@" 1>&2
4 exit 1
5 }
6
7 clean() {
8 echo $1 | sed -e 's/\\//g'
9 }
10
11 ### NOTE: ############################################################
12 ### These variables specify the tool versions we want to use.
13 ### Periods should be escaped with backslash for use by grep.
14 ###
15 ### If you update these, please also update docs/GettingStarted.rst
16 want_autoconf_version='2\.60'
17 want_autoheader_version=$want_autoconf_version
18 want_aclocal_version='1\.9\.6'
19 ### END NOTE #########################################################
20
21 outfile=configure
22 configfile=configure.ac
23
24 want_autoconf_version_clean=$(clean $want_autoconf_version)
25 want_autoheader_version_clean=$(clean $want_autoheader_version)
26 want_aclocal_version_clean=$(clean $want_aclocal_version)
27
28 test -d autoconf && test -f autoconf/$configfile && cd autoconf
29 test -f $configfile || die "Can't find 'autoconf' dir; please cd into it first"
30 autoconf --version | grep $want_autoconf_version > /dev/null
31 test $? -eq 0 || die "Your autoconf was not detected as being $want_autoconf_version_clean"
32 aclocal --version | grep '^aclocal.*'$want_aclocal_version > /dev/null
33 test $? -eq 0 || die "Your aclocal was not detected as being $want_aclocal_version_clean"
34 autoheader --version | grep '^autoheader.*'$want_autoheader_version > /dev/null
35 test $? -eq 0 || die "Your autoheader was not detected as being $want_autoheader_version_clean"
36 echo ""
37 echo "### NOTE: ############################################################"
38 echo "### If you get *any* warnings from autoconf below you MUST fix the"
39 echo "### scripts in the m4 directory because there are future forward"
40 echo "### compatibility or platform support issues at risk. Please do NOT"
41 echo "### commit any configure script that was generated with warnings"
42 echo "### present. You should get just three 'Regenerating..' lines."
43 echo "######################################################################"
44 echo ""
45 echo "Regenerating aclocal.m4 with aclocal $want_aclocal_version_clean"
46 cwd=`pwd`
47 aclocal --force -I $cwd/m4 || die "aclocal failed"
48 echo "Regenerating configure with autoconf $want_autoconf_version_clean"
49 autoconf --force --warnings=all -o ../$outfile $configfile || die "autoconf failed"
50 cd ..
51 echo "Regenerating config.h.in with autoheader $want_autoheader_version_clean"
52 autoheader --warnings=all -I autoconf -I autoconf/m4 autoconf/$configfile || die "autoheader failed"
53 exit 0
+0
-7
autoconf/ExportMap.map less more
None {
1 global: main;
2 __progname;
3 environ;
4
5 local: *;
6 };
+0
-24
autoconf/LICENSE.TXT less more
None ------------------------------------------------------------------------------
1 Autoconf Files
2 ------------------------------------------------------------------------------
3 All autoconf files are licensed under the LLVM license with the following
4 additions:
5
6 llvm/autoconf/install-sh:
7 This script is licensed under the LLVM license, with the following
8 additional copyrights and restrictions:
9
10 Copyright 1991 by the Massachusetts Institute of Technology
11
12 Permission to use, copy, modify, distribute, and sell this software and its
13 documentation for any purpose is hereby granted without fee, provided that
14 the above copyright notice appear in all copies and that both that
15 copyright notice and this permission notice appear in supporting
16 documentation, and that the name of M.I.T. not be used in advertising or
17 publicity pertaining to distribution of the software without specific,
18 written prior permission. M.I.T. makes no representations about the
19 suitability of this software for any purpose. It is provided "as is"
20 without express or implied warranty.
21
22 Please see the source files for additional copyrights.
23
+0
-14
autoconf/README.TXT less more
None Upgrading autoconf
1 ===============================================================================
2
3 If you are in the mood to upgrade autoconf, you should:
4
5 1. Consider not upgrading.
6 2. No really, this is a hassle, you don't want to do it.
7 3. Get the new version of autoconf and put it in
8 4. configure/build/install autoconf with --prefix=
9 5. Run autoupdate on all the m4 macros in llvm/autoconf/m4
10 6. Run autoupdate on llvm/autoconf/configure.ac
11 7. Regenerate configure script with AutoRegen.sh
12 8. If there are any warnings from AutoRegen.sh, fix them and go to step 7.
13 9. Test, test, test.
+0
-1529
autoconf/config.guess less more
<
None #! /bin/sh
1 # Attempt to guess a canonical system name.
2 # Copyright (C) 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999,
3 # 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010,
4 # 2011 Free Software Foundation, Inc.
5
6 timestamp='2011-08-20'
7
8 # This file is free software; you can redistribute it and/or modify it
9 # under the terms of the GNU General Public License as published by
10 # the Free Software Foundation; either version 2 of the License, or
11 # (at your option) any later version.
12 #
13 # This program is distributed in the hope that it will be useful, but
14 # WITHOUT ANY WARRANTY; without even the implied warranty of
15 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
16 # General Public License for more details.
17 #
18 # You should have received a copy of the GNU General Public License
19 # along with this program; if not, write to the Free Software
20 # Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston, MA
21 # 02110-1301, USA.
22 #
23 # As a special exception to the GNU General Public License, if you
24 # distribute this file as part of a program that contains a
25 # configuration script generated by Autoconf, you may include it under
26 # the same distribution terms that you use for the rest of that program.
27
28
29 # Originally written by Per Bothner. Please send patches (context
30 # diff format) to and include a ChangeLog
31 # entry.
32 #
33 # This script attempts to guess a canonical system name similar to
34 # config.sub. If it succeeds, it prints the system name on stdout, and
35 # exits with 0. Otherwise, it exits with 1.
36 #
37 # You can get the latest version of this script from:
38 # http://git.savannah.gnu.org/gitweb/?p=config.git;a=blob_plain;f=config.guess;hb=HEAD
39
40 me=`echo "$0" | sed -e 's,.*/,,'`
41
42 usage="\
43 Usage: $0 [OPTION]
44
45 Output the configuration name of the system \`$me' is run on.
46
47 Operation modes:
48 -h, --help print this help, then exit
49 -t, --time-stamp print date of last modification, then exit
50 -v, --version print version number, then exit
51
52 Report bugs and patches to ."
53
54 version="\
55 GNU config.guess ($timestamp)
56
57 Originally written by Per Bothner.
58 Copyright (C) 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999, 2000,
59 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011 Free
60 Software Foundation, Inc.
61
62 This is free software; see the source for copying conditions. There is NO
63 warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE."
64
65 help="
66 Try \`$me --help' for more information."
67
68 # Parse command line
69 while test $# -gt 0 ; do
70 case $1 in
71 --time-stamp | --time* | -t )
72 echo "$timestamp" ; exit ;;
73 --version | -v )
74 echo "$version" ; exit ;;
75 --help | --h* | -h )
76 echo "$usage"; exit ;;
77 -- ) # Stop option processing
78 shift; break ;;
79 - ) # Use stdin as input.
80 break ;;
81 -* )
82 echo "$me: invalid option $1$help" >&2
83 exit 1 ;;
84 * )
85 break ;;
86 esac
87 done
88
89 if test $# != 0; then
90 echo "$me: too many arguments$help" >&2
91 exit 1
92 fi
93
94 trap 'exit 1' 1 2 15
95
96 # CC_FOR_BUILD -- compiler used by this script. Note that the use of a
97 # compiler to aid in system detection is discouraged as it requires
98 # temporary files to be created and, as you can see below, it is a
99 # headache to deal with in a portable fashion.
100
101 # Historically, `CC_FOR_BUILD' used to be named `HOST_CC'. We still
102 # use `HOST_CC' if defined, but it is deprecated.
103
104 # Portable tmp directory creation inspired by the Autoconf team.
105
106 set_cc_for_build='
107 trap "exitcode=\$?; (rm -f \$tmpfiles 2>/dev/null; rmdir \$tmp 2>/dev/null) && exit \$exitcode" 0 ;
108 trap "rm -f \$tmpfiles 2>/dev/null; rmdir \$tmp 2>/dev/null; exit 1" 1 2 13 15 ;
109 : ${TMPDIR=/tmp} ;
110 { tmp=`(umask 077 && mktemp -d "$TMPDIR/cgXXXXXX") 2>/dev/null` && test -n "$tmp" && test -d "$tmp" ; } ||
111 { test -n "$RANDOM" && tmp=$TMPDIR/cg$$-$RANDOM && (umask 077 && mkdir $tmp) ; } ||
112 { tmp=$TMPDIR/cg-$$ && (umask 077 && mkdir $tmp) && echo "Warning: creating insecure temp directory" >&2 ; } ||
113 { echo "$me: cannot create a temporary directory in $TMPDIR" >&2 ; exit 1 ; } ;
114 dummy=$tmp/dummy ;
115 tmpfiles="$dummy.c $dummy.o $dummy.rel $dummy" ;
116 case $CC_FOR_BUILD,$HOST_CC,$CC in
117 ,,) echo "int x;" > $dummy.c ;
118 for c in cc gcc c89 c99 ; do
119 if ($c -c -o $dummy.o $dummy.c) >/dev/null 2>&1 ; then
120 CC_FOR_BUILD="$c"; break ;
121 fi ;
122 done ;
123 if test x"$CC_FOR_BUILD" = x ; then
124 CC_FOR_BUILD=no_compiler_found ;
125 fi
126 ;;
127 ,,*) CC_FOR_BUILD=$CC ;;
128 ,*,*) CC_FOR_BUILD=$HOST_CC ;;
129 esac ; set_cc_for_build= ;'
130
131 # This is needed to find uname on a Pyramid OSx when run in the BSD universe.
132 # (ghazi@noc.rutgers.edu 1994-08-24)
133 if (test -f /.attbin/uname) >/dev/null 2>&1 ; then
134 PATH=$PATH:/.attbin ; export PATH
135 fi
136
137 UNAME_MACHINE=`(uname -m) 2>/dev/null` || UNAME_MACHINE=unknown
138 UNAME_RELEASE=`(uname -r) 2>/dev/null` || UNAME_RELEASE=unknown
139 UNAME_SYSTEM=`(uname -s) 2>/dev/null` || UNAME_SYSTEM=unknown
140 UNAME_VERSION=`(uname -v) 2>/dev/null` || UNAME_VERSION=unknown
141
142 # Note: order is significant - the case branches are not exclusive.
143
144 case "${UNAME_MACHINE}:${UNAME_SYSTEM}:${UNAME_RELEASE}:${UNAME_VERSION}" in
145 *:NetBSD:*:*)
146 # NetBSD (nbsd) targets should (where applicable) match one or
147 # more of the tupples: *-*-netbsdelf*, *-*-netbsdaout*,
148 # *-*-netbsdecoff* and *-*-netbsd*. For targets that recently
149 # switched to ELF, *-*-netbsd* would select the old
150 # object file format. This provides both forward
151 # compatibility and a consistent mechanism for selecting the
152 # object file format.
153 #
154 # Note: NetBSD doesn't particularly care about the vendor
155 # portion of the name. We always set it to "unknown".
156 sysctl="sysctl -n hw.machine_arch"
157 UNAME_MACHINE_ARCH=`(/sbin/$sysctl 2>/dev/null || \
158 /usr/sbin/$sysctl 2>/dev/null || echo unknown)`
159 case "${UNAME_MACHINE_ARCH}" in
160 armeb) machine=armeb-unknown ;;
161 arm*) machine=arm-unknown ;;
162 sh3el) machine=shl-unknown ;;
163 sh3eb) machine=sh-unknown ;;
164 sh5el) machine=sh5le-unknown ;;
165 *) machine=${UNAME_MACHINE_ARCH}-unknown ;;
166 esac
167 # The Operating System including object format, if it has switched
168 # to ELF recently, or will in the future.
169 case "${UNAME_MACHINE_ARCH}" in
170 arm*|i386|m68k|ns32k|sh3*|sparc|vax)
171 eval $set_cc_for_build
172 if echo __ELF__ | $CC_FOR_BUILD -E - 2>/dev/null \
173 | grep -q __ELF__
174 then
175 # Once all utilities can be ECOFF (netbsdecoff) or a.out (netbsdaout).
176 # Return netbsd for either. FIX?
177 os=netbsd
178 else
179 os=netbsdelf
180 fi
181 ;;
182 *)
183 os=netbsd
184 ;;
185 esac
186 # The OS release
187 # Debian GNU/NetBSD machines have a different userland, and
188 # thus, need a distinct triplet. However, they do not need
189 # kernel version information, so it can be replaced with a
190 # suitable tag, in the style of linux-gnu.
191 case "${UNAME_VERSION}" in
192 Debian*)
193 release='-gnu'
194 ;;
195 *)
196 release=`echo ${UNAME_RELEASE}|sed -e 's/[-_].*/\./'`
197 ;;
198 esac
199 # Since CPU_TYPE-MANUFACTURER-KERNEL-OPERATING_SYSTEM:
200 # contains redundant information, the shorter form:
201 # CPU_TYPE-MANUFACTURER-OPERATING_SYSTEM is used.
202 echo "${machine}-${os}${release}"
203 exit ;;
204 *:OpenBSD:*:*)
205 UNAME_MACHINE_ARCH=`arch | sed 's/OpenBSD.//'`
206 echo ${UNAME_MACHINE_ARCH}-unknown-openbsd${UNAME_RELEASE}
207 exit ;;
208 *:Bitrig:*:*)
209 UNAME_MACHINE_ARCH=`arch | sed 's/Bitrig.//'`
210 echo ${UNAME_MACHINE_ARCH}-unknown-bitrig${UNAME_RELEASE}
211 exit ;;
212 *:ekkoBSD:*:*)
213 echo ${UNAME_MACHINE}-unknown-ekkobsd${UNAME_RELEASE}
214 exit ;;
215 *:SolidBSD:*:*)
216 echo ${UNAME_MACHINE}-unknown-solidbsd${UNAME_RELEASE}
217 exit ;;
218 macppc:MirBSD:*:*)
219 echo powerpc-unknown-mirbsd${UNAME_RELEASE}
220 exit ;;
221 *:MirBSD:*:*)
222 echo ${UNAME_MACHINE}-unknown-mirbsd${UNAME_RELEASE}
223 exit ;;
224 alpha:OSF1:*:*)
225 case $UNAME_RELEASE in
226 *4.0)
227 UNAME_RELEASE=`/usr/sbin/sizer -v | awk '{print $3}'`
228 ;;
229 *5.*)
230 UNAME_RELEASE=`/usr/sbin/sizer -v | awk '{print $4}'`
231 ;;
232 esac
233 # According to Compaq, /usr/sbin/psrinfo has been available on
234 # OSF/1 and Tru64 systems produced since 1995. I hope that
235 # covers most systems running today. This code pipes the CPU
236 # types through head -n 1, so we only detect the type of CPU 0.
237 ALPHA_CPU_TYPE=`/usr/sbin/psrinfo -v | sed -n -e 's/^ The alpha \(.*\) processor.*$/\1/p' | head -n 1`
238 case "$ALPHA_CPU_TYPE" in
239 "EV4 (21064)")
240 UNAME_MACHINE="alpha" ;;
241 "EV4.5 (21064)")
242 UNAME_MACHINE="alpha" ;;
243 "LCA4 (21066/21068)")
244 UNAME_MACHINE="alpha" ;;
245 "EV5 (21164)")
246 UNAME_MACHINE="alphaev5" ;;
247 "EV5.6 (21164A)")
248 UNAME_MACHINE="alphaev56" ;;
249 "EV5.6 (21164PC)")
250 UNAME_MACHINE="alphapca56" ;;
251 "EV5.7 (21164PC)")
252 UNAME_MACHINE="alphapca57" ;;
253 "EV6 (21264)")
254 UNAME_MACHINE="alphaev6" ;;
255 "EV6.7 (21264A)")
256 UNAME_MACHINE="alphaev67" ;;
257 "EV6.8CB (21264C)")
258 UNAME_MACHINE="alphaev68" ;;
259 "EV6.8AL (21264B)")
260 UNAME_MACHINE="alphaev68" ;;
261 "EV6.8CX (21264D)")
262 UNAME_MACHINE="alphaev68" ;;
263 "EV6.9A (21264/EV69A)")
264 UNAME_MACHINE="alphaev69" ;;
265 "EV7 (21364)")
266 UNAME_MACHINE="alphaev7" ;;
267 "EV7.9 (21364A)")
268 UNAME_MACHINE="alphaev79" ;;
269 esac
270 # A Pn.n version is a patched version.
271 # A Vn.n version is a released version.
272 # A Tn.n version is a released field test version.
273 # A Xn.n version is an unreleased experimental baselevel.
274 # 1.2 uses "1.2" for uname -r.
275 echo ${UNAME_MACHINE}-dec-osf`echo ${UNAME_RELEASE} | sed -e 's/^[PVTX]//' | tr 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvwxyz'`
276 # Reset EXIT trap before exiting to avoid spurious non-zero exit code.
277 exitcode=$?
278 trap '' 0
279 exit $exitcode ;;
280 Alpha\ *:Windows_NT*:*)
281 # How do we know it's Interix rather than the generic POSIX subsystem?
282 # Should we change UNAME_MACHINE based on the output of uname instead
283 # of the specific Alpha model?
284 echo alpha-pc-interix
285 exit ;;
286 21064:Windows_NT:50:3)
287 echo alpha-dec-winnt3.5
288 exit ;;
289 Amiga*:UNIX_System_V:4.0:*)
290 echo m68k-unknown-sysv4
291 exit ;;
292 *:[Aa]miga[Oo][Ss]:*:*)
293 echo ${UNAME_MACHINE}-unknown-amigaos
294 exit ;;
295 *:[Mm]orph[Oo][Ss]:*:*)
296 echo ${UNAME_MACHINE}-unknown-morphos
297 exit ;;
298 *:OS/390:*:*)
299 echo i370-ibm-openedition
300 exit ;;
301 *:z/VM:*:*)
302 echo s390-ibm-zvmoe
303 exit ;;
304 *:OS400:*:*)
305 echo powerpc-ibm-os400
306 exit ;;
307 arm:RISC*:1.[012]*:*|arm:riscix:1.[012]*:*)
308 echo arm-acorn-riscix${UNAME_RELEASE}
309 exit ;;
310 arm:riscos:*:*|arm:RISCOS:*:*)
311 echo arm-unknown-riscos
312 exit ;;
313 SR2?01:HI-UX/MPP:*:* | SR8000:HI-UX/MPP:*:*)
314 echo hppa1.1-hitachi-hiuxmpp
315 exit ;;
316 Pyramid*:OSx*:*:* | MIS*:OSx*:*:* | MIS*:SMP_DC-OSx*:*:*)
317 # akee@wpdis03.wpafb.af.mil (Earle F. Ake) contributed MIS and NILE.
318 if test "`(/bin/universe) 2>/dev/null`" = att ; then
319 echo pyramid-pyramid-sysv3
320 else
321 echo pyramid-pyramid-bsd
322 fi
323 exit ;;
324 NILE*:*:*:dcosx)
325 echo pyramid-pyramid-svr4
326 exit ;;
327 DRS?6000:unix:4.0:6*)
328 echo sparc-icl-nx6
329 exit ;;
330 DRS?6000:UNIX_SV:4.2*:7* | DRS?6000:isis:4.2*:7*)
331 case `/usr/bin/uname -p` in
332 sparc) echo sparc-icl-nx7; exit ;;
333 esac ;;
334 s390x:SunOS:*:*)
335 echo ${UNAME_MACHINE}-ibm-solaris2`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'`
336 exit ;;
337 sun4H:SunOS:5.*:*)
338 echo sparc-hal-solaris2`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'`
339 exit ;;
340 sun4*:SunOS:5.*:* | tadpole*:SunOS:5.*:*)
341 echo sparc-sun-solaris2`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'`
342 exit ;;
343 i86pc:AuroraUX:5.*:* | i86xen:AuroraUX:5.*:*)
344 echo i386-pc-auroraux${UNAME_RELEASE}
345 exit ;;
346 i86pc:SunOS:5.*:* | i86xen:SunOS:5.*:*)
347 eval $set_cc_for_build
348 SUN_ARCH="i386"
349 # If there is a compiler, see if it is configured for 64-bit objects.
350 # Note that the Sun cc does not turn __LP64__ into 1 like gcc does.
351 # This test works for both compilers.
352 if [ "$CC_FOR_BUILD" != 'no_compiler_found' ]; then
353 if (echo '#ifdef __amd64'; echo IS_64BIT_ARCH; echo '#endif') | \
354 (CCOPTS= $CC_FOR_BUILD -E - 2>/dev/null) | \
355 grep IS_64BIT_ARCH >/dev/null
356 then
357 SUN_ARCH="x86_64"
358 fi
359 fi
360 echo ${SUN_ARCH}-pc-solaris2`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'`
361 exit ;;
362 sun4*:SunOS:6*:*)
363 # According to config.sub, this is the proper way to canonicalize
364 # SunOS6. Hard to guess exactly what SunOS6 will be like, but
365 # it's likely to be more like Solaris than SunOS4.
366 echo sparc-sun-solaris3`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'`
367 exit ;;
368 sun4*:SunOS:*:*)
369 case "`/usr/bin/arch -k`" in
370 Series*|S4*)
371 UNAME_RELEASE=`uname -v`
372 ;;
373 esac
374 # Japanese Language versions have a version number like `4.1.3-JL'.
375 echo sparc-sun-sunos`echo ${UNAME_RELEASE}|sed -e 's/-/_/'`
376 exit ;;
377 sun3*:SunOS:*:*)
378 echo m68k-sun-sunos${UNAME_RELEASE}
379 exit ;;
380 sun*:*:4.2BSD:*)
381 UNAME_RELEASE=`(sed 1q /etc/motd | awk '{print substr($5,1,3)}') 2>/dev/null`
382 test "x${UNAME_RELEASE}" = "x" && UNAME_RELEASE=3
383 case "`/bin/arch`" in
384 sun3)
385 echo m68k-sun-sunos${UNAME_RELEASE}
386 ;;
387 sun4)
388 echo sparc-sun-sunos${UNAME_RELEASE}
389 ;;
390 esac
391 exit ;;
392 aushp:SunOS:*:*)
393 echo sparc-auspex-sunos${UNAME_RELEASE}
394 exit ;;
395 # The situation for MiNT is a little confusing. The machine name
396 # can be virtually everything (everything which is not
397 # "atarist" or "atariste" at least should have a processor
398 # > m68000). The system name ranges from "MiNT" over "FreeMiNT"
399 # to the lowercase version "mint" (or "freemint"). Finally
400 # the system name "TOS" denotes a system which is actually not
401 # MiNT. But MiNT is downward compatible to TOS, so this should
402 # be no problem.
403 atarist[e]:*MiNT:*:* | atarist[e]:*mint:*:* | atarist[e]:*TOS:*:*)
404 echo m68k-atari-mint${UNAME_RELEASE}
405 exit ;;
406 atari*:*MiNT:*:* | atari*:*mint:*:* | atarist[e]:*TOS:*:*)
407 echo m68k-atari-mint${UNAME_RELEASE}
408 exit ;;
409 *falcon*:*MiNT:*:* | *falcon*:*mint:*:* | *falcon*:*TOS:*:*)
410 echo m68k-atari-mint${UNAME_RELEASE}
411 exit ;;
412 milan*:*MiNT:*:* | milan*:*mint:*:* | *milan*:*TOS:*:*)
413 echo m68k-milan-mint${UNAME_RELEASE}
414 exit ;;
415 hades*:*MiNT:*:* | hades*:*mint:*:* | *hades*:*TOS:*:*)
416 echo m68k-hades-mint${UNAME_RELEASE}
417 exit ;;
418 *:*MiNT:*:* | *:*mint:*:* | *:*TOS:*:*)
419 echo m68k-unknown-mint${UNAME_RELEASE}
420 exit ;;
421 m68k:machten:*:*)
422 echo m68k-apple-machten${UNAME_RELEASE}
423 exit ;;
424 powerpc:machten:*:*)
425 echo powerpc-apple-machten${UNAME_RELEASE}
426 exit ;;
427 RISC*:Mach:*:*)
428 echo mips-dec-mach_bsd4.3
429 exit ;;
430 RISC*:ULTRIX:*:*)
431 echo mips-dec-ultrix${UNAME_RELEASE}
432 exit ;;
433 VAX*:ULTRIX*:*:*)
434 echo vax-dec-ultrix${UNAME_RELEASE}
435 exit ;;
436 2020:CLIX:*:* | 2430:CLIX:*:*)
437 echo clipper-intergraph-clix${UNAME_RELEASE}
438 exit ;;
439 mips:*:*:UMIPS | mips:*:*:RISCos)
440 eval $set_cc_for_build
441 sed 's/^ //' << EOF >$dummy.c
442 #ifdef __cplusplus
443 #include /* for printf() prototype */
444 int main (int argc, char *argv[]) {
445 #else
446 int main (argc, argv) int argc; char *argv[]; {
447 #endif
448 #if defined (host_mips) && defined (MIPSEB)
449 #if defined (SYSTYPE_SYSV)
450 printf ("mips-mips-riscos%ssysv\n", argv[1]); exit (0);
451 #endif
452 #if defined (SYSTYPE_SVR4)
453 printf ("mips-mips-riscos%ssvr4\n", argv[1]); exit (0);
454 #endif
455 #if defined (SYSTYPE_BSD43) || defined(SYSTYPE_BSD)
456 printf ("mips-mips-riscos%sbsd\n", argv[1]); exit (0);
457 #endif
458 #endif
459 exit (-1);
460 }
461 EOF
462 $CC_FOR_BUILD -o $dummy $dummy.c &&
463 dummyarg=`echo "${UNAME_RELEASE}" | sed -n 's/\([0-9]*\).*/\1/p'` &&
464 SYSTEM_NAME=`$dummy $dummyarg` &&
465 { echo "$SYSTEM_NAME"; exit; }
466 echo mips-mips-riscos${UNAME_RELEASE}
467 exit ;;
468 Motorola:PowerMAX_OS:*:*)
469 echo powerpc-motorola-powermax
470 exit ;;
471 Motorola:*:4.3:PL8-*)
472 echo powerpc-harris-powermax
473 exit ;;
474 Night_Hawk:*:*:PowerMAX_OS | Synergy:PowerMAX_OS:*:*)
475 echo powerpc-harris-powermax
476 exit ;;
477 Night_Hawk:Power_UNIX:*:*)
478 echo powerpc-harris-powerunix
479 exit ;;
480 m88k:CX/UX:7*:*)
481 echo m88k-harris-cxux7
482 exit ;;
483 m88k:*:4*:R4*)
484 echo m88k-motorola-sysv4
485 exit ;;
486 m88k:*:3*:R3*)
487 echo m88k-motorola-sysv3
488 exit ;;
489 AViiON:dgux:*:*)
490 # DG/UX returns AViiON for all architectures
491 UNAME_PROCESSOR=`/usr/bin/uname -p`
492 if [ $UNAME_PROCESSOR = mc88100 ] || [ $UNAME_PROCESSOR = mc88110 ]
493 then
494 if [ ${TARGET_BINARY_INTERFACE}x = m88kdguxelfx ] || \
495 [ ${TARGET_BINARY_INTERFACE}x = x ]
496 then
497 echo m88k-dg-dgux${UNAME_RELEASE}
498 else
499 echo m88k-dg-dguxbcs${UNAME_RELEASE}
500 fi
501 else
502 echo i586-dg-dgux${UNAME_RELEASE}
503 fi
504 exit ;;
505 M88*:DolphinOS:*:*) # DolphinOS (SVR3)
506 echo m88k-dolphin-sysv3
507 exit ;;
508 M88*:*:R3*:*)
509 # Delta 88k system running SVR3
510 echo m88k-motorola-sysv3
511 exit ;;
512 XD88*:*:*:*) # Tektronix XD88 system running UTekV (SVR3)
513 echo m88k-tektronix-sysv3
514 exit ;;
515 Tek43[0-9][0-9]:UTek:*:*) # Tektronix 4300 system running UTek (BSD)
516 echo m68k-tektronix-bsd
517 exit ;;
518 *:IRIX*:*:*)
519 echo mips-sgi-irix`echo ${UNAME_RELEASE}|sed -e 's/-/_/g'`
520 exit ;;
521 ????????:AIX?:[12].1:2) # AIX 2.2.1 or AIX 2.1.1 is RT/PC AIX.
522 echo romp-ibm-aix # uname -m gives an 8 hex-code CPU id
523 exit ;; # Note that: echo "'`uname -s`'" gives 'AIX '
524 i*86:AIX:*:*)
525 echo i386-ibm-aix
526 exit ;;
527 ia64:AIX:*:*)
528 if [ -x /usr/bin/oslevel ] ; then
529 IBM_REV=`/usr/bin/oslevel`
530 else
531 IBM_REV=${UNAME_VERSION}.${UNAME_RELEASE}
532 fi
533 echo ${UNAME_MACHINE}-ibm-aix${IBM_REV}
534 exit ;;
535 *:AIX:2:3)
536 if grep bos325 /usr/include/stdio.h >/dev/null 2>&1; then
537 eval $set_cc_for_build
538 sed 's/^ //' << EOF >$dummy.c
539 #include
540
541 main()
542 {
543 if (!__power_pc())
544 exit(1);
545 puts("powerpc-ibm-aix3.2.5");
546 exit(0);
547 }
548 EOF
549 if $CC_FOR_BUILD -o $dummy $dummy.c && SYSTEM_NAME=`$dummy`
550 then
551 echo "$SYSTEM_NAME"
552 else
553 echo rs6000-ibm-aix3.2.5
554 fi
555 elif grep bos324 /usr/include/stdio.h >/dev/null 2>&1; then
556 echo rs6000-ibm-aix3.2.4
557 else
558 echo rs6000-ibm-aix3.2
559 fi
560 exit ;;
561 *:AIX:*:[4567])
562 IBM_CPU_ID=`/usr/sbin/lsdev -C -c processor -S available | sed 1q | awk '{ print $1 }'`
563 if /usr/sbin/lsattr -El ${IBM_CPU_ID} | grep ' POWER' >/dev/null 2>&1; then
564 IBM_ARCH=rs6000
565 else
566 IBM_ARCH=powerpc
567 fi
568 if [ -x /usr/bin/oslevel ] ; then
569 IBM_REV=`/usr/bin/oslevel`
570 else
571 IBM_REV=${UNAME_VERSION}.${UNAME_RELEASE}
572 fi
573 echo ${IBM_ARCH}-ibm-aix${IBM_REV}
574 exit ;;
575 *:AIX:*:*)
576 echo rs6000-ibm-aix
577 exit ;;
578 ibmrt:4.4BSD:*|romp-ibm:BSD:*)
579 echo romp-ibm-bsd4.4
580 exit ;;
581 ibmrt:*BSD:*|romp-ibm:BSD:*) # covers RT/PC BSD and
582 echo romp-ibm-bsd${UNAME_RELEASE} # 4.3 with uname added to
583 exit ;; # report: romp-ibm BSD 4.3
584 *:BOSX:*:*)
585 echo rs6000-bull-bosx
586 exit ;;
587 DPX/2?00:B.O.S.:*:*)
588 echo m68k-bull-sysv3
589 exit ;;
590 9000/[34]??:4.3bsd:1.*:*)
591 echo m68k-hp-bsd
592 exit ;;
593 hp300:4.4BSD:*:* | 9000/[34]??:4.3bsd:2.*:*)
594 echo m68k-hp-bsd4.4
595 exit ;;
596 9000/[34678]??:HP-UX:*:*)
597 HPUX_REV=`echo ${UNAME_RELEASE}|sed -e 's/[^.]*.[0B]*//'`
598 case "${UNAME_MACHINE}" in
599 9000/31? ) HP_ARCH=m68000 ;;
600 9000/[34]?? ) HP_ARCH=m68k ;;
601 9000/[678][0-9][0-9])
602 if [ -x /usr/bin/getconf ]; then
603 sc_cpu_version=`/usr/bin/getconf SC_CPU_VERSION 2>/dev/null`
604 sc_kernel_bits=`/usr/bin/getconf SC_KERNEL_BITS 2>/dev/null`
605 case "${sc_cpu_version}" in
606 523) HP_ARCH="hppa1.0" ;; # CPU_PA_RISC1_0
607 528) HP_ARCH="hppa1.1" ;; # CPU_PA_RISC1_1
608 532) # CPU_PA_RISC2_0
609 case "${sc_kernel_bits}" in
610 32) HP_ARCH="hppa2.0n" ;;
611 64) HP_ARCH="hppa2.0w" ;;
612 '') HP_ARCH="hppa2.0" ;; # HP-UX 10.20
613 esac ;;
614 esac
615 fi
616 if [ "${HP_ARCH}" = "" ]; then
617 eval $set_cc_for_build
618 sed 's/^ //' << EOF >$dummy.c
619
620 #define _HPUX_SOURCE
621 #include
622 #include
623
624 int main ()
625 {
626 #if defined(_SC_KERNEL_BITS)
627 long bits = sysconf(_SC_KERNEL_BITS);
628 #endif
629 long cpu = sysconf (_SC_CPU_VERSION);
630
631 switch (cpu)
632 {
633 case CPU_PA_RISC1_0: puts ("hppa1.0"); break;
634 case CPU_PA_RISC1_1: puts ("hppa1.1"); break;
635 case CPU_PA_RISC2_0:
636 #if defined(_SC_KERNEL_BITS)
637 switch (bits)
638 {
639 case 64: puts ("hppa2.0w"); break;
640 case 32: puts ("hppa2.0n"); break;
641 default: puts ("hppa2.0"); break;
642 } break;
643 #else /* !defined(_SC_KERNEL_BITS) */
644 puts ("hppa2.0"); break;
645 #endif
646 default: puts ("hppa1.0"); break;
647 }
648 exit (0);
649 }
650 EOF
651 (CCOPTS= $CC_FOR_BUILD -o $dummy $dummy.c 2>/dev/null) && HP_ARCH=`$dummy`
652 test -z "$HP_ARCH" && HP_ARCH=hppa
653 fi ;;
654 esac
655 if [ ${HP_ARCH} = "hppa2.0w" ]
656