Added rules for building sparc executable with and without tracing,
[oota-llvm.git] / test / Makefile
1 LLC  := ../tools/Debug/llc
2 LAS  := ../tools/Debug/as
3 LDIS := ../tools/Debug/dis 
4 LINK := ../tools/Debug/link
5 LLCLIBS := runtime.o
6 LLCOPTS := 
7
8 ifeq ($(TRACE), yes)
9     LLCOPTS := -trace
10 endif
11
12 CC      = /opt/SUNWspro/bin/cc
13 AS      = /opt/SUNWspro/bin/cc
14 DIS     = /usr/ccs/bin/dis
15 CFLAGS  = -g -xarch=v9
16 CCFLAGS = $(CFLAGS)
17 LDFLAGS = $(CFLAGS)
18 ASFLAGS = -c $(CFLAGS)
19
20
21 TESTS := $(wildcard *.ll)
22
23 LLCTESTS := $(shell /bin/ls *.ll | grep -v testswitch | grep -v opttest | grep -v xx | grep -v calltest | grep -v alloca | grep -v memory )
24
25
26 test all : testasmdis testopt testcodegen
27         @echo "All tests successfully completed!"
28
29 testasmdis  : $(TESTS:%.ll=%.ll.asmdis)
30         @echo "All assembler/disassembler test succeeded!"
31
32 testopt     : $(TESTS:%.ll=%.ll.opt)
33
34 testselect  : $(LLCTESTS:%.ll=%.mc)
35
36 testsched   : $(LLCTESTS:%.ll=%.mc)
37
38 testcodegen : $(LLCTESTS:%.ll=%.mc)
39
40 testsparc   : $(LLCTESTS:%.ll=%.s)
41
42 clean :
43         rm -f *.[123] *.bc *.mc *.s *.o a.out core 
44
45 %.asmdis: %
46         @echo "Running assembler/disassembler test on $<"
47         @./TestAsmDisasm.sh $<
48
49 %.opt: %
50         @echo "Running optimizier test on $<"
51         @./TestOptimizer.sh $<
52
53 %.bc: %.ll $(LAS)
54         $(LAS) -f $<
55
56 %.mc: %.bc $(LLC) $(AS)
57         @echo "Generating machine instructions for $<"
58         $(LLC) -dsched y $(LLCOPTS) $< > $@
59
60 %.trace.bc: %.bc $(LLC)
61         $(LLC) -f -trace $(LLCOPTS) $<
62
63 %.s: %.bc $(LLC)
64         $(LLC) -f $(LLCOPTS) $<
65
66 %: %.o $(LLCLIBS)
67         $(CC) -o $@ $(LDFLAGS) $< $(LLCLIBS)
68
69
70 ## Cancel built-in implicit rule that overrides the above rule
71 %: %.s
72
73 ## The next two rules are for disassembling an executable or an object file
74 %.dis: %
75         $(DIS) $< > $@
76
77 %.dis: %.o
78         $(DIS) $< > $@
79