Move some makefile stuff to subdirectories
[oota-llvm.git] / test / Makefile.tests
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
9 include ${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
17 TOOLS    = $(LEVEL)/tools/Debug
18
19 LLI      = $(TOOLS)/lli
20 LLC      = $(TOOLS)/llc
21 LAS      = $(TOOLS)/gccas
22 LDIS     = $(TOOLS)/dis 
23 LOPT     = $(TOOLS)/opt
24 LLINK    = $(TOOLS)/link
25 LLCFLAGS =
26
27 LCC      = /home/vadve/lattner/cvs/gcc_install/bin/gcc
28 LCFLAGS  += -O2 -Wall
29
30 LLCLIB   = $(LEVEL)/test/runtime.o
31 LIBS    += $(LLCLIB)
32
33 ifeq ($(TRACE), yes)
34     LLCFLAGS += -trace
35 endif
36 ifeq ($(TRACEM), yes)
37     LLCFLAGS += -tracem
38 endif
39
40 NATGCC  = /usr/dcs/software/supported/bin/gcc
41
42 CC      = /opt/SUNWspro/bin/cc
43 AS      = /opt/SUNWspro/bin/cc
44 DIS     = /usr/ccs/bin/dis
45 CP      = /bin/cp -f
46 CFLAGS  += -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
57 clean ::
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
69 ## FIXME: LIBS should be specified, not hardcoded to -lm
70 #Output/%.native: %.c Output/.dir
71 #       $(NATGCC) $+ -lm -o $@
72
73 Output/%.ll: %.c $(LCC) Output/.dir
74         $(LCC) $(LCFLAGS) -S $< -o $@
75
76 %.bc: %.ll $(LAS)
77         $(LAS) $< -o $@
78
79 #%.s: %.linked.bc
80 #       $(LLC) -f $(LCFLAGS) $< -o $@
81
82 #%: %.o $(LIBS)
83 #       $(CC) $(LDFLAGS) $< $(LIBS) -o $@
84
85
86 ## Cancel built-in implicit rules that override above rules
87 %: %.s
88
89 %: %.c
90
91 %.o: %.c
92
93 ## The next two rules are for disassembling an executable or an object file
94 %.dis: %
95         $(DIS) $< > $@
96
97 %.dis: %.o
98         $(DIS) $< > $@
99
100