Makefile.tests revision 747604218fecb44cf3acf553984cfc57444bd7d4
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## keep %.bc and %.s from being deleted while we're debugging
14.PRECIOUS: Output/%.bc Output/%.ll %.s Output/.dir
15
16
17TOOLS    = $(LEVEL)/tools/Debug
18
19LLI      = $(TOOLS)/lli
20LLC      = $(TOOLS)/llc
21LAS      = $(TOOLS)/gccas
22LDIS     = $(TOOLS)/dis 
23LOPT     = $(TOOLS)/opt
24LLINK    = $(TOOLS)/link
25LLCFLAGS =
26
27LCC      = /home/vadve/lattner/cvs/gcc_install/bin/gcc
28LCFLAGS  += -O2 -Wall
29
30LLCLIB   = $(LEVEL)/test/runtime.o
31LIBS    += $(LLCLIB)
32
33ifeq ($(TRACE), yes)
34    LLCFLAGS += -trace
35endif
36ifeq ($(TRACEM), yes)
37    LLCFLAGS += -tracem
38endif
39
40NATGCC  = /usr/dcs/software/supported/bin/gcc
41
42CC      = /opt/SUNWspro/bin/cc
43AS	= /opt/SUNWspro/bin/cc
44DIS     = /usr/ccs/bin/dis
45CP	= /bin/cp -f
46CFLAGS  += -g -xarch=v9
47
48## Special target to force target-dependent library to be compiled
49## directly to native code.
50## 
51$(LLCLIB): $(LLCLIB:.o=.c)
52	cd $(LEVEL)/test; $(MAKE) $(@F)
53
54#runtime.o: runtime.c
55#	$(CC) -c $(CCFLAGS) $<
56
57clean ::
58	$(RM) *.bc *.mc *.s *.o a.out core
59	$(RM) -rf Output/
60
61%.mc: %.bc $(LLC) $(AS)
62	@echo "Generating machine instructions for $<"
63	$(LLC) -f -dsched y $(LLCFLAGS) $< > $@
64
65%.trace.bc: %.bc $(LLC)
66	$(LLC) -f -trace $(LLCFLAGS) $<
67
68
69Output/%.ll: %.c $(LCC) Output/.dir
70	$(LCC) $(LCFLAGS) -S $< -o $@
71
72Output/%.bc: Output/%.ll $(LAS)
73	$(LAS) $< -o $@
74
75#%.s: %.linked.bc
76#	$(LLC) -f $(LCFLAGS) $< -o $@
77
78#%: %.o $(LIBS)
79#	$(CC) $(LDFLAGS) $< $(LIBS) -o $@
80
81
82## Cancel built-in implicit rules that override above rules
83%: %.s
84
85%: %.c
86
87%.o: %.c
88
89## The next two rules are for disassembling an executable or an object file
90#%.dis: %
91#	$(DIS) $< > $@
92
93#%.dis: %.o
94#	$(DIS) $< > $@
95
96
97