2002-01-22 16:56:41 +00:00
|
|
|
##-----------------------------------------------------------*-Makefile-*-
|
|
|
|
## Common rules for generating, linking, and compiling via LLVM. This is
|
|
|
|
## used to implement a robust testing framework for LLVM
|
2001-11-05 00:35:56 +00:00
|
|
|
##------------------------------------------------------------------------
|
|
|
|
|
2001-12-15 01:13:42 +00:00
|
|
|
## NOTE: This is preliminary and will change in the future
|
|
|
|
|
|
|
|
|
|
|
|
include ${LEVEL}/Makefile.common
|
|
|
|
|
2001-11-05 00:18:30 +00:00
|
|
|
.PHONY: clean default
|
|
|
|
|
2002-01-23 21:36:59 +00:00
|
|
|
# These files, which might be intermediate results, should not be deleted by
|
|
|
|
# make
|
|
|
|
.PRECIOUS: Output/%.bc Output/%.ll
|
|
|
|
.PRECIOUS: Output/%.tbc Output/%.tll
|
|
|
|
.PRECIOUS: Output/.dir
|
|
|
|
|
|
|
|
# LLVM Tool Definitions...
|
|
|
|
#
|
|
|
|
LCC = /home/vadve/lattner/cvs/gcc_install/bin/gcc
|
2002-01-26 22:48:08 +00:00
|
|
|
LCC1 = /home/vadve/lattner/cvs/gcc_install/lib/gcc-lib/llvm/3.1/cc1
|
2001-11-05 00:18:30 +00:00
|
|
|
TOOLS = $(LEVEL)/tools/Debug
|
2001-12-15 01:13:42 +00:00
|
|
|
LLI = $(TOOLS)/lli
|
2001-11-05 00:18:30 +00:00
|
|
|
LLC = $(TOOLS)/llc
|
2002-01-23 21:36:59 +00:00
|
|
|
LAS = $(TOOLS)/as
|
|
|
|
LGCCAS = $(TOOLS)/gccas
|
2002-03-11 17:46:34 +00:00
|
|
|
LGCCLD = $(TOOLS)/gccld -L/home/vadve/lattner/cvs/gcc_install/lib/gcc-lib/llvm/3.1/
|
2001-11-05 00:18:30 +00:00
|
|
|
LDIS = $(TOOLS)/dis
|
|
|
|
LOPT = $(TOOLS)/opt
|
|
|
|
LLINK = $(TOOLS)/link
|
2002-01-23 21:36:59 +00:00
|
|
|
|
|
|
|
LCCFLAGS += -O2 -Wall
|
2001-11-05 00:18:30 +00:00
|
|
|
LLCFLAGS =
|
2002-01-23 21:36:59 +00:00
|
|
|
FAILURE = $(LEVEL)/test/Failure.sh
|
2002-02-01 04:25:12 +00:00
|
|
|
TESTRUNR = $(LEVEL)/test/TestRunner.sh
|
2001-11-05 00:18:30 +00:00
|
|
|
|
2002-01-23 21:36:59 +00:00
|
|
|
# Native Tool Definitions
|
|
|
|
NATGCC = /usr/dcs/software/supported/bin/gcc
|
|
|
|
CC = /opt/SUNWspro/bin/cc
|
|
|
|
AS = /opt/SUNWspro/bin/cc
|
|
|
|
DIS = /usr/ccs/bin/dis
|
|
|
|
CP = /bin/cp -f
|
|
|
|
CFLAGS += -g -xarch=v9
|
2001-11-05 00:18:30 +00:00
|
|
|
|
2002-03-18 03:53:22 +00:00
|
|
|
LLCLIB = $(LEVEL)/test/Libraries/runtime.o
|
2002-01-22 16:56:41 +00:00
|
|
|
LIBS += $(LLCLIB)
|
2001-11-05 00:18:30 +00:00
|
|
|
|
2002-01-23 21:36:59 +00:00
|
|
|
|
|
|
|
|
2001-11-05 00:18:30 +00:00
|
|
|
ifeq ($(TRACE), yes)
|
2002-01-22 16:56:41 +00:00
|
|
|
LLCFLAGS += -trace
|
2001-11-05 00:18:30 +00:00
|
|
|
endif
|
2001-12-12 15:19:55 +00:00
|
|
|
ifeq ($(TRACEM), yes)
|
2002-01-22 16:56:41 +00:00
|
|
|
LLCFLAGS += -tracem
|
2001-12-12 15:19:55 +00:00
|
|
|
endif
|
2001-11-05 00:18:30 +00:00
|
|
|
|
2001-12-15 01:13:42 +00:00
|
|
|
clean ::
|
2002-01-23 21:36:59 +00:00
|
|
|
$(RM) a.out core
|
2002-01-22 16:56:41 +00:00
|
|
|
$(RM) -rf Output/
|
2001-11-05 00:18:30 +00:00
|
|
|
|
2002-02-12 15:39:38 +00:00
|
|
|
# Compile from X.c to Output/X.ll
|
2002-01-26 22:48:08 +00:00
|
|
|
Output/%.ll: %.c $(LCC1) Output/.dir
|
2002-01-23 21:36:59 +00:00
|
|
|
$(LCC) $(LCCFLAGS) -S $< -o $@
|
2001-11-05 00:18:30 +00:00
|
|
|
|
2002-02-12 15:39:38 +00:00
|
|
|
# LLVM Assemble from Output/X.ll to Output/X.bc. Output/X.ll must have come
|
|
|
|
# from GCC output, so use GCCAS.
|
|
|
|
#
|
2002-01-23 21:36:59 +00:00
|
|
|
Output/%.bc: Output/%.ll $(LGCCAS)
|
|
|
|
$(LGCCAS) $< -o $@
|
2001-11-05 00:18:30 +00:00
|
|
|
|
2002-02-12 15:39:38 +00:00
|
|
|
# LLVM Assemble from X.ll to Output/X.bc. Because we are coming directly from
|
|
|
|
# LLVM source, use the non-transforming assembler.
|
|
|
|
#
|
2002-02-01 04:25:12 +00:00
|
|
|
Output/%.bc: %.ll $(LAS) Output/.dir
|
2002-01-31 00:27:32 +00:00
|
|
|
$(LAS) -f $< -o $@
|
2002-01-23 21:36:59 +00:00
|
|
|
|
2002-02-12 15:39:38 +00:00
|
|
|
# Compile a linked program to machine code for this processor.
|
|
|
|
#
|
|
|
|
Output/%.llc.s: Output/%.linked.bc
|
|
|
|
$(LLC) $(LLCFLAGS) -f $< -o $@
|
|
|
|
|
|
|
|
# Assemble (and link) an LLVM-linked program using the system assembler...
|
|
|
|
#
|
|
|
|
Output/%.llc: Output/%.llc.s
|
2002-03-18 03:53:22 +00:00
|
|
|
$(CC) $(CFLAGS) $< $(LIBS) -o $@
|
2002-02-12 15:39:38 +00:00
|
|
|
|
2002-01-23 21:36:59 +00:00
|
|
|
#
|
|
|
|
# Testing versions of provided utilities...
|
|
|
|
#
|
2002-01-26 22:48:08 +00:00
|
|
|
Output/%.tll: %.c $(LCC1) Output/.dir
|
2002-01-23 21:36:59 +00:00
|
|
|
@echo "======== Compiling $<"
|
|
|
|
$(LCC) $(LCCFLAGS) -S $< -o $@ || \
|
|
|
|
( rm -f $@; $(FAILURE) $@ )
|
|
|
|
|
|
|
|
Output/%.tbc: Output/%.tll $(LAS)
|
|
|
|
@echo "======== Assembling $<"
|
|
|
|
$(LAS) -f $< -o $@ || \
|
|
|
|
( rm -f $@; $(FAILURE) $@ )
|
2001-11-06 17:09:49 +00:00
|
|
|
|
2001-11-05 00:18:30 +00:00
|
|
|
|
2001-11-06 17:09:49 +00:00
|
|
|
## Cancel built-in implicit rules that override above rules
|
2001-11-05 00:18:30 +00:00
|
|
|
%: %.s
|
|
|
|
|
2001-11-06 17:09:49 +00:00
|
|
|
%: %.c
|
|
|
|
|
|
|
|
%.o: %.c
|
|
|
|
|