GNUmakefile revision b4eae999f6064291ef1069a5d5e219189cc902a4
1b33857040f63a9fdfb0c2a2ca2af67ec12cf9d02Sirish Pande# LLVM LOCAL file build machinery
2b33857040f63a9fdfb0c2a2ca2af67ec12cf9d02Sirish Pande# LLVM Compiler Makefile for use by buildit.  
3b33857040f63a9fdfb0c2a2ca2af67ec12cf9d02Sirish Pande#
4b33857040f63a9fdfb0c2a2ca2af67ec12cf9d02Sirish Pande# This makefile is intended only for use with B&I buildit. For "normal" builds
5b33857040f63a9fdfb0c2a2ca2af67ec12cf9d02Sirish Pande# use the conventional top-level makefile.
6b33857040f63a9fdfb0c2a2ca2af67ec12cf9d02Sirish Pande#
7b33857040f63a9fdfb0c2a2ca2af67ec12cf9d02Sirish Pande# You can specify TARGETS=ppc (or i386) on the buildit command line to limit the
8b33857040f63a9fdfb0c2a2ca2af67ec12cf9d02Sirish Pande# build to just one target. The default is for ppc and i386. The compiler
9b33857040f63a9fdfb0c2a2ca2af67ec12cf9d02Sirish Pande# targetted at this host gets built anyway, but not installed unless it's listed
10b33857040f63a9fdfb0c2a2ca2af67ec12cf9d02Sirish Pande# in TARGETS.
11b33857040f63a9fdfb0c2a2ca2af67ec12cf9d02Sirish Pande
12d9b0b025612992a0b724eeca8bdf10b1d7a5c355Benjamin Kramer# Include the set of standard Apple makefile definitions.
13b33857040f63a9fdfb0c2a2ca2af67ec12cf9d02Sirish Pandeifndef CoreOSMakefiles
14d9b0b025612992a0b724eeca8bdf10b1d7a5c355Benjamin KramerCoreOSMakefiles = $(MAKEFILEPATH)/CoreOS
15b33857040f63a9fdfb0c2a2ca2af67ec12cf9d02Sirish Pandeendif
16b33857040f63a9fdfb0c2a2ca2af67ec12cf9d02Sirish Pandeinclude $(CoreOSMakefiles)/Standard/Standard.make
17b33857040f63a9fdfb0c2a2ca2af67ec12cf9d02Sirish Pande
18b33857040f63a9fdfb0c2a2ca2af67ec12cf9d02Sirish Pande# Enable Apple extensions to (gnu)make.
19b33857040f63a9fdfb0c2a2ca2af67ec12cf9d02Sirish PandeUSE_APPLE_PB_SUPPORT = all
20b33857040f63a9fdfb0c2a2ca2af67ec12cf9d02Sirish Pande
21b33857040f63a9fdfb0c2a2ca2af67ec12cf9d02Sirish PandeRC_ARCHS := ppc i386
22b33857040f63a9fdfb0c2a2ca2af67ec12cf9d02Sirish PandeHOSTS = $(RC_ARCHS)
23b33857040f63a9fdfb0c2a2ca2af67ec12cf9d02Sirish Pandetargets = echo $(RC_ARCHS)
241a7eab387849feaa3e9c35f145d5b07be54686e3Jyotsna VermaTARGETS := $(shell $(targets))
2536b56886974eae4f9c5ebc96befd3e7bfe5de338Stephen Hines
2636b56886974eae4f9c5ebc96befd3e7bfe5de338Stephen HinesSRCROOT = .
2736b56886974eae4f9c5ebc96befd3e7bfe5de338Stephen Hines
2836b56886974eae4f9c5ebc96befd3e7bfe5de338Stephen HinesSRC = $(shell cd $(SRCROOT) && pwd | sed s,/private,,)
2936b56886974eae4f9c5ebc96befd3e7bfe5de338Stephen HinesOBJROOT = $(SRC)/obj
3036b56886974eae4f9c5ebc96befd3e7bfe5de338Stephen HinesSYMROOT = $(OBJROOT)/../sym
31b33857040f63a9fdfb0c2a2ca2af67ec12cf9d02Sirish PandeDSTROOT = $(OBJROOT)/../dst
32b33857040f63a9fdfb0c2a2ca2af67ec12cf9d02Sirish Pande
331a7eab387849feaa3e9c35f145d5b07be54686e3Jyotsna Verma#######################################################################
341a7eab387849feaa3e9c35f145d5b07be54686e3Jyotsna Verma
3536b56886974eae4f9c5ebc96befd3e7bfe5de338Stephen HinesPREFIX = /usr/local
3636b56886974eae4f9c5ebc96befd3e7bfe5de338Stephen Hines
3736b56886974eae4f9c5ebc96befd3e7bfe5de338Stephen Hines# Unless assertions are forced on in the GMAKE command line, disable them.
3836b56886974eae4f9c5ebc96befd3e7bfe5de338Stephen Hinesifdef ENABLE_ASSERTIONS
3936b56886974eae4f9c5ebc96befd3e7bfe5de338Stephen HinesLLVM_ASSERTIONS := yes
4036b56886974eae4f9c5ebc96befd3e7bfe5de338Stephen Hineselse
4136b56886974eae4f9c5ebc96befd3e7bfe5de338Stephen HinesLLVM_ASSERTIONS := no
4236b56886974eae4f9c5ebc96befd3e7bfe5de338Stephen Hinesendif
434c5e43da7792f75567b693105cc53e3f1992ad98Pirama Arumuga Nainar
441a7eab387849feaa3e9c35f145d5b07be54686e3Jyotsna Verma# Default is optimized build.
4536b56886974eae4f9c5ebc96befd3e7bfe5de338Stephen Hinesifeq ($(LLVM_DEBUG),1)
46b33857040f63a9fdfb0c2a2ca2af67ec12cf9d02Sirish PandeLLVM_OPTIMIZED := no
47b33857040f63a9fdfb0c2a2ca2af67ec12cf9d02Sirish Pandeelse
48b33857040f63a9fdfb0c2a2ca2af67ec12cf9d02Sirish PandeLLVM_OPTIMIZED := yes
49b33857040f63a9fdfb0c2a2ca2af67ec12cf9d02Sirish Pandeendif
50dce4a407a24b04eebc6a376f8e62b41aaa7b071fStephen Hines
51dce4a407a24b04eebc6a376f8e62b41aaa7b071fStephen Hinesifndef RC_ProjectSourceVersion
52b33857040f63a9fdfb0c2a2ca2af67ec12cf9d02Sirish PandeRC_ProjectSourceVersion = 9999
53b33857040f63a9fdfb0c2a2ca2af67ec12cf9d02Sirish Pandeendif
54b33857040f63a9fdfb0c2a2ca2af67ec12cf9d02Sirish Pande
55b33857040f63a9fdfb0c2a2ca2af67ec12cf9d02Sirish Pandeifndef RC_ProjectSourceSubversion
56b33857040f63a9fdfb0c2a2ca2af67ec12cf9d02Sirish PandeRC_ProjectSourceSubversion = 01
57b33857040f63a9fdfb0c2a2ca2af67ec12cf9d02Sirish Pandeendif
58b33857040f63a9fdfb0c2a2ca2af67ec12cf9d02Sirish Pande
59b33857040f63a9fdfb0c2a2ca2af67ec12cf9d02Sirish Pandeinstall: $(OBJROOT) $(SYMROOT) $(DSTROOT)
60b33857040f63a9fdfb0c2a2ca2af67ec12cf9d02Sirish Pande	cd $(OBJROOT) && \
61b33857040f63a9fdfb0c2a2ca2af67ec12cf9d02Sirish Pande	  $(SRC)/build_llvm "$(RC_ARCHS)" "$(TARGETS)" \
621a7eab387849feaa3e9c35f145d5b07be54686e3Jyotsna Verma	    $(SRC) $(PREFIX) $(DSTROOT) $(SYMROOT) \
636948897e478cbd66626159776a8017b3c18579b9Pirama Arumuga Nainar	    $(RC_ProjectSourceVersion) $(RC_ProjectSourceSubversion) \
641a7eab387849feaa3e9c35f145d5b07be54686e3Jyotsna Verma	    $(LLVM_ASSERTIONS) $(LLVM_OPTIMIZED)
651a7eab387849feaa3e9c35f145d5b07be54686e3Jyotsna Verma
661a7eab387849feaa3e9c35f145d5b07be54686e3Jyotsna Verma# installhdrs does nothing, because the headers aren't useful until
671a7eab387849feaa3e9c35f145d5b07be54686e3Jyotsna Verma# the compiler is installed.
68b33857040f63a9fdfb0c2a2ca2af67ec12cf9d02Sirish Pandeinstallhdrs:
69b33857040f63a9fdfb0c2a2ca2af67ec12cf9d02Sirish Pande
70b33857040f63a9fdfb0c2a2ca2af67ec12cf9d02Sirish Pande# We build and install in one shell script.
71b33857040f63a9fdfb0c2a2ca2af67ec12cf9d02Sirish Pandebuild: 
72b33857040f63a9fdfb0c2a2ca2af67ec12cf9d02Sirish Pande
73b33857040f63a9fdfb0c2a2ca2af67ec12cf9d02Sirish Pandeinstallsrc:
74b33857040f63a9fdfb0c2a2ca2af67ec12cf9d02Sirish Pande	@echo
75b33857040f63a9fdfb0c2a2ca2af67ec12cf9d02Sirish Pande	@echo ++++++++++++++++++++++
761a7eab387849feaa3e9c35f145d5b07be54686e3Jyotsna Verma	@echo + Installing sources +
771a7eab387849feaa3e9c35f145d5b07be54686e3Jyotsna Verma	@echo ++++++++++++++++++++++
781a7eab387849feaa3e9c35f145d5b07be54686e3Jyotsna Verma	@echo
79b33857040f63a9fdfb0c2a2ca2af67ec12cf9d02Sirish Pande	if [ $(SRCROOT) != . ]; then \
80dce4a407a24b04eebc6a376f8e62b41aaa7b071fStephen Hines	  $(PAX) -rw . $(SRCROOT); \
81f945d09d53a4f2f392b8b51191d37de2f8acd566Jyotsna Verma	fi
82b33857040f63a9fdfb0c2a2ca2af67ec12cf9d02Sirish Pande	find -d "$(SRCROOT)" \( -type d -a -name .svn -o \
83b33857040f63a9fdfb0c2a2ca2af67ec12cf9d02Sirish Pande	                        -type f -a -name .DS_Store -o \
84b33857040f63a9fdfb0c2a2ca2af67ec12cf9d02Sirish Pande				-name \*~ -o -name .\#\* \) \
85dce4a407a24b04eebc6a376f8e62b41aaa7b071fStephen Hines	  -exec rm -rf {} \;
86b33857040f63a9fdfb0c2a2ca2af67ec12cf9d02Sirish Pande
87b33857040f63a9fdfb0c2a2ca2af67ec12cf9d02Sirish Pande#######################################################################
88b33857040f63a9fdfb0c2a2ca2af67ec12cf9d02Sirish Pande
89dce4a407a24b04eebc6a376f8e62b41aaa7b071fStephen Hinesclean:
90b33857040f63a9fdfb0c2a2ca2af67ec12cf9d02Sirish Pande	@echo
91b33857040f63a9fdfb0c2a2ca2af67ec12cf9d02Sirish Pande	@echo ++++++++++++
92f945d09d53a4f2f392b8b51191d37de2f8acd566Jyotsna Verma	@echo + Cleaning +
93f945d09d53a4f2f392b8b51191d37de2f8acd566Jyotsna Verma	@echo ++++++++++++
94b33857040f63a9fdfb0c2a2ca2af67ec12cf9d02Sirish Pande	@echo
95cddc3e03e4ec99c0268c03a126195173e519ed58Pirama Arumuga Nainar	@if [ -d $(OBJROOT) -a "$(OBJROOT)" != / ]; then \
96b33857040f63a9fdfb0c2a2ca2af67ec12cf9d02Sirish Pande	  echo '*** DELETING ' $(OBJROOT); \
97b33857040f63a9fdfb0c2a2ca2af67ec12cf9d02Sirish Pande	  rm -rf $(OBJROOT); \
98b33857040f63a9fdfb0c2a2ca2af67ec12cf9d02Sirish Pande	fi
99b33857040f63a9fdfb0c2a2ca2af67ec12cf9d02Sirish Pande	@if [ -d $(SYMROOT) -a "$(SYMROOT)" != / ]; then \
100b33857040f63a9fdfb0c2a2ca2af67ec12cf9d02Sirish Pande	  echo '*** DELETING ' $(SYMROOT); \
101b33857040f63a9fdfb0c2a2ca2af67ec12cf9d02Sirish Pande	  rm -rf $(SYMROOT); \
1021a7eab387849feaa3e9c35f145d5b07be54686e3Jyotsna Verma	fi
1031a7eab387849feaa3e9c35f145d5b07be54686e3Jyotsna Verma	@if [ -d $(DSTROOT) -a "$(DSTROOT)" != / ]; then \
1041a7eab387849feaa3e9c35f145d5b07be54686e3Jyotsna Verma	  echo '*** DELETING ' $(DSTROOT); \
1051a7eab387849feaa3e9c35f145d5b07be54686e3Jyotsna Verma	  rm -rf $(DSTROOT); \
1061a7eab387849feaa3e9c35f145d5b07be54686e3Jyotsna Verma	fi
1071a7eab387849feaa3e9c35f145d5b07be54686e3Jyotsna Verma
1081a7eab387849feaa3e9c35f145d5b07be54686e3Jyotsna Verma#######################################################################
109b33857040f63a9fdfb0c2a2ca2af67ec12cf9d02Sirish Pande
110b33857040f63a9fdfb0c2a2ca2af67ec12cf9d02Sirish Pande$(OBJROOT) $(SYMROOT) $(DSTROOT):
111b33857040f63a9fdfb0c2a2ca2af67ec12cf9d02Sirish Pande	mkdir -p $@
112b33857040f63a9fdfb0c2a2ca2af67ec12cf9d02Sirish Pande
113b33857040f63a9fdfb0c2a2ca2af67ec12cf9d02Sirish Pande.PHONY: install installsrc clean
114b33857040f63a9fdfb0c2a2ca2af67ec12cf9d02Sirish Pande