2 ##------------------------------------------------------------------------
3 ## Common rules for generating, linking, and compiling via LLVM.
4 ##------------------------------------------------------------------------
6 ## NOTE: This is preliminary and will change in the future
9 include ${LEVEL}/Makefile.common
13 ## keep %.linked.bc and %.s from being deleted while we're debugging
14 .PRECIOUS: %.bc %.s %.ll
17 TOOLS = $(LEVEL)/tools/Debug
27 LCC = /home/vadve/lattner/cvs/gcc_install/bin/gcc
28 LCFLAGS = -O2 $(LOCAL_LCFLAGS) -Wall
30 LLCLIB = $(LEVEL)/test/runtime.o
31 LIBS = $(LLCLIB) $(LOCAL_LIBS)
34 LLCFLAGS := $(LLCFLAGS) -trace
37 LLCFLAGS := $(LLCFLAGS) -tracem
40 NATGCC = /usr/dcs/software/supported/bin/gcc
42 CC = /opt/SUNWspro/bin/cc
43 AS = /opt/SUNWspro/bin/cc
44 DIS = /usr/ccs/bin/dis
46 CFLAGS = -g -xarch=v9 $(LOCAL_CFLAGS)
48 LDFLAGS = $(CFLAGS) $(LOCAL_LDFLAGS)
49 ASFLAGS = -c $(CFLAGS)
51 ## Special targets to build a program from multiple source files
55 default: $(PROG) $(PROG).native
57 ifeq ($(strip $(OBJS)),)
60 BCOBJS = $(OBJS:.o=.bc)
63 $(PROG).linked.bc: $(BCOBJS)
64 $(LLINK) -f $(BCOBJS) -o $(PROG).tmp.bc
65 $(LOPT) -cleangcc -raise -constprop -dce $(PROG).tmp.bc -o $@ -f
68 $(PROG).native: $(OBJS:.o=.c)
69 $(CC) $(OBJS:.o=.c) -g $(LOCAL_LCFLAGS) $(CFLAGS) -lm -o $@
72 ## Special target to force target-dependent library to be compiled
73 ## directly to native code.
75 $(LLCLIB): $(LLCLIB:.o=.c)
76 cd $(LEVEL)/test; $(MAKE) $(@F)
79 $(CC) -c $(CCFLAGS) $<
82 $(RM) *.bc *.mc *.s *.o a.out core $(PROG) $(PROG).native
84 %.mc: %.bc $(LLC) $(AS)
85 @echo "Generating machine instructions for $<"
86 $(LLC) -f -dsched y $(LLCFLAGS) $< > $@
88 %.trace.bc: %.bc $(LLC)
89 $(LLC) -f -trace $(LLCFLAGS) $<
92 ## FIXME: LIBS should be specified, not hardcoded to -lm
94 $(NATGCC) $+ -lm -o $@
97 $(LCC) $(LCFLAGS) -S $< -o $@
106 $(LLC) -f $(LLCFLAGS) $< -o $@
109 $(CC) $(LDFLAGS) $< $(LIBS) -o $@
112 ## Cancel built-in implicit rules that override above rules
119 ## The next two rules are for disassembling an executable or an object file