blob: cb09cd8eeedc9c1f0c1d7fca6f68a15715e149ed [file] [log] [blame]
##==-- test/Makefile.test - Common make rules Java tests -*- makefile -*--====##
#
# The LLVM Compiler Infrastructure
#
# This file was developed by the LLVM research group and is distributed under
# the University of Illinois Open Source License. See LICENSE.TXT for details.
#
##===----------------------------------------------------------------------===##
include $(LEVEL)/Makefile.common
.PHONY: clean
clean::
$(RM) -f a.out core
$(RM) -rf Output/
# we don't want these files to be deleted by make, even if they are
# intermediate results
.PRECIOUS: Output/.dir Output/%.class %.bc %.ll %.llvm.bc %.llvm
#rule to link in runtime to raw bytecode
%.linked.bc: %.raw.bc $(DESTLIBBYTECODE)/libjrt.bc
@$(ECHO) Linking $< with the Java runtime
$(LLVMTOOLCURRENT)/llvm-link$(EXEEXT) $^ -o - | \
$(LOPT) -simplifycfg -mem2reg -instcombine > $@
# rule to make assembly from bytecode
%.dis-ll: %.bc
@$(ECHO) Disassembling $<
$(LDIS) < $< > $@
# rule to compile java source
Output/%.class: %.java Output/.dir
@$(ECHO) Compiling $<
$(JAVAC) -d Output $<
# rule to run a .class file with the jvm
%.out-nat: %.class
$(JAVA) -cp Output $(subst /,.,$(subst Output/,,$*)) > $*.out-nat || rm -f $*.out-nat
# rule to run a .class file with the llvm jit
%.out-jit: %.llvm.bc
$(LLI) $< > $*.out-nat || rm -f $*.out-nat