Each new test is simply a link to opcodes.sh, generatated automatically.
AS51 = asem
-SUFFIXES = .hex .asm
+SUFFIXES = .hex .asm .sh
+# Should find a way to automatically generate each symlink here:
TESTS = \
- opcodes
-
-check_PROGRAMS = mul1.hex mul2.hex div.hex orl.hex anl.hex mov.hex timer0.hex timer1.hex timer2.hex
-
-mul1.hex: mul1.asm
-mul2.hex: mul2.asm
-div.hex: div.asm
-orl.hex: orl.asm
-anl.hex: anl.asm
-mov.hex: mov.asm
-timer0.hex: timer0.asm
-timer1.hex: timer1.asm
-timer2.hex: timer2.asm
-
+ mul1.sh mul2.sh \
+ div.sh \
+ orl.sh anl.sh \
+ mov.sh \
+ timer0.sh timer1.sh timer2.sh
+
+mul1.sh: mul1.hex
+mul2.sh: mul2.hex
+div.sh: div.hex
+orl.sh: orl.hex
+anl.sh: anl.hex
+mov.sh: mov.hex
+timer0.sh: timer0.hex
+timer1.sh: timer1.hex
+timer2.sh: timer2.hex
+
+# Tell make how to generate a .sh file after a .hex file is generated:
+.hex.sh:
+ ln -sf opcodes.sh $@
+
+# Tell make how to generate a .hex file from a .asm source file:
.asm.hex:
$(AS51) $<
-EXTRA_DIST = $(TESTS)
+EXTRA_DIST = $(TESTS) *.asm *.hex
-CLEANFILES = *~ *.lst *.log
+CLEANFILES = *~ *.lst *.hex $(TESTS)
MAINTAINERCLEANFILES = Makefile.in
+++ /dev/null
-#!/bin/sh
-
-lf=test.log
-
-STOP_ADDRESS="0xFFF0"
-XRAM_SIZE="256"
-
-for f in *.hex; do
- name=$(basename ${f} .hex)
-
- echo "Testing ${name}" > ${lf}
- ../src/emu8051-cli -d 2 --xram=${XRAM_SIZE} -s ${STOP_ADDRESS} ${f} >> ${lf}
- if $? -ne 0; then
- return 1
- fi
-
- while read line; do
- if echo ${line} | grep -q "; Test output"; then
- test_str=$(echo ${line} | sed "s/^; Test output: //")
-
- if ! grep -q "${test_str}" ${lf}; then
- echo "Failed test: ${test_str}" >> ${lf}
- exit 1
- fi
- fi
- done < ${name}.asm
-
-done
-
-exit 0
--- /dev/null
+#!/bin/sh
+
+# Get the symlink name (how we were called):
+test_name=`basename $0`
+
+lf=${test_name}.log
+
+STOP_ADDRESS="0xFFF0"
+XRAM_SIZE="256"
+
+name=$(basename ${test_name} .sh)
+hexfile=${name}.hex
+
+echo "Testing ${name}.hex" > ${lf}
+../src/emu8051-cli -d 2 --xram=${XRAM_SIZE} -s ${STOP_ADDRESS} ${hexfile} >> ${lf}
+if test $? -ne 0 ; then
+ return 1
+fi
+
+while read line; do
+ if echo ${line} | grep -q "; Test output"; then
+ test_str=$(echo ${line} | sed "s/^; Test output: //")
+
+ if ! grep -q "${test_str}" ${lf}; then
+ echo "Failed test: ${test_str}" >> ${lf}
+ exit 1
+ fi
+ fi
+done < ${name}.asm
+
+exit 0