aboutsummaryrefslogtreecommitdiffstats
path: root/test/Makefile.tests
diff options
context:
space:
mode:
authorVikram S. Adve <vadve@cs.uiuc.edu>2001-11-06 17:09:49 +0000
committerVikram S. Adve <vadve@cs.uiuc.edu>2001-11-06 17:09:49 +0000
commita46fb6bb901d0dea25281b24a8eff89a2e39ce46 (patch)
tree59d3dc2be512aee9686b19bb3eea0dad9f3d29a3 /test/Makefile.tests
parent7b10c3694a09cf5ee8b0aa19b2ea5ca25e895023 (diff)
downloadexternal_llvm-a46fb6bb901d0dea25281b24a8eff89a2e39ce46.zip
external_llvm-a46fb6bb901d0dea25281b24a8eff89a2e39ce46.tar.gz
external_llvm-a46fb6bb901d0dea25281b24a8eff89a2e39ce46.tar.bz2
Really fix Makefile to compile individual tests and Olden codes.
by using a better naming scheme. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@1156 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'test/Makefile.tests')
-rw-r--r--test/Makefile.tests57
1 files changed, 34 insertions, 23 deletions
diff --git a/test/Makefile.tests b/test/Makefile.tests
index eb0ea0e..e95724c 100644
--- a/test/Makefile.tests
+++ b/test/Makefile.tests
@@ -5,6 +5,9 @@
.PHONY: clean default
+## keep %.linked.bc from being deleted
+.PRECIOUS: %.linked.bc
+
TOOLS = $(LEVEL)/tools/Debug
@@ -28,6 +31,7 @@ endif
CC = /opt/SUNWspro/bin/cc
AS = /opt/SUNWspro/bin/cc
DIS = /usr/ccs/bin/dis
+CP = /bin/cp -p
CFLAGS = -g -xarch=v9
CCFLAGS = $(CFLAGS)
LDFLAGS = $(CFLAGS)
@@ -37,14 +41,19 @@ ASFLAGS = -c $(CFLAGS)
##
ifdef PROG
-default: $(PROG).clean.bc $(PROG).native
- #.SECONDARY: $(PROG).clean.bc ## keep %.clean.bc from being deleted
+ default: $(PROG) $(PROG).native
+
+ ifeq ($(strip $(OBJS)),)
+ BCOBJS = $(PROG).bc
+ else
+ BCOBJS = $(OBJS:.o=.bc)
+ endif
-$(PROG).bc: $(OBJS)
- $(LLINK) -f $(OBJS) -o $@
+ $(PROG).linked.bc: $(BCOBJS)
+ $(LLINK) -f $(BCOBJS) -o $@
-$(PROG).native: $(OBJS:.o=.c)
- gcc -o $@ $(OBJS:.o=.c) -O2 $(LOCAL_CFLAGS) -Wall
+ $(PROG).native: $(OBJS:.o=.c)
+ gcc $(OBJS:.o=.c) -O2 $(LOCAL_CFLAGS) -Wall -o $@
endif
## Special target to force target-dependent library to be compiled
@@ -57,7 +66,7 @@ runtime.o: runtime.c
$(CC) -c $(CCFLAGS) $<
clean :
- rm -f *.[123] *.bc *.mc *.s *.o a.out core $(PROG)
+ $(RM) *.[123] *.bc *.mc *.s *.o a.out core $(PROG)
%.mc: %.bc $(LLC) $(AS)
@echo "Generating machine instructions for $<"
@@ -66,33 +75,35 @@ clean :
%.trace.bc: %.bc $(LLC)
$(LLC) -f -trace $(LLCFLAGS) $<
-%.o: %.c
- $(LCC) $(LCFLAGS) $< -c -o $@
+## Leave this rule out to avoid problems in tests that have both .c and .ll
+## %.ll: %.c
+## $(LCC) $(LCFLAGS) -S $< -o $*.ll
+
+%.bc: %.c
+ $(LCC) $(LCFLAGS) -c $< -o $*.tmp.bc
+ $(LOPT) -cleangcc -raise -constprop -dce $*.tmp.bc -o $@
+ $(RM) $*.tmp.bc
%.bc: %.ll
$(LAS) -f $<
-%.clean.bc: %.bc
- $(LOPT) -cleangcc -raise -constprop -dce < $< > $@
+%.linked.bc: %.bc
+ $(CP) $< $@
-%.s: %.bc
- $(LLC) -f $(LLCOPTS) $<
+%.s: %.linked.bc
+ $(LLC) -f $(LLCFLAGS) $< -o $@
%: %.o $(LIBS)
- $(CC) -o $@ $(LDFLAGS) $< $(LIBS)
+ $(CC) $(LDFLAGS) $< $(LIBS) -o $@
-##
-## Use a single rule to go from %.bc to % to avoid ambiguity in
-## llvm bytecode files and native object code files, both named %.o
-##
-%: %.clean.bc $(LIBS)
- $(LLC) -f $(LLCFLAGS) -o $*.s $<
- $(AS) $(ASFLAGS) $*.s
- $(CC) -o $@ $(LDFLAGS) $*.o $(LIBS)
-## Cancel built-in implicit rule that overrides the above rule
+## Cancel built-in implicit rules that override above rules
%: %.s
+%: %.c
+
+%.o: %.c
+
## The next two rules are for disassembling an executable or an object file
%.dis: %
$(DIS) $< > $@