From bb0f82d5aa47d120e6d8a2fa6c2d59ab6034a20c Mon Sep 17 00:00:00 2001 From: Jan Nieuwenhuizen Date: Fri, 23 Jun 2017 20:18:09 +0200 Subject: [PATCH] build: Add stage0 hex2 test. * configure (HEX2): Check for hex2 from MESCC_tools. * INSTALL: Mention it. * GNUmakefile (SUBDIRS): Add stage0. * make/check-cc.make: New file. * make/check.make: Remove CC-not-empty guard. * scaffold/scaffold.make: Update CC check targets. --- GNUmakefile | 1 + INSTALL | 8 +++++--- configure | 4 ++++ make/check-cc.make | 3 +++ make/check.make | 3 --- scaffold/scaffold.make | 8 ++++---- stage0/stage0.make | 10 ++++++++++ 7 files changed, 27 insertions(+), 10 deletions(-) create mode 100644 make/check-cc.make create mode 100644 stage0/stage0.make diff --git a/GNUmakefile b/GNUmakefile index 5d49d1f7..ddd4b352 100644 --- a/GNUmakefile +++ b/GNUmakefile @@ -14,6 +14,7 @@ SUBDIRS:=\ src\ scaffold\ scripts\ + stage0\ tests\ tinycc\ # diff --git a/INSTALL b/INSTALL index b27bb483..8996a743 100644 --- a/INSTALL +++ b/INSTALL @@ -12,13 +12,15 @@ Building and Installing Mes guix environment --system=i686-linux -l guix.scm #32 bit only ** Other GNU/Linux -*** Nyacc, 0.78.0 is known to work. +*** [[https://github.com/oriansj/MESCC_Tools][MESCC_Tools]], 0.0 is known to work. + +*** [[https://savannah.gnu.org/projects/nyacc][Nyacc]], 0.78.0 is known to work. Matt Wette's C99 LALR parser. -*** A C compiler, GNU Gcc 4.9.3 is known to work. +*** GNU Gcc, 4.9.3 is known to work. The idea is to drop this requirement, of course. -*** Guile, version 2.0.12 or is know to work. +*** GNU Guile, version 2.0.12 or is know to work. Guile is not strictly necessary but it is used by the configure script and in development. diff --git a/configure b/configure index 6fdda156..c5cf4ab2 100755 --- a/configure +++ b/configure @@ -173,6 +173,7 @@ exec ${GUILE} --no-auto-compile -L $(pwd) -C $(pwd) -e 'main' -s "$0" ${1+"$@"} (define CC32 (or (getenv "CC32") (if (member ARCH '("i686" "arm")) (string-append BUILD_TRIPLET "-" CC) "i686-unknown-linux-gnu-gcc"))) +(define HEX2 (or (getenv "HEX2") "hex2")) (define (parse-opts args) (let* ((option-spec @@ -230,6 +231,8 @@ Usage: ./configure [OPTION]... (check-version 'make '(4 0)) (check-version 'perl '(5)) (check-version 'nyacc '(0 78 0) #:command (string-append GUILE " -c '(use-modules (nyacc lalr)) (display *nyacc-version*)'")) + (if (not (check-version HEX2 '(0) #:optional? #t)) + (set! HEX2 #f)) (when (pair? required) (stderr "\nMissing dependencies [~a], run\n\n" ((->string ", ") required)) @@ -249,6 +252,7 @@ Usage: ./configure [OPTION]... (stdout "GUILE_FOR_BUILD:=~a\n" GUILE) (stdout "GUILE_EFFECTIVE_VERSION:=~a\n" GUILE_EFFECTIVE_VERSION) (stdout "GUIX_P:=~a\n" (if guix? guix? "")) + (stdout "HEX2:=~a\n" (or HEX2 "")) (stdout "PACKAGE:=~a\n" PACKAGE) (stdout "VERSION:=~a\n" VERSION) (stdout "PREFIX:=~a\n" (gulp-pipe (string-append "echo " prefix))) diff --git a/make/check-cc.make b/make/check-cc.make new file mode 100644 index 00000000..fcba6caf --- /dev/null +++ b/make/check-cc.make @@ -0,0 +1,3 @@ +ifneq ($(CC),) +include make/check.make +endif diff --git a/make/check.make b/make/check.make index a7929b50..acfaab26 100644 --- a/make/check.make +++ b/make/check.make @@ -1,4 +1,3 @@ -ifneq ($(CC),) ifeq ($(TEST),) TEST:=$(TARGET)-check $(TEST): EXPECT:=$(EXPECT) @@ -14,6 +13,4 @@ endif CHECK+=$(TEST) $(TEST): TEST:=$(TEST) $(DIR)-check: $(TEST) -endif include make/reset.make - diff --git a/scaffold/scaffold.make b/scaffold/scaffold.make index be1c89ee..fd585b20 100644 --- a/scaffold/scaffold.make +++ b/scaffold/scaffold.make @@ -6,7 +6,7 @@ include make/bin.make TARGET:=m EXPECT:=255 -include make/check.make +include make/check-cc.make TARGET:=hello C_FILES:=$(DIR)/hello.c @@ -16,7 +16,7 @@ include make/bin.make TARGET:=hello EXPECT:=42 -include make/check.make +include make/check-cc.make TARGET:=t C_FILES:=$(DIR)/t.c @@ -25,7 +25,7 @@ INCLUDES:=mlibc include make/bin.make TARGET:=t -include make/check.make +include make/check-cc.make TARGET:=t-tcc C_FILES:=$(DIR)/t-tcc.c @@ -34,7 +34,7 @@ INCLUDES:=mlibc include make/bin.make TARGET:=t-tcc -include make/check.make +include make/check-cc.make TARGET:=m.mlibc C_FILES:=$(DIR)/m.c diff --git a/stage0/stage0.make b/stage0/stage0.make new file mode 100644 index 00000000..fc9d62aa --- /dev/null +++ b/stage0/stage0.make @@ -0,0 +1,10 @@ +ifneq ($(HEX2),) +CLEAN+=$(OUT)/exit42 +$(OUT)/exit42: stage0/elf32-header-exit-42.hex2 stage0/elf32-body-exit-42.hex2 stage0/elf32-footer-exit-42.hex2 + @echo " HEX2 $(notdir $^) -> $(notdir $@)" + $(QUIET)$(HEX2) -f stage0/elf32-header-exit-42.hex2 -f stage0/elf32-body-exit-42.hex2 -f stage0/elf32-footer-exit-42.hex2 --LittleEndian --Architecture 1 --BaseAddress 0x1000000 > $@ + chmod +x $@ +TARGET:=exit42 +EXPECT:=42 +include make/check.make +endif