New target "hc08" for the Motorola 68hc08 family of micros
[fw/sdcc] / support / regression / Makefile
index 5ad6aad332fbab1687c13aec01df916785111e4d..0253dd531ce7473d4f0b656c83f6e743988dc021 100644 (file)
 #       o Provides the emulators
 #   * The gbdk-lib package from gbdk.
 #       o cvs -d cvs.gbdk.sourceforge.net:/cvsroot/gbdk co gbdk-lib
-#       o Provildes mul, div, and include files for the z80 tests.
+#       o Proviles mul, div, and include files for the z80 tests.
 #   * python 1.5 or above
+#   * uCsim for the mcs51 port
 #
 # The paths below assume that sdcc, sdcc-extra, and gbdk-lib all reside in
 # the same directory.
 
-# Old nores:
+# Old notes:
 # Starting at the bottom
 # Set of source test suites
 # Each source suite is processesd producing multiple device specific test suites.
 
 # Uncomment this to show only errors and the summary.
 # Comment this out for debugging.
-.SILENT:
+#.SILENT:
 
 # All original tests live in TESTS_DIR and below
 TESTS_DIR = tests
+TESTS_NAME = $(TESTS_DIR)
 # All suite results go in RESULTS_DIR
 RESULTS_DIR = results
 # All data relating to supported ports live in their own directory
@@ -56,20 +58,58 @@ GENERATE_CASES = generate-cases.py
 
 # Magically generate the list of configured ports to test.
 # Each directory under ports/ is used as a port name.  Each port is tested.
-# The port name must be the same as the one used in the SDCC '-mxxx' argument.
 # Each port must have a spec.mk which describes how to build the object
 # files and how to run the emulator.
-ALL_PORTS = $(filter-out CVS,$(notdir $(wildcard $(PORTS_DIR)/*)))
+ALL_PORTS = $(filter-out CVS xa51 mcs51 mcs51-large mcs51-stack-auto ds390 gbz80 hc08,$(notdir $(wildcard $(PORTS_DIR)/*)))
+
+# These  ports will be cleaned with 'make clean'
+CLEAN_PORTS = $(filter-out CVS,$(notdir $(wildcard $(PORTS_DIR)/*)))
+
+all: test-ports
 
 # Test all of the ports
 test-ports:
-       for i in $(ALL_PORTS); do $(MAKE) inter-port-clean test-port PORT=$$i; done
+       for i in $(ALL_PORTS); do $(MAKE) test-port PORT=$$i; done
 
 # Helper rule for testing the z80 port only
 test-z80:
-       $(MAKE) inter-port-clean clean test-port PORT=z80
+       $(MAKE) test-port PORT=z80
+
+# Helper rule for testing the z80 port only
+test-gbz80:
+       $(MAKE) test-port PORT=gbz80
+
+# Helper rule for testing the mcs51 port only
+test-mcs51:
+       $(MAKE) test-port PORT=mcs51
+test-mcs51-large:
+       $(MAKE) test-port PORT=mcs51-large
+test-mcs51-stack-auto:
+       $(MAKE) make-library test-port PORT=mcs51-stack-auto
+
+# Helper rule for testing the ds390 port only
+test-ds390:
+       $(MAKE) test-port PORT=ds390
+
+# Helper rule for testing the z80 port only(use ucSim simulator)
+test-ucz80:
+       $(MAKE) test-port PORT=ucz80
+
+# Helper rule for testing the hc08 port only(use ucSim simulator)
+test-hc08:
+       $(MAKE) test-port PORT=hc08
+
+# Helper rule for testing the xa51 port only(use ucSim simulator)
+test-xa51:
+       $(MAKE) test-port PORT=xa51
+
+### Helper rule for testing the host cc only
+test-host:
+       $(MAKE) test-port PORT=host
+
+test-host2:
+       $(MAKE) test-port PORT=host
 
-test-z80:
 # Begin per-port rules
 # List of all of the known source test suites.
 ALL_TESTS = $(shell find $(TESTS_DIR) -name "*.c")
@@ -83,42 +123,42 @@ PORT_RESULTS = $(ALL_TESTS:$(TESTS_DIR)/%.c=$(PORT_RESULTS_DIR)/%.out)
 SDCC_DIR = ../..
 SDCC_EXTRA_DIR = ../../../sdcc-extra
 
+
 # Defaults.  Override in spec.mk if required.
 # Path to SDCC
 SDCC = $(SDCC_DIR)/bin/sdcc
 # Base flags.
-SDCCFLAGS = -m$(PORT)
+SDCCFLAGS +=
 # Extension of object intermediate files
 OBJEXT = .o
 # Extension of files that can be run in the emulator
 EXEEXT = .bin
 # Currently unused.  Extension to append to intermediate directories.
-DIREXT = 
+DIREXT =
 
 # Only include if we're in a per-port call.
 ifdef PORT
 include $(PORTS_DIR)/$(PORT)/spec.mk
 endif
 
-SDCCFLAGS += -Ifwk/include
+SDCCFLAGS += -Ifwk/include -Itests
 
 # List of intermediate files to keep.  Pretty much keep everything as
 # disk space is free.
 .PRECIOUS: $(PORT_CASES_DIR)/% %$(OBJEXT) %$(EXEEXT)
 
 # Rule to generate the iterations of a test suite off the soure suite.
-$(PORT_CASES_DIR)/%$(DIREXT): $(TESTS_DIR)/%.c $(GENERATE_CASES)
-       rm -rf $(CASES_DIR)/tests
-       mkdir -p $(CASES_DIR)/tests
-       mkdir -p $@
-       python $(GENERATE_CASES) $< > /dev/null
-       cp $(CASES_DIR)/tests/*.c $@
+$(PORT_CASES_DIR)/%/iterations.stamp: $(TESTS_DIR)/%.c $(GENERATE_CASES)
+       echo Processing $<
+       rm -rf `dirname $@`
+       mkdir -p `dirname $@`
+       python $(GENERATE_CASES) $< `dirname $@` > /dev/null
        touch $@
 
 # Rule linking the combined results log to all of the files in the
 # iteration directory.
-$(PORT_RESULTS_DIR)/%.out: $(PORT_CASES_DIR)/%$(DIREXT)
-       $(MAKE) iterations PORT=$(PORT) CASES=$<
+$(PORT_RESULTS_DIR)/%.out: $(PORT_CASES_DIR)/%/iterations.stamp
+       $(MAKE) iterations PORT=$(PORT) CASES=`dirname $<`
 
 # Rule to summaries the results for one port after all of the tests
 # have been run.
@@ -134,7 +174,7 @@ test-port: port-results
 # test
 
 # List of all of the generated iteration source files.
-SUB_CASES = $(wildcard $(CASES)/*.c)
+SUB_CASES = $(sort $(wildcard $(CASES)/*.c))
 # List of all the sub result logs generated from the iterations.
 SUB_RESULTS = $(SUB_CASES:%.c=%.out)
 # Overall target.  Concatenation of all of the sub results.
@@ -160,7 +200,5 @@ $(RESULTS): $(SUB_RESULTS)
 # BeginGeneric rules
 
 clean:
-       rm -rf $(CASES_DIR) $(RESULTS_DIR)
-
-inter-port-clean:
-       rm -f  fwk/lib/*.o
+       rm -rf $(CASES_DIR) $(RESULTS_DIR) *.pyc fwk/lib/timeout fwk/lib/timeout.exe
+       for i in $(CLEAN_PORTS); do $(MAKE) -f $(PORTS_DIR)/$$i/spec.mk _clean PORTS_DIR=$(PORTS_DIR) PORT=$$i; done