Bill Wendling | 71df1dd | 2007-11-09 06:59:33 +0000 | [diff] [blame] | 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 |
Chris Lattner | 0ab5e2c | 2011-04-15 05:18:47 +0000 | [diff] [blame] | 9 | # targeted at this host gets built anyway, but not installed unless it's listed |
Bill Wendling | 71df1dd | 2007-11-09 06:59:33 +0000 | [diff] [blame] | 10 | # in TARGETS. |
| 11 | |
| 12 | # Include the set of standard Apple makefile definitions. |
| 13 | ifndef CoreOSMakefiles |
| 14 | CoreOSMakefiles = $(MAKEFILEPATH)/CoreOS |
| 15 | endif |
| 16 | include $(CoreOSMakefiles)/Standard/Standard.make |
| 17 | |
| 18 | # Enable Apple extensions to (gnu)make. |
| 19 | USE_APPLE_PB_SUPPORT = all |
| 20 | |
| 21 | RC_ARCHS := ppc i386 |
| 22 | HOSTS = $(RC_ARCHS) |
| 23 | targets = echo $(RC_ARCHS) |
| 24 | TARGETS := $(shell $(targets)) |
| 25 | |
| 26 | SRCROOT = . |
| 27 | |
| 28 | SRC = $(shell cd $(SRCROOT) && pwd | sed s,/private,,) |
| 29 | OBJROOT = $(SRC)/obj |
| 30 | SYMROOT = $(OBJROOT)/../sym |
| 31 | DSTROOT = $(OBJROOT)/../dst |
| 32 | |
| 33 | ####################################################################### |
| 34 | |
Bob Wilson | b103fbf | 2011-11-29 06:11:56 +0000 | [diff] [blame] | 35 | PREFIX = /usr/local |
Bill Wendling | 71df1dd | 2007-11-09 06:59:33 +0000 | [diff] [blame] | 36 | |
Bill Wendling | 907ef87 | 2010-03-03 05:40:40 +0000 | [diff] [blame] | 37 | # Unless assertions are forced on in the GMAKE command line, disable them. |
Stuart Hastings | b65256c | 2010-01-14 00:22:05 +0000 | [diff] [blame] | 38 | ifndef ENABLE_ASSERTIONS |
Bill Wendling | 8cff305 | 2010-03-03 01:13:55 +0000 | [diff] [blame] | 39 | ENABLE_ASSERTIONS := no |
Bill Wendling | 71df1dd | 2007-11-09 06:59:33 +0000 | [diff] [blame] | 40 | endif |
| 41 | |
Evan Cheng | 26c3303 | 2008-01-18 21:01:00 +0000 | [diff] [blame] | 42 | # Default is optimized build. |
| 43 | ifeq ($(LLVM_DEBUG),1) |
| 44 | LLVM_OPTIMIZED := no |
| 45 | else |
| 46 | LLVM_OPTIMIZED := yes |
| 47 | endif |
| 48 | |
Bob Wilson | ebcadde | 2010-07-20 20:44:02 +0000 | [diff] [blame] | 49 | # Default to do a native build, not a cross-build for an ARM host or simulator. |
Bob Wilson | 0d54560 | 2010-05-05 22:22:40 +0000 | [diff] [blame] | 50 | ARM_HOSTED_BUILD := no |
Bob Wilson | ebcadde | 2010-07-20 20:44:02 +0000 | [diff] [blame] | 51 | IOS_SIM_BUILD := no |
Bob Wilson | 0d54560 | 2010-05-05 22:22:40 +0000 | [diff] [blame] | 52 | |
Bill Wendling | 71df1dd | 2007-11-09 06:59:33 +0000 | [diff] [blame] | 53 | ifndef RC_ProjectSourceVersion |
| 54 | RC_ProjectSourceVersion = 9999 |
| 55 | endif |
| 56 | |
| 57 | ifndef RC_ProjectSourceSubversion |
Nick Kledzik | 618ba73 | 2008-02-29 19:30:23 +0000 | [diff] [blame] | 58 | RC_ProjectSourceSubversion = 0 |
Bill Wendling | 71df1dd | 2007-11-09 06:59:33 +0000 | [diff] [blame] | 59 | endif |
| 60 | |
Devang Patel | ebde4b3 | 2008-01-30 18:30:11 +0000 | [diff] [blame] | 61 | # NOTE : Always put version numbers at the end because they are optional. |
Bill Wendling | 71df1dd | 2007-11-09 06:59:33 +0000 | [diff] [blame] | 62 | install: $(OBJROOT) $(SYMROOT) $(DSTROOT) |
| 63 | cd $(OBJROOT) && \ |
Stuart Hastings | 8de31d0 | 2009-10-22 17:22:37 +0000 | [diff] [blame] | 64 | $(SRC)/utils/buildit/build_llvm "$(RC_ARCHS)" "$(TARGETS)" \ |
Bob Wilson | 7ebb5e4 | 2010-04-28 18:18:36 +0000 | [diff] [blame] | 65 | $(SRC) $(PREFIX) $(DSTROOT) $(SYMROOT) \ |
Bob Wilson | 9d12ffc | 2012-04-03 23:13:26 +0000 | [diff] [blame] | 66 | $(ENABLE_ASSERTIONS) $(LLVM_OPTIMIZED) \ |
Bob Wilson | ebcadde | 2010-07-20 20:44:02 +0000 | [diff] [blame] | 67 | $(ARM_HOSTED_BUILD) $(IOS_SIM_BUILD) \ |
Bob Wilson | 7ebb5e4 | 2010-04-28 18:18:36 +0000 | [diff] [blame] | 68 | $(RC_ProjectSourceVersion) $(RC_ProjectSourceSubversion) |
Bill Wendling | 71df1dd | 2007-11-09 06:59:33 +0000 | [diff] [blame] | 69 | |
Bob Wilson | 0d54560 | 2010-05-05 22:22:40 +0000 | [diff] [blame] | 70 | EmbeddedHosted: |
Bob Wilson | 57825eea | 2010-08-16 16:39:59 +0000 | [diff] [blame] | 71 | $(MAKE) ARM_HOSTED_BUILD=yes PREFIX=/usr/local install |
Bob Wilson | 0d54560 | 2010-05-05 22:22:40 +0000 | [diff] [blame] | 72 | |
Bob Wilson | ebcadde | 2010-07-20 20:44:02 +0000 | [diff] [blame] | 73 | # When building for the iOS simulator, MACOSX_DEPLOYMENT_TARGET is not set |
| 74 | # by default, but it needs to be set when building tools that run on the host |
| 75 | # (e.g., tblgen), so set it here. |
| 76 | EmbeddedSim: |
| 77 | export MACOSX_DEPLOYMENT_TARGET=`sw_vers -productVersion`; \ |
Bob Wilson | 57825eea | 2010-08-16 16:39:59 +0000 | [diff] [blame] | 78 | $(MAKE) IOS_SIM_BUILD=yes PREFIX=$(SDKROOT)/usr/local install |
Bob Wilson | ebcadde | 2010-07-20 20:44:02 +0000 | [diff] [blame] | 79 | |
Bob Wilson | 15c6f99 | 2011-02-25 23:42:03 +0000 | [diff] [blame] | 80 | Embedded: |
| 81 | ARM_PLATFORM=`xcodebuild -version -sdk iphoneos PlatformPath` && \ |
Bob Wilson | 3e66d73 | 2012-04-03 23:44:39 +0000 | [diff] [blame] | 82 | $(MAKE) DSTROOT=$(DSTROOT)$$ARM_PLATFORM/Developer install |
Bob Wilson | 15c6f99 | 2011-02-25 23:42:03 +0000 | [diff] [blame] | 83 | |
Bill Wendling | 71df1dd | 2007-11-09 06:59:33 +0000 | [diff] [blame] | 84 | # installhdrs does nothing, because the headers aren't useful until |
| 85 | # the compiler is installed. |
| 86 | installhdrs: |
| 87 | |
| 88 | # We build and install in one shell script. |
| 89 | build: |
| 90 | |
| 91 | installsrc: |
| 92 | @echo |
| 93 | @echo ++++++++++++++++++++++ |
| 94 | @echo + Installing sources + |
| 95 | @echo ++++++++++++++++++++++ |
| 96 | @echo |
| 97 | if [ $(SRCROOT) != . ]; then \ |
| 98 | $(PAX) -rw . $(SRCROOT); \ |
| 99 | fi |
| 100 | find -d "$(SRCROOT)" \( -type d -a -name .svn -o \ |
| 101 | -type f -a -name .DS_Store -o \ |
| 102 | -name \*~ -o -name .\#\* \) \ |
| 103 | -exec rm -rf {} \; |
Bill Wendling | 25eeddf | 2009-08-26 21:00:34 +0000 | [diff] [blame] | 104 | rm -rf "$(SRCROOT)/test" |
Bill Wendling | 71df1dd | 2007-11-09 06:59:33 +0000 | [diff] [blame] | 105 | |
| 106 | ####################################################################### |
| 107 | |
| 108 | clean: |
| 109 | @echo |
| 110 | @echo ++++++++++++ |
| 111 | @echo + Cleaning + |
| 112 | @echo ++++++++++++ |
| 113 | @echo |
| 114 | @if [ -d $(OBJROOT) -a "$(OBJROOT)" != / ]; then \ |
| 115 | echo '*** DELETING ' $(OBJROOT); \ |
| 116 | rm -rf $(OBJROOT); \ |
| 117 | fi |
| 118 | @if [ -d $(SYMROOT) -a "$(SYMROOT)" != / ]; then \ |
| 119 | echo '*** DELETING ' $(SYMROOT); \ |
| 120 | rm -rf $(SYMROOT); \ |
| 121 | fi |
| 122 | @if [ -d $(DSTROOT) -a "$(DSTROOT)" != / ]; then \ |
| 123 | echo '*** DELETING ' $(DSTROOT); \ |
| 124 | rm -rf $(DSTROOT); \ |
| 125 | fi |
| 126 | |
| 127 | ####################################################################### |
| 128 | |
| 129 | $(OBJROOT) $(SYMROOT) $(DSTROOT): |
| 130 | mkdir -p $@ |
| 131 | |
Bob Wilson | 15c6f99 | 2011-02-25 23:42:03 +0000 | [diff] [blame] | 132 | .PHONY: install installsrc clean EmbeddedHosted EmbeddedSim Embedded |