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.
This commit is contained in:
Jan Nieuwenhuizen 2017-06-23 20:18:09 +02:00
parent afb5c207a9
commit bb0f82d5aa
7 changed files with 27 additions and 10 deletions

View file

@ -14,6 +14,7 @@ SUBDIRS:=\
src\ src\
scaffold\ scaffold\
scripts\ scripts\
stage0\
tests\ tests\
tinycc\ tinycc\
# #

View file

@ -12,13 +12,15 @@ Building and Installing Mes
guix environment --system=i686-linux -l guix.scm #32 bit only guix environment --system=i686-linux -l guix.scm #32 bit only
** Other GNU/Linux ** 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. 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. 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 Guile is not strictly necessary but it is used by the configure script
and in development. and in development.

4
configure vendored
View file

@ -173,6 +173,7 @@ exec ${GUILE} --no-auto-compile -L $(pwd) -C $(pwd) -e 'main' -s "$0" ${1+"$@"}
(define CC32 (or (getenv "CC32") (define CC32 (or (getenv "CC32")
(if (member ARCH '("i686" "arm")) (string-append BUILD_TRIPLET "-" CC) (if (member ARCH '("i686" "arm")) (string-append BUILD_TRIPLET "-" CC)
"i686-unknown-linux-gnu-gcc"))) "i686-unknown-linux-gnu-gcc")))
(define HEX2 (or (getenv "HEX2") "hex2"))
(define (parse-opts args) (define (parse-opts args)
(let* ((option-spec (let* ((option-spec
@ -230,6 +231,8 @@ Usage: ./configure [OPTION]...
(check-version 'make '(4 0)) (check-version 'make '(4 0))
(check-version 'perl '(5)) (check-version 'perl '(5))
(check-version 'nyacc '(0 78 0) #:command (string-append GUILE " -c '(use-modules (nyacc lalr)) (display *nyacc-version*)'")) (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) (when (pair? required)
(stderr "\nMissing dependencies [~a], run\n\n" ((->string ", ") 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_FOR_BUILD:=~a\n" GUILE)
(stdout "GUILE_EFFECTIVE_VERSION:=~a\n" GUILE_EFFECTIVE_VERSION) (stdout "GUILE_EFFECTIVE_VERSION:=~a\n" GUILE_EFFECTIVE_VERSION)
(stdout "GUIX_P:=~a\n" (if guix? guix? "")) (stdout "GUIX_P:=~a\n" (if guix? guix? ""))
(stdout "HEX2:=~a\n" (or HEX2 ""))
(stdout "PACKAGE:=~a\n" PACKAGE) (stdout "PACKAGE:=~a\n" PACKAGE)
(stdout "VERSION:=~a\n" VERSION) (stdout "VERSION:=~a\n" VERSION)
(stdout "PREFIX:=~a\n" (gulp-pipe (string-append "echo " prefix))) (stdout "PREFIX:=~a\n" (gulp-pipe (string-append "echo " prefix)))

3
make/check-cc.make Normal file
View file

@ -0,0 +1,3 @@
ifneq ($(CC),)
include make/check.make
endif

View file

@ -1,4 +1,3 @@
ifneq ($(CC),)
ifeq ($(TEST),) ifeq ($(TEST),)
TEST:=$(TARGET)-check TEST:=$(TARGET)-check
$(TEST): EXPECT:=$(EXPECT) $(TEST): EXPECT:=$(EXPECT)
@ -14,6 +13,4 @@ endif
CHECK+=$(TEST) CHECK+=$(TEST)
$(TEST): TEST:=$(TEST) $(TEST): TEST:=$(TEST)
$(DIR)-check: $(TEST) $(DIR)-check: $(TEST)
endif
include make/reset.make include make/reset.make

View file

@ -6,7 +6,7 @@ include make/bin.make
TARGET:=m TARGET:=m
EXPECT:=255 EXPECT:=255
include make/check.make include make/check-cc.make
TARGET:=hello TARGET:=hello
C_FILES:=$(DIR)/hello.c C_FILES:=$(DIR)/hello.c
@ -16,7 +16,7 @@ include make/bin.make
TARGET:=hello TARGET:=hello
EXPECT:=42 EXPECT:=42
include make/check.make include make/check-cc.make
TARGET:=t TARGET:=t
C_FILES:=$(DIR)/t.c C_FILES:=$(DIR)/t.c
@ -25,7 +25,7 @@ INCLUDES:=mlibc
include make/bin.make include make/bin.make
TARGET:=t TARGET:=t
include make/check.make include make/check-cc.make
TARGET:=t-tcc TARGET:=t-tcc
C_FILES:=$(DIR)/t-tcc.c C_FILES:=$(DIR)/t-tcc.c
@ -34,7 +34,7 @@ INCLUDES:=mlibc
include make/bin.make include make/bin.make
TARGET:=t-tcc TARGET:=t-tcc
include make/check.make include make/check-cc.make
TARGET:=m.mlibc TARGET:=m.mlibc
C_FILES:=$(DIR)/m.c C_FILES:=$(DIR)/m.c

10
stage0/stage0.make Normal file
View file

@ -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