components/llvm/Makefile
changeset 5434 9f55c805ce9d
child 5437 449f3459d285
equal deleted inserted replaced
5428:3c05d530e67e 5434:9f55c805ce9d
       
     1 #
       
     2 # CDDL HEADER START
       
     3 #
       
     4 # The contents of this file are subject to the terms of the
       
     5 # Common Development and Distribution License (the "License").
       
     6 # You may not use this file except in compliance with the License.
       
     7 #
       
     8 # You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
       
     9 # or http://www.opensolaris.org/os/licensing.
       
    10 # See the License for the specific language governing permissions
       
    11 # and limitations under the License.
       
    12 #
       
    13 # When distributing Covered Code, include this CDDL HEADER in each
       
    14 # file and include the License file at usr/src/OPENSOLARIS.LICENSE.
       
    15 # If applicable, add the following below this CDDL HEADER, with the
       
    16 # fields enclosed by brackets "[]" replaced with your own identifying
       
    17 # information: Portions Copyright [yyyy] [name of copyright owner]
       
    18 #
       
    19 # CDDL HEADER END
       
    20 #
       
    21 
       
    22 #
       
    23 # Copyright (c) 2015, 2016, Oracle and/or its affiliates. All rights reserved.
       
    24 #
       
    25 export PARFAIT_BUILD=no
       
    26 COMPILER=gcc
       
    27 
       
    28 include ../../make-rules/shared-macros.mk
       
    29 
       
    30 COMPONENT_NAME=		llvm
       
    31 COMPONENT_VERSION=	3.6.2
       
    32 COMPONENT_PROJECT_URL=	http://llvm.org/
       
    33 COMPONENT_SRC=		$(COMPONENT_NAME)
       
    34 COMPONENT_BUGDB=	utility/llvm
       
    35 
       
    36 COMPONENT_SRC=		$(COMPONENT_NAME)-$(COMPONENT_VERSION)
       
    37 COMPONENT_SRC_NAME=	$(COMPONENT_SRC).src
       
    38 COMPONENT_ARCHIVE=	$(COMPONENT_SRC_NAME).tar.xz
       
    39 COMPONENT_ARCHIVE_HASH=	\
       
    40     sha256:f60dc158bfda6822de167e87275848969f0558b3134892ff54fced87e4667b94
       
    41 COMPONENT_ARCHIVE_URL=	$(COMPONENT_PROJECT_URL)/releases/$(COMPONENT_VERSION)/$(COMPONENT_ARCHIVE)
       
    42 
       
    43 TPNO=			24358
       
    44 
       
    45 COMPONENT_NAME_1 =	clang
       
    46 COMPONENT_SRC_1 =	cfe-$(COMPONENT_VERSION).src
       
    47 COMPONENT_ARCHIVE_1 =	$(COMPONENT_SRC_1).tar.xz
       
    48 COMPONENT_ARCHIVE_HASH_1 = \
       
    49 	sha256:ae9180466a23acb426d12444d866b266ff2289b266064d362462e44f8d4699f3
       
    50 COMPONENT_ARCHIVE_URL_1 = $(COMPONENT_PROJECT_URL)/releases/$(COMPONENT_VERSION)/$(COMPONENT_ARCHIVE_1)
       
    51 
       
    52 COMPONENT_POST_UNPACK_ACTION = \
       
    53        ( $(MV) $(COMPONENT_SRC_NAME) $(COMPONENT_SRC) )
       
    54 
       
    55 COMPONENT_POST_UNPACK_ACTION_1 = \
       
    56 	 ( $(RM) -rf $(COMPONENT_SRC)/tools/$(COMPONENT_NAME_1) ; \
       
    57 	 $(CP) -rp $(COMPONENT_SRC_1) \
       
    58 	    $(COMPONENT_SRC)/tools/$(COMPONENT_NAME_1) )
       
    59 
       
    60 COMPONENT_PRE_CONFIGURE_ACTION = \
       
    61 	 ( cd $(SOURCE_DIR) ; \
       
    62 	 $(CHMOD) 0755 ./autoconf/AutoRegen.sh ; \
       
    63 	 ./autoconf/AutoRegen.sh )
       
    64 
       
    65 COMPONENT_POST_BUILD_ACTION = \
       
    66       if test -d $(COMPONENT_DIR)/cxa_finalize ; then \
       
    67       $(GMAKE) -C $(COMPONENT_DIR)/cxa_finalize build ; \
       
    68       fi
       
    69 
       
    70 COMPONENT_POST_INSTALL_ACTION = \
       
    71 	if test -d $(COMPONENT_DIR)/cxa_finalize ; then \
       
    72 	$(GMAKE) -C $(COMPONENT_DIR)/cxa_finalize install ; \
       
    73 	fi;
       
    74 
       
    75 include $(WS_MAKE_RULES)/prep.mk
       
    76 include $(WS_MAKE_RULES)/configure.mk
       
    77 include $(WS_MAKE_RULES)/ips.mk
       
    78 
       
    79 PATCH_LEVEL := 0
       
    80 DEBUG_BUILD := 0
       
    81 GCC_VERSION := 4.9
       
    82 
       
    83 # We need GCC version 4.9, and not another version.
       
    84 CC=/usr/gcc/$(GCC_VERSION)/bin/gcc
       
    85 CXX=/usr/gcc/$(GCC_VERSION)/bin/g++
       
    86 
       
    87 # We need the specific C++ runtime that clang/llvm was built and
       
    88 # linked with, and not some random and incompatible stuff from
       
    89 # /usr/lib.
       
    90 LLVM_RUNPATH_32 = /usr/gcc/$(GCC_VERSION)/lib
       
    91 LLVM_RUNPATH_64 = /usr/gcc/$(GCC_VERSION)/lib/$(MACH64)
       
    92 LLVM_RUNPATH = $(LLVM_RUNPATH_$(BITS))
       
    93 
       
    94 # -O0 for now. Ideally we want -O2.
       
    95 OFLAG="-O0"
       
    96 GFLAG=""
       
    97 
       
    98 ifeq ($(DEBUG_BUILD), 1)
       
    99   OFLAG="-O0"
       
   100   GFLAG="-g3"
       
   101 endif
       
   102 
       
   103 export PATH=/usr/gnu/bin:/usr/xpg4/bin:/usr/bin:/usr/perl5/5.16/bin
       
   104 
       
   105 # Because LLVM's install target doesn't install everything that
       
   106 # needs to be installed.
       
   107 EXTRA_INSTALL_BITS=llvm-lto arcmt-test c-arcmt-test c-index-test diagtool
       
   108 LLVM_BINDIR=$(BUILD_DIR_64)/Release/bin
       
   109 
       
   110 ifeq ($(DEBUG_BUILD), 1)
       
   111   LLVM_BINDIR=$(BUILD_DIR_64)/Debug+Asserts+Checks/bin
       
   112 endif
       
   113 
       
   114 COMPONENT_POST_INSTALL_ACTION += \
       
   115 	list1='$(EXTRA_INSTALL_BITS)' ; for f in $$list1 ; do \
       
   116 	    $(INSTALL) --mode=755 $(LLVM_BINDIR)/$$f $(PROTOUSRBINDIR)/$$f ; \
       
   117 	done;
       
   118 
       
   119 # No ASLR for compilers.
       
   120 ASLR_MODE = $(ASLR_DISABLE)
       
   121 
       
   122 # GCC options used:
       
   123 # -ftree-vectorize | -fno-tree-vectorize:
       
   124 # Enable/disable loop vectorization in optimizations. For details:
       
   125 # https://gcc.gnu.org/projects/tree-ssa/vectorization.html
       
   126 # Disabled in debug builds, will be enabled in production/optimized
       
   127 # builds at some point in the future..
       
   128 #
       
   129 # -ftree-slp-vectorize | -fno-tree-slp-vectorize:
       
   130 # Enable/disable Basic Block tree vectorization.
       
   131 # Less aggressive vectorization than -ftree-vectorize, but useful
       
   132 # in case -ftree-slp-vectorize misses some vectorization opportunities.
       
   133 # Documentation at the same URL as above.
       
   134 # Disabled in debug builds, will be enabled in production/optimized
       
   135 # builds at some point in the future.
       
   136 #
       
   137 # -freorder-blocks | -fno-reorder-blocks
       
   138 # Enable/disable BasicBlock reordering as an optimization.
       
   139 # Disabled in debug builds, will be enabled in production/optimized
       
   140 # builds at some point in the future.
       
   141 # Documented here:
       
   142 # https://gcc.gnu.org/onlinedocs/gcc/Optimize-Options.html
       
   143 #
       
   144 # -ftoplevel-reorder | -fno-toplevel-reorder
       
   145 # Another BasiBlock depentent optimization option.
       
   146 # Disabled in debug builds, will be enabled in production/optimized
       
   147 # builds at some point in the future.
       
   148 # Documented here:
       
   149 # https://gcc.gnu.org/onlinedocs/gcc/Optimize-Options.html
       
   150 #
       
   151 # -fstack-protector-all:
       
   152 # Enable stack smashing (stack corruption) protection and detection.
       
   153 # This flag should always be used in conjunction with -Wstack-protector.
       
   154 # -Wstack-protector acts at compile-time, -fstack-protector-all acts
       
   155 # at runtime. -fstack-protector-all enables linking with libssp.so.
       
   156 # This flag carries significant runtime overhead, but is very useful.
       
   157 # Always enabled for now. May be removed in the future.
       
   158 #
       
   159 # -g3: Enable macro visibility in GDB. With just -g, debug builds will
       
   160 # not record the expanded values of macros. With -g3, the values of
       
   161 # expanded macros will be recorded, and macros will be observable in
       
   162 # GDB.
       
   163 #
       
   164 # -mno-unaligned-doubles:
       
   165 # Assume that the code does not make use of misaligned doubles on SPARC.
       
   166 # On SPARC, doubles must align on 8. This flag makes GCC assume that
       
   167 # there is no misaligned double use in the code, and GCC will not
       
   168 # attempt to correct such misaligned loads/stores. If, however, there
       
   169 # is such broken code when using this flag, the program will SIGBUS
       
   170 # at runtime. This is a very useful debugging flag.
       
   171 #
       
   172 # -mhard-float:
       
   173 # Use hardware floating-point operations when available. Compilers
       
   174 # generally make very little use of floating-point, but this is
       
   175 # a valuable/low-cost optimization for those rare cases where
       
   176 # floating-point operations are used. No-op for quad-floating-point
       
   177 # and UltraSPARC-1/2/3 because on those ISA's quad-floating-point
       
   178 # ops are always done in software. But quad-floating-point ops in a
       
   179 # compiler are virtually non-existent.
       
   180 #
       
   181 # -mptr32 | -mptr64:
       
   182 #  Tell GCC the size of a pointer on SPARC.
       
   183 #
       
   184 # -mimpure-text:
       
   185 # When used in addition to -shared on SPARC, this tells GCC to not pass
       
   186 # -z text to the linker when linking a shared object.
       
   187 # There is some suspicious interaction happening here between GCC/GAS
       
   188 # and the Sun linker. Technically, and in theory, this flag should not
       
   189 # be needed when compiling -fPIC. However, extensive documented use
       
   190 # and practice has shown that it is indeed needed. The disadvantage
       
   191 # of using this flag is that it triggers copy-on-write relocations.
       
   192 #
       
   193 # -mno-sse3 -mno-ssse3:
       
   194 # Do not use SSE3/SSSE3 instructions on Intel. These might not be
       
   195 # available. Building for Opteron - which implies SSE2 - is adequate
       
   196 # for performance purposes.
       
   197 
       
   198 CFLAGS = -m$(BITS) $(GFLAG) $(OFLAG) -pthread -std=c99 -fno-strict-aliasing
       
   199 CFLAGS += -fno-tree-slp-vectorize -fno-tree-vectorize
       
   200 CFLAGS += -fno-reorder-blocks -fno-toplevel-reorder
       
   201 CFLAGS += -Wall -Wcast-align -Wno-long-long -Woverflow
       
   202 CFLAGS += -Wstack-protector -fdata-sections -fstack-protector-all
       
   203 CFLAGS += -fkeep-static-consts -ffunction-sections
       
   204 CFLAGS += -Wl,-z -Wl,relax=common -Wl,-z -Wl,relax=secadj
       
   205 CFLAGS += -Wl,-z -Wl,relax=transtls -Wl,-R -Wl,$(LLVM_RUNPATH)
       
   206 CFLAGS.i386 += -mtune=opteron -mno-sse3 -mno-ssse3 -fno-common
       
   207 CFLAGS.sparc += -mtune=ultrasparc -mcpu=ultrasparc -mvis -mhard-float
       
   208 CFLAGS.sparc += -mptr$(BITS) -fdata-sections -falign-functions=8
       
   209 CFLAGS.sparc += -mno-unaligned-doubles -mimpure-text
       
   210 CFLAGS += $(CFLAGS.$(MACH))
       
   211 
       
   212 CXXFLAGS = -m$(BITS) $(GFLAG) $(OFLAG) -pthread -fno-strict-aliasing
       
   213 CXXFLAGS += -fexceptions -frtti -fstack-protector-all
       
   214 CXXFLAGS += -fno-tree-vectorize -fno-tree-slp-vectorize
       
   215 CXXFLAGS += -fno-reorder-blocks -fno-toplevel-reorder
       
   216 CXXFLAGS += -Wall -Wcast-align -Wno-long-long -Woverflow
       
   217 CXXFLAGS += -Wstack-protector -fkeep-static-consts
       
   218 CXXFLAGS += -std=c++11 -fdata-sections -ffunction-sections
       
   219 CXXFLAGS += -Wl,-z -Wl,relax=common -Wl,-z -Wl,relax=secadj
       
   220 CXXFLAGS += -Wl,-z -Wl,relax=transtls -Wl,-R -Wl,$(LLVM_RUNPATH)
       
   221 CXXFLAGS.sparc += -mptr$(BITS)
       
   222 CXXFLAGS += $(CFLAGS.$(MACH))
       
   223 
       
   224 CPPFLAGS = -D_GNU_SOURCE -DLLVM_SOLARIS -I/usr/gnu/include
       
   225 
       
   226 ifeq ($(DEBUG_BUILD), 1)
       
   227   CPPFLAGS += -D_DEBUG
       
   228 endif
       
   229 
       
   230 CPPFLAGS += -D_REENTRANT -D_LARGEFILE64_SOURCE -D_FILE_OFFSET_BITS=64
       
   231 CPPFLAGS += -D_FILE_OFFSET_BITS=64 -D__EXTENSIONS__=1
       
   232 CPPFLAGS += -D__STDC_CONSTANT_MACROS -D__STDC_FORMAT_MACROS
       
   233 CPPFLAGS += -D__STDC_LIMIT_MACROS -DHAVE_POSIX_MEMALIGN
       
   234 CPPFLAGS += -D_GLIBCXX_FULLY_DYNAMIC_STRING=1
       
   235 CPPFLAGS.i386 = -DLLVM_INTEL
       
   236 CPPFLAGS.sparc = -DLLVM_SPARC
       
   237 CPPFLAGS += $(CPPFLAGS.$(MACH))
       
   238 
       
   239 LLVM_LIBDIR_32 = /usr/lib
       
   240 LLVM_LIBDIR_64 = /usr/lib/$(MACH64)
       
   241 LLVM_LIBDIR = $(LLVM_LIBDIR_$(BITS))
       
   242 
       
   243 LLVM_LIBEXECDIR_32 = /usr/libexec
       
   244 LLVM_LIBEXECDIR_64 = /usr/libexec/$(MACH64)
       
   245 LLVM_LIBEXECDIR = $(LLVM_LIBEXECDIR_$(BITS))
       
   246 
       
   247 CONFIGURE_SCRIPT = $(SOURCE_DIR)/configure
       
   248 CONFIGURE_OPTIONS += CC="$(CC)"
       
   249 CONFIGURE_OPTIONS += CXX="$(CXX)"
       
   250 CONFIGURE_OPTIONS += CFLAGS="$(CFLAGS)"
       
   251 CONFIGURE_OPTIONS += CPPFLAGS="$(CPPFLAGS)"
       
   252 CONFIGURE_OPTIONS += CXXFLAGS="$(CXXFLAGS)"
       
   253 CONFIGURE_OPTIONS += --libdir=$(LLVM_LIBDIR)
       
   254 CONFIGURE_OPTIONS += --libexecdir=$(LLVM_LIBEXECDIR)
       
   255 CONFIGURE_OPTIONS += --sharedstatedir=/tmp
       
   256 CONFIGURE_OPTIONS += --localstatedir=/var
       
   257 CONFIGURE_OPTIONS += --enable-compiler-version-checks=yes
       
   258 CONFIGURE_OPTIONS += --enable-clang-static-analyzer=yes
       
   259 
       
   260 ifeq ($(DEBUG_BUILD), 1)
       
   261   CONFIGURE_OPTIONS += --enable-assertions=yes
       
   262   CONFIGURE_OPTIONS += --enable-optimized=no
       
   263   CONFIGURE_OPTIONS += --enable-expensive-checks=yes
       
   264   CONFIGURE_OPTIONS += --enable-debug-runtime=yes
       
   265   CONFIGURE_OPTIONS += --enable-debug-symbols=yes
       
   266 else
       
   267   CONFIGURE_OPTIONS += --enable-assertions=no
       
   268   CONFIGURE_OPTIONS += --enable-optimized=yes
       
   269   CONFIGURE_OPTIONS += --enable-expensive-checks=no
       
   270   CONFIGURE_OPTIONS += --enable-debug-runtime=no
       
   271   CONFIGURE_OPTIONS += --enable-debug-symbols=no
       
   272 endif
       
   273 
       
   274 CONFIGURE_OPTIONS += --enable-keep-symbols=yes
       
   275 CONFIGURE_OPTIONS += --enable-jit=yes
       
   276 CONFIGURE_OPTIONS += --disable-docs
       
   277 CONFIGURE_OPTIONS += --disable-doxygen
       
   278 CONFIGURE_OPTIONS += --enable-threads=yes
       
   279 CONFIGURE_OPTIONS += --enable-pthreads=yes
       
   280 CONFIGURE_OPTIONS += --enable-shared=yes
       
   281 CONFIGURE_OPTIONS += --enable-zlib=yes
       
   282 CONFIGURE_OPTIONS += --enable-pic=yes
       
   283 CONFIGURE_OPTIONS += --enable-timestamps
       
   284 CONFIGURE_OPTIONS += --enable-backtraces
       
   285 CONFIGURE_OPTIONS += --enable-bindings=auto
       
   286 CONFIGURE_OPTIONS += --enable-libffi=yes
       
   287 CONFIGURE_OPTIONS += --enable-terminfo=yes
       
   288 CONFIGURE_OPTIONS += --enable-ltdl-install=no
       
   289 CONFIGURE_OPTIONS += --with-python=$(PYTHON)
       
   290 
       
   291 ifeq ($(MACH),sparc)
       
   292   CONFIGURE_OPTIONS += --with-extra-ld-options='-lkstat'
       
   293 endif
       
   294 CONFIGURE_OPTIONS += --with-gcc-toolchain=/usr/gcc/$(GCC_VERSION)
       
   295 CONFIGURE_OPTIONS += --with-optimize-option="$(OFLAG) $(GFLAG)"
       
   296 
       
   297 # Enable the cross-compiler in 3.8.X.
       
   298 CONFIGURE_OPTIONS.i386 += --enable-targets="x86"
       
   299 CONFIGURE_OPTIONS.sparc += --enable-targets="sparc"
       
   300 CONFIGURE_OPTIONS += $(CONFIGURE_OPTIONS.$(MACH))
       
   301 
       
   302 # Put this here for now until the gpatch problems are resolved.
       
   303 COMPONENT_BUILD_ARGS += -j8
       
   304 
       
   305 # use bash(1) to run the install recipes otherwise clang header installation
       
   306 # fails
       
   307 COMPONENT_INSTALL_ARGS += SHELL=/bin/bash
       
   308 
       
   309 # common targets
       
   310 configure:	$(CONFIGURE_64)
       
   311 
       
   312 build:		$(BUILD_64)
       
   313 
       
   314 install:	$(INSTALL_64)
       
   315 
       
   316 # There are no master test results yet. TBDL in 3.8.X.
       
   317 test:
       
   318 	@echo "Tests not yet implemented (wait for 3.8.X)."
       
   319 
       
   320 system-test:    $(SYSTEM_TESTS_NOT_IMPLEMENTED)
       
   321 
       
   322 REQUIRED_PACKAGES += developer/gcc-4/gcc-common-49
       
   323 REQUIRED_PACKAGES += developer/gnu-binutils
       
   324 REQUIRED_PACKAGES += library/libedit
       
   325 REQUIRED_PACKAGES += library/libffi
       
   326 REQUIRED_PACKAGES += library/libxml2
       
   327 REQUIRED_PACKAGES += library/zlib
       
   328 REQUIRED_PACKAGES += runtime/python-27
       
   329 REQUIRED_PACKAGES += system/core-os
       
   330 REQUIRED_PACKAGES += system/header
       
   331 REQUIRED_PACKAGES += system/library
       
   332 REQUIRED_PACKAGES += system/library/gcc/gcc-c++-runtime-49
       
   333 REQUIRED_PACKAGES += system/library/gcc/gcc-gobjcc-runtime-49
       
   334 REQUIRED_PACKAGES += system/library/math
       
   335 REQUIRED_PACKAGES += system/linker
       
   336