2 ##------------------------------------------------------------------------
3 ## Common rules for generating, linking, and compiling via LLVM.
4 ##------------------------------------------------------------------------
8 ## keep %.linked.bc from being deleted
12 TOOLS = $(LEVEL)/tools/Debug
21 LCC = /home/vadve/lattner/cvs/gcc_install/bin/gcc
22 LCFLAGS = -O2 $(LOCAL_CFLAGS) -Wall
24 LLCLIB = $(LEVEL)/test/runtime.o
25 LIBS = $(LLCLIB) $(LOCAL_LIBS)
28 LLCFLAGS := $(LLCFLAGS) -trace
31 CC = /opt/SUNWspro/bin/cc
32 AS = /opt/SUNWspro/bin/cc
33 DIS = /usr/ccs/bin/dis
38 ASFLAGS = -c $(CFLAGS)
40 ## Special targets to build a program from multiple source files
44 default: $(PROG).clean.bc $(PROG).native $(PROG)
46 ifeq ($(strip $(OBJS)),)
49 BCOBJS = $(OBJS:.o=.bc)
52 $(PROG).linked.bc: $(BCOBJS)
53 $(LLINK) -f $(BCOBJS) -o $@
55 $(PROG).clean.bc: $(PROG).linked.bc
56 $(LOPT) -cleangcc -raise -constprop -dce -o $@ -f $<
58 $(PROG).native: $(OBJS:.o=.c)
59 gcc $(OBJS:.o=.c) -O2 $(LOCAL_CFLAGS) $(LOCAL_LIBS) -Wall -o $@
62 rm -f $(PROG).native $(PROG)
66 ## Special target to force target-dependent library to be compiled
67 ## directly to native code.
70 cd $(LEVEL)/test; $(MAKE) $(@F)
73 $(CC) -c $(CCFLAGS) $<
76 $(RM) *.[123] *.bc *.mc *.s *.o a.out core *~
78 %.mc: %.bc $(LLC) $(AS)
79 @echo "Generating machine instructions for $<"
80 $(LLC) -f -dsched y $(LLCFLAGS) $< > $@
82 %.trace.bc: %.bc $(LLC)
83 $(LLC) -f -trace $(LLCFLAGS) $<
85 ## Leave this rule out to avoid problems in tests that have both .c and .ll
87 ## $(LCC) $(LCFLAGS) -S $< -o $*.ll
90 $(LCC) $(LCFLAGS) -c $< -o $@
99 $(LLC) -f $(LLCFLAGS) $< -o $@
102 $(CC) $(LDFLAGS) $< $(LIBS) -o $@
105 ## Cancel built-in implicit rules that override above rules
112 ## The next two rules are for disassembling an executable or an object file