llvm.org GIT mirror llvm / 9802a6c
Remove projects/sample. As an example that was not actually being used, it suffered from a slow bitrot. The two main issues with it were that it had no cmake support and included a copy of the autoconf directory. The reality is that autoconf is not easily composable. The lack of composabilty is why we have clang options in llvm's configure. Suggesting that users include a copy of autoconf/ in their projects seems a bad idea. We are also in the process of switching to cmake, so pushing autoconf to new project is probably not what we want. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@203728 91177308-0d34-0410-b5e6-96231b3b80d8 Rafael Espindola 5 years ago
50 changed file(s) with 7 addition(s) and 27470 deletion(s). Raw diff Collapse all Expand all
3636 #==============================================================================#
3737 # External projects that are tracked independently.
3838 projects/*
39 !projects/sample
4039 !projects/CMakeLists.txt
4140 !projects/Makefile
4241 # Clang, which is tracked independently.
6262 ------- ---------
6363 Autoconf llvm/autoconf
6464 llvm/projects/ModuleMaker/autoconf
65 llvm/projects/sample/autoconf
6665 Google Test llvm/utils/unittest/googletest
6766 OpenBSD regex llvm/lib/Support/{reg*, COPYRIGHT.regex}
6867 pyyaml tests llvm/test/YAMLParser/{*.data, LICENSE.TXT}
165165 do
166166 if test -d ${srcdir}/projects/${i} ; then
167167 case ${i} in
168 sample) AC_CONFIG_SUBDIRS([projects/sample]) ;;
169168 safecode) AC_CONFIG_SUBDIRS([projects/safecode]) ;;
170169 compiler-rt) ;;
171170 test-suite) ;;
822822 projects/llvm-test
823823 projects/poolalloc
824824 projects/llvm-poolalloc
825 projects/sample
826825 projects/safecode
827826 tools/polly'
828827
37503749 do
37513750 if test -d ${srcdir}/projects/${i} ; then
37523751 case ${i} in
3753 sample) subdirs="$subdirs projects/sample"
3754 ;;
37553752 safecode) subdirs="$subdirs projects/safecode"
37563753 ;;
37573754 compiler-rt) ;;
499499
500500 * The stack map is not compiled into the executable.
501501
502 Using the LLVM makefiles (like the `sample project
503 `__), this code
502 Using the LLVM makefiles, this code
504503 can be compiled as a plugin using a simple makefile:
505504
506505 .. code-block:: make
10771077
10781078 This directory contains projects that are not strictly part of LLVM but are
10791079 shipped with LLVM. This is also the directory where you should create your own
1080 LLVM-based projects. See ``llvm/projects/sample`` for an example of how to set
1081 up your own project.
1080 LLVM-based projects.
10821081
10831082 ``llvm/runtime``
10841083 ----------------
4646 compiles itself using the same features of the makefile system as used for
4747 projects.
4848
49 For complete details on setting up your projects configuration, simply mimic the
50 ``llvm/projects/sample`` project. Or for further details, consult the
51 `Projects `_ page.
49 For further details, consult the `Projects `_ page.
5250
5351 Variable Values
5452 ---------------
3636 of LLVM, and the ability to support multiple object directories from a single
3737 source directory.
3838
39 This document assumes that you will base your project on the LLVM sample project
40 found in ``llvm/projects/sample``. If you want to devise your own build system,
41 studying the sample project and LLVM ``Makefiles`` will probably provide enough
42 information on how to write your own ``Makefiles``.
43
44 Create a Project from the Sample Project
45 ========================================
46
47 Follow these simple steps to start your project:
48
49 1. Copy the ``llvm/projects/sample`` directory to any place of your choosing.
50 You can place it anywhere you like. Rename the directory to match the name
51 of your project.
52
53 2. If you downloaded LLVM using Subversion, remove all the directories named
54 ``.svn`` (and all the files therein) from your project's new source tree.
55 This will keep Subversion from thinking that your project is inside
56 ``llvm/trunk/projects/sample``.
57
58 3. Add your source code and Makefiles to your source tree.
59
60 4. If you want your project to be configured with the ``configure`` script then
61 you need to edit ``autoconf/configure.ac`` as follows:
62
63 * **AC_INIT** - Place the name of your project, its version number and a
64 contact email address for your project as the arguments to this macro
65
66 * **AC_CONFIG_AUX_DIR** - If your project isn't in the ``llvm/projects``
67 directory then you might need to adjust this so that it specifies a
68 relative path to the ``llvm/autoconf`` directory.
69
70 * **LLVM_CONFIG_PROJECT** - Just leave this alone.
71
72 * **AC_CONFIG_SRCDIR** - Specify a path to a file name that identifies your
73 project; or just leave it at ``Makefile.common.in``.
74
75 * **AC_CONFIG_FILES** - Do not change.
76
77 * **AC_CONFIG_MAKEFILE** - Use one of these macros for each Makefile that
78 your project uses. This macro arranges for your makefiles to be copied from
79 the source directory, unmodified, to the build directory.
80
81 5. After updating ``autoconf/configure.ac``, regenerate the configure script
82 with these commands. (You must be using ``Autoconf`` version 2.59 or later
83 and your ``aclocal`` version should be 1.9 or later.)
84
85 .. code-block:: bash
86
87 % cd autoconf
88 % ./AutoRegen.sh
89
90 6. Run ``configure`` in the directory in which you want to place object code.
91 Use the following options to tell your project where it can find LLVM:
92
93 ``--with-llvmsrc=``
94 Tell your project where the LLVM source tree is located.
95
96 ``--with-llvmobj=``
97 Tell your project where the LLVM object tree is located.
98
99 ``--prefix=``
100 Tell your project where it should get installed.
101
102 That's it! Now all you have to do is type ``gmake`` (or ``make`` if you're on a
103 GNU/Linux system) in the root of your object directory, and your project should
104 build.
39 If you want to devise your own build system, studying other projects and LLVM
40 ``Makefiles`` will probably provide enough information on how to write your own
41 ``Makefiles``.
10542
10643 Source Tree Layout
10744 ==================
10845
10946 In order to use the LLVM build system, you will want to organize your source
11047 code so that it can benefit from the build system's features. Mainly, you want
111 your source tree layout to look similar to the LLVM source tree layout. The
112 best way to do this is to just copy the project tree from
113 ``llvm/projects/sample`` and modify it to meet your needs, but you can certainly
114 add to it if you want.
48 your source tree layout to look similar to the LLVM source tree layout.
11549
11650 Underneath your top level directory, you should have the following directories:
11751
2222 # DragonEgg may be checked out here but doesn't (yet) build directly.
2323 DIRS := $(filter-out dragonegg,$(DIRS))
2424
25 # Sparc cannot link shared libraries (libtool problem?)
26 ifeq ($(ARCH), Sparc)
27 DIRS := $(filter-out sample, $(DIRS))
28 endif
29
3025 include $(PROJ_SRC_ROOT)/Makefile.rules
+0
-18
projects/sample/Makefile less more
None ##===- projects/sample/Makefile ----------------------------*- Makefile -*-===##
1 #
2 # This is a sample Makefile for a project that uses LLVM.
3 #
4 ##===----------------------------------------------------------------------===##
5
6 #
7 # Indicates our relative path to the top of the project's root directory.
8 #
9 LEVEL = .
10 DIRS = lib tools
11 EXTRA_DIST = include
12
13 #
14 # Include the Master Makefile that knows how to build all.
15 #
16 include $(LEVEL)/Makefile.common
17
+0
-26
projects/sample/Makefile.common.in less more
None # Set the name of the project here
1 PROJECT_NAME := sample
2 PROJ_VERSION := 0.9
3
4 # Set this variable to the top of the LLVM source tree.
5 LLVM_SRC_ROOT = @LLVM_SRC@
6
7 # Set this variable to the top level directory where LLVM was built
8 # (this is *not* the same as OBJ_ROOT as defined in LLVM's Makefile.config).
9 LLVM_OBJ_ROOT = @LLVM_OBJ@
10
11 # Set the directory root of this project's source files
12 PROJ_SRC_ROOT := $(subst //,/,@abs_top_srcdir@)
13
14 # Set the root directory of this project's object files
15 PROJ_OBJ_ROOT := $(subst //,/,@abs_top_builddir@)
16
17 # Set the root directory of this project's install prefix
18 PROJ_INSTALL_ROOT := @prefix@
19
20 # Configuration file to set paths specific to local installation of LLVM
21 include $(PROJ_OBJ_ROOT)/Makefile.llvm.config
22
23 # Include all of the build rules used for making LLVM
24 include $(PROJ_SRC_ROOT)/Makefile.llvm.rules
25
+0
-314
projects/sample/Makefile.llvm.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 LLVMVersion := @LLVM_VERSION@
16
17 ###########################################################################
18 # Directory Configuration
19 # This section of the Makefile determines what is where. To be
20 # specific, there are several locations that need to be defined:
21 #
22 # o LLVM_SRC_ROOT : The root directory of the LLVM source code.
23 # o LLVM_OBJ_ROOT : The root directory containing the built LLVM code.
24 #
25 # o PROJ_SRC_DIR : The directory containing the code to build.
26 # o PROJ_SRC_ROOT : The root directory of the code to build.
27 #
28 # o PROJ_OBJ_DIR : The directory in which compiled code will be placed.
29 # o PROJ_OBJ_ROOT : The root directory in which compiled code is placed.
30 #
31 ###########################################################################
32
33 PWD := @BINPWD@
34
35 # The macro below is expanded when 'realpath' is not built-in.
36 # Built-in 'realpath' is available on GNU Make 3.81.
37 realpath = $(shell cd $(1); $(PWD))
38
39 PROJ_OBJ_DIR := $(call realpath, .)
40 PROJ_OBJ_ROOT := $(call realpath, $(PROJ_OBJ_DIR)/$(LEVEL))
41
42 ifndef PROJ_SRC_ROOT
43 $(error Projects must define PROJ_SRC_ROOT)
44 endif
45 ifndef PROJ_OBJ_ROOT
46 $(error Projects must define PROJ_OBJ_ROOT)
47 endif
48 ifndef PROJ_INSTALL_ROOT
49 $(error Projects must define PROJ_INSTALL_ROOT)
50 endif
51 ifndef LLVM_SRC_ROOT
52 $(error Projects must define LLVM_SRC_ROOT)
53 endif
54 ifndef LLVM_OBJ_ROOT
55 $(error Projects must define LLVM_OBJ_ROOT)
56 endif
57 PROJ_SRC_DIR := $(call realpath, $(PROJ_SRC_ROOT)/$(patsubst $(PROJ_OBJ_ROOT)%,%,$(PROJ_OBJ_DIR)))
58 prefix := $(PROJ_INSTALL_ROOT)
59 PROJ_prefix := $(prefix)
60 ifndef PROJ_VERSION
61 PROJ_VERSION := 1.0
62 endif
63
64 PROJ_bindir := $(PROJ_prefix)/bin
65 PROJ_libdir := $(PROJ_prefix)/lib
66 PROJ_datadir := $(PROJ_prefix)/share
67 PROJ_docsdir := $(PROJ_prefix)/docs/llvm
68 PROJ_etcdir := $(PROJ_prefix)/etc/llvm
69 PROJ_includedir := $(PROJ_prefix)/include
70 PROJ_infodir := $(PROJ_prefix)/info
71 PROJ_mandir := $(PROJ_prefix)/share/man
72
73 # Determine if we're on a unix type operating system
74 LLVM_ON_UNIX:=@LLVM_ON_UNIX@
75 LLVM_ON_WIN32:=@LLVM_ON_WIN32@
76
77 # Host operating system for which LLVM will be run.
78 OS=@OS@
79 HOST_OS=@HOST_OS@
80 # Target operating system for which LLVM will compile for.
81 TARGET_OS=@TARGET_OS@
82
83 # Target hardware architecture
84 ARCH=@ARCH@
85
86 # Indicates, whether we're cross-compiling LLVM or not
87 LLVM_CROSS_COMPILING=@LLVM_CROSS_COMPILING@
88
89 # Executable file extension for build platform (mainly for
90 # tablegen call if we're cross-compiling).
91 BUILD_EXEEXT=@BUILD_EXEEXT@
92
93 # Compilers for the build platflorm (mainly for tablegen
94 # call if we're cross-compiling).
95 BUILD_CC=@BUILD_CC@
96 BUILD_CXX=@BUILD_CXX@
97
98 # Triple for configuring build tools when cross-compiling
99 BUILD_TRIPLE=@build@
100
101 # Target triple (cpu-vendor-os) for which we should generate code
102 TARGET_TRIPLE=@target@
103
104 # Extra options to compile LLVM with
105 EXTRA_OPTIONS=@EXTRA_OPTIONS@
106
107 # Extra options to link LLVM with
108 EXTRA_LD_OPTIONS=@EXTRA_LD_OPTIONS@
109
110 # Endian-ness of the target
111 ENDIAN=@ENDIAN@
112
113 # Path to the C++ compiler to use. This is an optional setting, which defaults
114 # to whatever your gmake defaults to.
115 CXX = @CXX@
116
117 # Path to the CC binary, which use used by testcases for native builds.
118 CC := @CC@
119
120 # Linker flags.
121 LDFLAGS+=@LDFLAGS@
122
123 # Path to the library archiver program.
124 AR_PATH = @AR@
125 AR = @AR@
126
127 # Path to the nm program
128 NM_PATH = @NM@
129
130 # The pathnames of the programs we require to build
131 CMP := @CMP@
132 CP := @CP@
133 DATE := @DATE@
134 FIND := @FIND@
135 GREP := @GREP@
136 INSTALL := @INSTALL@
137 MKDIR := $(PROJ_SRC_ROOT)/autoconf/mkinstalldirs
138 MV := @MV@
139 RANLIB := @RANLIB@
140 RM := @RM@
141 SED := @SED@
142 TAR := @TAR@
143
144 # Paths to miscellaneous programs we hope are present but might not be
145 BZIP2 := @BZIP2@
146 CAT := @CAT@
147 DOT := @DOT@
148 DOXYGEN := @DOXYGEN@
149 GROFF := @GROFF@
150 GZIPBIN := @GZIPBIN@
151 OCAMLC := @OCAMLC@
152 OCAMLOPT := @OCAMLOPT@
153 OCAMLDEP := @OCAMLDEP@
154 OCAMLDOC := @OCAMLDOC@
155 GAS := @GAS@
156 POD2HTML := @POD2HTML@
157 POD2MAN := @POD2MAN@
158 PDFROFF := @PDFROFF@
159 ZIP := @ZIP@
160
161 HAVE_PTHREAD := @HAVE_PTHREAD@
162
163 LIBS := @LIBS@
164
165 # Targets that we should build
166 TARGETS_TO_BUILD=@TARGETS_TO_BUILD@
167
168 # Path to directory where object files should be stored during a build.
169 # Set OBJ_ROOT to "." if you do not want to use a separate place for
170 # object files.
171 OBJ_ROOT := .
172
173 # What to pass as rpath flag to g++
174 RPATH := @RPATH@
175
176 # What to pass as -rdynamic flag to g++
177 RDYNAMIC := @RDYNAMIC@
178
179 # These are options that can either be enabled here, or can be enabled on the
180 # make command line (ie, make ENABLE_PROFILING=1):
181
182 # When ENABLE_LIBCPP is enabled, LLVM uses libc++ by default to build.
183 #ENABLE_LIBCPP = 0
184 ENABLE_LIBCPP = @ENABLE_LIBCPP@
185
186 # When ENABLE_CXX11 is enabled, LLVM uses c++11 mode by default to build.
187 ENABLE_CXX11 = @ENABLE_CXX11@
188
189 # When ENABLE_WERROR is enabled, we'll pass -Werror on the command line
190 ENABLE_WERROR = @ENABLE_WERROR@
191
192 # When ENABLE_OPTIMIZED is enabled, LLVM code is optimized and output is put
193 # into the "Release" directories. Otherwise, LLVM code is not optimized and
194 # output is put in the "Debug" directories.
195 #ENABLE_OPTIMIZED = 1
196 @ENABLE_OPTIMIZED@
197
198 # When ENABLE_PROFILING is enabled, profile instrumentation is done
199 # and output is put into the "+Profile" directories, where
200 # is either Debug or Release depending on how other build
201 # flags are set. Otherwise, output is put in the
202 # directories.
203 #ENABLE_PROFILING = 1
204 @ENABLE_PROFILING@
205
206 # When DISABLE_ASSERTIONS is enabled, builds of all of the LLVM code will
207 # exclude assertion checks, otherwise they are included.
208 #DISABLE_ASSERTIONS = 1
209 @DISABLE_ASSERTIONS@
210
211 # When ENABLE_EXPENSIVE_CHECKS is enabled, builds of all of the LLVM
212 # code will include expensive checks, otherwise they are excluded.
213 #ENABLE_EXPENSIVE_CHECKS = 0
214 @ENABLE_EXPENSIVE_CHECKS@
215
216 # When DEBUG_RUNTIME is enabled, the runtime libraries will retain debug
217 # symbols.
218 #DEBUG_RUNTIME = 1
219 @DEBUG_RUNTIME@
220
221 # When DEBUG_SYMBOLS is enabled, the compiler libraries will retain debug
222 # symbols.
223 #DEBUG_SYMBOLS = 1
224 @DEBUG_SYMBOLS@
225
226 # The compiler flags to use for optimized builds.
227 OPTIMIZE_OPTION := @OPTIMIZE_OPTION@
228
229 # When ENABLE_PROFILING is enabled, the llvm source base is built with profile
230 # information to allow gprof to be used to get execution frequencies.
231 #ENABLE_PROFILING = 1
232
233 # When ENABLE_DOCS is disabled, docs/ will not be built.
234 ENABLE_DOCS = @ENABLE_DOCS@
235
236 # When ENABLE_DOXYGEN is enabled, the doxygen documentation will be built
237 ENABLE_DOXYGEN = @ENABLE_DOXYGEN@
238
239 # Do we want to enable threads?
240 ENABLE_THREADS := @ENABLE_THREADS@
241
242 # Do we want to build with position independent code?
243 ENABLE_PIC := @ENABLE_PIC@
244
245 # Do we want to build a shared library and link the tools with it?
246 ENABLE_SHARED := @ENABLE_SHARED@
247
248 # Do we want to link the stdc++ into a shared library? (Cygming)
249 ENABLE_EMBED_STDCXX := @ENABLE_EMBED_STDCXX@
250
251 # Use -fvisibility-inlines-hidden?
252 ENABLE_VISIBILITY_INLINES_HIDDEN := @ENABLE_VISIBILITY_INLINES_HIDDEN@
253
254 # Do we want to allow timestamping information into builds?
255 ENABLE_TIMESTAMPS := @ENABLE_TIMESTAMPS@
256
257 # This option tells the Makefiles to produce verbose output.
258 # It essentially prints the commands that make is executing
259 #VERBOSE = 1
260
261 # Enable JIT for this platform
262 TARGET_HAS_JIT = @TARGET_HAS_JIT@
263
264 # Shared library extension for host platform.
265 SHLIBEXT = @SHLIBEXT@
266
267 # Executable file extension for host platform.
268 EXEEXT = @EXEEXT@
269
270 # Things we just assume are "there"
271 ECHO := echo
272
273 # Get the options for causing archives to link all their content instead of
274 # just missing symbols, and the inverse of that. This is used for certain LLVM
275 # tools that permit loadable modules. It ensures that the LLVM symbols will be
276 # available to those loadable modules.
277 LINKALL := @LINKALL@
278 NOLINKALL := @NOLINKALL@
279
280 # Get the value of HUGE_VAL_SANITY which will be either "yes" or "no" depending
281 # on the check.
282 HUGE_VAL_SANITY = @HUGE_VAL_SANITY@
283
284 # Bindings that we should build
285 BINDINGS_TO_BUILD := @BINDINGS_TO_BUILD@
286 ALL_BINDINGS := @ALL_BINDINGS@
287 OCAML_LIBDIR := @OCAML_LIBDIR@
288
289 # When compiling under Mingw/Cygwin, executables such as tblgen
290 # expect Windows paths, whereas the build system uses Unix paths.
291 # The function SYSPATH transforms Unix paths into Windows paths.
292 ifneq (,$(findstring -mno-cygwin, $(CXX)))
293 SYSPATH = $(shell echo $(1) | cygpath -m -f -)
294 else
295 SYSPATH = $(1)
296 endif
297
298 # Location of the plugin header file for gold.
299 BINUTILS_INCDIR := @BINUTILS_INCDIR@
300
301 # Optional flags supported by the compiler
302 # -Wno-missing-field-initializers
303 NO_MISSING_FIELD_INITIALIZERS = @NO_MISSING_FIELD_INITIALIZERS@
304 # -Wno-variadic-macros
305 NO_VARIADIC_MACROS = @NO_VARIADIC_MACROS@
306 # -Wcovered-switch-default
307 COVERED_SWITCH_DEFAULT = @COVERED_SWITCH_DEFAULT@
308
309 # Was polly found in tools/polly?
310 LLVM_HAS_POLLY = @LLVM_HAS_POLLY@
311 # Flags supported by the linker.
312 # bfd ld / gold --version-script=file
313 HAVE_LINK_VERSION_SCRIPT = @HAVE_LINK_VERSION_SCRIPT@
+0
-2007
projects/sample/Makefile.llvm.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 # PRECONDITIONS: that which must be built/checked first
61 ################################################################################
62
63 SrcMakefiles := $(filter %Makefile %Makefile.tests,\
64 $(wildcard $(PROJ_SRC_DIR)/Makefile*))
65 ObjMakefiles := $(subst $(PROJ_SRC_DIR),$(PROJ_OBJ_DIR),$(SrcMakefiles))
66 ConfigureScript := $(PROJ_SRC_ROOT)/configure
67 ConfigStatusScript := $(PROJ_OBJ_ROOT)/config.status
68 MakefileConfigIn := $(strip $(wildcard $(PROJ_SRC_ROOT)/Makefile.config.in))
69 MakefileCommonIn := $(strip $(wildcard $(PROJ_SRC_ROOT)/Makefile.common.in))
70 MakefileConfig := $(PROJ_OBJ_ROOT)/Makefile.config
71 MakefileCommon := $(PROJ_OBJ_ROOT)/Makefile.common
72 PreConditions := $(ConfigStatusScript) $(ObjMakefiles)
73 ifneq ($(MakefileCommonIn),)
74 PreConditions += $(MakefileCommon)
75 endif
76
77 ifneq ($(MakefileConfigIn),)
78 PreConditions += $(MakefileConfig)
79 endif
80
81 preconditions: $(PreConditions)
82
83 #------------------------------------------------------------------------
84 # Make sure the BUILT_SOURCES are built first
85 #------------------------------------------------------------------------
86 $(filter-out clean clean-local,$(UserTargets)):: $(BUILT_SOURCES)
87
88 clean-all-local::
89 ifneq ($(strip $(BUILT_SOURCES)),)
90 -$(Verb) $(RM) -f $(BUILT_SOURCES)
91 endif
92
93 ifneq ($(PROJ_OBJ_ROOT),$(PROJ_SRC_ROOT))
94 spotless:
95 $(Verb) if test -x config.status ; then \
96 $(EchoCmd) Wiping out $(PROJ_OBJ_ROOT) ; \
97 $(MKDIR) .spotless.save ; \
98 $(MV) config.status .spotless.save ; \
99 $(MV) mklib .spotless.save ; \
100 $(MV) projects .spotless.save ; \
101 $(RM) -rf * ; \
102 $(MV) .spotless.save/config.status . ; \
103 $(MV) .spotless.save/mklib . ; \
104 $(MV) .spotless.save/projects . ; \
105 $(RM) -rf .spotless.save ; \
106 $(EchoCmd) Rebuilding configuration of $(PROJ_OBJ_ROOT) ; \
107 $(ConfigStatusScript) --recheck $(ConfigureScriptFLAGS) && \
108 $(ConfigStatusScript) ; \
109 else \
110 $(EchoCmd) "make spotless" can only be run from $(PROJ_OBJ_ROOT); \
111 fi
112 else
113 spotless:
114 $(EchoCmd) "spotless target not supported for objdir == srcdir"
115 endif
116
117 $(BUILT_SOURCES) : $(ObjMakefiles)
118
119 #------------------------------------------------------------------------
120 # Make sure we're not using a stale configuration
121 #------------------------------------------------------------------------
122 reconfigure:
123 $(Echo) Reconfiguring $(PROJ_OBJ_ROOT)
124 $(Verb) cd $(PROJ_OBJ_ROOT) && \
125 $(ConfigStatusScript) --recheck $(ConfigureScriptFLAGS) && \
126 $(ConfigStatusScript)
127
128 .PRECIOUS: $(ConfigStatusScript)
129 $(ConfigStatusScript): $(ConfigureScript)
130 $(Echo) Reconfiguring with $<
131 $(Verb) cd $(PROJ_OBJ_ROOT) && \
132 $(ConfigStatusScript) --recheck $(ConfigureScriptFLAGS) && \
133 $(ConfigStatusScript)
134
135 #------------------------------------------------------------------------
136 # Make sure the configuration makefile is up to date
137 #------------------------------------------------------------------------
138 ifneq ($(MakefileConfigIn),)
139 $(MakefileConfig): $(MakefileConfigIn) $(ConfigStatusScript)
140 $(Echo) Regenerating $@
141 $(Verb) cd $(PROJ_OBJ_ROOT) ; $(ConfigStatusScript) Makefile.config
142 endif
143
144 ifneq ($(MakefileCommonIn),)
145 $(MakefileCommon): $(MakefileCommonIn) $(ConfigStatusScript)
146 $(Echo) Regenerating $@
147 $(Verb) cd $(PROJ_OBJ_ROOT) ; $(ConfigStatusScript) Makefile.common
148 endif
149
150 #------------------------------------------------------------------------
151 # If the Makefile in the source tree has been updated, copy it over into the
152 # build tree. But, only do this if the source and object makefiles differ
153 #------------------------------------------------------------------------
154 ifndef PROJ_MAKEFILE
155 PROJ_MAKEFILE := $(PROJ_SRC_DIR)/Makefile
156 endif
157
158 ifneq ($(PROJ_OBJ_DIR),$(PROJ_SRC_DIR))
159
160 Makefile: $(PROJ_MAKEFILE) $(ExtraMakefiles)
161 $(Echo) "Updating Makefile"
162 $(Verb) $(MKDIR) $(@D)
163 $(Verb) $(CP) -f $< $@
164
165 # Copy the Makefile.* files unless we're in the root directory which avoids
166 # the copying of Makefile.config.in or other things that should be explicitly
167 # taken care of.
168 $(PROJ_OBJ_DIR)/Makefile% : $(PROJ_MAKEFILE)%
169 @case '$?' in \
170 *Makefile.rules) ;; \
171 *.in) ;; \
172 *) $(EchoCmd) "Updating $(@F)" ; \
173 $(MKDIR) $(@D) ; \
174 $(CP) -f $< $@ ;; \
175 esac
176
177 endif
178
179 #------------------------------------------------------------------------
180 # Set up the basic dependencies
181 #------------------------------------------------------------------------
182 $(UserTargets):: $(PreConditions)
183
184 all:: all-local
185 clean:: clean-local
186 clean-all:: clean-local clean-all-local
187 install:: install-local
188 uninstall:: uninstall-local
189 install-local:: all-local
190 install-bytecode:: install-bytecode-local
191
192 ###############################################################################
193 # VARIABLES: Set up various variables based on configuration data
194 ###############################################################################
195
196 # Variable for if this make is for a "cleaning" target
197 ifneq ($(strip $(filter clean clean-local dist-clean,$(MAKECMDGOALS))),)
198 IS_CLEANING_TARGET=1
199 endif
200
201 #--------------------------------------------------------------------
202 # Variables derived from configuration we are building
203 #--------------------------------------------------------------------
204
205 CPP.Defines :=
206 ifeq ($(ENABLE_OPTIMIZED),1)
207 BuildMode := Release
208 # Don't use -fomit-frame-pointer on Darwin or FreeBSD.
209 ifneq ($(HOST_OS),FreeBSD)
210 ifneq ($(HOST_OS),GNU/kFreeBSD)
211 ifneq ($(HOST_OS),Darwin)
212 OmitFramePointer := -fomit-frame-pointer
213 endif
214 endif
215 endif
216
217 # Darwin requires -fstrict-aliasing to be explicitly enabled.
218 # Avoid -fstrict-aliasing on Darwin for now, there are unresolved issues
219 # with -fstrict-aliasing and ipa-type-escape radr://6756684
220 #ifeq ($(HOST_OS),Darwin)
221 # EXTRA_OPTIONS += -fstrict-aliasing -Wstrict-aliasing
222 #endif
223 CXX.Flags += $(OPTIMIZE_OPTION) $(OmitFramePointer)
224 C.Flags += $(OPTIMIZE_OPTION) $(OmitFramePointer)
225 LD.Flags += $(OPTIMIZE_OPTION)
226 ifdef DEBUG_SYMBOLS
227 BuildMode := $(BuildMode)+Debug
228 CXX.Flags += -g
229 C.Flags += -g
230 LD.Flags += -g
231 KEEP_SYMBOLS := 1
232 endif
233 else
234 ifdef NO_DEBUG_SYMBOLS
235 BuildMode := Unoptimized
236 CXX.Flags +=
237 C.Flags +=
238 LD.Flags +=
239 KEEP_SYMBOLS := 1
240 else
241 BuildMode := Debug
242 CXX.Flags += -g
243 C.Flags += -g
244 LD.Flags += -g
245 KEEP_SYMBOLS := 1
246 endif
247 endif
248
249 ifeq ($(ENABLE_LIBCPP),1)
250 CXX.Flags += -stdlib=libc++
251 LD.Flags += -stdlib=libc++
252 endif
253
254 ifeq ($(ENABLE_CXX11),1)
255 CXX.Flags += -std=c++11
256 endif
257
258 ifeq ($(ENABLE_WERROR),1)
259 CXX.Flags += -Werror
260 C.Flags += -Werror
261 endif
262
263 ifeq ($(ENABLE_PROFILING),1)
264 BuildMode := $(BuildMode)+Profile
265 CXX.Flags := $(filter-out -fomit-frame-pointer,$(CXX.Flags)) -pg -g
266 C.Flags := $(filter-out -fomit-frame-pointer,$(C.Flags)) -pg -g
267 LD.Flags := $(filter-out -fomit-frame-pointer,$(LD.Flags)) -pg -g
268 KEEP_SYMBOLS := 1
269 endif
270
271 #ifeq ($(ENABLE_VISIBILITY_INLINES_HIDDEN),1)
272 # CXX.Flags += -fvisibility-inlines-hidden
273 #endif
274
275 ifdef ENABLE_EXPENSIVE_CHECKS
276 # GNU libstdc++ uses RTTI if you define _GLIBCXX_DEBUG, which we did above.
277 # See http://gcc.gnu.org/bugzilla/show_bug.cgi?id=40160
278 REQUIRES_RTTI := 1
279 endif
280
281 # IF REQUIRES_EH=1 is specified then don't disable exceptions
282 ifndef REQUIRES_EH
283 CXX.Flags += -fno-exceptions
284 else
285 # If the library requires EH, it also requires RTTI.
286 REQUIRES_RTTI := 1
287 endif
288
289 ifdef REQUIRES_FRAME_POINTER
290 CXX.Flags := $(filter-out -fomit-frame-pointer,$(CXX.Flags))
291 C.Flags := $(filter-out -fomit-frame-pointer,$(C.Flags))
292 LD.Flags := $(filter-out -fomit-frame-pointer,$(LD.Flags))
293 endif
294
295 # If REQUIRES_RTTI=1 is specified then don't disable run-time type id.
296 ifneq ($(REQUIRES_RTTI), 1)
297 CXX.Flags += -fno-rtti
298 endif
299
300 ifeq ($(ENABLE_COVERAGE),1)
301 BuildMode := $(BuildMode)+Coverage
302 CXX.Flags += -ftest-coverage -fprofile-arcs
303 C.Flags += -ftest-coverage -fprofile-arcs
304 endif
305
306 # If DISABLE_ASSERTIONS=1 is specified (make command line or configured),
307 # then disable assertions by defining the appropriate preprocessor symbols.
308 ifeq ($(DISABLE_ASSERTIONS),1)
309 CPP.Defines += -DNDEBUG
310 else
311 BuildMode := $(BuildMode)+Asserts
312 CPP.Defines += -D_DEBUG
313 endif
314
315 # If ENABLE_EXPENSIVE_CHECKS=1 is specified (make command line or
316 # configured), then enable expensive checks by defining the
317 # appropriate preprocessor symbols.
318 ifeq ($(ENABLE_EXPENSIVE_CHECKS),1)
319 BuildMode := $(BuildMode)+Checks
320 CPP.Defines += -D_GLIBCXX_DEBUG -DXDEBUG
321 endif
322
323 # LOADABLE_MODULE implies several other things so we force them to be
324 # defined/on.
325 ifdef LOADABLE_MODULE
326 SHARED_LIBRARY := 1
327 LINK_LIBS_IN_SHARED := 1
328 endif
329
330 ifdef SHARED_LIBRARY
331 ENABLE_PIC := 1
332 PIC_FLAG = "(PIC)"
333 endif
334
335 ifeq ($(ENABLE_PIC),1)
336 ifeq ($(HOST_OS), $(filter $(HOST_OS), Cygwin MingW))
337 # Nothing. Win32 defaults to PIC and warns when given -fPIC
338 else
339 ifeq ($(HOST_OS),Darwin)
340 # Common symbols not allowed in dylib files
341 CXX.Flags += -fno-common
342 C.Flags += -fno-common
343 else
344 # Linux and others; pass -fPIC
345 CXX.Flags += -fPIC
346 C.Flags += -fPIC
347 endif
348 endif
349 else
350 ifeq ($(HOST_OS),Darwin)
351 CXX.Flags += -mdynamic-no-pic
352 C.Flags += -mdynamic-no-pic
353 endif
354 endif
355
356 # Support makefile variable to disable any kind of timestamp/non-deterministic
357 # info from being used in the build.
358 ifeq ($(ENABLE_TIMESTAMPS),1)
359 DOTDIR_TIMESTAMP_COMMAND := $(DATE)
360 else
361 DOTDIR_TIMESTAMP_COMMAND := echo 'Created.'
362 endif
363
364 ifeq ($(HOST_OS),MingW)
365 # Work around PR4957
366 CPP.Defines += -D__NO_CTYPE_INLINE
367 ifeq ($(LLVM_CROSS_COMPILING),1)
368 # Work around http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=525016
369 ifdef TOOLNAME
370 LD.Flags += -Wl,--allow-multiple-definition
371 endif
372 endif
373 endif
374
375 CXX.Flags += -Woverloaded-virtual
376 CPP.BaseFlags += $(CPP.Defines)
377 AR.Flags := cru
378
379 # Make Floating point IEEE compliant on Alpha.
380 ifeq ($(ARCH),Alpha)
381 CXX.Flags += -mieee
382 CPP.BaseFlags += -mieee
383 ifeq ($(ENABLE_PIC),0)
384 CXX.Flags += -fPIC
385 CPP.BaseFlags += -fPIC
386 endif
387
388 LD.Flags += -Wl,--no-relax
389 endif
390
391 # GNU ld/PECOFF accepts but ignores them below;
392 # --version-script
393 # --export-dynamic
394 # --rpath
395 # FIXME: autoconf should be aware of them.
396 ifneq (,$(filter $(HOST_OS),Cygwin MingW))
397 HAVE_LINK_VERSION_SCRIPT := 0
398 RPATH :=
399 RDYNAMIC := -Wl,--export-all-symbols
400 endif
401
402 #--------------------------------------------------------------------
403 # Directory locations
404 #--------------------------------------------------------------------
405 TargetMode :=
406 ifeq ($(LLVM_CROSS_COMPILING),1)
407 BuildLLVMToolDir := $(LLVM_OBJ_ROOT)/BuildTools/$(BuildMode)/bin
408 endif
409
410 ObjRootDir := $(PROJ_OBJ_DIR)/$(BuildMode)
411 ObjDir := $(ObjRootDir)
412 LibDir := $(PROJ_OBJ_ROOT)/$(BuildMode)/lib
413 ToolDir := $(PROJ_OBJ_ROOT)/$(BuildMode)/bin
414 ExmplDir := $(PROJ_OBJ_ROOT)/$(BuildMode)/examples
415 LLVMLibDir := $(LLVM_OBJ_ROOT)/$(BuildMode)/lib
416 LLVMToolDir := $(LLVM_OBJ_ROOT)/$(BuildMode)/bin
417 LLVMExmplDir:= $(LLVM_OBJ_ROOT)/$(BuildMode)/examples
418
419 #--------------------------------------------------------------------
420 # Locations of shared libraries
421 #--------------------------------------------------------------------
422
423 SharedPrefix := lib
424 SharedLibDir := $(LibDir)
425 LLVMSharedLibDir := $(LLVMLibDir)
426
427 # Win32.DLL prefers to be located on the "PATH" of binaries.
428 ifeq ($(HOST_OS), $(filter $(HOST_OS), Cygwin MingW))
429 SharedLibDir := $(ToolDir)
430 LLVMSharedLibDir := $(LLVMToolDir)
431
432 ifeq ($(HOST_OS),Cygwin)
433 SharedPrefix := cyg
434 else
435 SharedPrefix :=
436 endif
437 endif
438
439 #--------------------------------------------------------------------
440 # Full Paths To Compiled Tools and Utilities
441 #--------------------------------------------------------------------
442 EchoCmd = $(ECHO) llvm[$(MAKELEVEL)]:
443 Echo = @$(EchoCmd)
444 ifndef LLVMAS
445 LLVMAS := $(LLVMToolDir)/llvm-as$(EXEEXT)
446 endif
447 ifndef LLVM_TBLGEN
448 ifeq ($(LLVM_CROSS_COMPILING),1)
449 LLVM_TBLGEN := $(BuildLLVMToolDir)/llvm-tblgen$(BUILD_EXEEXT)
450 else
451 LLVM_TBLGEN := $(LLVMToolDir)/llvm-tblgen$(EXEEXT)
452 endif
453 endif
454 LLVM_CONFIG := $(LLVMToolDir)/llvm-config
455 ifndef LLVMDIS
456 LLVMDIS := $(LLVMToolDir)/llvm-dis$(EXEEXT)
457 endif
458 ifndef LLI
459 LLI := $(LLVMToolDir)/lli$(EXEEXT)
460 endif
461 ifndef LLC
462 LLC := $(LLVMToolDir)/llc$(EXEEXT)
463 endif
464 ifndef LOPT
465 LOPT := $(LLVMToolDir)/opt$(EXEEXT)
466 endif
467 ifndef LBUGPOINT
468 LBUGPOINT := $(LLVMToolDir)/bugpoint$(EXEEXT)
469 endif
470
471 #--------------------------------------------------------------------
472 # Adjust to user's request
473 #--------------------------------------------------------------------
474
475 ifeq ($(HOST_OS),Darwin)
476 DARWIN_VERSION := `sw_vers -productVersion`
477 # Strip a number like 10.4.7 to 10.4
478 DARWIN_VERSION := $(shell echo $(DARWIN_VERSION)| sed -E 's/(10.[0-9]).*/\1/')
479 # Get "4" out of 10.4 for later pieces in the makefile.
480 DARWIN_MAJVERS := $(shell echo $(DARWIN_VERSION)| sed -E 's/10.([0-9]).*/\1/')
481
482 LoadableModuleOptions := -Wl,-flat_namespace -Wl,-undefined,suppress
483 SharedLinkOptions := -dynamiclib
484 ifdef DEPLOYMENT_TARGET
485 SharedLinkOptions += $(DEPLOYMENT_TARGET)
486 else
487 ifneq ($(ARCH),ARM)
488 SharedLinkOptions += -mmacosx-version-min=$(DARWIN_VERSION)
489 endif
490 endif
491 else
492 SharedLinkOptions=-shared
493 endif
494
495 ifeq ($(TARGET_OS),Darwin)
496 ifdef DEPLOYMENT_TARGET
497 TargetCommonOpts += $(DEPLOYMENT_TARGET)
498 else
499 ifneq ($(ARCH),ARM)
500 TargetCommonOpts += -mmacosx-version-min=$(DARWIN_VERSION)
501 endif
502 endif
503 endif
504
505 ifdef SHARED_LIBRARY
506 ifneq ($(HOST_OS), $(filter $(HOST_OS), Cygwin MingW))
507 ifneq ($(HOST_OS),Darwin)
508 LD.Flags += $(RPATH) -Wl,'$$ORIGIN'
509 endif
510 endif
511 endif
512
513 ifdef TOOL_VERBOSE
514 C.Flags += -v
515 CXX.Flags += -v
516 LD.Flags += -v
517 VERBOSE := 1
518 endif
519
520 # Adjust settings for verbose mode
521 ifndef VERBOSE
522 Verb := @
523 AR.Flags += >/dev/null 2>/dev/null
524 ConfigureScriptFLAGS += >$(PROJ_OBJ_DIR)/configure.out 2>&1
525 else
526 ConfigureScriptFLAGS :=
527 endif
528
529 # By default, strip symbol information from executable
530 ifndef KEEP_SYMBOLS
531 Strip := $(PLATFORMSTRIPOPTS)
532 StripWarnMsg := "(without symbols)"
533 Install.StripFlag += -s
534 endif
535
536 # Adjust linker flags for building an executable
537 ifneq ($(HOST_OS), $(filter $(HOST_OS), Cygwin MingW))
538 ifndef TOOL_NO_EXPORTS
539 LD.Flags += $(RDYNAMIC)
540 endif
541 ifneq ($(HOST_OS), Darwin)
542 ifdef TOOLNAME
543 LD.Flags += $(RPATH) -Wl,'$$ORIGIN/../lib'
544 ifdef EXAMPLE_TOOL
545 LD.Flags += $(RPATH) -Wl,$(ExmplDir)
546 else
547 LD.Flags += $(RPATH) -Wl,$(ToolDir)
548 endif
549 endif
550 else
551 ifneq ($(DARWIN_MAJVERS),4)
552 LD.Flags += $(RPATH) -Wl,@executable_path/../lib
553 endif
554 endif
555 endif
556
557
558 #----------------------------------------------------------
559 # Options To Invoke Tools
560 #----------------------------------------------------------
561
562 ifdef EXTRA_LD_OPTIONS
563 LD.Flags += $(EXTRA_LD_OPTIONS)
564 endif
565
566 ifndef NO_PEDANTIC
567 CompileCommonOpts += -pedantic -Wno-long-long
568 endif
569 CompileCommonOpts += -Wall -W -Wno-unused-parameter -Wwrite-strings \
570 $(EXTRA_OPTIONS) $(COVERED_SWITCH_DEFAULT)
571 # Enable cast-qual for C++; the workaround is to use const_cast.
572 CXX.Flags += -Wcast-qual
573
574 ifeq ($(HOST_OS),HP-UX)
575 CompileCommonOpts := -D_REENTRANT -D_HPUX_SOURCE
576 endif
577
578 # If we are building a universal binary on Mac OS X, pass extra options. This
579 # is useful to people that want to link the LLVM libraries into their universal
580 # apps.
581 #
582 # The following can be optionally specified:
583 # UNIVERSAL_SDK_PATH variable can be specified as a path to the SDK to use.
584 # For Mac OS X 10.4 Intel machines, the traditional one is:
585 # UNIVERSAL_SDK_PATH=/Developer/SDKs/MacOSX10.4u.sdk/
586 # UNIVERSAL_ARCH can be optionally specified to be a list of architectures
587 # to build for, e.g. UNIVERSAL_ARCH="i386 ppc ppc64". This defaults to
588 # i386/ppc only.
589 ifdef UNIVERSAL
590 ifndef UNIVERSAL_ARCH
591 UNIVERSAL_ARCH := i386 ppc
592 endif
593 UNIVERSAL_ARCH_OPTIONS := $(UNIVERSAL_ARCH:%=-arch %)
594 CompileCommonOpts += $(UNIVERSAL_ARCH_OPTIONS)
595 ifdef UNIVERSAL_SDK_PATH
596 CompileCommonOpts += -isysroot $(UNIVERSAL_SDK_PATH)
597 endif
598
599 # Building universal cannot compute dependencies automatically.
600 DISABLE_AUTO_DEPENDENCIES=1
601 else
602 ifeq ($(TARGET_OS),Darwin)
603 ifeq ($(ARCH),x86_64)
604 TargetCommonOpts = -m64
605 else
606 ifeq ($(ARCH),x86)
607 TargetCommonOpts = -m32
608 endif
609 endif
610 endif
611 endif
612
613 ifeq ($(HOST_OS),SunOS)
614 CPP.BaseFlags += -include llvm/Support/Solaris.h
615 endif
616
617 ifeq ($(HOST_OS),AuroraUX)
618 CPP.BaseFlags += -include llvm/Support/Solaris.h
619 endif # !HOST_OS - AuroraUX.
620
621 LD.Flags += -L$(LibDir) -L$(LLVMLibDir)
622 CPP.BaseFlags += -D_GNU_SOURCE -D__STDC_CONSTANT_MACROS -D__STDC_FORMAT_MACROS -D__STDC_LIMIT_MACROS
623 # All -I flags should go here, so that they don't confuse llvm-config.
624 CPP.Flags += $(sort -I$(PROJ_OBJ_DIR) -I$(PROJ_SRC_DIR) \
625 $(patsubst %,-I%/include,\
626 $(PROJ_OBJ_ROOT) $(PROJ_SRC_ROOT) \
627 $(LLVM_OBJ_ROOT) $(LLVM_SRC_ROOT))) \
628 $(CPP.BaseFlags)
629
630 # SHOW_DIAGNOSTICS support.
631 ifeq ($(SHOW_DIAGNOSTICS),1)
632 Compile.Wrapper := env CC_LOG_DIAGNOSTICS=1 \
633 CC_LOG_DIAGNOSTICS_FILE="$(LLVM_OBJ_ROOT)/$(BuildMode)/diags"
634 else
635 Compile.Wrapper :=
636 endif
637
638 ifeq ($(BUILD_COMPONENT), 1)
639 Compile.C = $(Compile.Wrapper) \
640 $(BUILD_CC) $(CPP.Flags) $(C.Flags) $(CFLAGS) $(CPPFLAGS) \
641 $(TargetCommonOpts) $(CompileCommonOpts) -c
642 Compile.CXX = $(Compile.Wrapper) \
643 $(BUILD_CXX) $(CPP.Flags) $(CXX.Flags) $(CXXFLAGS) \
644 $(CPPFLAGS) \
645 $(TargetCommonOpts) $(CompileCommonOpts) -c
646 Preprocess.CXX= $(Compile.Wrapper) \
647 $(BUILD_CXX) $(CPP.Flags) $(CPPFLAGS) $(TargetCommonOpts) \
648 $(CompileCommonOpts) $(CXX.Flags) -E
649 Link = $(Compile.Wrapper) \
650 $(BUILD_CXX) $(CPP.Flags) $(CXX.Flags) $(CXXFLAGS) \
651 $(LD.Flags) $(LDFLAGS) \
652 $(TargetCommonOpts) $(CompileCommonOpts) $(Strip)
653 else
654 Compile.C = $(Compile.Wrapper) \
655 $(CC) $(CPP.Flags) $(C.Flags) $(CFLAGS) $(CPPFLAGS) \
656 $(TargetCommonOpts) $(CompileCommonOpts) -c
657 Compile.CXX = $(Compile.Wrapper) \
658 $(CXX) $(CPP.Flags) $(CXX.Flags) $(CXXFLAGS) $(CPPFLAGS) \
659 $(TargetCommonOpts) $(CompileCommonOpts) -c
660 Preprocess.CXX= $(Compile.Wrapper) \
661 $(CXX) $(CPP.Flags) $(TargetCommonOpts) $(CPPFLAGS) \
662 $(CompileCommonOpts) $(CXX.Flags) -E
663 Link = $(Compile.Wrapper) \
664 $(CXX) $(CPP.Flags) $(CXX.Flags) $(CXXFLAGS) $(LD.Flags) \
665 $(LDFLAGS) $(TargetCommonOpts) $(CompileCommonOpts) $(Strip)
666 endif
667
668 Preprocess.C = $(CC) $(CPP.Flags) $(C.Flags) $(CPPFLAGS) \
669 $(TargetCommonOpts) $(CompileCommonOpts) -E
670
671 ProgInstall = $(INSTALL) $(Install.StripFlag) -m 0755
672 ScriptInstall = $(INSTALL) -m 0755
673 DataInstall = $(INSTALL) -m 0644
674
675 # When compiling under Mingw/Cygwin, the tblgen tool expects Windows
676 # paths. In this case, the SYSPATH function (defined in
677 # Makefile.config) transforms Unix paths into Windows paths.
678 TableGen.Flags= -I $(call SYSPATH, $(PROJ_SRC_DIR)) \
679 -I $(call SYSPATH, $(LLVM_SRC_ROOT)/include) \
680 -I $(call SYSPATH, $(PROJ_SRC_ROOT)/include) \
681 -I $(call SYSPATH, $(PROJ_SRC_ROOT)/lib/Target)
682 LLVMTableGen = $(LLVM_TBLGEN) $(TableGen.Flags)
683
684 Archive = $(AR) $(AR.Flags)
685 ifdef RANLIB
686 Ranlib = $(RANLIB)
687 else
688 Ranlib = ranlib
689 endif
690
691 AliasTool = ln -s
692
693 #----------------------------------------------------------
694 # Get the list of source files and compute object file
695 # names from them.
696 #----------------------------------------------------------
697
698 ifndef SOURCES
699 Sources := $(notdir $(wildcard $(PROJ_SRC_DIR)/*.cpp \
700 $(PROJ_SRC_DIR)/*.cc $(PROJ_SRC_DIR)/*.c))
701 else
702 Sources := $(SOURCES)
703 endif
704
705 ifdef BUILT_SOURCES
706 Sources += $(filter %.cpp %.c %.cc,$(BUILT_SOURCES))
707 endif
708
709 BaseNameSources := $(sort $(basename $(Sources)))
710
711 ObjectsO := $(BaseNameSources:%=$(ObjDir)/%.o)
712
713 #----------------------------------------------------------
714 # For Mingw MSYS bash and Python/w32:
715 #
716 # $(ECHOPATH) prints DOSish pathstring.
717 # ex) $(ECHOPATH) /include/sys/types.h
718 # --> C:/mingw/include/sys/types.h
719 # built-in "echo" does not transform path to DOSish path.
720 #
721 # FIXME: It would not be needed when MSYS's python
722 # were provided.
723 #----------------------------------------------------------
724
725 ifeq (-mingw32,$(findstring -mingw32,$(BUILD_TRIPLE)))
726 ECHOPATH := $(Verb)$(PYTHON) -u -c "import sys;print ' '.join(sys.argv[1:])"
727 else
728 ECHOPATH := $(Verb)$(ECHO)
729 endif
730
731 ###############################################################################
732 # DIRECTORIES: Handle recursive descent of directory structure
733 ###############################################################################
734
735 #---------------------------------------------------------
736 # Provide rules to make install dirs. This must be early
737 # in the file so they get built before dependencies
738 #---------------------------------------------------------
739
740 $(DESTDIR)$(PROJ_bindir) $(DESTDIR)$(PROJ_libdir) $(DESTDIR)$(PROJ_includedir) $(DESTDIR)$(PROJ_etcdir)::
741 $(Verb) $(MKDIR) $@
742
743 # To create other directories, as needed, and timestamp their creation
744 %/.dir:
745 $(Verb) $(MKDIR) $* > /dev/null
746 $(Verb) $(DOTDIR_TIMESTAMP_COMMAND) > $@
747
748 .PRECIOUS: $(ObjDir)/.dir $(LibDir)/.dir $(ToolDir)/.dir $(ExmplDir)/.dir
749 .PRECIOUS: $(LLVMLibDir)/.dir $(LLVMToolDir)/.dir $(LLVMExmplDir)/.dir
750
751 #---------------------------------------------------------
752 # Handle the DIRS options for sequential construction
753 #---------------------------------------------------------
754
755 SubDirs :=
756 ifdef DIRS
757 SubDirs += $(DIRS)
758
759 ifneq ($(PROJ_SRC_ROOT),$(PROJ_OBJ_ROOT))
760 $(RecursiveTargets)::
761 $(Verb) for dir in $(DIRS); do \
762 if ([ ! -f $$dir/Makefile ] || \
763 command test $$dir/Makefile -ot $(PROJ_SRC_DIR)/$$dir/Makefile ); then \
764 $(MKDIR) $$dir; \
765 $(CP) $(PROJ_SRC_DIR)/$$dir/Makefile $$dir/Makefile; \
766 fi; \
767 ($(MAKE) -C $$dir $@ ) || exit 1; \
768 done
769 else
770 $(RecursiveTargets)::
771 $(Verb) for dir in $(DIRS); do \
772 ($(MAKE) -C $$dir $@ ) || exit 1; \
773 done
774 endif
775
776 endif
777
778 #---------------------------------------------------------
779 # Handle the EXPERIMENTAL_DIRS options ensuring success
780 # after each directory is built.
781 #---------------------------------------------------------
782 ifdef EXPERIMENTAL_DIRS
783 $(RecursiveTargets)::
784 $(Verb) for dir in $(EXPERIMENTAL_DIRS); do \
785 if ([ ! -f $$dir/Makefile ] || \
786 command test $$dir/Makefile -ot $(PROJ_SRC_DIR)/$$dir/Makefile ); then \
787 $(MKDIR) $$dir; \
788 $(CP) $(PROJ_SRC_DIR)/$$dir/Makefile $$dir/Makefile; \
789 fi; \
790 ($(MAKE) -C $$dir $@ ) || exit 0; \
791 done
792 endif
793
794 #-----------------------------------------------------------
795 # Handle the OPTIONAL_PARALLEL_DIRS options for optional parallel construction
796 #-----------------------------------------------------------
797 ifdef OPTIONAL_PARALLEL_DIRS
798 PARALLEL_DIRS += $(foreach T,$(OPTIONAL_PARALLEL_DIRS),$(shell test -d $(PROJ_SRC_DIR)/$(T) && echo "$(T)"))
799 endif
800
801 #-----------------------------------------------------------
802 # Handle the PARALLEL_DIRS options for parallel construction
803 #-----------------------------------------------------------
804 ifdef PARALLEL_DIRS
805
806 SubDirs += $(PARALLEL_DIRS)
807
808 # Unfortunately, this list must be maintained if new recursive targets are added
809 all :: $(addsuffix /.makeall ,$(PARALLEL_DIRS))
810 clean :: $(addsuffix /.makeclean ,$(PARALLEL_DIRS))
811 clean-all:: $(addsuffix /.makeclean-all,$(PARALLEL_DIRS))
812 install :: $(addsuffix /.makeinstall ,$(PARALLEL_DIRS))
813 uninstall:: $(addsuffix /.makeuninstall,$(PARALLEL_DIRS))
814 install-bytecode :: $(addsuffix /.makeinstall-bytecode,$(PARALLEL_DIRS))
815 unitcheck:: $(addsuffix /.makeunitcheck,$(PARALLEL_DIRS))
816
817 ParallelTargets := $(foreach T,$(RecursiveTargets),%/.make$(T))
818
819 $(ParallelTargets) :
820 $(Verb) if ([ ! -f $(@D)/Makefile ] || \
821 command test $(@D)/Makefile -ot \
822 $(PROJ_SRC_DIR)/$(@D)/Makefile ); then \
823 $(MKDIR) $(@D); \
824 $(CP) $(PROJ_SRC_DIR)/$(@D)/Makefile $(@D)/Makefile; \
825 fi; \
826 $(MAKE) -C $(@D) $(subst $(@D)/.make,,$@)
827 endif
828
829 #---------------------------------------------------------
830 # Handle the OPTIONAL_DIRS options for directores that may
831 # or may not exist.
832 #---------------------------------------------------------
833 ifdef OPTIONAL_DIRS
834
835 SubDirs += $(OPTIONAL_DIRS)
836
837 ifneq ($(PROJ_SRC_ROOT),$(PROJ_OBJ_ROOT))
838 $(RecursiveTargets)::
839 $(Verb) for dir in $(OPTIONAL_DIRS); do \
840 if [ -d $(PROJ_SRC_DIR)/$$dir ]; then\
841 if ([ ! -f $$dir/Makefile ] || \
842 command test $$dir/Makefile -ot $(PROJ_SRC_DIR)/$$dir/Makefile ); then \
843 $(MKDIR) $$dir; \
844 $(CP) $(PROJ_SRC_DIR)/$$dir/Makefile $$dir/Makefile; \
845 fi; \
846 ($(MAKE) -C$$dir $@ ) || exit 1; \
847 fi \
848 done
849 else
850 $(RecursiveTargets)::
851 $(Verb) for dir in $(OPTIONAL_DIRS); do \
852 if [ -d $(PROJ_SRC_DIR)/$$dir ]; then\
853 ($(MAKE) -C$$dir $@ ) || exit 1; \
854 fi \
855 done
856 endif
857 endif
858
859 #---------------------------------------------------------
860 # Handle the CONFIG_FILES options
861 #---------------------------------------------------------
862 ifdef CONFIG_FILES
863
864 ifdef NO_INSTALL
865 install-local::
866 $(Echo) Install circumvented with NO_INSTALL
867 uninstall-local::
868 $(Echo) UnInstall circumvented with NO_INSTALL
869 else
870 install-local:: $(DESTDIR)$(PROJ_etcdir) $(CONFIG_FILES)
871 $(Echo) Installing Configuration Files To $(DESTDIR)$(PROJ_etcdir)
872 $(Verb)for file in $(CONFIG_FILES); do \
873 if test -f $(PROJ_OBJ_DIR)/$${file} ; then \
874 $(DataInstall) $(PROJ_OBJ_DIR)/$${file} $(DESTDIR)$(PROJ_etcdir) ; \
875 elif test -f $(PROJ_SRC_DIR)/$${file} ; then \
876 $(DataInstall) $(PROJ_SRC_DIR)/$${file} $(DESTDIR)$(PROJ_etcdir) ; \
877 else \
878 $(ECHO) Error: cannot find config file $${file}. ; \
879 fi \
880 done
881
882 uninstall-local::
883 $(Echo) Uninstalling Configuration Files From $(DESTDIR)$(PROJ_etcdir)
884 $(Verb)for file in $(CONFIG_FILES); do \
885 $(RM) -f $(DESTDIR)$(PROJ_etcdir)/$${file} ; \
886 done
887 endif
888
889 endif
890
891 ###############################################################################
892 # Set up variables for building libraries
893 ###############################################################################
894
895 #---------------------------------------------------------
896 # Define various command line options pertaining to the
897 # libraries needed when linking. There are "Proj" libs
898 # (defined by the user's project) and "LLVM" libs (defined
899 # by the LLVM project).
900 #---------------------------------------------------------
901
902 ifdef USEDLIBS
903 ProjLibsOptions := $(patsubst %.a.o, -l%, $(addsuffix .o, $(USEDLIBS)))
904 ProjLibsOptions := $(patsubst %.o, $(LibDir)/%.o, $(ProjLibsOptions))
905 ProjUsedLibs := $(patsubst %.a.o, lib%.a, $(addsuffix .o, $(USEDLIBS)))
906 ProjLibsPaths := $(addprefix $(LibDir)/,$(ProjUsedLibs))
907 endif
908
909 ifdef LLVMLIBS
910 LLVMLibsOptions := $(patsubst %.a.o, -l%, $(addsuffix .o, $(LLVMLIBS)))
911 LLVMLibsOptions := $(patsubst %.o, $(LLVMLibDir)/%.o, $(LLVMLibsOptions))
912 LLVMUsedLibs := $(patsubst %.a.o, lib%.a, $(addsuffix .o, $(LLVMLIBS)))
913 LLVMLibsPaths := $(addprefix $(LLVMLibDir)/,$(LLVMUsedLibs))
914 endif
915
916 # Loadable module for Win32 requires all symbols resolved for linking.
917 # Then all symbols in LLVM.dll will be available.
918 ifeq ($(ENABLE_SHARED),1)
919 ifdef LOADABLE_MODULE
920 ifneq (,$(filter $(HOST_OS),Cygwin MingW))
921 LINK_COMPONENTS += all
922 endif
923 endif
924 endif
925
926 ifndef IS_CLEANING_TARGET
927 ifdef LINK_COMPONENTS
928
929 # If LLVM_CONFIG doesn't exist, build it. This can happen if you do a make
930 # clean in tools, then do a make in tools (instead of at the top level).
931 $(LLVM_CONFIG):
932 @echo "*** llvm-config doesn't exist - rebuilding it."
933 @$(MAKE) -C $(PROJ_OBJ_ROOT)/tools/llvm-config
934
935 $(ToolDir)/$(strip $(TOOLNAME))$(EXEEXT): $(LLVM_CONFIG)
936
937 ifeq ($(ENABLE_SHARED), 1)
938 # We can take the "auto-import" feature to get rid of using dllimport.
939 ifeq ($(HOST_OS), $(filter $(HOST_OS), Cygwin MingW))
940 LLVMLibsOptions += -Wl,--enable-auto-import,--enable-runtime-pseudo-reloc \
941 -L $(SharedLibDir)
942 endif
943 LLVMLibsOptions += -lLLVM-$(LLVMVersion)
944 LLVMLibsPaths += $(SharedLibDir)/$(SharedPrefix)LLVM-$(LLVMVersion)$(SHLIBEXT)
945 else
946
947 ifndef NO_LLVM_CONFIG
948 LLVMConfigLibs := $(shell $(LLVM_CONFIG) --libs $(LINK_COMPONENTS) || echo Error)
949 ifeq ($(LLVMConfigLibs),Error)
950 $(error llvm-config --libs failed)
951 endif
952 LLVMLibsOptions += $(LLVMConfigLibs)
953 LLVMConfigLibfiles := $(shell $(LLVM_CONFIG) --libfiles $(LINK_COMPONENTS) || echo Error)
954 ifeq ($(LLVMConfigLibfiles),Error)
955 $(error llvm-config --libfiles failed)
956 endif
957 LLVMLibsPaths += $(LLVM_CONFIG) $(LLVMConfigLibfiles)
958 endif
959
960 endif
961 endif
962 endif
963
964 # Set up the library exports file.
965 ifdef EXPORTED_SYMBOL_FILE
966
967 # First, set up the native export file, which may differ from the source
968 # export file.
969
970 ifeq ($(HOST_OS),Darwin)
971 # Darwin convention prefixes symbols with underscores.
972 NativeExportsFile := $(ObjDir)/$(notdir $(EXPORTED_SYMBOL_FILE)).sed
973 $(NativeExportsFile): $(EXPORTED_SYMBOL_FILE) $(ObjDir)/.dir
974 $(Verb) sed -e 's/^/_/' < $< > $@
975 clean-local::
976 -$(Verb) $(RM) -f $(NativeExportsFile)
977 else
978 ifeq ($(HAVE_LINK_VERSION_SCRIPT),1)
979 # Gold and BFD ld require a version script rather than a plain list.
980 NativeExportsFile := $(ObjDir)/$(notdir $(EXPORTED_SYMBOL_FILE)).map
981 $(NativeExportsFile): $(EXPORTED_SYMBOL_FILE) $(ObjDir)/.dir
982 $(Verb) echo "{" > $@
983 $(Verb) grep -q "\<" $< && echo " global:" >> $@ || :
984 $(Verb) sed -e 's/$$/;/' -e 's/^/ /' < $< >> $@
985 ifneq ($(HOST_OS),OpenBSD)
986 $(Verb) echo " local: *;" >> $@
987 endif
988 $(Verb) echo "};" >> $@
989 clean-local::
990 -$(Verb) $(RM) -f $(NativeExportsFile)
991 else
992 ifeq ($(HOST_OS), $(filter $(HOST_OS), Cygwin MingW))
993 # GNU ld Win32 accepts .DEF files that contain "DATA" entries.
994 NativeExportsFile := $(ObjDir)/$(notdir $(EXPORTED_SYMBOL_FILE:.exports=.def))
995 $(NativeExportsFile): $(EXPORTED_SYMBOL_FILE) $(ObjDir)/.dir
996 $(Echo) Generating $(notdir $@)
997 $(Verb) $(ECHO) "EXPORTS" > $@
998 $(Verb) $(CAT) $< >> $@
999 clean-local::
1000 -$(Verb) $(RM) -f $(NativeExportsFile)
1001 else
1002 # Default behavior: just use the exports file verbatim.
1003 NativeExportsFile := $(EXPORTED_SYMBOL_FILE)
1004 endif
1005 endif
1006 endif
1007
1008 # Now add the linker command-line options to use the native export file.
1009
1010 # Darwin
1011 ifeq ($(HOST_OS),Darwin)
1012 LLVMLibsOptions += -Wl,-exported_symbols_list,$(NativeExportsFile)
1013 endif
1014
1015 # gold, bfd ld, etc.
1016 ifeq ($(HAVE_LINK_VERSION_SCRIPT),1)
1017 LLVMLibsOptions += -Wl,--version-script,$(NativeExportsFile)
1018 endif
1019
1020 # Windows
1021 ifeq ($(HOST_OS), $(filter $(HOST_OS), Cygwin MingW))
1022 # LLVMLibsOptions is invalidated at processing tools/llvm-shlib.
1023 SharedLinkOptions += $(NativeExportsFile)
1024 endif
1025
1026 endif
1027
1028 ###############################################################################
1029 # Library Build Rules: Four ways to build a library
1030 ###############################################################################
1031
1032 # if we're building a library ...
1033 ifdef LIBRARYNAME
1034
1035 # Make sure there isn't any extraneous whitespace on the LIBRARYNAME option
1036 LIBRARYNAME := $(strip $(LIBRARYNAME))
1037 ifdef LOADABLE_MODULE
1038 BaseLibName.A := $(LIBRARYNAME).a
1039 BaseLibName.SO := $(LIBRARYNAME)$(SHLIBEXT)
1040 else
1041 BaseLibName.A := lib$(LIBRARYNAME).a
1042 BaseLibName.SO := $(SharedPrefix)$(LIBRARYNAME)$(SHLIBEXT)
1043 endif
1044 LibName.A := $(LibDir)/$(BaseLibName.A)
1045 LibName.SO := $(SharedLibDir)/$(BaseLibName.SO)
1046 LibName.O := $(LibDir)/$(LIBRARYNAME).o
1047
1048 #---------------------------------------------------------
1049 # Shared Library Targets:
1050 # If the user asked for a shared library to be built
1051 # with the SHARED_LIBRARY variable, then we provide
1052 # targets for building them.
1053 #---------------------------------------------------------
1054 ifdef SHARED_LIBRARY
1055
1056 all-local:: $(LibName.SO)
1057
1058 ifdef EXPORTED_SYMBOL_FILE
1059 $(LibName.SO): $(NativeExportsFile)
1060 endif
1061
1062 ifdef LINK_LIBS_IN_SHARED
1063 ifdef LOADABLE_MODULE
1064 SharedLibKindMessage := "Loadable Module"
1065 SharedLinkOptions := $(LoadableModuleOptions) $(SharedLinkOptions)
1066 else
1067 SharedLibKindMessage := "Shared Library"
1068 endif
1069 $(LibName.SO): $(ObjectsO) $(ProjLibsPaths) $(LLVMLibsPaths) $(SharedLibDir)/.dir
1070 $(Echo) Linking $(BuildMode) $(SharedLibKindMessage) \
1071 $(notdir $@)
1072 $(Verb) $(Link) $(SharedLinkOptions) -o $@ $(ObjectsO) \
1073 $(ProjLibsOptions) $(LLVMLibsOptions) $(LIBS)
1074 else
1075 $(LibName.SO): $(ObjectsO) $(SharedLibDir)/.dir
1076 $(Echo) Linking $(BuildMode) Shared Library $(notdir $@)
1077 $(Verb) $(Link) $(SharedLinkOptions) -o $@ $(ObjectsO)
1078 endif
1079
1080 clean-local::
1081 ifneq ($(strip $(LibName.SO)),)
1082 -$(Verb) $(RM) -f $(LibName.SO)
1083 endif
1084
1085 ifdef NO_INSTALL
1086 install-local::
1087 $(Echo) Install circumvented with NO_INSTALL
1088 uninstall-local::
1089 $(Echo) Uninstall circumvented with NO_INSTALL
1090 else
1091
1092 # Win32.DLL prefers to be located on the "PATH" of binaries.
1093 ifeq ($(HOST_OS), $(filter $(HOST_OS), Cygwin MingW))
1094 DestSharedLibDir := $(DESTDIR)$(PROJ_bindir)
1095 else
1096 DestSharedLibDir := $(DESTDIR)$(PROJ_libdir)
1097 endif
1098 DestSharedLib := $(DestSharedLibDir)/$(BaseLibName.SO)
1099
1100 install-local:: $(DestSharedLib)
1101
1102 $(DestSharedLib): $(LibName.SO) $(DestSharedLibDir)
1103 $(Echo) Installing $(BuildMode) Shared Library $(DestSharedLib)
1104 $(Verb) $(INSTALL) $(LibName.SO) $(DestSharedLib)
1105
1106 uninstall-local::
1107 $(Echo) Uninstalling $(BuildMode) Shared Library $(DestSharedLib)
1108 -$(Verb) $(RM) -f $(DestSharedLibDir)/$(SharedPrefix)$(LIBRARYNAME).*
1109 endif
1110 endif
1111
1112 #---------------------------------------------------------
1113 # Library Targets:
1114 # If neither BUILD_ARCHIVE or LOADABLE_MODULE are specified, default to
1115 # building an archive.
1116 #---------------------------------------------------------
1117 ifndef NO_BUILD_ARCHIVE
1118 ifndef BUILD_ARCHIVE
1119 ifndef LOADABLE_MODULE
1120 BUILD_ARCHIVE = 1
1121 endif
1122 endif
1123 endif
1124
1125 #---------------------------------------------------------
1126 # Archive Library Targets:
1127 # If the user wanted a regular archive library built,
1128 # then we provide targets for building them.
1129 #---------------------------------------------------------
1130 ifdef BUILD_ARCHIVE
1131
1132 all-local:: $(LibName.A)
1133
1134 $(LibName.A): $(ObjectsO) $(LibDir)/.dir
1135 $(Echo) Building $(BuildMode) Archive Library $(notdir $@)
1136 -$(Verb) $(RM) -f $@
1137 $(Verb) $(Archive) $@ $(ObjectsO)
1138 $(Verb) $(Ranlib) $@
1139
1140 clean-local::
1141 ifneq ($(strip $(LibName.A)),)
1142 -$(Verb) $(RM) -f $(LibName.A)
1143 endif
1144
1145 ifdef NO_INSTALL
1146 install-local::
1147 $(Echo) Install circumvented with NO_INSTALL
1148 uninstall-local::
1149 $(Echo) Uninstall circumvented with NO_INSTALL
1150 else
1151 ifdef NO_INSTALL_ARCHIVES
1152 install-local::
1153 $(Echo) Install circumvented with NO_INSTALL
1154 uninstall-local::
1155 $(Echo) Uninstall circumvented with NO_INSTALL
1156 else
1157 DestArchiveLib := $(DESTDIR)$(PROJ_libdir)/lib$(LIBRARYNAME).a
1158
1159 install-local:: $(DestArchiveLib)
1160
1161 $(DestArchiveLib): $(LibName.A) $(DESTDIR)$(PROJ_libdir)
1162 $(Echo) Installing $(BuildMode) Archive Library $(DestArchiveLib)
1163 $(Verb) $(MKDIR) $(DESTDIR)$(PROJ_libdir)
1164 $(Verb) $(INSTALL) $(LibName.A) $(DestArchiveLib)
1165
1166 uninstall-local::
1167 $(Echo) Uninstalling $(BuildMode) Archive Library $(DestArchiveLib)
1168 -$(Verb) $(RM) -f $(DestArchiveLib)
1169 endif
1170 endif
1171 endif
1172
1173 # endif LIBRARYNAME
1174 endif
1175
1176 ###############################################################################
1177 # Tool Build Rules: Build executable tool based on TOOLNAME option
1178 ###############################################################################
1179
1180 ifdef TOOLNAME
1181
1182 #---------------------------------------------------------
1183 # Set up variables for building a tool.
1184 #---------------------------------------------------------
1185 TOOLEXENAME := $(strip $(TOOLNAME))$(EXEEXT)
1186 ifdef EXAMPLE_TOOL
1187 ToolBuildPath := $(ExmplDir)/$(TOOLEXENAME)
1188 else
1189 ToolBuildPath := $(ToolDir)/$(TOOLEXENAME)
1190 endif
1191
1192 # TOOLALIAS is a name to symlink (or copy) the tool to.
1193 ifdef TOOLALIAS
1194 ifdef EXAMPLE_TOOL
1195 ToolAliasBuildPath := $(ExmplDir)/$(strip $(TOOLALIAS))$(EXEEXT)
1196 else
1197 ToolAliasBuildPath := $(ToolDir)/$(strip $(TOOLALIAS))$(EXEEXT)
1198 endif
1199 endif
1200
1201 #---------------------------------------------------------
1202 # Prune Exports
1203 #---------------------------------------------------------
1204
1205 # If the tool opts in with TOOL_NO_EXPORTS, optimize startup time of the app by
1206 # not exporting all of the weak symbols from the binary. This reduces dyld
1207 # startup time by 4x on darwin in some cases.
1208 ifdef TOOL_NO_EXPORTS
1209 ifeq ($(HOST_OS),Darwin)
1210
1211 # Tiger tools don't support this.
1212 ifneq ($(DARWIN_MAJVERS),4)
1213 LD.Flags += -Wl,-exported_symbol,_main
1214 endif
1215 endif
1216
1217 ifeq ($(HOST_OS), $(filter $(HOST_OS), Linux NetBSD FreeBSD GNU/kFreeBSD))
1218 ifneq ($(ARCH), Mips)
1219 LD.Flags += -Wl,--version-script=$(PROJ_SRC_ROOT)/autoconf/ExportMap.map
1220 endif
1221 endif
1222 endif
1223
1224 #---------------------------------------------------------
1225 # Tool Order File Support
1226 #---------------------------------------------------------
1227
1228 ifeq ($(HOST_OS),Darwin)
1229 ifdef TOOL_ORDER_FILE
1230
1231 LD.Flags += -Wl,-order_file,$(TOOL_ORDER_FILE)
1232
1233 endif
1234 endif
1235
1236 #---------------------------------------------------------
1237 # Tool Version Info Support
1238 #---------------------------------------------------------
1239
1240 ifeq ($(HOST_OS),Darwin)
1241 ifdef TOOL_INFO_PLIST
1242
1243 LD.Flags += -Wl,-sectcreate,__TEXT,__info_plist,$(ObjDir)/$(TOOL_INFO_PLIST)
1244
1245 $(ToolBuildPath): $(ObjDir)/$(TOOL_INFO_PLIST)
1246
1247 $(ObjDir)/$(TOOL_INFO_PLIST): $(PROJ_SRC_DIR)/$(TOOL_INFO_PLIST).in $(ObjDir)/.dir
1248 $(Echo) "Creating $(TOOLNAME) '$(TOOL_INFO_PLIST)' file..."
1249 $(Verb)sed -e "s#@TOOL_INFO_UTI@#$(TOOL_INFO_UTI)#g" \
1250 -e "s#@TOOL_INFO_NAME@#$(TOOL_INFO_NAME)#g" \
1251 -e "s#@TOOL_INFO_VERSION@#$(TOOL_INFO_VERSION)#g" \
1252 -e "s#@TOOL_INFO_BUILD_VERSION@#$(TOOL_INFO_BUILD_VERSION)#g" \
1253 $< > $@
1254
1255 endif
1256 endif
1257
1258 #---------------------------------------------------------
1259 # Provide targets for building the tools
1260 #---------------------------------------------------------
1261 all-local:: $(ToolBuildPath) $(ToolAliasBuildPath)
1262
1263 clean-local::
1264 ifneq ($(strip $(ToolBuildPath)),)
1265 -$(Verb) $(RM) -f $(ToolBuildPath)
1266 endif
1267 ifneq ($(strip $(ToolAliasBuildPath)),)
1268 -$(Verb) $(RM) -f $(ToolAliasBuildPath)
1269 endif
1270
1271 ifdef EXAMPLE_TOOL
1272 $(ToolBuildPath): $(ExmplDir)/.dir
1273 else
1274 $(ToolBuildPath): $(ToolDir)/.dir
1275 endif
1276
1277 $(ToolBuildPath): $(ObjectsO) $(ProjLibsPaths) $(LLVMLibsPaths)
1278 $(Echo) Linking $(BuildMode) executable $(TOOLNAME) $(StripWarnMsg)
1279 $(Verb) $(Link) -o $@ $(TOOLLINKOPTS) $(ObjectsO) $(ProjLibsOptions) \
1280 $(LLVMLibsOptions) $(ExtraLibs) $(TOOLLINKOPTSB) $(LIBS)
1281 $(Echo) ======= Finished Linking $(BuildMode) Executable $(TOOLNAME) \
1282 $(StripWarnMsg)
1283
1284 ifneq ($(strip $(ToolAliasBuildPath)),)
1285 $(ToolAliasBuildPath): $(ToolBuildPath)
1286 $(Echo) Creating $(BuildMode) Alias $(TOOLALIAS) $(StripWarnMsg)
1287 $(Verb) $(RM) -f $(ToolAliasBuildPath)
1288 $(Verb) $(AliasTool) $(TOOLEXENAME) $(ToolAliasBuildPath)
1289 $(Echo) ======= Finished Creating $(BuildMode) Alias $(TOOLALIAS) \
1290 $(StripWarnMsg)
1291 endif
1292
1293 ifdef NO_INSTALL
1294 install-local::
1295 $(Echo) Install circumvented with NO_INSTALL
1296 uninstall-local::
1297 $(Echo) Uninstall circumvented with NO_INSTALL
1298 else
1299 DestTool = $(DESTDIR)$(PROJ_bindir)/$(program_prefix)$(TOOLEXENAME)
1300
1301 install-local:: $(DestTool)
1302
1303 $(DestTool): $(ToolBuildPath) $(DESTDIR)$(PROJ_bindir)
1304 $(Echo) Installing $(BuildMode) $(DestTool)
1305 $(Verb) $(ProgInstall) $(ToolBuildPath) $(DestTool)
1306
1307 uninstall-local::
1308 $(Echo) Uninstalling $(BuildMode) $(DestTool)
1309 -$(Verb) $(RM) -f $(DestTool)
1310
1311 # TOOLALIAS install.
1312 ifdef TOOLALIAS
1313 DestToolAlias = $(DESTDIR)$(PROJ_bindir)/$(program_prefix)$(TOOLALIAS)$(EXEEXT)
1314
1315 install-local:: $(DestToolAlias)
1316
1317 $(DestToolAlias): $(DestTool)
1318 $(Echo) Installing $(BuildMode) $(DestToolAlias)
1319 $(Verb) $(RM) -f $(DestToolAlias)
1320 $(Verb) $(AliasTool) $(TOOLEXENAME) $(DestToolAlias)
1321
1322 uninstall-local::
1323 $(Echo) Uninstalling $(BuildMode) $(DestToolAlias)
1324 -$(Verb) $(RM) -f $(DestToolAlias)
1325 endif
1326
1327 endif
1328 endif
1329
1330 ###############################################################################
1331 # Object Build Rules: Build object files based on sources
1332 ###############################################################################
1333
1334 # FIXME: This should be checking for "if not GCC or ICC", not for "if HP-UX"
1335 ifeq ($(HOST_OS),HP-UX)
1336 DISABLE_AUTO_DEPENDENCIES=1
1337 endif
1338
1339 # Provide rule sets for when dependency generation is enabled
1340 ifndef DISABLE_AUTO_DEPENDENCIES
1341
1342 #---------------------------------------------------------
1343 # Create .o files in the ObjDir directory from the .cpp and .c files...
1344 #---------------------------------------------------------
1345
1346 DEPEND_OPTIONS = -MMD -MP -MF "$(ObjDir)/$*.d.tmp" \
1347 -MT "$(ObjDir)/$*.o" -MT "$(ObjDir)/$*.d"
1348
1349 # If the build succeeded, move the dependency file over, otherwise
1350 # remove it.
1351 DEPEND_MOVEFILE = then $(MV) -f "$(ObjDir)/$*.d.tmp" "$(ObjDir)/$*.d"; \
1352 else $(RM) "$(ObjDir)/$*.d.tmp"; exit 1; fi
1353
1354 $(ObjDir)/%.o: %.cpp $(ObjDir)/.dir $(BUILT_SOURCES) $(PROJ_MAKEFILE)
1355 $(Echo) "Compiling $*.cpp for $(BuildMode) build" $(PIC_FLAG)
1356 $(Verb) if $(Compile.CXX) $(DEPEND_OPTIONS) $< -o $(ObjDir)/$*.o ; \
1357 $(DEPEND_MOVEFILE)
1358
1359 $(ObjDir)/%.o: %.mm $(ObjDir)/.dir $(BUILT_SOURCES) $(PROJ_MAKEFILE)
1360 $(Echo) "Compiling $*.mm for $(BuildMode) build" $(PIC_FLAG)
1361 $(Verb) if $(Compile.CXX) $(DEPEND_OPTIONS) $< -o $(ObjDir)/$*.o ; \
1362 $(DEPEND_MOVEFILE)
1363
1364 $(ObjDir)/%.o: %.cc $(ObjDir)/.dir $(BUILT_SOURCES) $(PROJ_MAKEFILE)
1365 $(Echo) "Compiling $*.cc for $(BuildMode) build" $(PIC_FLAG)
1366 $(Verb) if $(Compile.CXX) $(DEPEND_OPTIONS) $< -o $(ObjDir)/$*.o ; \
1367 $(DEPEND_MOVEFILE)
1368
1369 $(ObjDir)/%.o: %.c $(ObjDir)/.dir $(BUILT_SOURCES) $(PROJ_MAKEFILE)
1370 $(Echo) "Compiling $*.c for $(BuildMode) build" $(PIC_FLAG)
1371 $(Verb) if $(Compile.C) $(DEPEND_OPTIONS) $< -o $(ObjDir)/$*.o ; \
1372 $(DEPEND_MOVEFILE)
1373
1374 $(ObjDir)/%.o: %.m $(ObjDir)/.dir $(BUILT_SOURCES) $(PROJ_MAKEFILE)
1375 $(Echo) "Compiling $*.m for $(BuildMode) build" $(PIC_FLAG)
1376 $(Verb) if $(Compile.C) $(DEPEND_OPTIONS) $< -o $(ObjDir)/$*.o ; \
1377 $(DEPEND_MOVEFILE)
1378
1379 # Provide alternate rule sets if dependencies are disabled
1380 else
1381
1382 $(ObjDir)/%.o: %.cpp $(ObjDir)/.dir $(BUILT_SOURCES)
1383 $(Echo) "Compiling $*.cpp for $(BuildMode) build" $(PIC_FLAG)
1384 $(Compile.CXX) $< -o $@
1385
1386 $(ObjDir)/%.o: %.mm $(ObjDir)/.dir $(BUILT_SOURCES)
1387 $(Echo) "Compiling $*.mm for $(BuildMode) build" $(PIC_FLAG)
1388 $(Compile.CXX) $< -o $@
1389
1390 $(ObjDir)/%.o: %.cc $(ObjDir)/.dir $(BUILT_SOURCES)
1391 $(Echo) "Compiling $*.cc for $(BuildMode) build" $(PIC_FLAG)
1392 $(Compile.CXX) $< -o $@
1393
1394 $(ObjDir)/%.o: %.c $(ObjDir)/.dir $(BUILT_SOURCES)
1395 $(Echo) "Compiling $*.c for $(BuildMode) build" $(PIC_FLAG)
1396 $(Compile.C) $< -o $@
1397
1398 $(ObjDir)/%.o: %.m $(ObjDir)/.dir $(BUILT_SOURCES)
1399 $(Echo) "Compiling $*.m for $(BuildMode) build" $(PIC_FLAG)
1400 $(Compile.C) $< -o $@
1401 endif
1402
1403
1404 ## Rules for building preprocessed (.i/.ii) outputs.
1405 $(BuildMode)/%.ii: %.cpp $(ObjDir)/.dir $(BUILT_SOURCES)
1406 $(Echo) "Compiling $*.cpp for $(BuildMode) build to .ii file"
1407 $(Verb) $(Preprocess.CXX) $< -o $@
1408
1409 $(BuildMode)/%.ii: %.mm $(ObjDir)/.dir $(BUILT_SOURCES)
1410 $(Echo) "Compiling $*.mm for $(BuildMode) build to .ii file"
1411 $(Verb) $(Preprocess.CXX) $< -o $@
1412
1413 $(BuildMode)/%.ii: %.cc $(ObjDir)/.dir $(BUILT_SOURCES)
1414 $(Echo) "Compiling $*.cc for $(BuildMode) build to .ii file"
1415 $(Verb) $(Preprocess.CXX) $< -o $@
1416
1417 $(BuildMode)/%.i: %.c $(ObjDir)/.dir $(BUILT_SOURCES)
1418 $(Echo) "Compiling $*.c for $(BuildMode) build to .i file"
1419 $(Verb) $(Preprocess.C) $< -o $@
1420
1421 $(BuildMode)/%.i: %.m $(ObjDir)/.dir $(BUILT_SOURCES)
1422 $(Echo) "Compiling $*.m for $(BuildMode) build to .i file"
1423 $(Verb) $(Preprocess.C) $< -o $@
1424
1425
1426 $(ObjDir)/%.s: %.cpp $(ObjDir)/.dir $(BUILT_SOURCES)
1427 $(Echo) "Compiling $*.cpp to asm for $(BuildMode) build" $(PIC_FLAG)
1428 $(Compile.CXX) $< -o $@ -S
1429
1430 $(ObjDir)/%.s: %.mm $(ObjDir)/.dir $(BUILT_SOURCES)
1431 $(Echo) "Compiling $*.mm to asm for $(BuildMode) build" $(PIC_FLAG)
1432 $(Compile.CXX) $< -o $@ -S
1433
1434 $(ObjDir)/%.s: %.cc $(ObjDir)/.dir $(BUILT_SOURCES)
1435 $(Echo) "Compiling $*.cc to asm for $(BuildMode) build" $(PIC_FLAG)
1436 $(Compile.CXX) $< -o $@ -S
1437
1438 $(ObjDir)/%.s: %.c $(ObjDir)/.dir $(BUILT_SOURCES)
1439 $(Echo) "Compiling $*.c to asm for $(BuildMode) build" $(PIC_FLAG)
1440 $(Compile.C) $< -o $@ -S
1441
1442 $(ObjDir)/%.s: %.m $(ObjDir)/.dir $(BUILT_SOURCES)
1443 $(Echo) "Compiling $*.m to asm for $(BuildMode) build" $(PIC_FLAG)
1444 $(Compile.C) $< -o $@ -S
1445
1446 ###############################################################################
1447 # TABLEGEN: Provide rules for running tblgen to produce *.inc files
1448 ###############################################################################
1449
1450 ifdef TARGET
1451 TABLEGEN_INC_FILES_COMMON = 1
1452 endif
1453
1454 ifdef TABLEGEN_INC_FILES_COMMON
1455
1456 INCFiles := $(filter %.inc,$(BUILT_SOURCES))
1457 INCTMPFiles := $(INCFiles:%=$(ObjDir)/%.tmp)
1458 .PRECIOUS: $(INCTMPFiles) $(INCFiles)
1459
1460 # INCFiles rule: All of the tblgen generated files are emitted to
1461 # $(ObjDir)/%.inc.tmp, instead of emitting them directly to %.inc. This allows
1462 # us to only "touch" the real file if the contents of it change. IOW, if
1463 # tblgen is modified, all of the .inc.tmp files are regenerated, but no
1464 # dependencies of the .inc files are, unless the contents of the .inc file
1465 # changes.
1466 $(INCFiles) : %.inc : $(ObjDir)/%.inc.tmp
1467 $(Verb) $(CMP) -s $@ $< || $(CP) $< $@
1468
1469 endif # TABLEGEN_INC_FILES_COMMON
1470
1471 ifdef TARGET
1472
1473 TDFiles := $(strip $(wildcard $(PROJ_SRC_DIR)/*.td) \
1474 $(LLVM_SRC_ROOT)/include/llvm/Target/Target.td \
1475 $(LLVM_SRC_ROOT)/include/llvm/Target/TargetCallingConv.td \
1476 $(LLVM_SRC_ROOT)/include/llvm/Target/TargetSchedule.td \
1477 $(LLVM_SRC_ROOT)/include/llvm/Target/TargetSelectionDAG.td \
1478 $(LLVM_SRC_ROOT)/include/llvm/CodeGen/ValueTypes.td) \
1479 $(wildcard $(LLVM_SRC_ROOT)/include/llvm/Intrinsics*.td)
1480
1481 # All .inc.tmp files depend on the .td files.
1482 $(INCTMPFiles) : $(TDFiles)
1483
1484 $(TARGET:%=$(ObjDir)/%GenRegisterInfo.inc.tmp): \
1485 $(ObjDir)/%GenRegisterInfo.inc.tmp : %.td $(ObjDir)/.dir $(LLVM_TBLGEN)
1486 $(Echo) "Building $(
1487 $(Verb) $(LLVMTableGen) -gen-register-info -o $(call SYSPATH, $@) $<
1488
1489 $(TARGET:%=$(ObjDir)/%GenInstrInfo.inc.tmp): \
1490 $(ObjDir)/%GenInstrInfo.inc.tmp : %.td $(ObjDir)/.dir $(LLVM_TBLGEN)
1491 $(Echo) "Building $(
1492 $(Verb) $(LLVMTableGen) -gen-instr-info -o $(call SYSPATH, $@) $<
1493
1494 $(TARGET:%=$(ObjDir)/%GenAsmWriter.inc.tmp): \
1495 $(ObjDir)/%GenAsmWriter.inc.tmp : %.td $(ObjDir)/.dir $(LLVM_TBLGEN)
1496 $(Echo) "Building $(
1497 $(Verb) $(LLVMTableGen) -gen-asm-writer -o $(call SYSPATH, $@) $<
1498
1499 $(TARGET:%=$(ObjDir)/%GenAsmWriter1.inc.tmp): \
1500 $(ObjDir)/%GenAsmWriter1.inc.tmp : %.td $(ObjDir)/.dir $(LLVM_TBLGEN)
1501 $(Echo) "Building $(
1502 $(Verb) $(LLVMTableGen) -gen-asm-writer -asmwriternum=1 -o $(call SYSPATH, $@) $<
1503
1504 $(TARGET:%=$(ObjDir)/%GenAsmMatcher.inc.tmp): \
1505 $(ObjDir)/%GenAsmMatcher.inc.tmp : %.td $(ObjDir)/.dir $(LLVM_TBLGEN)
1506 $(Echo) "Building $(
1507 $(Verb) $(LLVMTableGen) -gen-asm-matcher -o $(call SYSPATH, $@) $<
1508
1509 $(TARGET:%=$(ObjDir)/%GenMCCodeEmitter.inc.tmp): \
1510 $(ObjDir)/%GenMCCodeEmitter.inc.tmp: %.td $(ObjDir)/.dir $(LLVM_TBLGEN)
1511 $(Echo) "Building $(
1512 $(Verb) $(LLVMTableGen) -gen-emitter -mc-emitter -o $(call SYSPATH, $@) $<
1513
1514 $(TARGET:%=$(ObjDir)/%GenMCPseudoLowering.inc.tmp): \
1515 $(ObjDir)/%GenMCPseudoLowering.inc.tmp: %.td $(ObjDir)/.dir $(LLVM_TBLGEN)
1516 $(Echo) "Building $(
1517 $(Verb) $(LLVMTableGen) -gen-pseudo-lowering -o $(call SYSPATH, $@) $<
1518
1519 $(TARGET:%=$(ObjDir)/%GenCodeEmitter.inc.tmp): \
1520 $(ObjDir)/%GenCodeEmitter.inc.tmp: %.td $(ObjDir)/.dir $(LLVM_TBLGEN)
1521 $(Echo) "Building $(
1522 $(Verb) $(LLVMTableGen) -gen-emitter -o $(call SYSPATH, $@) $<
1523
1524 $(TARGET:%=$(ObjDir)/%GenDAGISel.inc.tmp): \
1525 $(ObjDir)/%GenDAGISel.inc.tmp : %.td $(ObjDir)/.dir $(LLVM_TBLGEN)
1526 $(Echo) "Building $(
1527 $(Verb) $(LLVMTableGen) -gen-dag-isel -o $(call SYSPATH, $@) $<
1528
1529 $(TARGET:%=$(ObjDir)/%GenDisassemblerTables.inc.tmp): \
1530 $(ObjDir)/%GenDisassemblerTables.inc.tmp : %.td $(ObjDir)/.dir $(LLVM_TBLGEN)
1531 $(Echo) "Building $(
1532 $(Verb) $(LLVMTableGen) -gen-disassembler -o $(call SYSPATH, $@) $<
1533
1534 $(TARGET:%=$(ObjDir)/%GenEDInfo.inc.tmp): \
1535 $(ObjDir)/%GenEDInfo.inc.tmp : %.td $(ObjDir)/.dir $(LLVM_TBLGEN)
1536 $(Echo) "Building $(
1537 $(Verb) $(LLVMTableGen) -gen-enhanced-disassembly-info -o $(call SYSPATH, $@) $<
1538
1539 $(TARGET:%=$(ObjDir)/%GenFastISel.inc.tmp): \
1540 $(ObjDir)/%GenFastISel.inc.tmp : %.td $(ObjDir)/.dir $(LLVM_TBLGEN)
1541 $(Echo) "Building $(
1542 $(Verb) $(LLVMTableGen) -gen-fast-isel -o $(call SYSPATH, $@) $<
1543
1544 $(TARGET:%=$(ObjDir)/%GenSubtargetInfo.inc.tmp): \
1545 $(ObjDir)/%GenSubtargetInfo.inc.tmp : %.td $(ObjDir)/.dir $(LLVM_TBLGEN)
1546 $(Echo) "Building $(
1547 $(Verb) $(LLVMTableGen) -gen-subtarget -o $(call SYSPATH, $@) $<
1548
1549 $(TARGET:%=$(ObjDir)/%GenCallingConv.inc.tmp): \
1550 $(ObjDir)/%GenCallingConv.inc.tmp : %.td $(ObjDir)/.dir $(LLVM_TBLGEN)
1551 $(Echo) "Building $(
1552 $(Verb) $(LLVMTableGen) -gen-callingconv -o $(call SYSPATH, $@) $<
1553
1554 $(TARGET:%=$(ObjDir)/%GenIntrinsics.inc.tmp): \
1555 $(ObjDir)/%GenIntrinsics.inc.tmp : %.td $(ObjDir)/.dir $(LLVM_TBLGEN)
1556 $(Echo) "Building $(
1557 $(Verb) $(LLVMTableGen) -gen-tgt-intrinsic -o $(call SYSPATH, $@) $<
1558
1559 $(ObjDir)/ARMGenDecoderTables.inc.tmp : ARM.td $(ObjDir)/.dir $(LLVM_TBLGEN)
1560 $(Echo) "Building $(
1561 $(Verb) $(LLVMTableGen) -gen-arm-decoder -o $(call SYSPATH, $@) $<
1562
1563
1564 clean-local::
1565 -$(Verb) $(RM) -f $(INCFiles)
1566
1567 endif # TARGET
1568
1569 ###############################################################################
1570 # OTHER RULES: Other rules needed
1571 ###############################################################################
1572
1573 # To create postscript files from dot files...
1574 ifneq ($(DOT),false)
1575 %.ps: %.dot
1576 $(DOT) -Tps < $< > $@
1577 else
1578 %.ps: %.dot
1579 $(Echo) "Cannot build $@: The program dot is not installed"
1580 endif
1581
1582 # This rules ensures that header files that are removed still have a rule for
1583 # which they can be "generated." This allows make to ignore them and
1584 # reproduce the dependency lists.
1585 %.h:: ;
1586 %.hpp:: ;
1587
1588 # Define clean-local to clean the current directory. Note that this uses a
1589 # very conservative approach ensuring that empty variables do not cause
1590 # errors or disastrous removal.
1591 clean-local::
1592 ifneq ($(strip $(ObjRootDir)),)
1593 -$(Verb) $(RM) -rf $(ObjRootDir)
1594 endif
1595 -$(Verb) $(RM) -f core core.[0-9][0-9]* *.o *.d *~ *.flc
1596 ifneq ($(strip $(SHLIBEXT)),) # Extra paranoia - make real sure SHLIBEXT is set
1597 -$(Verb) $(RM) -f *$(SHLIBEXT)
1598 endif
1599
1600 clean-all-local::
1601 -$(Verb) $(RM) -rf Debug Release Profile
1602
1603
1604 ###############################################################################
1605 # DEPENDENCIES: Include the dependency files if we should
1606 ###############################################################################
1607 ifndef DISABLE_AUTO_DEPENDENCIES
1608
1609 # If its not one of the cleaning targets
1610 ifndef IS_CLEANING_TARGET
1611
1612 # Get the list of dependency files
1613 DependSourceFiles := $(basename $(filter %.cpp %.c %.cc %.m %.mm, $(Sources)))
1614 DependFiles := $(DependSourceFiles:%=$(PROJ_OBJ_DIR)/$(BuildMode)/%.d)
1615
1616 -include $(DependFiles) ""
1617
1618 endif
1619
1620 endif
1621
1622 ###############################################################################
1623 # CHECK: Running the test suite
1624 ###############################################################################
1625
1626 check::
1627 $(Verb) if test -d "$(PROJ_OBJ_ROOT)/test" ; then \
1628 if test -f "$(PROJ_OBJ_ROOT)/test/Makefile" ; then \
1629 $(EchoCmd) Running test suite ; \
1630 $(MAKE) -C $(PROJ_OBJ_ROOT)/test check-local \
1631 TESTSUITE=$(TESTSUITE) ; \
1632 else \
1633 $(EchoCmd) No Makefile in test directory ; \
1634 fi ; \
1635 else \
1636 $(EchoCmd) No test directory ; \
1637 fi
1638
1639 # An alias dating from when both lit and DejaGNU test runners were used.
1640 check-lit:: check
1641
1642 check-all::
1643 $(Verb) if test -d "$(PROJ_OBJ_ROOT)/test" ; then \
1644 if test -f "$(PROJ_OBJ_ROOT)/test/Makefile" ; then \
1645 $(EchoCmd) Running test suite ; \
1646 $(MAKE) -C $(PROJ_OBJ_ROOT)/test check-local-all ; \
1647 else \
1648 $(EchoCmd) No Makefile in test directory ; \
1649 fi ; \
1650 else \
1651 $(EchoCmd) No test directory ; \
1652 fi
1653
1654 ###############################################################################
1655 # UNITTESTS: Running the unittests test suite
1656 ###############################################################################
1657
1658 unittests::
1659 $(Verb) if test -d "$(PROJ_OBJ_ROOT)/unittests" ; then \
1660 if test -f "$(PROJ_OBJ_ROOT)/unittests/Makefile" ; then \
1661 $(EchoCmd) Running unittests test suite ; \
1662 $(MAKE) -C $(PROJ_OBJ_ROOT)/unittests unitcheck; \
1663 else \
1664 $(EchoCmd) No Makefile in unittests directory ; \
1665 fi ; \
1666 else \
1667 $(EchoCmd) No unittests directory ; \
1668 fi
1669
1670 ###############################################################################
1671 # DISTRIBUTION: Handle construction of a distribution tarball
1672 ###############################################################################
1673
1674 #------------------------------------------------------------------------
1675 # Define distribution related variables
1676 #------------------------------------------------------------------------
1677 DistName := $(PROJECT_NAME)-$(PROJ_VERSION)
1678 DistDir := $(PROJ_OBJ_ROOT)/$(DistName)
1679 TopDistDir := $(PROJ_OBJ_ROOT)/$(DistName)
1680 DistTarGZip := $(PROJ_OBJ_ROOT)/$(DistName).tar.gz
1681 DistZip := $(PROJ_OBJ_ROOT)/$(DistName).zip
1682 DistTarBZ2 := $(PROJ_OBJ_ROOT)/$(DistName).tar.bz2
1683 DistAlways := CREDITS.TXT LICENSE.TXT README.txt README AUTHORS COPYING \
1684 ChangeLog INSTALL NEWS Makefile Makefile.common Makefile.rules \
1685 Makefile.config.in configure autoconf
1686 DistOther := $(notdir $(wildcard \
1687 $(PROJ_SRC_DIR)/*.h \
1688 $(PROJ_SRC_DIR)/*.td \
1689 $(PROJ_SRC_DIR)/*.def \
1690 $(PROJ_SRC_DIR)/*.ll \
1691 $(PROJ_SRC_DIR)/*.in))
1692 DistSubDirs := $(SubDirs)
1693 DistSources = $(Sources) $(EXTRA_DIST)
1694 DistFiles = $(DistAlways) $(DistSources) $(DistOther)
1695
1696 #------------------------------------------------------------------------
1697 # We MUST build distribution with OBJ_DIR != SRC_DIR
1698 #------------------------------------------------------------------------
1699 ifeq ($(PROJ_SRC_DIR),$(PROJ_OBJ_DIR))
1700 dist dist-check dist-clean dist-gzip dist-bzip2 dist-zip ::
1701 $(Echo) ERROR: Target $@ only available with OBJ_DIR != SRC_DIR
1702
1703 else
1704
1705 #------------------------------------------------------------------------
1706 # Prevent attempt to run dist targets from anywhere but the top level
1707 #------------------------------------------------------------------------
1708 ifneq ($(LEVEL),.)
1709 dist dist-check dist-clean dist-gzip dist-bzip2 dist-zip ::
1710 $(Echo) ERROR: You must run $@ from $(PROJ_OBJ_ROOT)
1711 else
1712
1713 #------------------------------------------------------------------------
1714 # Provide the top level targets
1715 #------------------------------------------------------------------------
1716
1717 dist-gzip:: $(DistTarGZip)
1718
1719 $(DistTarGZip) : $(TopDistDir)/.makedistdir
1720 $(Echo) Packing gzipped distribution tar file.
1721 $(Verb) cd $(PROJ_OBJ_ROOT) ; $(TAR) chf - "$(DistName)" | \
1722 $(GZIP) -c > "$(DistTarGZip)"
1723
1724 dist-bzip2:: $(DistTarBZ2)
1725
1726 $(DistTarBZ2) : $(TopDistDir)/.makedistdir
1727 $(Echo) Packing bzipped distribution tar file.
1728 $(Verb) cd $(PROJ_OBJ_ROOT) ; $(TAR) chf - $(DistName) | \
1729 $(BZIP2) -c >$(DistTarBZ2)
1730
1731 dist-zip:: $(DistZip)
1732
1733 $(DistZip) : $(TopDistDir)/.makedistdir
1734 $(Echo) Packing zipped distribution file.
1735 $(Verb) rm -f $(DistZip)
1736 $(Verb) cd $(PROJ_OBJ_ROOT) ; $(ZIP) -rq $(DistZip) $(DistName)
1737
1738 dist :: $(DistTarGZip) $(DistTarBZ2) $(DistZip)
1739 $(Echo) ===== DISTRIBUTION PACKAGING SUCCESSFUL =====
1740
1741 DistCheckDir := $(PROJ_OBJ_ROOT)/_distcheckdir
1742
1743 dist-check:: $(DistTarGZip)
1744 $(Echo) Checking distribution tar file.
1745 $(Verb) if test -d $(DistCheckDir) ; then \
1746 $(RM) -rf $(DistCheckDir) ; \
1747 fi
1748 $(Verb) $(MKDIR) $(DistCheckDir)
1749 $(Verb) cd $(DistCheckDir) && \
1750 $(MKDIR) $(DistCheckDir)/build && \
1751 $(MKDIR) $(DistCheckDir)/install && \
1752 gunzip -c $(DistTarGZip) | $(TAR) xf - && \
1753 cd build && \
1754 ../$(DistName)/configure --prefix="$(DistCheckDir)/install" \
1755 --srcdir=../$(DistName) $(DIST_CHECK_CONFIG_OPTIONS) && \
1756 $(MAKE) all && \
1757 $(MAKE) check && \
1758 $(MAKE) unittests && \
1759 $(MAKE) install && \
1760 $(MAKE) uninstall && \
1761 $(MAKE) dist-clean && \
1762 $(EchoCmd) ===== $(DistTarGZip) Ready For Distribution =====
1763
1764 dist-clean::
1765 $(Echo) Cleaning distribution files
1766 -$(Verb) $(RM) -rf $(DistTarGZip) $(DistTarBZ2) $(DistZip) $(DistName) \
1767 $(DistCheckDir)
1768
1769 endif
1770
1771 #------------------------------------------------------------------------
1772 # Provide the recursive distdir target for building the distribution directory
1773 #------------------------------------------------------------------------
1774 distdir: $(DistDir)/.makedistdir
1775 $(DistDir)/.makedistdir: $(DistSources)
1776 $(Verb) if test "$(DistDir)" = "$(TopDistDir)" ; then \
1777 if test -d "$(DistDir)" ; then \
1778 find $(DistDir) -type d ! -perm -200 -exec chmod u+w {} ';' || \
1779 exit 1 ; \
1780 fi ; \
1781 $(EchoCmd) Removing old $(DistDir) ; \
1782 $(RM) -rf $(DistDir); \
1783 $(EchoCmd) Making 'all' to verify build ; \
1784 $(MAKE) ENABLE_OPTIMIZED=1 all ; \
1785 fi
1786 $(Echo) Building Distribution Directory $(DistDir)
1787 $(Verb) $(MKDIR) $(DistDir)
1788 $(Verb) srcdirstrip=`echo "$(PROJ_SRC_DIR)" | sed 's|.|.|g'`; \
1789 srcrootstrip=`echo "$(PROJ_SRC_ROOT)" | sed 's|.|.|g'`; \
1790 for file in $(DistFiles) ; do \
1791 case "$$file" in \
1792 $(PROJ_SRC_DIR)/*) \
1793 file=`echo "$$file" | sed "s#^$$srcdirstrip/##"` \
1794 ;; \
1795 $(PROJ_SRC_ROOT)/*) \
1796 file=`echo "$$file" | \
1797 sed "s#^$$srcrootstrip/##"` \
1798 ;; \
1799 esac; \
1800 if test -f "$(PROJ_SRC_DIR)/$$file" || \
1801 test -d "$(PROJ_SRC_DIR)/$$file" ; then \
1802 from_dir="$(PROJ_SRC_DIR)" ; \
1803 elif test -f "$$file" || test -d "$$file" ; then \
1804 from_dir=. ; \
1805 fi ; \
1806 to_dir=`echo "$$file" | sed -e 's#/[^/]*$$##'` ; \
1807 if test "$$to_dir" != "$$file" && test "$$to_dir" != "."; then \
1808 to_dir="$(DistDir)/$$dir"; \
1809 $(MKDIR) "$$to_dir" ; \
1810 else \
1811 to_dir="$(DistDir)"; \
1812 fi; \
1813 mid_dir=`echo "$$file" | sed -n -e 's#^\(.*\)/[^/]*$$#\1#p'`; \
1814 if test -n "$$mid_dir" ; then \
1815 $(MKDIR) "$$to_dir/$$mid_dir" || exit 1; \
1816 fi ; \
1817 if test -d "$$from_dir/$$file"; then \
1818 if test -d "$(PROJ_SRC_DIR)/$$file" && \
1819 test "$$from_dir" != "$(PROJ_SRC_DIR)" ; then \
1820 cd $(PROJ_SRC_DIR) ; \
1821 $(TAR) cf - $$file --exclude .svn --exclude CVS | \
1822 ( cd $$to_dir ; $(TAR) xf - ) ; \
1823 cd $(PROJ_OBJ_DIR) ; \
1824 else \
1825 cd $$from_dir ; \
1826 $(TAR) cf - $$file --exclude .svn --exclude CVS | \
1827 ( cd $$to_dir ; $(TAR) xf - ) ; \
1828 cd $(PROJ_OBJ_DIR) ; \
1829 fi; \
1830 elif test -f "$$from_dir/$$file" ; then \
1831 $(CP) -p "$$from_dir/$$file" "$(DistDir)/$$file" || exit 1; \
1832 elif test -L "$$from_dir/$$file" ; then \
1833 $(CP) -pd "$$from_dir/$$file" $(DistDir)/$$file || exit 1; \
1834 elif echo "$(DistAlways)" | grep -v "$$file" >/dev/null ; then \
1835 $(EchoCmd) "===== WARNING: Distribution Source " \
1836 "$$from_dir/$$file Not Found!" ; \
1837 elif test "$(Verb)" != '@' ; then \
1838 $(EchoCmd) "Skipping non-existent $$from_dir/$$file" ; \
1839 fi; \
1840 done
1841 $(Verb) for subdir in $(DistSubDirs) ; do \
1842 if test "$$subdir" \!= "." ; then \
1843 new_distdir="$(DistDir)/$$subdir" ; \
1844 test -d "$$new_distdir" || $(MKDIR) "$$new_distdir" || exit 1; \
1845 ( cd $$subdir && $(MAKE) ENABLE_OPTIMIZED=1 \
1846 DistDir="$$new_distdir" distdir ) || exit 1; \
1847 fi; \
1848 done
1849 $(Verb) if test "$(DistDir)" = "$(TopDistDir)" ; then \
1850 $(EchoCmd) Eliminating CVS/.svn directories from distribution ; \
1851 $(RM) -rf `find $(TopDistDir) -type d \( -name CVS -o \
1852 -name .svn \) -print` ;\
1853 $(MAKE) dist-hook ; \
1854 $(FIND) $(TopDistDir) -type d ! -perm -777 -exec chmod a+rwx {} \; \
1855 -o ! -type d ! -perm -444 -links 1 -exec chmod a+r {} \; \
1856 -o ! -type d ! -perm -400 -exec chmod a+r {} \; \
1857 -o ! -type d ! -perm -444 -exec \
1858 $(SHELL) $(INSTALL_SH) -c -m a+r {} {} \; \
1859 || chmod -R a+r $(DistDir) ; \
1860 fi
1861
1862 # This is invoked by distdir target, define it as a no-op to avoid errors if not
1863 # defined by user.
1864 dist-hook::
1865
1866 endif
1867
1868 ###############################################################################
1869 # TOP LEVEL - targets only to apply at the top level directory
1870 ###############################################################################
1871
1872 ifeq ($(LEVEL),.)
1873
1874 #------------------------------------------------------------------------
1875 # Install support for the project's include files:
1876 #------------------------------------------------------------------------
1877 ifdef NO_INSTALL
1878 install-local::
1879 $(Echo) Install circumvented with NO_INSTALL
1880 uninstall-local::
1881 $(Echo) Uninstall circumvented with NO_INSTALL
1882 else
1883 install-local::
1884 $(Echo) Installing include files
1885 $(Verb) $(MKDIR) $(DESTDIR)$(PROJ_includedir)
1886 $(Verb) if test -d "$(PROJ_SRC_ROOT)/include" ; then \
1887 cd $(PROJ_SRC_ROOT)/include && \
1888 for hdr in `find . -type f \
1889 '(' -name LICENSE.TXT \
1890 -o -name '*.def' \
1891 -o -name '*.h' \
1892 -o -name '*.inc' \
1893 -o -name '*.td' \
1894 ')' -print | grep -v CVS | \
1895 grep -v .svn` ; do \
1896 instdir=`dirname "$(DESTDIR)$(PROJ_includedir)/$$hdr"` ; \
1897 if test \! -d "$$instdir" ; then \
1898 $(EchoCmd) Making install directory $$instdir ; \
1899 $(MKDIR) $$instdir ;\
1900 fi ; \
1901 $(DataInstall) $$hdr $(DESTDIR)$(PROJ_includedir)/$$hdr ; \
1902 done ; \
1903 fi
1904 ifneq ($(PROJ_SRC_ROOT),$(PROJ_OBJ_ROOT))
1905 $(Verb) if test -d "$(PROJ_OBJ_ROOT)/include" ; then \
1906 cd $(PROJ_OBJ_ROOT)/include && \
1907 for hdr in `find . -type f \
1908 '(' -name LICENSE.TXT \
1909 -o -name '*.def' \
1910 -o -name '*.h' \
1911 -o -name '*.inc' \
1912 -o -name '*.td' \
1913 ')' -print | grep -v CVS | \
1914 grep -v .svn` ; do \
1915 instdir=`dirname "$(DESTDIR)$(PROJ_includedir)/$$hdr"` ; \
1916 if test \! -d "$$instdir" ; then \
1917 $(EchoCmd) Making install directory $$instdir ; \
1918 $(MKDIR) $$instdir ;\
1919 fi ; \
1920 $(DataInstall) $$hdr $(DESTDIR)$(PROJ_includedir)/$$hdr ; \
1921 done ; \
1922 fi
1923 endif
1924
1925 uninstall-local::
1926 $(Echo) Uninstalling include files
1927 $(Verb) if [ -d "$(PROJ_SRC_ROOT)/include" ] ; then \
1928 cd $(PROJ_SRC_ROOT)/include && \
1929 $(RM) -f `find . -path '*/Internal' -prune -o '(' -type f \
1930 '!' '(' -name '*~' -o -name '.#*' \
1931 -o -name '*.in' ')' -print ')' | \
1932 grep -v CVS | sed 's#^#$(DESTDIR)$(PROJ_includedir)/#'` ; \
1933 cd $(PROJ_SRC_ROOT)/include && \
1934 $(RM) -f `find . -path '*/Internal' -prune -o '(' -type f -name '*.in' \
1935 -print ')' | sed 's#\.in$$##;s#^#$(DESTDIR)$(PROJ_includedir)/#'` ; \
1936 fi
1937 endif
1938 endif
1939
1940 check-line-length:
1941 @echo searching for overlength lines in files: $(Sources)
1942 @echo
1943 @echo
1944 egrep -n '.{81}' $(Sources) /dev/null
1945
1946 check-for-tabs:
1947 @echo searching for tabs in files: $(Sources)
1948 @echo
1949 @echo
1950 egrep -n ' ' $(Sources) /dev/null
1951
1952 check-footprint:
1953 @ls -l $(LibDir) | awk '\
1954 BEGIN { sum = 0; } \
1955 { sum += $$5; } \
1956 END { printf("Libraries: %6.3f MBytes\n", sum/(1024.0*1024.0)); }'
1957 @ls -l $(ToolDir) | awk '\
1958 BEGIN { sum = 0; } \
1959 { sum += $$5; } \
1960 END { printf("Programs: %6.3f MBytes\n", sum/(1024.0*1024.0)); }'
1961 #------------------------------------------------------------------------
1962 # Print out the directories used for building
1963 #------------------------------------------------------------------------
1964 printvars::
1965 $(Echo) "BuildMode : " '$(BuildMode)'
1966 $(Echo) "PROJ_SRC_ROOT: " '$(PROJ_SRC_ROOT)'
1967 $(Echo) "PROJ_SRC_DIR : " '$(PROJ_SRC_DIR)'
1968 $(Echo) "PROJ_OBJ_ROOT: " '$(PROJ_OBJ_ROOT)'
1969 $(Echo) "PROJ_OBJ_DIR : " '$(PROJ_OBJ_DIR)'
1970 $(Echo) "LLVM_SRC_ROOT: " '$(LLVM_SRC_ROOT)'
1971 $(Echo) "LLVM_OBJ_ROOT: " '$(LLVM_OBJ_ROOT)'
1972 $(Echo) "PROJ_prefix : " '$(PROJ_prefix)'
1973 $(Echo) "PROJ_bindir : " '$(PROJ_bindir)'
1974 $(Echo) "PROJ_libdir : " '$(PROJ_libdir)'
1975 $(Echo) "PROJ_etcdir : " '$(PROJ_etcdir)'
1976 $(Echo) "PROJ_includedir : " '$(PROJ_includedir)'
1977 $(Echo) "UserTargets : " '$(UserTargets)'
1978 $(Echo) "ObjMakefiles : " '$(ObjMakefiles)'
1979 $(Echo) "SrcMakefiles : " '$(SrcMakefiles)'
1980 $(Echo) "ObjDir : " '$(ObjDir)'
1981 $(Echo) "LibDir : " '$(LibDir)'
1982 $(Echo) "ToolDir : " '$(ToolDir)'
1983 $(Echo) "ExmplDir : " '$(ExmplDir)'
1984 $(Echo) "Sources : " '$(Sources)'
1985 $(Echo) "TDFiles : " '$(TDFiles)'
1986 $(Echo) "INCFiles : " '$(INCFiles)'
1987 $(Echo) "INCTMPFiles : " '$(INCTMPFiles)'
1988 $(Echo) "PreConditions: " '$(PreConditions)'
1989 $(Echo) "Compile.CXX : " '$(Compile.CXX)'
1990 $(Echo) "Compile.C : " '$(Compile.C)'
1991 $(Echo) "Archive : " '$(Archive)'
1992 $(Echo) "YaccFiles : " '$(YaccFiles)'
1993 $(Echo) "LexFiles : " '$(LexFiles)'
1994 $(Echo) "Module : " '$(Module)'
1995 $(Echo) "FilesToConfig: " '$(FilesToConfigPATH)'
1996 $(Echo) "SubDirs : " '$(SubDirs)'
1997 $(Echo) "ProjLibsPaths: " '$(ProjLibsPaths)'
1998 $(Echo) "ProjLibsOptions: " '$(ProjLibsOptions)'
1999
2000 ###
2001 # Debugging
2002
2003 # General debugging rule, use 'make dbg-print-XXX' to print the
2004 # definition, value and origin of XXX.
2005 make-print-%:
2006 $(error PRINT: $(value $*) = "$($*)" (from $(origin $*)))
+0
-45
projects/sample/autoconf/AutoRegen.sh less more
None #!/bin/sh
1 die () {
2 echo "$@" 1>&2
3 exit 1
4 }
5 test -d autoconf && test -f autoconf/configure.ac && cd autoconf
6 test -f configure.ac || die "Can't find 'autoconf' dir; please cd into it first"
7 autoconf --version | egrep '2\.[56][0-9]' > /dev/null
8 if test $? -ne 0 ; then
9 die "Your autoconf was not detected as being 2.5x or 2.6x"
10 fi
11 cwd=`pwd`
12 if test -d ../../../autoconf/m4 ; then
13 cd ../../../autoconf/m4
14 llvm_src_root=../..
15 llvm_obj_root=../..
16 cd $cwd
17 elif test -d ../../llvm/autoconf/m4 ; then
18 cd ../../llvm/autoconf/m4
19 llvm_src_root=../..
20 llvm_obj_root=../..
21 cd $cwd
22 else
23 while true ; do
24 echo "LLVM source root not found."
25 read -p "Enter full path to LLVM source:" REPLY
26 if test -d "$REPLY/autoconf/m4" ; then
27 llvm_src_root="$REPLY"
28 read -p "Enter full path to LLVM objects (empty for same as source):" REPLY
29 if test -d "$REPLY" ; then
30 llvm_obj_root="$REPLY"
31 else
32 llvm_obj_root="$llvm_src_root"
33 fi
34 break
35 fi
36 done
37 fi
38 echo "Regenerating aclocal.m4 with aclocal"
39 rm -f aclocal.m4
40 aclocal -I $cwd/m4 || die "aclocal failed"
41 echo "Regenerating configure with autoconf"
42 autoconf --warnings=all -o ../configure configure.ac || die "autoconf failed"
43 cd ..
44 exit 0
+0
-7
projects/sample/autoconf/ExportMap.map less more
None {
1 global: main;
2 __progname;
3 environ;
4
5 local: *;
6 };
+0
-24
projects/sample/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
-1519
projects/sample/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 *:ekkoBSD:*:*)
209 echo ${UNAME_MACHINE}-unknown-ekkobsd${UNAME_RELEASE}
210 exit ;;
211 *:SolidBSD:*:*)
212 echo ${UNAME_MACHINE}-unknown-solidbsd${UNAME_RELEASE}
213 exit ;;
214 macppc:MirBSD:*:*)
215 echo powerpc-unknown-mirbsd${UNAME_RELEASE}
216 exit ;;
217 *:MirBSD:*:*)
218 echo ${UNAME_MACHINE}-unknown-mirbsd${UNAME_RELEASE}
219 exit ;;
220 alpha:OSF1:*:*)
221 case $UNAME_RELEASE in
222 *4.0)
223 UNAME_RELEASE=`/usr/sbin/sizer -v | awk '{print $3}'`
224 ;;
225 *5.*)
226 UNAME_RELEASE=`/usr/sbin/sizer -v | awk '{print $4}'`
227 ;;
228 esac
229 # According to Compaq, /usr/sbin/psrinfo has been available on
230 # OSF/1 and Tru64 systems produced since 1995. I hope that
231 # covers most systems running today. This code pipes the CPU
232 # types through head -n 1, so we only detect the type of CPU 0.
233 ALPHA_CPU_TYPE=`/usr/sbin/psrinfo -v | sed -n -e 's/^ The alpha \(.*\) processor.*$/\1/p' | head -n 1`
234 case "$ALPHA_CPU_TYPE" in
235 "EV4 (21064)")
236 UNAME_MACHINE="alpha" ;;
237 "EV4.5 (21064)")
238 UNAME_MACHINE="alpha" ;;
239 "LCA4 (21066/21068)")
240 UNAME_MACHINE="alpha" ;;
241 "EV5 (21164)")
242 UNAME_MACHINE="alphaev5" ;;
243 "EV5.6 (21164A)")
244 UNAME_MACHINE="alphaev56" ;;
245 "EV5.6 (21164PC)")
246 UNAME_MACHINE="alphapca56" ;;
247 "EV5.7 (21164PC)")
248 UNAME_MACHINE="alphapca57" ;;
249 "EV6 (21264)")
250 UNAME_MACHINE="alphaev6" ;;
251 "EV6.7 (21264A)")
252 UNAME_MACHINE="alphaev67" ;;
253 "EV6.8CB (21264C)")
254 UNAME_MACHINE="alphaev68" ;;
255 "EV6.8AL (21264B)")
256 UNAME_MACHINE="alphaev68" ;;
257 "EV6.8CX (21264D)")
258 UNAME_MACHINE="alphaev68" ;;
259 "EV6.9A (21264/EV69A)")
260 UNAME_MACHINE="alphaev69" ;;
261 "EV7 (21364)")
262 UNAME_MACHINE="alphaev7" ;;
263 "EV7.9 (21364A)")
264 UNAME_MACHINE="alphaev79" ;;
265 esac
266 # A Pn.n version is a patched version.
267 # A Vn.n version is a released version.
268 # A Tn.n version is a released field test version.
269 # A Xn.n version is an unreleased experimental baselevel.
270 # 1.2 uses "1.2" for uname -r.
271 echo ${UNAME_MACHINE}-dec-osf`echo ${UNAME_RELEASE} | sed -e 's/^[PVTX]//' | tr 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvwxyz'`
272 # Reset EXIT trap before exiting to avoid spurious non-zero exit code.
273 exitcode=$?
274 trap '' 0
275 exit $exitcode ;;
276 Alpha\ *:Windows_NT*:*)
277 # How do we know it's Interix rather than the generic POSIX subsystem?
278 # Should we change UNAME_MACHINE based on the output of uname instead
279 # of the specific Alpha model?
280 echo alpha-pc-interix
281 exit ;;
282 21064:Windows_NT:50:3)
283 echo alpha-dec-winnt3.5
284 exit ;;
285 Amiga*:UNIX_System_V:4.0:*)
286 echo m68k-unknown-sysv4
287 exit ;;
288 *:[Aa]miga[Oo][Ss]:*:*)
289 echo ${UNAME_MACHINE}-unknown-amigaos
290 exit ;;
291 *:[Mm]orph[Oo][Ss]:*:*)
292 echo ${UNAME_MACHINE}-unknown-morphos
293 exit ;;
294 *:OS/390:*:*)
295 echo i370-ibm-openedition
296 exit ;;
297 *:z/VM:*:*)
298 echo s390-ibm-zvmoe
299 exit ;;
300 *:OS400:*:*)
301 echo powerpc-ibm-os400
302 exit ;;
303 arm:RISC*:1.[012]*:*|arm:riscix:1.[012]*:*)
304 echo arm-acorn-riscix${UNAME_RELEASE}
305 exit ;;
306 arm:riscos:*:*|arm:RISCOS:*:*)
307 echo arm-unknown-riscos
308 exit ;;
309 SR2?01:HI-UX/MPP:*:* | SR8000:HI-UX/MPP:*:*)
310 echo hppa1.1-hitachi-hiuxmpp
311 exit ;;
312 Pyramid*:OSx*:*:* | MIS*:OSx*:*:* | MIS*:SMP_DC-OSx*:*:*)
313 # akee@wpdis03.wpafb.af.mil (Earle F. Ake) contributed MIS and NILE.
314 if test "`(/bin/universe) 2>/dev/null`" = att ; then
315 echo pyramid-pyramid-sysv3
316 else
317 echo pyramid-pyramid-bsd
318 fi
319 exit ;;
320 NILE*:*:*:dcosx)
321 echo pyramid-pyramid-svr4
322 exit ;;
323 DRS?6000:unix:4.0:6*)
324 echo sparc-icl-nx6
325 exit ;;
326 DRS?6000:UNIX_SV:4.2*:7* | DRS?6000:isis:4.2*:7*)
327 case `/usr/bin/uname -p` in
328 sparc) echo sparc-icl-nx7; exit ;;
329 esac ;;
330 s390x:SunOS:*:*)
331 echo ${UNAME_MACHINE}-ibm-solaris2`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'`
332 exit ;;
333 sun4H:SunOS:5.*:*)
334 echo sparc-hal-solaris2`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'`
335 exit ;;
336 sun4*:SunOS:5.*:* | tadpole*:SunOS:5.*:*)
337 echo sparc-sun-solaris2`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'`
338 exit ;;
339 i86pc:AuroraUX:5.*:* | i86xen:AuroraUX:5.*:*)
340 echo i386-pc-auroraux${UNAME_RELEASE}
341 exit ;;
342 i86pc:SunOS:5.*:* | i86xen:SunOS:5.*:*)
343 eval $set_cc_for_build
344 SUN_ARCH="i386"
345 # If there is a compiler, see if it is configured for 64-bit objects.
346 # Note that the Sun cc does not turn __LP64__ into 1 like gcc does.
347 # This test works for both compilers.
348 if [ "$CC_FOR_BUILD" != 'no_compiler_found' ]; then
349 if (echo '#ifdef __amd64'; echo IS_64BIT_ARCH; echo '#endif') | \
350 (CCOPTS= $CC_FOR_BUILD -E - 2>/dev/null) | \
351 grep IS_64BIT_ARCH >/dev/null
352 then
353 SUN_ARCH="x86_64"
354 fi
355 fi
356 echo ${SUN_ARCH}-pc-solaris2`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'`
357 exit ;;
358 sun4*:SunOS:6*:*)
359 # According to config.sub, this is the proper way to canonicalize
360 # SunOS6. Hard to guess exactly what SunOS6 will be like, but
361 # it's likely to be more like Solaris than SunOS4.
362 echo sparc-sun-solaris3`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'`
363 exit ;;
364 sun4*:SunOS:*:*)
365 case "`/usr/bin/arch -k`" in
366 Series*|S4*)
367 UNAME_RELEASE=`uname -v`
368 ;;
369 esac
370 # Japanese Language versions have a version number like `4.1.3-JL'.
371 echo sparc-sun-sunos`echo ${UNAME_RELEASE}|sed -e 's/-/_/'`
372 exit ;;
373 sun3*:SunOS:*:*)
374 echo m68k-sun-sunos${UNAME_RELEASE}
375 exit ;;
376 sun*:*:4.2BSD:*)
377 UNAME_RELEASE=`(sed 1q /etc/motd | awk '{print substr($5,1,3)}') 2>/dev/null`
378 test "x${UNAME_RELEASE}" = "x" && UNAME_RELEASE=3
379 case "`/bin/arch`" in
380 sun3)
381 echo m68k-sun-sunos${UNAME_RELEASE}
382 ;;
383 sun4)
384 echo sparc-sun-sunos${UNAME_RELEASE}
385 ;;
386 esac
387 exit ;;
388 aushp:SunOS:*:*)
389 echo sparc-auspex-sunos${UNAME_RELEASE}
390 exit ;;
391 # The situation for MiNT is a little confusing. The machine name
392 # can be virtually everything (everything which is not
393 # "atarist" or "atariste" at least should have a processor
394 # > m68000). The system name ranges from "MiNT" over "FreeMiNT"
395 # to the lowercase version "mint" (or "freemint"). Finally
396 # the system name "TOS" denotes a system which is actually not
397 # MiNT. But MiNT is downward compatible to TOS, so this should
398 # be no problem.
399 atarist[e]:*MiNT:*:* | atarist[e]:*mint:*:* | atarist[e]:*TOS:*:*)
400 echo m68k-atari-mint${UNAME_RELEASE}
401 exit ;;
402 atari*:*MiNT:*:* | atari*:*mint:*:* | atarist[e]:*TOS:*:*)
403 echo m68k-atari-mint${UNAME_RELEASE}
404 exit ;;
405 *falcon*:*MiNT:*:* | *falcon*:*mint:*:* | *falcon*:*TOS:*:*)
406 echo m68k-atari-mint${UNAME_RELEASE}
407 exit ;;
408 milan*:*MiNT:*:* | milan*:*mint:*:* | *milan*:*TOS:*:*)
409 echo m68k-milan-mint${UNAME_RELEASE}
410 exit ;;
411 hades*:*MiNT:*:* | hades*:*mint:*:* | *hades*:*TOS:*:*)
412 echo m68k-hades-mint${UNAME_RELEASE}
413 exit ;;
414 *:*MiNT:*:* | *:*mint:*:* | *:*TOS:*:*)
415 echo m68k-unknown-mint${UNAME_RELEASE}
416 exit ;;
417 m68k:machten:*:*)
418 echo m68k-apple-machten${UNAME_RELEASE}
419 exit ;;
420 powerpc:machten:*:*)
421 echo powerpc-apple-machten${UNAME_RELEASE}
422 exit ;;
423 RISC*:Mach:*:*)
424 echo mips-dec-mach_bsd4.3
425 exit ;;
426 RISC*:ULTRIX:*:*)
427 echo mips-dec-ultrix${UNAME_RELEASE}
428 exit ;;
429 VAX*:ULTRIX*:*:*)
430 echo vax-dec-ultrix${UNAME_RELEASE}
431 exit ;;
432 2020:CLIX:*:* | 2430:CLIX:*:*)
433 echo clipper-intergraph-clix${UNAME_RELEASE}
434 exit ;;
435 mips:*:*:UMIPS | mips:*:*:RISCos)
436 eval $set_cc_for_build
437 sed 's/^ //' << EOF >$dummy.c
438 #ifdef __cplusplus
439 #include /* for printf() prototype */
440 int main (int argc, char *argv[]) {
441 #else
442 int main (argc, argv) int argc; char *argv[]; {
443 #endif
444 #if defined (host_mips) && defined (MIPSEB)
445 #if defined (SYSTYPE_SYSV)
446 printf ("mips-mips-riscos%ssysv\n", argv[1]); exit (0);
447 #endif
448 #if defined (SYSTYPE_SVR4)
449 printf ("mips-mips-riscos%ssvr4\n", argv[1]); exit (0);
450 #endif
451 #if defined (SYSTYPE_BSD43) || defined(SYSTYPE_BSD)
452 printf ("mips-mips-riscos%sbsd\n", argv[1]); exit (0);
453 #endif
454 #endif
455 exit (-1);
456 }
457 EOF
458 $CC_FOR_BUILD -o $dummy $dummy.c &&
459 dummyarg=`echo "${UNAME_RELEASE}" | sed -n 's/\([0-9]*\).*/\1/p'` &&
460 SYSTEM_NAME=`$dummy $dummyarg` &&
461 { echo "$SYSTEM_NAME"; exit; }
462 echo mips-mips-riscos${UNAME_RELEASE}
463 exit ;;
464 Motorola:PowerMAX_OS:*:*)
465 echo powerpc-motorola-powermax
466 exit ;;
467 Motorola:*:4.3:PL8-*)
468 echo powerpc-harris-powermax
469 exit ;;
470 Night_Hawk:*:*:PowerMAX_OS | Synergy:PowerMAX_OS:*:*)
471 echo powerpc-harris-powermax
472 exit ;;
473 Night_Hawk:Power_UNIX:*:*)
474 echo powerpc-harris-powerunix
475 exit ;;
476 m88k:CX/UX:7*:*)
477 echo m88k-harris-cxux7
478 exit ;;
479 m88k:*:4*:R4*)
480 echo m88k-motorola-sysv4
481 exit ;;
482 m88k:*:3*:R3*)
483 echo m88k-motorola-sysv3
484 exit ;;
485 AViiON:dgux:*:*)
486 # DG/UX returns AViiON for all architectures
487 UNAME_PROCESSOR=`/usr/bin/uname -p`
488 if [ $UNAME_PROCESSOR = mc88100 ] || [ $UNAME_PROCESSOR = mc88110 ]
489 then
490 if [ ${TARGET_BINARY_INTERFACE}x = m88kdguxelfx ] || \
491 [ ${TARGET_BINARY_INTERFACE}x = x ]
492 then
493 echo m88k-dg-dgux${UNAME_RELEASE}
494 else
495 echo m88k-dg-dguxbcs${UNAME_RELEASE}
496 fi
497 else
498 echo i586-dg-dgux${UNAME_RELEASE}
499 fi
500 exit ;;
501 M88*:DolphinOS:*:*) # DolphinOS (SVR3)
502 echo m88k-dolphin-sysv3
503 exit ;;
504 M88*:*:R3*:*)
505 # Delta 88k system running SVR3
506 echo m88k-motorola-sysv3
507 exit ;;
508 XD88*:*:*:*) # Tektronix XD88 system running UTekV (SVR3)
509 echo m88k-tektronix-sysv3
510 exit ;;
511 Tek43[0-9][0-9]:UTek:*:*) # Tektronix 4300 system running UTek (BSD)
512 echo m68k-tektronix-bsd
513 exit ;;
514 *:IRIX*:*:*)
515 echo mips-sgi-irix`echo ${UNAME_RELEASE}|sed -e 's/-/_/g'`
516 exit ;;
517 ????????:AIX?:[12].1:2) # AIX 2.2.1 or AIX 2.1.1 is RT/PC AIX.
518 echo romp-ibm-aix # uname -m gives an 8 hex-code CPU id
519 exit ;; # Note that: echo "'`uname -s`'" gives 'AIX '
520 i*86:AIX:*:*)
521 echo i386-ibm-aix
522 exit ;;
523 ia64:AIX:*:*)
524 if [ -x /usr/bin/oslevel ] ; then
525 IBM_REV=`/usr/bin/oslevel`
526 else
527 IBM_REV=${UNAME_VERSION}.${UNAME_RELEASE}
528 fi
529 echo ${UNAME_MACHINE}-ibm-aix${IBM_REV}
530 exit ;;
531 *:AIX:2:3)
532 if grep bos325 /usr/include/stdio.h >/dev/null 2>&1; then
533 eval $set_cc_for_build
534 sed 's/^ //' << EOF >$dummy.c
535 #include
536
537 main()
538 {
539 if (!__power_pc())
540 exit(1);
541 puts("powerpc-ibm-aix3.2.5");
542 exit(0);
543 }
544 EOF
545 if $CC_FOR_BUILD -o $dummy $dummy.c && SYSTEM_NAME=`$dummy`
546 then
547 echo "$SYSTEM_NAME"
548 else
549 echo rs6000-ibm-aix3.2.5
550 fi
551 elif grep bos324 /usr/include/stdio.h >/dev/null 2>&1; then
552 echo rs6000-ibm-aix3.2.4
553 else
554 echo rs6000-ibm-aix3.2
555 fi
556 exit ;;
557 *:AIX:*:[4567])
558 IBM_CPU_ID=`/usr/sbin/lsdev -C -c processor -S available | sed 1q | awk '{ print $1 }'`
559 if /usr/sbin/lsattr -El ${IBM_CPU_ID} | grep ' POWER' >/dev/null 2>&1; then
560 IBM_ARCH=rs6000
561 else
562 IBM_ARCH=powerpc
563 fi
564 if [ -x /usr/bin/oslevel ] ; then
565 IBM_REV=`/usr/bin/oslevel`
566 else
567 IBM_REV=${UNAME_VERSION}.${UNAME_RELEASE}
568 fi
569 echo ${IBM_ARCH}-ibm-aix${IBM_REV}
570 exit ;;
571 *:AIX:*:*)
572 echo rs6000-ibm-aix
573 exit ;;
574 ibmrt:4.4BSD:*|romp-ibm:BSD:*)
575 echo romp-ibm-bsd4.4
576 exit ;;
577 ibmrt:*BSD:*|romp-ibm:BSD:*) # covers RT/PC BSD and
578 echo romp-ibm-bsd${UNAME_RELEASE} # 4.3 with uname added to
579 exit ;; # report: romp-ibm BSD 4.3
580 *:BOSX:*:*)
581 echo rs6000-bull-bosx
582 exit ;;
583 DPX/2?00:B.O.S.:*:*)
584 echo m68k-bull-sysv3
585 exit ;;
586 9000/[34]??:4.3bsd:1.*:*)
587 echo m68k-hp-bsd
588 exit ;;
589 hp300:4.4BSD:*:* | 9000/[34]??:4.3bsd:2.*:*)
590 echo m68k-hp-bsd4.4
591 exit ;;
592 9000/[34678]??:HP-UX:*:*)
593 HPUX_REV=`echo ${UNAME_RELEASE}|sed -e 's/[^.]*.[0B]*//'`
594 case "${UNAME_MACHINE}" in
595 9000/31? ) HP_ARCH=m68000 ;;
596 9000/[34]?? ) HP_ARCH=m68k ;;
597 9000/[678][0-9][0-9])
598 if [ -x /usr/bin/getconf ]; then
599 sc_cpu_version=`/usr/bin/getconf SC_CPU_VERSION 2>/dev/null`
600 sc_kernel_bits=`/usr/bin/getconf SC_KERNEL_BITS 2>/dev/null`
601 case "${sc_cpu_version}" in
602 523) HP_ARCH="hppa1.0" ;; # CPU_PA_RISC1_0
603 528) HP_ARCH="hppa1.1" ;; # CPU_PA_RISC1_1
604 532) # CPU_PA_RISC2_0
605 case "${sc_kernel_bits}" in
606 32) HP_ARCH="hppa2.0n" ;;
607 64) HP_ARCH="hppa2.0w" ;;
608 '') HP_ARCH="hppa2.0" ;; # HP-UX 10.20
609 esac ;;
610 esac
611 fi
612 if [ "${HP_ARCH}" = "" ]; then
613 eval $set_cc_for_build
614 sed 's/^ //' << EOF >$dummy.c
615
616 #define _HPUX_SOURCE
617 #include
618 #include
619
620 int main ()
621 {
622 #if defined(_SC_KERNEL_BITS)
623 long bits = sysconf(_SC_KERNEL_BITS);
624 #endif
625 long cpu = sysconf (_SC_CPU_VERSION);
626
627 switch (cpu)
628 {
629 case CPU_PA_RISC1_0: puts ("hppa1.0"); break;
630 case CPU_PA_RISC1_1: puts ("hppa1.1"); break;
631 case CPU_PA_RISC2_0:
632 #if defined(_SC_KERNEL_BITS)
633 switch (bits)
634 {
635 case 64: puts ("hppa2.0w"); break;
636 case 32: puts ("hppa2.0n"); break;
637 default: puts ("hppa2.0"); break;
638 } break;
639 #else /* !defined(_SC_KERNEL_BITS) */
640 puts ("hppa2.0"); break;
641 #endif
642 default: puts ("hppa1.0"); break;
643 }
644 exit (0);
645 }
646 EOF
647 (CCOPTS= $CC_FOR_BUILD -o $dummy $dummy.c 2>/dev/null) && HP_ARCH=`$dummy`
648 test -z "$HP_ARCH" && HP_ARCH=hppa
649 fi ;;
650 esac
651 if [ ${HP_ARCH} = "hppa2.0w" ]
652 then
653 eval $set_cc_for_build
654
655 # hppa2.0w-hp-hpux* has a 64-bit kernel and a compiler generating
656 # 32-bit code. hppa64-hp-hpux* has the same kernel and a compiler
657 # generating 64-bit code. GNU and HP use different nomenclature:
658 #
659 # $ CC_FOR_BUILD=cc ./config.guess
660 # => hppa2.0w-hp-hpux11.23
661 # $ CC_FOR_BUILD="cc +DA2.0w" ./config.guess
662 # => hppa64-hp-hpux11.23
663
664 if echo __LP64__ | (CCOPTS= $CC_FOR_BUILD -E - 2>/dev/null) |
665 grep -q __LP64__
666 then
667 HP_ARCH="hppa2.0w"
668 else
669 HP_ARCH="hppa64"
670 fi
671 fi
672 echo ${HP_ARCH}-hp-hpux${HPUX_REV}
673 exit ;;
674 ia64:HP-UX:*:*)
675 HPUX_REV=`echo ${UNAME_RELEASE}|sed -e 's/[^.]*.[0B]*//'`
676 echo ia64-hp-hpux${HPUX_REV}
677 exit ;;
678 3050*:HI-UX:*:*)
679 eval $set_cc_for_build
680 sed 's/^ //' << EOF >$dummy.c
681 #include
682 int
683 main ()
684 {
685 long cpu = sysconf (_SC_CPU_VERSION);
686 /* The order matters, because CPU_IS_HP_MC68K erroneously returns
687 true for CPU_PA_RISC1_0. CPU_IS_PA_RISC returns correct
688 results, however. */
689 if (CPU_IS_PA_RISC (cpu))
690 {
691 switch (cpu)
692 {
693 case CPU_PA_RISC1_0: puts ("hppa1.0-hitachi-hiuxwe2"); break;
694 case CPU_PA_RISC1_1: puts ("hppa1.1-hitachi-hiuxwe2"); break;
695 case CPU_PA_RISC2_0: puts ("hppa2.0-hitachi-hiuxwe2"); break;
696 default: puts ("hppa-hitachi-hiuxwe2"); break;
697 }
698 }
699 else if (CPU_IS_HP_MC68K (cpu))
700 puts ("m68k-hitachi-hiuxwe2");
701 else puts ("unknown-hitachi-hiuxwe2");
702 exit (0);
703 }
704 EOF
705 $CC_FOR_BUILD -o $dummy $dummy.c && SYSTEM_NAME=`$dummy` &&
706 { echo "$SYSTEM_NAME"; exit; }
707 echo unknown-hitachi-hiuxwe2
708 exit ;;
709 9000/7??:4.3bsd:*:* | 9000/8?[79]:4.3bsd:*:* )
710 echo hppa1.1-hp-bsd
711 exit ;;
712 9000/8??:4.3bsd:*:*)
713 echo hppa1.0-hp-bsd
714 exit ;;
715 *9??*:MPE/iX:*:* | *3000*:MPE/iX:*:*)
716 echo hppa1.0-hp-mpeix
717 exit ;;
718 hp7??:OSF1:*:* | hp8?[79]:OSF1:*:* )
719 echo hppa1.1-hp-osf
720 exit ;;
721 hp8??:OSF1:*:*)
722 echo hppa1.0-hp-osf
723 exit ;;
724 i*86:OSF1:*:*)
725 if [ -x /usr/sbin/sysversion ] ; then
726 echo ${UNAME_MACHINE}-unknown-osf1mk
727 else
728 echo ${UNAME_MACHINE}-unknown-osf1
729 fi
730 exit ;;
731 parisc*:Lites*:*:*)
732 echo hppa1.1-hp-lites
733 exit ;;
734 C1*:ConvexOS:*:* | convex:ConvexOS:C1*:*)
735 echo c1-convex-bsd
736 exit ;;
737 C2*:ConvexOS:*:* | convex:ConvexOS:C2*:*)
738 if getsysinfo -f scalar_acc
739 then echo c32-convex-bsd
740 else echo c2-convex-bsd
741 fi
742 exit ;;
743 C34*:ConvexOS:*:* | convex:ConvexOS:C34*:*)
744 echo c34-convex-bsd
745 exit ;;
746 C38*:ConvexOS:*:* | convex:ConvexOS:C38*:*)
747 echo c38-convex-bsd
748 exit ;;
749 C4*:ConvexOS:*:* | convex:ConvexOS:C4*:*)
750 echo c4-convex-bsd
751 exit ;;
752 CRAY*Y-MP:*:*:*)
753 echo ymp-cray-unicos${UNAME_RELEASE} | sed -e 's/\.[^.]*$/.X/'
754 exit ;;
755 CRAY*[A-Z]90:*:*:*)
756 echo ${UNAME_MACHINE}-cray-unicos${UNAME_RELEASE} \
757 | sed -e 's/CRAY.*\([A-Z]90\)/\1/' \
758 -e y/ABCDEFGHIJKLMNOPQRSTUVWXYZ/abcdefghijklmnopqrstuvwxyz/ \
759 -e 's/\.[^.]*$/.X/'
760 exit ;;
761 CRAY*TS:*:*:*)
762 echo t90-cray-unicos${UNAME_RELEASE} | sed -e 's/\.[^.]*$/.X/'
763 exit ;;
764 CRAY*T3E:*:*:*)
765 echo alphaev5-cray-unicosmk${UNAME_RELEASE} | sed -e 's/\.[^.]*$/.X/'
766 exit ;;
767 CRAY*SV1:*:*:*)
768 echo sv1-cray-unicos${UNAME_RELEASE} | sed -e 's/\.[^.]*$/.X/'
769 exit ;;
770 *:UNICOS/mp:*:*)
771 echo craynv-cray-unicosmp${UNAME_RELEASE} | sed -e 's/\.[^.]*$/.X/'
772 exit ;;
773 F30[01]:UNIX_System_V:*:* | F700:UNIX_System_V:*:*)
774 FUJITSU_PROC=`uname -m | tr 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvwxyz'`
775 FUJITSU_SYS=`uname -p | tr 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvwxyz' | sed -e 's/\///'`
776 FUJITSU_REL=`echo ${UNAME_RELEASE} | sed -e 's/ /_/'`
777 echo "${FUJITSU_PROC}-fujitsu-${FUJITSU_SYS}${FUJITSU_REL}"
778 exit ;;
779 5000:UNIX_System_V:4.*:*)
780 FUJITSU_SYS=`uname -p | tr 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvwxyz' | sed -e 's/\///'`
781 FUJITSU_REL=`echo ${UNAME_RELEASE} | tr 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvwxyz' | sed -e 's/ /_/'`
782 echo "sparc-fujitsu-${FUJITSU_SYS}${FUJITSU_REL}"
783 exit ;;
784 i*86:BSD/386:*:* | i*86:BSD/OS:*:* | *:Ascend\ Embedded/OS:*:*)
785 echo ${UNAME_MACHINE}-pc-bsdi${UNAME_RELEASE}
786 exit ;;
787 sparc*:BSD/OS:*:*)
788 echo sparc-unknown-bsdi${UNAME_RELEASE}
789 exit ;;
790 *:BSD/OS:*:*)
791 echo ${UNAME_MACHINE}-unknown-bsdi${UNAME_RELEASE}
792 exit ;;
793 *:FreeBSD:*:*)
794 UNAME_PROCESSOR=`/usr/bin/uname -p`
795 case ${UNAME_PROCESSOR} in
796 amd64)
797 echo x86_64-unknown-freebsd`echo ${UNAME_RELEASE}|sed -e 's/[-(].*//'` ;;
798 *)
799 echo ${UNAME_PROCESSOR}-unknown-freebsd`echo ${UNAME_RELEASE}|sed -e 's/[-(].*//'` ;;
800 esac
801 exit ;;
802 i*:CYGWIN*:*)
803 echo ${UNAME_MACHINE}-pc-cygwin
804 exit ;;
805 *:MINGW*:*)
806 echo ${UNAME_MACHINE}-pc-mingw32
807 exit ;;
808 i*:windows32*:*)
809 # uname -m includes "-pc" on this system.
810 echo ${UNAME_MACHINE}-mingw32
811 exit ;;
812 i*:PW*:*)
813 echo ${UNAME_MACHINE}-pc-pw32
814 exit ;;
815 *:Interix*:*)
816 case ${UNAME_MACHINE} in
817 x86)
818 echo i586-pc-interix${UNAME_RELEASE}
819 exit ;;
820 authenticamd | genuineintel | EM64T)
821 echo x86_64-unknown-interix${UNAME_RELEASE}
822 exit ;;
823 IA64)
824 echo ia64-unknown-interix${UNAME_RELEASE}
825 exit ;;
826 esac ;;
827 [345]86:Windows_95:* | [345]86:Windows_98:* | [345]86:Windows_NT:*)
828 echo i${UNAME_MACHINE}-pc-mks
829 exit ;;
830 8664:Windows_NT:*)
831 echo x86_64-pc-mks
832 exit ;;
833 i*:Windows_NT*:* | Pentium*:Windows_NT*:*)
834 # How do we know it's Interix rather than the generic POSIX subsystem?
835 # It also conflicts with pre-2.0 versions of AT&T UWIN. Should we
836 # UNAME_MACHINE based on the output of uname instead of i386?
837 echo i586-pc-interix
838 exit ;;
839 i*:UWIN*:*)
840 echo ${UNAME_MACHINE}-pc-uwin
841 exit ;;
842 amd64:CYGWIN*:*:* | x86_64:CYGWIN*:*:*)
843 echo x86_64-unknown-cygwin
844 exit ;;
845 p*:CYGWIN*:*)
846 echo powerpcle-unknown-cygwin
847 exit ;;
848 prep*:SunOS:5.*:*)
849 echo powerpcle-unknown-solaris2`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'`
850 exit ;;
851 *:GNU:*:*)
852 # the GNU system
853 echo `echo ${UNAME_MACHINE}|sed -e 's,[-/].*$,,'`-unknown-gnu`echo ${UNAME_RELEASE}|sed -e 's,/.*$,,'`
854 exit ;;
855 *:GNU/*:*:*)
856 # other systems with GNU libc and userland
857 echo ${UNAME_MACHINE}-unknown-`echo ${UNAME_SYSTEM} | sed 's,^[^/]*/,,' | tr '[A-Z]' '[a-z]'``echo ${UNAME_RELEASE}|sed -e 's/[-(].*//'`-gnu
858 exit ;;
859 i*86:Minix:*:*)
860 echo ${UNAME_MACHINE}-pc-minix
861 exit ;;
862 alpha:Linux:*:*)
863 case `sed -n '/^cpu model/s/^.*: \(.*\)/\1/p' < /proc/cpuinfo` in
864 EV5) UNAME_MACHINE=alphaev5 ;;
865 EV56) UNAME_MACHINE=alphaev56 ;;
866 PCA56) UNAME_MACHINE=alphapca56 ;;
867 PCA57) UNAME_MACHINE=alphapca56 ;;
868 EV6) UNAME_MACHINE=alphaev6 ;;
869 EV67) UNAME_MACHINE=alphaev67 ;;
870 EV68*) UNAME_MACHINE=alphaev68 ;;
871 esac
872 objdump --private-headers /bin/sh | grep -q ld.so.1
873 if test "$?" = 0 ; then LIBC="libc1" ; else LIBC="" ; fi
874 echo ${UNAME_MACHINE}-unknown-linux-gnu${LIBC}
875 exit ;;
876 arm*:Linux:*:*)
877 eval $set_cc_for_build
878 if echo __ARM_EABI__ | $CC_FOR_BUILD -E - 2>/dev/null \
879 | grep -q __ARM_EABI__
880 then
881 echo ${UNAME_MACHINE}-unknown-linux-gnu
882 else
883 if echo __ARM_PCS_VFP | $CC_FOR_BUILD -E - 2>/dev/null \
884 | grep -q __ARM_PCS_VFP
885 then
886 echo ${UNAME_MACHINE}-unknown-linux-gnueabi
887 else
888 echo ${UNAME_MACHINE}-unknown-linux-gnueabihf
889 fi
890 fi
891 exit ;;
892 avr32*:Linux:*:*)
893 echo ${UNAME_MACHINE}-unknown-linux-gnu
894 exit ;;
895 cris:Linux:*:*)
896 echo cris-axis-linux-gnu
897 exit ;;
898 crisv32:Linux:*:*)
899 echo crisv32-axis-linux-gnu
900 exit ;;
901 frv:Linux:*:*)
902 echo frv-unknown-linux-gnu
903 exit ;;
904 i*86:Linux:*:*)
905 LIBC=gnu
906 eval $set_cc_for_build
907 sed 's/^ //' << EOF >$dummy.c
908 #ifdef __dietlibc__
909 LIBC=dietlibc
910 #endif
911 EOF
912 eval `$CC_FOR_BUILD -E $dummy.c 2>/dev/null | grep '^LIBC'`
913 echo "${UNAME_MACHINE}-pc-linux-${LIBC}"
914 exit ;;
915 ia64:Linux:*:*)
916 echo ${UNAME_MACHINE}-unknown-linux-gnu
917 exit ;;
918 m32r*:Linux:*:*)
919 echo ${UNAME_MACHINE}-unknown-linux-gnu
920 exit ;;
921 m68*:Linux:*:*)
922 echo ${UNAME_MACHINE}-unknown-linux-gnu
923 exit ;;
924 mips:Linux:*:* | mips64:Linux:*:*)
925 eval $set_cc_for_build
926 sed 's/^ //' << EOF >$dummy.c
927 #undef CPU
928 #undef ${UNAME_MACHINE}
929 #undef ${UNAME_MACHINE}el
930 #if defined(__MIPSEL__) || defined(__MIPSEL) || defined(_MIPSEL) || defined(MIPSEL)
931 CPU=${UNAME_MACHINE}el
932 #else
933 #if defined(__MIPSEB__) || defined(__MIPSEB) || defined(_MIPSEB) || defined(MIPSEB)
934 CPU=${UNAME_MACHINE}
935 #else
936 CPU=
937 #endif
938 #endif
939 EOF
940 eval `$CC_FOR_BUILD -E $dummy.c 2>/dev/null | grep '^CPU'`
941 test x"${CPU}" != x && { echo "${CPU}-unknown-linux-gnu"; exit; }
942 ;;
943 or32:Linux:*:*)
944 echo or32-unknown-linux-gnu
945 exit ;;
946 padre:Linux:*:*)
947 echo sparc-unknown-linux-gnu
948 exit ;;
949 parisc64:Linux:*:* | hppa64:Linux:*:*)
950 echo hppa64-unknown-linux-gnu
951 exit ;;
952 parisc:Linux:*:* | hppa:Linux:*:*)
953 # Look for CPU level
954 case `grep '^cpu[^a-z]*:' /proc/cpuinfo 2>/dev/null | cut -d' ' -f2` in
955 PA7*) echo hppa1.1-unknown-linux-gnu ;;
956 PA8*) echo hppa2.0-unknown-linux-gnu ;;
957 *) echo hppa-unknown-linux-gnu ;;
958 esac
959 exit ;;
960 ppc64:Linux:*:*)
961 echo powerpc64-unknown-linux-gnu
962 exit ;;
963 ppc64le:Linux:*:*)
964 echo powerpc64le-unknown-linux-gnu
965 exit ;;
966 ppc:Linux:*:*)
967 echo powerpc-unknown-linux-gnu
968 exit ;;
969 s390:Linux:*:* | s390x:Linux:*:*)
970 echo ${UNAME_MACHINE}-ibm-linux
971 exit ;;
972 sh64*:Linux:*:*)
973 echo ${UNAME_MACHINE}-unknown-linux-gnu
974 exit ;;
975 sh*:Linux:*:*)
976 echo ${UNAME_MACHINE}-unknown-linux-gnu
977 exit ;;
978 sparc:Linux:*:* | sparc64:Linux:*:*)
979 echo ${UNAME_MACHINE}-unknown-linux-gnu
980 exit ;;
981 tile*:Linux:*:*)
982 echo ${UNAME_MACHINE}-unknown-linux-gnu
983 exit ;;
984 vax:Linux:*:*)
985 echo ${UNAME_MACHINE}-dec-linux-gnu
986 exit ;;
987 x86_64:Linux:*:*)
988 echo x86_64-unknown-linux-gnu
989 exit ;;
990 xtensa*:Linux:*:*)
991 echo ${UNAME_MACHINE}-unknown-linux-gnu
992 exit ;;
993 i*86:DYNIX/ptx:4*:*)
994 # ptx 4.0 does uname -s correctly, with DYNIX/ptx in there.
995 # earlier versions are messed up and put the nodename in both
996 # sysname and nodename.
997 echo i386-sequent-sysv4
998 exit ;;
999 i*86:UNIX_SV:4.2MP:2.*)
1000 # Unixware is an offshoot of SVR4, but it has its own version
1001 # number series starting with 2...
1002 # I am not positive that other SVR4 systems won't match this,
1003 # I just have to hope. -- rms.
1004 # Use sysv4.2uw... so that sysv4* matches it.
1005 echo ${UNAME_MACHINE}-pc-sysv4.2uw${UNAME_VERSION}
1006 exit ;;
1007 i*86:OS/2:*:*)
1008 # If we were able to find `uname', then EMX Unix compatibility
1009 # is probably installed.
1010 echo ${UNAME_MACHINE}-pc-os2-emx
1011 exit ;;
1012 i*86:XTS-300:*:STOP)
1013 echo ${UNAME_MACHINE}-unknown-stop
1014 exit ;;
1015 i*86:atheos:*:*)
1016 echo ${UNAME_MACHINE}-unknown-atheos
1017 exit ;;
1018 i*86:syllable:*:*)
1019 echo ${UNAME_MACHINE}-pc-syllable
1020 exit ;;
1021 i*86:LynxOS:2.*:* | i*86:LynxOS:3.[01]*:* | i*86:LynxOS:4.[02]*:*)
1022 echo i386-unknown-lynxos${UNAME_RELEASE}
1023 exit ;;
1024 i*86:*DOS:*:*)
1025 echo ${UNAME_MACHINE}-pc-msdosdjgpp
1026 exit ;;
1027 i*86:*:4.*:* | i*86:SYSTEM_V:4.*:*)
1028 UNAME_REL=`echo ${UNAME_RELEASE} | sed 's/\/MP$//'`
1029 if grep Novell /usr/include/link.h >/dev/null 2>/dev/null; then
1030 echo ${UNAME_MACHINE}-univel-sysv${UNAME_REL}
1031 else
1032 echo ${UNAME_MACHINE}-pc-sysv${UNAME_REL}
1033 fi
1034 exit ;;
1035 i*86:*:5:[678]*)
1036 # UnixWare 7.x, OpenUNIX and OpenServer 6.
1037 case `/bin/uname -X | grep "^Machine"` in
1038 *486*) UNAME_MACHINE=i486 ;;
1039 *Pentium) UNAME_MACHINE=i586 ;;
1040 *Pent*|*Celeron) UNAME_MACHINE=i686 ;;
1041 esac
1042 echo ${UNAME_MACHINE}-unknown-sysv${UNAME_RELEASE}${UNAME_SYSTEM}${UNAME_VERSION}
1043 exit ;;
1044 i*86:*:3.2:*)
1045 if test -f /usr/options/cb.name; then
1046 UNAME_REL=`sed -n 's/.*Version //p'
1047 echo ${UNAME_MACHINE}-pc-isc$UNAME_REL
1048 elif /bin/uname -X 2>/dev/null >/dev/null ; then
1049 UNAME_REL=`(/bin/uname -X|grep Release|sed -e 's/.*= //')`
1050 (/bin/uname -X|grep i80486 >/dev/null) && UNAME_MACHINE=i486
1051 (/bin/uname -X|grep '^Machine.*Pentium' >/dev/null) \
1052 && UNAME_MACHINE=i586
1053 (/bin/uname -X|grep '^Machine.*Pent *II' >/dev/null) \
1054 && UNAME_MACHINE=i686
1055 (/bin/uname -X|grep '^Machine.*Pentium Pro' >/dev/null) \
1056 && UNAME_MACHINE=i686
1057 echo ${UNAME_MACHINE}-pc-sco$UNAME_REL
1058 else
1059