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 CC = /opt/SUNWspro/bin/cc
33 AS = /opt/SUNWspro/bin/cc
34 DIS = /usr/ccs/bin/dis
36 CFLAGS = -g -xarch=v9 $(LOCAL_CFLAGS)
38 LDFLAGS = $(CFLAGS) $(LOCAL_LDFLAGS)
39 ASFLAGS = -c $(CFLAGS)
41 ## Special targets to build a program from multiple source files
45 default: $(PROG) $(PROG).native
47 ifeq ($(strip $(OBJS)),)
50 BCOBJS = $(OBJS:.o=.bc)
53 $(PROG).linked.bc: $(BCOBJS)
54 $(LLINK) -f $(BCOBJS) -o $(PROG).tmp.bc
55 $(LOPT) -cleangcc -raise -constprop -dce $(PROG).tmp.bc -o $@ -f
58 $(PROG).native: $(OBJS:.o=.c)
59 $(CC) $(OBJS:.o=.c) -O $(LOCAL_LCFLAGS) $(CFLAGS) -lm -o $@
62 ## Special target to force target-dependent library to be compiled
63 ## directly to native code.
65 $(LLCLIB): $(LLCLIB:.o=.c)
66 cd $(LEVEL)/test; $(MAKE) $(@F)
69 $(CC) -c $(CCFLAGS) $<
72 $(RM) *.[123] *.bc *.mc *.s *.o a.out core $(PROG) $(PROG).native
74 %.mc: %.bc $(LLC) $(AS)
75 @echo "Generating machine instructions for $<"
76 $(LLC) -f -dsched y $(LLCFLAGS) $< > $@
78 %.trace.bc: %.bc $(LLC)
79 $(LLC) -f -trace $(LLCFLAGS) $<
81 ## Leave this rule out to avoid problems in tests that have both .c and .ll
83 ## $(LCC) $(LCFLAGS) -S $< -o $*.ll
86 $(LCC) $(LCFLAGS) -S $< -o $@
98 $(LLC) -f $(LLCFLAGS) $< -o $@
101 $(CC) $(LDFLAGS) $< $(LIBS) -o $@
104 ## Cancel built-in implicit rules that override above rules
111 ## The next two rules are for disassembling an executable or an object file