Radar 8710868: Build a separate version of libcc_kext.a for each ARM slice.
[llvm-gcc-4.2.git] / GNUmakefile
blobadd33c1c7212a1b6819d69d2e0066a378354bc89
1 # APPLE LOCAL file build machinery
2 # Apple GCC Compiler Makefile for use by buildit.
4 # This makefile is intended only for use with B&I buildit. For "normal"
5 # builds use the conventional FSF top-level makefile.
7 # You can specify TARGETS=ppc (or i386) on the buildit command line to
8 # limit the build to just one target. The default is for ppc and i386.
9 # The compiler targetted at this host gets built anyway, but not installed
10 # unless it's listed in TARGETS.
12 # The following default target is for the benefit of those who try to
13 # build llvm-gcc in the source directory. GNU make will prefer to use
14 # this GNUmakefile instead of the Makefile generated by configure. Since
15 # buildit always invokes this makefile with an explicit target, report an
16 # error for the default target and some other common gcc targets.
17 .PHONY: all all-gcc all-host all-target bootstrap
18 all all-gcc all-host all-target bootstrap:
19 @echo
20 @echo "Error: llvm-gcc cannot be built in the source directory."
21 @echo "Please follow the instructions in the README.LLVM file."
22 @exit 1
24 # Include the set of standard Apple makefile definitions.
25 ifndef CoreOSMakefiles
26 CoreOSMakefiles = $(MAKEFILEPATH)/CoreOS
27 endif
28 include $(CoreOSMakefiles)/Standard/Standard.make
30 # Enable Apple extensions to (gnu)make.
31 USE_APPLE_PB_SUPPORT = all
33 RC_ARCHS := ppc i386
34 HOSTS = $(RC_ARCHS)
35 targets = echo $(RC_ARCHS)
36 TARGETS := $(shell $(targets))
38 SRCROOT = .
40 SRC = $(shell cd $(SRCROOT) && pwd | sed s,/private,,)
41 OBJROOT = $(SRC)/obj
42 SYMROOT = $(OBJROOT)/../sym
43 DSTROOT = $(OBJROOT)/../dst
45 PREFIX = /usr
47 #######################################################################
49 # LLVM LOCAL begin
50 # LLVM gets installed into /Developer/usr/local, not /usr.
51 ifndef DEVELOPER_DIR
52 PREFIX = /Developer/usr/llvm-gcc-4.2
53 else
54 PREFIX = ${DEVELOPER_DIR}/usr/llvm-gcc-4.2
55 endif
57 # Default to not reinstall libLTO.dylib.
58 INSTALL_LIBLTO := no
60 # Unless assertions are forced on in the GMAKE command line, disable them.
61 ifndef ENABLE_ASSERTIONS
62 ENABLE_ASSERTIONS := no
63 endif
65 ifndef LLVMCORE_PATH
66 ifndef DEVELOPER_DIR
67 LLVMCORE_PATH = /Developer/usr/local
68 else
69 LLVMCORE_PATH = ${DEVELOPER_DIR}/usr/local
70 endif
71 endif
73 # Default is optimized build.
74 ifeq ($(LLVM_DEBUG),1)
75 LLVM_OPTIMIZED := no
76 else
77 LLVM_OPTIMIZED := yes
78 endif
80 # Cross-builds for ARM hosts or iOS Simulator are not supported here.
81 ARM_HOSTED_BUILD := no
82 IOS_SIM_BUILD := no
84 ifndef RC_ProjectSourceVersion
85 RC_ProjectSourceVersion = 9999
86 endif
88 ifndef RC_ProjectSourceSubversion
89 RC_ProjectSourceSubversion = 00
90 endif
92 install:
93 $(MAKE) OBJROOT=$(OBJROOT)/obj-llvmCore \
94 SYMROOT=$(OBJROOT)/sym-llvmCore \
95 DSTROOT=$(OBJROOT)/dst-llvmCore llvmCore
96 $(MAKE) LLVMCORE_PATH=$(OBJROOT)/dst-llvmCore/Developer/usr/local \
97 llvmgcc42
99 llvmCore: $(OBJROOT) $(SYMROOT) $(DSTROOT)
100 if [ ! -d $(SRC)/llvmCore ]; then \
101 echo "Error: llvmCore source directory is missing"; \
102 exit 1; \
104 cd $(OBJROOT) && \
105 $(SRC)/llvmCore/utils/buildit/build_llvm "$(RC_ARCHS)" "$(TARGETS)" \
106 $(SRC)/llvmCore /Developer/usr/local $(DSTROOT) $(SYMROOT) \
107 $(ENABLE_ASSERTIONS) $(LLVM_OPTIMIZED) $(INSTALL_LIBLTO) \
108 $(ARM_HOSTED_BUILD) $(IOS_SIM_BUILD) \
109 $(RC_ProjectSourceVersion) $(RC_ProjectSourceSubversion)
111 llvmgcc42: $(OBJROOT) $(SYMROOT) $(DSTROOT)
112 cd $(OBJROOT) && \
113 $(SRC)/build_gcc "$(RC_ARCHS)" "$(TARGETS)" \
114 $(SRC) $(PREFIX) $(DSTROOT) $(SYMROOT) $(INSTALL_LIBLTO) \
115 $(ENABLE_ASSERTIONS) $(LLVMCORE_PATH) \
116 $(RC_ProjectSourceVersion) $(RC_ProjectSourceSubversion)
118 Embedded:
119 @if [ -z "$(ARM_SDK)" ]; then \
120 echo "ARM_SDK must be set to build the Embedded target"; \
121 exit 1; \
123 ARM_PLATFORM=`xcodebuild -version -sdk $(ARM_SDK) PlatformPath` && \
124 $(MAKE) DSTROOT=$(DSTROOT)$$ARM_PLATFORM DISABLE_USR_LINKS=1 install
126 # LLVM LOCAL end
128 # installhdrs does nothing, because the headers aren't useful until
129 # the compiler is installed.
130 installhdrs:
132 # We build and install in one shell script.
133 build:
135 installsrc:
136 @echo
137 @echo ++++++++++++++++++++++
138 @echo + Installing sources +
139 @echo ++++++++++++++++++++++
140 @echo
141 if [ $(SRCROOT) != . ]; then \
142 $(PAX) -rw . $(SRCROOT); \
144 # LLVM LOCAL begin: Avoid verification error due to binaries in libjava.
145 rm -rf "$(SRCROOT)/libjava/"
146 find -d "$(SRCROOT)" \( -type d -a -name .svn -o \
147 -type f -a -name .DS_Store -o \
148 -name \*~ -o -name .\#\* \) \
149 -exec rm -rf {} \;
150 rm -rf "$(SRCROOT)/gcc/testsuite"
151 rm -rf "$(SRCROOT)/llvmCore/test"
153 #######################################################################
155 clean:
156 @echo
157 @echo ++++++++++++
158 @echo + Cleaning +
159 @echo ++++++++++++
160 @echo
161 @if [ -d $(OBJROOT) -a "$(OBJROOT)" != / ]; then \
162 echo '*** DELETING ' $(OBJROOT); \
163 rm -rf $(OBJROOT); \
165 @if [ -d $(SYMROOT) -a "$(SYMROOT)" != / ]; then \
166 echo '*** DELETING ' $(SYMROOT); \
167 rm -rf $(SYMROOT); \
169 @if [ -d $(DSTROOT) -a "$(DSTROOT)" != / ]; then \
170 echo '*** DELETING ' $(DSTROOT); \
171 rm -rf $(DSTROOT); \
174 #######################################################################
176 $(OBJROOT) $(SYMROOT) $(DSTROOT):
177 mkdir -p $@
179 .PHONY: install installsrc clean llvmCore llvmgcc42 Embedded