Makefile.tests revision 52a4e85a98fdb7e03f13cfc1eb9f2ef4326ec62a
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
8
9include ${LEVEL}/Makefile.common
10
11.PHONY: clean default
12
13# These files, which might be intermediate results, should not be deleted by
14# make
15.PRECIOUS: Output/%.bc  Output/%.ll
16.PRECIOUS: Output/%.tbc Output/%.tll
17.PRECIOUS: Output/.dir
18
19# LLVM Tool Definitions...
20#
21LCC      = /home/vadve/lattner/cvs/gcc_install/bin/gcc
22TOOLS    = $(LEVEL)/tools/Debug
23LLI      = $(TOOLS)/lli
24LLC      = $(TOOLS)/llc
25LAS      = $(TOOLS)/as
26LGCCAS   = $(TOOLS)/gccas
27LDIS     = $(TOOLS)/dis 
28LOPT     = $(TOOLS)/opt
29LLINK    = $(TOOLS)/link
30
31LCCFLAGS  += -O2 -Wall
32LLCFLAGS =
33FAILURE  = $(LEVEL)/test/Failure.sh
34
35# Native Tool Definitions
36NATGCC  = /usr/dcs/software/supported/bin/gcc
37CC      = /opt/SUNWspro/bin/cc
38AS	= /opt/SUNWspro/bin/cc
39DIS     = /usr/ccs/bin/dis
40CP	= /bin/cp -f
41CFLAGS  += -g -xarch=v9
42
43LLCLIB   = $(LEVEL)/test/runtime.o
44LIBS    += $(LLCLIB)
45
46
47
48ifeq ($(TRACE), yes)
49    LLCFLAGS += -trace
50endif
51ifeq ($(TRACEM), yes)
52    LLCFLAGS += -tracem
53endif
54
55clean ::
56	$(RM) a.out core
57	$(RM) -rf Output/
58
59Output/%.ll: %.c $(LCC) Output/.dir
60	$(LCC) $(LCCFLAGS) -S $< -o $@
61
62Output/%.bc: Output/%.ll $(LGCCAS)
63	$(LGCCAS) $< -o $@
64
65Output/%.bc: %.ll $(LAS)
66	$(LAS) $< -o $@
67
68#
69# Testing versions of provided utilities...
70#
71Output/%.tll: %.c $(LCC) Output/.dir
72	@echo "======== Compiling $<"
73	$(LCC) $(LCCFLAGS) -S $< -o $@ || \
74	    ( rm -f $@; $(FAILURE) $@ )
75
76Output/%.tbc: Output/%.tll $(LAS)
77	@echo "======== Assembling $<"
78	$(LAS) -f $< -o $@ || \
79            ( rm -f $@; $(FAILURE) $@ )
80
81
82
83#%.s: %.linked.bc
84#	$(LLC) -f $(LLCFLAGS) $< -o $@
85
86#%: %.o $(LIBS)
87#	$(CC) $(LDFLAGS) $< $(LIBS) -o $@
88
89
90## Cancel built-in implicit rules that override above rules
91%: %.s
92
93%: %.c
94
95%.o: %.c
96
97## The next two rules are for disassembling an executable or an object file
98#%.dis: %
99#	$(DIS) $< > $@
100
101#%.dis: %.o
102#	$(DIS) $< > $@
103
104
105