2 ##------------------------------------------------------------------------
3 ## Common rules for generating, linking, and compiling via LLVM.
4 ##------------------------------------------------------------------------
8 ## keep %.linked.bc and %.s from being deleted while we're debugging
9 .PRECIOUS: %.linked.bc %.s
12 TOOLS = $(LEVEL)/tools/Debug
19 LGCCAS = $(TOOLS)/gccas
22 LCC = /home/vadve/lattner/cvs/gcc_install/bin/gcc
23 LCFLAGS = -O2 $(LOCAL_LCFLAGS) -Wall
25 LLCLIB = $(LEVEL)/test/runtime.o
26 LIBS = $(LLCLIB) $(LOCAL_LIBS)
29 LLCFLAGS := $(LLCFLAGS) -trace
32 LLCFLAGS := $(LLCFLAGS) -tracem
35 CC = /opt/SUNWspro/bin/cc
36 AS = /opt/SUNWspro/bin/cc
37 DIS = /usr/ccs/bin/dis
39 CFLAGS = -g -xarch=v9 $(LOCAL_CFLAGS)
41 LDFLAGS = $(CFLAGS) $(LOCAL_LDFLAGS)
42 ASFLAGS = -c $(CFLAGS)
44 ## Special targets to build a program from multiple source files
48 default: $(PROG) $(PROG).native
50 ifeq ($(strip $(OBJS)),)
53 BCOBJS = $(OBJS:.o=.bc)
56 $(PROG).linked.bc: $(BCOBJS)
57 $(LLINK) -f $(BCOBJS) -o $(PROG).tmp.bc
58 $(LOPT) -cleangcc -raise -constprop -dce $(PROG).tmp.bc -o $@ -f
61 $(PROG).native: $(OBJS:.o=.c)
62 $(CC) $(OBJS:.o=.c) -g $(LOCAL_LCFLAGS) $(CFLAGS) -lm -o $@
65 ## Special target to force target-dependent library to be compiled
66 ## directly to native code.
68 $(LLCLIB): $(LLCLIB:.o=.c)
69 cd $(LEVEL)/test; $(MAKE) $(@F)
72 $(CC) -c $(CCFLAGS) $<
75 $(RM) *.[123] *.bc *.mc *.s *.o a.out core $(PROG) $(PROG).native
77 %.mc: %.bc $(LLC) $(AS)
78 @echo "Generating machine instructions for $<"
79 $(LLC) -f -dsched y $(LLCFLAGS) $< > $@
81 %.trace.bc: %.bc $(LLC)
82 $(LLC) -f -trace $(LLCFLAGS) $<
84 ## Leave this rule out to avoid problems in tests that have both .c and .ll
86 ## $(LCC) $(LCFLAGS) -S $< -o $*.ll
89 $(LCC) $(LCFLAGS) -S $< -o $@
101 $(LLC) -f $(LLCFLAGS) $< -o $@
104 $(CC) $(LDFLAGS) $< $(LIBS) -o $@
107 ## Cancel built-in implicit rules that override above rules
114 ## The next two rules are for disassembling an executable or an object file