Delete rule to disassemble %.bc -- need to make it effective only when
[oota-llvm.git] / test / Makefile.tests
1 .PHONY: clean default
2
3 ## Special targets to build a program from multiple source files
4 ## 
5 ifdef PROG
6   default:    $(PROG)
7   .SECONDARY: $(PROG).clean.bc  ## keep %.clean.bc from being deleted
8
9   $(PROG).bc: $(OBJS)
10         $(LLINK) -f $(OBJS) -o $@
11 endif
12
13 TOOLS    = $(LEVEL)/tools/Debug
14
15 LLC      = $(TOOLS)/llc
16 LAS      = $(TOOLS)/as
17 LDIS     = $(TOOLS)/dis 
18 LOPT     = $(TOOLS)/opt
19 LLINK    = $(TOOLS)/link
20 LLCFLAGS =
21
22 LCC      = /home/vadve/lattner/cvs/gcc_install/bin/gcc
23 LCFLAGS  = -DTORONTO -O2 $(LOCAL_CFLAGS) -Wall
24
25 LLCLIB   = $(LEVEL)/test/runtime.o
26 LIBS     = $(LLCLIB) $(LOCAL_LIBS)
27
28 ifeq ($(TRACE), yes)
29     LLCFLAGS := $(LLCFLAGS) -trace
30 endif
31
32 CC      = /opt/SUNWspro/bin/cc
33 AS      = /opt/SUNWspro/bin/cc
34 DIS     = /usr/ccs/bin/dis
35 CFLAGS  = -g -xarch=v9
36 CCFLAGS = $(CFLAGS)
37 LDFLAGS = $(CFLAGS)
38 ASFLAGS = -c $(CFLAGS)
39
40
41 ## Special target to force target-dependent library to be compiled
42 ## directly to native code.
43 ## 
44 $(LLCLIB):
45         cd $(LEVEL)/test; $(MAKE) $(@F)
46
47 runtime.o: runtime.c
48         $(CC) -c $(CCFLAGS) $<
49
50 clean :
51         rm -f *.[123] *.bc *.mc *.s *.o a.out core $(PROG) 
52
53 %.mc: %.bc $(LLC) $(AS)
54         @echo "Generating machine instructions for $<"
55         $(LLC) -f -dsched y $(LLCFLAGS) $< > $@
56
57 %.trace.bc: %.bc $(LLC)
58         $(LLC) -f -trace $(LLCFLAGS) $<
59
60 %.o: %.c
61         $(LCC) $(LCFLAGS) -c $<
62
63 %.bc: %.ll
64         $(LAS) -f $<
65
66 %.clean.bc: %.bc
67         $(LOPT) -cleangcc -raise -constprop -dce < $< > $@
68
69 %.s: %.bc
70         $(LLC) -f $(LLCOPTS) $<
71
72 %: %.o $(LIBS)
73         $(CC) -o $@ $(LDFLAGS) $< $(LIBS)
74
75 ## 
76 ## Use a single rule to go from %.bc to % to avoid ambiguity in
77 ## llvm bytecode files and native object code files, both named %.o
78 ## 
79 %: %.clean.bc $(LIBS)
80         $(LLC) -f $(LLCFLAGS) -o $*.s $<
81         $(AS) $(ASFLAGS) $*.s
82         $(CC) -o $@ $(LDFLAGS) $*.o $(LIBS)
83
84 ## Cancel built-in implicit rule that overrides the above rule
85 %: %.s
86
87 ## The next two rules are for disassembling an executable or an object file
88 %.dis: %
89         $(DIS) $< > $@
90
91 %.dis: %.o
92         $(DIS) $< > $@
93
94