• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1# LLVM LOCAL file build machinery
2# LLVM Compiler Makefile for use by buildit.
3#
4# This makefile is intended only for use with B&I buildit. For "normal" builds
5# use the conventional top-level makefile.
6#
7# You can specify TARGETS=ppc (or i386) on the buildit command line to limit the
8# build to just one target. The default is for ppc and i386. The compiler
9# targeted at this host gets built anyway, but not installed unless it's listed
10# in TARGETS.
11
12# Include the set of standard Apple makefile definitions.
13ifndef CoreOSMakefiles
14CoreOSMakefiles = $(MAKEFILEPATH)/CoreOS
15endif
16include $(CoreOSMakefiles)/Standard/Standard.make
17
18# Enable Apple extensions to (gnu)make.
19USE_APPLE_PB_SUPPORT = all
20
21RC_ARCHS := ppc i386
22HOSTS = $(RC_ARCHS)
23targets = echo $(RC_ARCHS)
24TARGETS := $(shell $(targets))
25
26SRCROOT = .
27
28SRC = $(shell cd $(SRCROOT) && pwd | sed s,/private,,)
29OBJROOT = $(SRC)/obj
30SYMROOT = $(OBJROOT)/../sym
31DSTROOT = $(OBJROOT)/../dst
32
33#######################################################################
34
35PREFIX = /Developer/usr/local
36
37# Unless assertions are forced on in the GMAKE command line, disable them.
38ifndef ENABLE_ASSERTIONS
39ENABLE_ASSERTIONS := no
40endif
41
42# Default is optimized build.
43ifeq ($(LLVM_DEBUG),1)
44LLVM_OPTIMIZED := no
45else
46LLVM_OPTIMIZED := yes
47endif
48
49# Default to not install libLTO.dylib.
50INSTALL_LIBLTO := no
51
52# Default to do a native build, not a cross-build for an ARM host or simulator.
53ARM_HOSTED_BUILD := no
54IOS_SIM_BUILD := no
55
56ifndef RC_ProjectSourceVersion
57RC_ProjectSourceVersion = 9999
58endif
59
60ifndef RC_ProjectSourceSubversion
61RC_ProjectSourceSubversion = 0
62endif
63
64# NOTE : Always put version numbers at the end because they are optional.
65install: $(OBJROOT) $(SYMROOT) $(DSTROOT)
66	cd $(OBJROOT) && \
67	  $(SRC)/utils/buildit/build_llvm "$(RC_ARCHS)" "$(TARGETS)" \
68	    $(SRC) $(PREFIX) $(DSTROOT) $(SYMROOT) \
69	    $(ENABLE_ASSERTIONS) $(LLVM_OPTIMIZED) $(INSTALL_LIBLTO) \
70	    $(ARM_HOSTED_BUILD) $(IOS_SIM_BUILD) \
71	    $(RC_ProjectSourceVersion) $(RC_ProjectSourceSubversion)
72
73EmbeddedHosted:
74	$(MAKE) ARM_HOSTED_BUILD=yes PREFIX=/usr/local install
75
76# When building for the iOS simulator, MACOSX_DEPLOYMENT_TARGET is not set
77# by default, but it needs to be set when building tools that run on the host
78# (e.g., tblgen), so set it here.
79EmbeddedSim:
80	export MACOSX_DEPLOYMENT_TARGET=`sw_vers -productVersion`; \
81	$(MAKE) IOS_SIM_BUILD=yes PREFIX=$(SDKROOT)/usr/local install
82
83Embedded:
84	ARM_PLATFORM=`xcodebuild -version -sdk iphoneos PlatformPath` && \
85	$(MAKE) DSTROOT=$(DSTROOT)$$ARM_PLATFORM install
86
87# installhdrs does nothing, because the headers aren't useful until
88# the compiler is installed.
89installhdrs:
90
91# We build and install in one shell script.
92build:
93
94installsrc:
95	@echo
96	@echo ++++++++++++++++++++++
97	@echo + Installing sources +
98	@echo ++++++++++++++++++++++
99	@echo
100	if [ $(SRCROOT) != . ]; then \
101	  $(PAX) -rw . $(SRCROOT); \
102	fi
103	find -d "$(SRCROOT)" \( -type d -a -name .svn -o \
104	                        -type f -a -name .DS_Store -o \
105				-name \*~ -o -name .\#\* \) \
106	  -exec rm -rf {} \;
107	rm -rf "$(SRCROOT)/test"
108
109#######################################################################
110
111clean:
112	@echo
113	@echo ++++++++++++
114	@echo + Cleaning +
115	@echo ++++++++++++
116	@echo
117	@if [ -d $(OBJROOT) -a "$(OBJROOT)" != / ]; then \
118	  echo '*** DELETING ' $(OBJROOT); \
119	  rm -rf $(OBJROOT); \
120	fi
121	@if [ -d $(SYMROOT) -a "$(SYMROOT)" != / ]; then \
122	  echo '*** DELETING ' $(SYMROOT); \
123	  rm -rf $(SYMROOT); \
124	fi
125	@if [ -d $(DSTROOT) -a "$(DSTROOT)" != / ]; then \
126	  echo '*** DELETING ' $(DSTROOT); \
127	  rm -rf $(DSTROOT); \
128	fi
129
130#######################################################################
131
132$(OBJROOT) $(SYMROOT) $(DSTROOT):
133	mkdir -p $@
134
135.PHONY: install installsrc clean EmbeddedHosted EmbeddedSim Embedded
136