Select an ARM-hosted cross build with a separate makefile target instead of
[oota-llvm.git] / utils / buildit / GNUmakefile
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 # targetted 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.
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
35 PREFIX = /usr/local
36
37 # Unless assertions are forced on in the GMAKE command line, disable them.
38 ifndef ENABLE_ASSERTIONS
39 ENABLE_ASSERTIONS := no
40 endif
41
42 # Default is optimized build.
43 ifeq ($(LLVM_DEBUG),1)
44 LLVM_OPTIMIZED := no
45 else
46 LLVM_OPTIMIZED := yes
47 endif
48
49 # Default to not install libLTO.dylib.
50 INSTALL_LIBLTO := no
51
52 # Default to do a native build, not a cross-build for an ARM host.
53 ARM_HOSTED_BUILD := no
54
55 ifndef RC_ProjectSourceVersion
56 RC_ProjectSourceVersion = 9999
57 endif
58
59 ifndef RC_ProjectSourceSubversion
60 RC_ProjectSourceSubversion = 0
61 endif
62
63 # NOTE : Always put version numbers at the end because they are optional.
64 install: $(OBJROOT) $(SYMROOT) $(DSTROOT)
65         cd $(OBJROOT) && \
66           $(SRC)/utils/buildit/build_llvm "$(RC_ARCHS)" "$(TARGETS)" \
67             $(SRC) $(PREFIX) $(DSTROOT) $(SYMROOT) \
68             $(ENABLE_ASSERTIONS) $(LLVM_OPTIMIZED) $(INSTALL_LIBLTO) \
69             $(ARM_HOSTED_BUILD) \
70             $(RC_ProjectSourceVersion) $(RC_ProjectSourceSubversion) 
71
72 EmbeddedHosted:
73         $(MAKE) ARM_HOSTED_BUILD=yes install
74
75 # installhdrs does nothing, because the headers aren't useful until
76 # the compiler is installed.
77 installhdrs:
78
79 # We build and install in one shell script.
80 build: 
81
82 installsrc:
83         @echo
84         @echo ++++++++++++++++++++++
85         @echo + Installing sources +
86         @echo ++++++++++++++++++++++
87         @echo
88         if [ $(SRCROOT) != . ]; then \
89           $(PAX) -rw . $(SRCROOT); \
90         fi
91         find -d "$(SRCROOT)" \( -type d -a -name .svn -o \
92                                 -type f -a -name .DS_Store -o \
93                                 -name \*~ -o -name .\#\* \) \
94           -exec rm -rf {} \;
95         rm -rf "$(SRCROOT)/test"
96
97 #######################################################################
98
99 clean:
100         @echo
101         @echo ++++++++++++
102         @echo + Cleaning +
103         @echo ++++++++++++
104         @echo
105         @if [ -d $(OBJROOT) -a "$(OBJROOT)" != / ]; then \
106           echo '*** DELETING ' $(OBJROOT); \
107           rm -rf $(OBJROOT); \
108         fi
109         @if [ -d $(SYMROOT) -a "$(SYMROOT)" != / ]; then \
110           echo '*** DELETING ' $(SYMROOT); \
111           rm -rf $(SYMROOT); \
112         fi
113         @if [ -d $(DSTROOT) -a "$(DSTROOT)" != / ]; then \
114           echo '*** DELETING ' $(DSTROOT); \
115           rm -rf $(DSTROOT); \
116         fi
117
118 #######################################################################
119
120 $(OBJROOT) $(SYMROOT) $(DSTROOT):
121         mkdir -p $@
122
123 .PHONY: install installsrc clean EmbeddedHosted