Makefile.tests revision 8b6c5e441250a298b91c50bc198a19e68372d6ad
1##-----------------------------------------------------------*-Makefile-*- 2## Common rules for generating, linking, and compiling via LLVM. This is 3## used to implement a robust testing framework for LLVM 4##------------------------------------------------------------------------ 5 6## NOTE: This is preliminary and will change in the future 7 8include ${LEVEL}/Makefile.common 9 10# Specify ENABLE_STATS on the command line to enable -stats output from gccas 11# and gccld. 12ifdef ENABLE_STATS 13STATS = -stats 14endif 15 16 17.PHONY: clean default 18 19# These files, which might be intermediate results, should not be deleted by 20# make 21.PRECIOUS: Output/%.bc Output/%.ll 22.PRECIOUS: Output/%.tbc Output/%.tll 23.PRECIOUS: Output/.dir 24.PRECIOUS: Output/%.llvm.bc 25.PRECIOUS: Output/%.llvm 26 27# LLVM Tool Definitions... 28# 29LCC = $(LLVMGCCDIR)/bin/llvm-gcc 30LCC1 = $(LLVMGCCDIR)/lib/gcc-lib/llvm/3.1/cc1 31TOOLS = $(BUILD_ROOT_TOP)/tools/Debug 32LLI = $(TOOLS)/lli 33LLC = $(TOOLS)/llc 34LAS = $(TOOLS)/as 35LGCCAS = $(TOOLS)/gccas 36LGCCLD = $(TOOLS)/gccld -L$(LLVMGCCDIR)/llvm/lib 37LDIS = $(TOOLS)/dis 38LOPT = $(TOOLS)/opt 39LLINK = $(TOOLS)/link 40LANALYZE = $(TOOLS)/analyze 41LJELLO = $(TOOLS)/jello 42 43LCCFLAGS += -O2 -Wall 44LLCFLAGS = 45FAILURE = $(LEVEL)/test/Failure.sh 46TESTRUNR = $(LEVEL)/test/TestRunner.sh 47 48# Native Tool Definitions 49NATGCC = /usr/dcs/software/supported/bin/gcc 50CP = /bin/cp -f 51 52ifndef DISABLE_LLC_DIFFS 53CC = /opt/SUNWspro/bin/cc 54AS = /opt/SUNWspro/bin/cc 55DIS = /usr/ccs/bin/dis 56CFLAGS += -g -xarch=v9 57endif 58 59 60ifeq ($(TRACE), yes) 61 LLCFLAGS += -trace basicblock 62 LLCLIBS := -L$(LEVEL)/test/Libraries/Output -linstr64 63else 64 ifeq ($(TRACEM), yes) 65 LLCFLAGS += -trace function 66 LLCLIBS := -L$(LEVEL)/test/Libraries/Output -linstr64 67 endif 68endif 69 70LLCLIBS := $(LLCLIBS) -lm 71 72clean:: 73 $(RM) a.out core 74 $(RM) -rf Output/ 75 76# Compile from X.c to Output/X.ll 77Output/%.ll: %.c $(LCC1) Output/.dir $(INCLUDES) 78 $(LCC) $(LCCFLAGS) -S $< -o $@ 79 80# LLVM Assemble from Output/X.ll to Output/X.bc. Output/X.ll must have come 81# from GCC output, so use GCCAS. 82# 83Output/%.bc: Output/%.ll $(LGCCAS) 84 $(LGCCAS) $(STATS) $< -o $@ 85 86# LLVM Assemble from X.ll to Output/X.bc. Because we are coming directly from 87# LLVM source, use the non-transforming assembler. 88# 89Output/%.bc: %.ll $(LAS) Output/.dir 90 $(LAS) -f $< -o $@ 91 92# Compile a linked program to machine code for this processor. 93# 94Output/%.llc.s: Output/%.llvm.bc $(LLC) 95 $(LLC) $(LLCFLAGS) -f $< -o $@ 96 97# Assemble (and link) an LLVM-linked program using the system assembler... 98# 99Output/%.llc: Output/%.llc.s 100 $(CC) $(CFLAGS) $< $(LLCLIBS) -o $@ 101 102# 103# Testing versions of provided utilities... 104# 105Output/%.tll: %.c $(LCC1) Output/.dir $(INCLUDES) 106 @echo "======== Compiling $<" 107 $(LCC) $(LCCFLAGS) -S $< -o $@ || \ 108 ( rm -f $@; $(FAILURE) $@ ) 109 110Output/%.tbc: Output/%.tll $(LAS) 111 @echo "======== Assembling $<" 112 $(LAS) -f $< -o $@ || \ 113 ( rm -f $@; $(FAILURE) $@ ) 114 115 116## Cancel built-in implicit rules that override above rules 117%: %.s 118 119%: %.c 120 121%.o: %.c 122 123