2004-09-04 20:13:54 +00:00
|
|
|
##===- projects/Stacker/test/Makefile ----------------------*- Makefile -*-===##
|
2003-11-23 18:12:22 +00:00
|
|
|
#
|
2004-09-04 20:13:54 +00:00
|
|
|
# This is the makefile that tests the various facilities of the Stacker language
|
2003-11-23 18:12:22 +00:00
|
|
|
#
|
|
|
|
##===----------------------------------------------------------------------===##
|
|
|
|
|
|
|
|
#
|
|
|
|
# Indicates our relative path to the top of the project's root directory.
|
|
|
|
#
|
2004-09-04 20:13:54 +00:00
|
|
|
LEVEL = ../
|
2003-11-23 18:12:22 +00:00
|
|
|
|
|
|
|
#
|
2004-09-04 20:13:54 +00:00
|
|
|
# Directories that need to be built.
|
2003-11-23 18:12:22 +00:00
|
|
|
#
|
|
|
|
DIRS =
|
|
|
|
|
|
|
|
#
|
|
|
|
# Include the Master Makefile that knows how to build all.
|
|
|
|
#
|
|
|
|
include $(LEVEL)/Makefile.common
|
|
|
|
|
|
|
|
LOGIC_TESTS = eq ne le ge gt lt false true
|
|
|
|
BITWISE_TESTS = shl shr xor or and
|
|
|
|
ARITHMETIC_TESTS = abs neg add sub mul div mod star_slash incr decr min max
|
|
|
|
STACK_TESTS = drop drop2 nip nip2 dup dup2 swap swap2 over over2 rot rot2 \
|
|
|
|
rrot rrot2 tuck tuck2 roll pick select
|
|
|
|
MEMORY_TESTS = memory
|
|
|
|
CONTROL_TESTS = while return
|
|
|
|
IO_TESTS = space tab out_chr out_num out_str
|
|
|
|
|
|
|
|
TESTS = $(LOGIC_TESTS) $(ARITHMETIC_TESTS) $(BITWISE_TESTS) $(STACK_TESTS) \
|
|
|
|
$(MEMORY_TESTS) $(CONTROL_TESTS) $(IO_TESTS)
|
|
|
|
|
2003-12-08 07:08:00 +00:00
|
|
|
STKRC_EXEC = $(BUILD_OBJ_ROOT)/tools/$(CONFIGURATION)/stkrc
|
|
|
|
|
2003-11-23 18:12:22 +00:00
|
|
|
all :: test_each
|
|
|
|
|
|
|
|
test_each: $(TESTS)
|
2003-11-24 02:57:25 +00:00
|
|
|
@$(ECHO) "Running Tests..."
|
2003-12-08 07:08:00 +00:00
|
|
|
$(VERB) LD_LIBRARY_PATH=$(BUILD_OBJ_ROOT)/lib/$(CONFIGURATION) $(BUILD_SRC_DIR)/runtests $(BUILD_OBJ_DIR) $(TESTS)
|
2003-11-23 18:12:22 +00:00
|
|
|
|
2004-09-04 20:13:54 +00:00
|
|
|
%.bc : %.st Makefile
|
|
|
|
@$(ECHO) "Compiling And Optimizing $< to $*.bc"
|
|
|
|
$(VERB)$(STKRC_EXEC) -f -O4 -s 2048 -o $*.bc $(BUILD_SRC_DIR)/$*.st
|
2003-11-23 18:12:22 +00:00
|
|
|
|
|
|
|
%.s : %.bc
|
2004-09-04 20:13:54 +00:00
|
|
|
@$(ECHO) "Assembling $< to $*.s"
|
|
|
|
$(VERB)$(LLC) -f -o $*.s $*.bc
|
2003-11-23 18:12:22 +00:00
|
|
|
|
2004-09-04 20:13:54 +00:00
|
|
|
% : %.s testing.s
|
|
|
|
@$(ECHO) "Linking $*"
|
|
|
|
$(VERB)$(CC) -ggdb -L$(BUILD_OBJ_ROOT)/lib/$(CONFIGURATION) testing.s -lstkr_runtime -o $* $*.s
|
2003-11-23 18:12:22 +00:00
|
|
|
|
|
|
|
%.ll : %.bc
|
2003-11-24 02:57:25 +00:00
|
|
|
@$(ECHO) "Disassembling $< to $*.ll"
|
2004-09-04 20:13:54 +00:00
|
|
|
$(VERB)$(LDIS) -dis -o $*.ll $<
|
2003-11-24 02:57:25 +00:00
|
|
|
|
|
|
|
TESTS_LL = $(TESTS:%=%.ll)
|
|
|
|
TESTS_BC = $(TESTS:%=%.bc)
|
|
|
|
TESTS_S = $(TESTS:%=%.s)
|
2003-11-23 18:12:22 +00:00
|
|
|
|
|
|
|
clean ::
|
2003-11-24 02:57:25 +00:00
|
|
|
$(VERB)rm -f gmon.out $(TESTS_LL) $(TESTS_BC) $(TESTS_S) $(TESTS) testing.bc testing.s testing.ll
|
2003-11-23 18:12:22 +00:00
|
|
|
|
2003-11-24 02:57:25 +00:00
|
|
|
.SUFFIXES: .st .s .ll .bc
|
2003-11-23 18:12:22 +00:00
|
|
|
.PRECIOUS: %.s %.ll %.bc %.st
|
2003-11-24 02:57:25 +00:00
|
|
|
.PHONY: test_each
|