Skip to content

Instantly share code, notes, and snippets.

@macmade
Created June 11, 2012 20:05
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save macmade/2912330 to your computer and use it in GitHub Desktop.
Save macmade/2912330 to your computer and use it in GitHub Desktop.
Clang - LLVM MakeFile
#-------------------------------------------------------------------------------
# Build settings
#-------------------------------------------------------------------------------
PREFIX = /usr/local/my-llvm/
#-------------------------------------------------------------------------------
# Software
#-------------------------------------------------------------------------------
RM = rm
TAR = tar
MAKE = make
SVN = svn
CD = cd
SUDO = sudo
#-------------------------------------------------------------------------------
# Software arguments
#-------------------------------------------------------------------------------
ARGS_RM = -rf
ARGS_TAR = -xf
ARGS_MAKE =
ARGS_SVN_CO = checkout
#-------------------------------------------------------------------------------
# Source repositories
#-------------------------------------------------------------------------------
REPOS_LLVM = http://llvm.org/svn/llvm-project/llvm/trunk
REPOS_CLANG = http://llvm.org/svn/llvm-project/cfe/trunk
REPOS_CRT = http://llvm.org/svn/llvm-project/compiler-rt/trunk
#-------------------------------------------------------------------------------
# Paths
#-------------------------------------------------------------------------------
DIR_BUILD = ./build/
DIR_LLVM = ./src/llvm/
DIR_CLANG = $(DIR_LLVM)tools/clang/
DIR_CRT = $(DIR_LLVM)projects/compiler-rt/
#-------------------------------------------------------------------------------
# Built-in targets
#-------------------------------------------------------------------------------
# Declaration for phony targets, to avoid problems with local files
.PHONY: all clean llvm_co clang_co crt_co llvm_build
#-------------------------------------------------------------------------------
# Phony targets
#-------------------------------------------------------------------------------
# Build the full project
all: llvm_co clang_co crt_co llvm_build
# Cleans the build files
clean:
@echo " *** Cleaning all build files"
@$(RM) $(ARGS_RM) $(DIR_BUILD)*
@$(RM) $(ARGS_RM) $(DIR_LLVM)
# LLVM checkout
llvm_co:
@echo " *** Checking out LLVM sources"
@if [ ! -d $(DIR_LLVM) ]; then $(SVN) $(ARGS_SVN_CO) $(REPOS_LLVM) $(DIR_LLVM); fi
# Clang checkout
clang_co:
@echo " *** Checking out Clang sources"
@if [ ! -d $(DIR_CLANG) ]; then $(SVN) $(ARGS_SVN_CO) $(REPOS_CLANG) $(DIR_CLANG); fi
# CRT checkout
crt_co:
@echo " *** Checking out CRT sources"
@if [ ! -d $(DIR_CRT) ]; then $(SVN) $(ARGS_SVN_CO) $(REPOS_CRT) $(DIR_CRT); fi
# LLVM build
llvm_build:
@echo " *** Building LLVM toolchain"
@$(CD) $(DIR_BUILD) && ../$(DIR_LLVM)configure --prefix=$(PREFIX)
@$(CD) $(DIR_BUILD) && $(MAKE)
@$(CD) $(DIR_BUILD) && $(SUDO) $(MAKE) install
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment