2 ##------------------------------------------------------------------------
3 ## Common rules for generating, linking, and compiling via LLVM.
4 ##------------------------------------------------------------------------
8 ## Special targets to build a program from multiple source files
12 .SECONDARY: $(PROG).clean.bc ## keep %.clean.bc from being deleted
15 $(LLINK) -f $(OBJS) -o $@
18 TOOLS = $(LEVEL)/tools/Debug
27 LCC = /home/vadve/lattner/cvs/gcc_install/bin/gcc
28 LCFLAGS = -O2 $(LOCAL_CFLAGS) -Wall
30 LLCLIB = $(LEVEL)/test/runtime.o
31 LIBS = $(LLCLIB) $(LOCAL_LIBS)
34 LLCFLAGS := $(LLCFLAGS) -trace
37 CC = /opt/SUNWspro/bin/cc
38 AS = /opt/SUNWspro/bin/cc
39 DIS = /usr/ccs/bin/dis
43 ASFLAGS = -c $(CFLAGS)
46 ## Special target to force target-dependent library to be compiled
47 ## directly to native code.
50 cd $(LEVEL)/test; $(MAKE) $(@F)
53 $(CC) -c $(CCFLAGS) $<
56 rm -f *.[123] *.bc *.mc *.s *.o a.out core $(PROG)
58 %.mc: %.bc $(LLC) $(AS)
59 @echo "Generating machine instructions for $<"
60 $(LLC) -f -dsched y $(LLCFLAGS) $< > $@
62 %.trace.bc: %.bc $(LLC)
63 $(LLC) -f -trace $(LLCFLAGS) $<
66 $(LCC) $(LCFLAGS) -S -o $*.ll $<
73 $(LOPT) -cleangcc -raise -constprop -dce < $< > $@
76 $(LLC) -f $(LLCOPTS) $<
79 $(CC) -o $@ $(LDFLAGS) $< $(LIBS)
82 ## Use a single rule to go from %.bc to % to avoid ambiguity in
83 ## llvm bytecode files and native object code files, both named %.o
86 $(LLC) -f $(LLCFLAGS) -o $*.s $<
88 $(CC) -o $@ $(LDFLAGS) $*.o $(LIBS)
90 ## Cancel built-in implicit rule that overrides the above rule
93 ## The next two rules are for disassembling an executable or an object file