From 670d28c10c178142146f6916c5fa0967732f3a8f Mon Sep 17 00:00:00 2001 From: Juho Snellman Date: Mon, 13 Nov 2006 16:03:29 +0000 Subject: [PATCH] 0.9.18.49: Fix Linux/x86 build after a clean.sh. * Write the target features to genesis/Makefile.features, included into other makefiles. * Remove the disgusting shell/grep tricks for feature-based conditionalizing in Makefiles --- src/compiler/generic/genesis.lisp | 29 +++++++++++++++++++++++------ src/runtime/Config.ppc-darwin | 9 +++++---- src/runtime/Config.ppc-linux | 9 +++++---- src/runtime/Config.x86-freebsd | 7 ++++--- src/runtime/Config.x86-linux | 15 +++++++-------- src/runtime/Config.x86_64-linux | 6 +++--- src/runtime/GNUmakefile | 4 +++- tools-for-build/Makefile | 1 + version.lisp-expr | 2 +- 9 files changed, 52 insertions(+), 30 deletions(-) diff --git a/src/compiler/generic/genesis.lisp b/src/compiler/generic/genesis.lisp index aa879d2..ef6968b 100644 --- a/src/compiler/generic/genesis.lisp +++ b/src/compiler/generic/genesis.lisp @@ -2599,6 +2599,15 @@ core and return a descriptor to it." (format t " *~@[ ~A~]~%" line)) (format t " */~%")) +(defun write-makefile-features () + ;; propagating *SHEBANG-FEATURES* into the Makefiles + (dolist (shebang-feature-name (sort (mapcar #'symbol-name + sb-cold:*shebang-features*) + #'string<)) + (format t + "LISP_FEATURE_~A=1~%" + (substitute #\_ #\- shebang-feature-name)))) + (defun write-config-h () ;; propagating *SHEBANG-FEATURES* into C-level #define's (dolist (shebang-feature-name (sort (mapcar #'symbol-name @@ -3264,11 +3273,11 @@ initially undefined function references:~2%") (format t "#endif /* SBCL_GENESIS_~A */~%" (string-upcase ,name)))))) - (when map-file-name - (with-open-file (*standard-output* map-file-name - :direction :output - :if-exists :supersede) - (write-map))) + (when map-file-name + (with-open-file (*standard-output* map-file-name + :direction :output + :if-exists :supersede) + (write-map))) (out-to "config" (write-config-h)) (out-to "constants" (write-constants-h)) (let ((structs (sort (copy-list sb!vm:*primitive-objects*) #'string< @@ -3295,5 +3304,13 @@ initially undefined function references:~2%") (sb!kernel:layout-info (sb!kernel:find-layout class))))) (out-to "static-symbols" (write-static-symbols)) - (when core-file-name + (let ((fn (format nil "~A/Makefile.features" c-header-dir-name))) + (ensure-directories-exist fn) + (with-open-file (*standard-output* fn :if-exists :supersede + :direction :output) + (write-makefile-features))) + + (when core-file-name (write-initial-core-file core-file-name)))))) + + diff --git a/src/runtime/Config.ppc-darwin b/src/runtime/Config.ppc-darwin index fbf57ce..aa3a2d5 100644 --- a/src/runtime/Config.ppc-darwin +++ b/src/runtime/Config.ppc-darwin @@ -20,10 +20,11 @@ ARCH_SRC = ppc-arch.c CPPFLAGS += -no-cpp-precomp -GC_SRC = $(shell if grep LISP_FEATURE_GENCGC genesis/config.h \ - > /dev/null 2>&1; \ - then echo "gencgc.c"; \ - else echo "cheneygc.c" ; fi) +ifdef LISP_FEATURE_GENCGC + GC_SRC = "gencgc.c" +else + GC_SRC = "cheneygc.c" +endif .PHONY: after-grovel-headers diff --git a/src/runtime/Config.ppc-linux b/src/runtime/Config.ppc-linux index cce5c4c..a18c813 100644 --- a/src/runtime/Config.ppc-linux +++ b/src/runtime/Config.ppc-linux @@ -19,10 +19,11 @@ ARCH_SRC = ppc-arch.c OS_SRC = linux-os.c ppc-linux-os.c OS_LIBS = -ldl -GC_SRC = $(shell if grep LISP_FEATURE_GENCGC genesis/config.h \ - > /dev/null 2>&1; \ - then echo "gencgc.c"; \ - else echo "cheneygc.c" ; fi) +ifdef LISP_FEATURE_GENCGC + GC_SRC = "gencgc.c" +else + GC_SRC = "cheneygc.c" +endif # Nothing to do for after-grovel-headers. .PHONY: after-grovel-headers diff --git a/src/runtime/Config.x86-freebsd b/src/runtime/Config.x86-freebsd index 423dc5a..d3f9a27 100644 --- a/src/runtime/Config.x86-freebsd +++ b/src/runtime/Config.x86-freebsd @@ -18,6 +18,7 @@ ASSEM_SRC += ldso-stubs.S # dlopen() etc., which in turn depend on dynamic linking of the # runtime. LINKFLAGS += -dynamic -export-dynamic -LINKFLAGS += $(shell if grep LISP_FEATURE_SB_THREAD genesis/config.h \ - > /dev/null 2>&1; \ - then echo "-lpthread"; fi) + +ifdef LISP_FEATURE_SB_THREAD + OS_LIBS += -lpthread +endif diff --git a/src/runtime/Config.x86-linux b/src/runtime/Config.x86-linux index 28ab484..d64a779 100644 --- a/src/runtime/Config.x86-linux +++ b/src/runtime/Config.x86-linux @@ -30,14 +30,13 @@ OS_SRC = linux-os.c x86-linux-os.c LINKFLAGS += -Wl,--export-dynamic OS_LIBS = -ldl -CFLAGS += $(shell if grep LISP_FEATURE_LARGEFILE genesis/config.h \ - > /dev/null 2>&1; \ - then echo "-D_LARGEFILE_SOURCE -D_LARGEFILE64_SOURCE \ - -D_FILE_OFFSET_BITS=64"; fi) - -OS_LIBS += $(shell if grep LISP_FEATURE_SB_THREAD genesis/config.h \ - > /dev/null 2>&1; \ - then echo "-lpthread"; fi) +ifdef LISP_FEATURE_LARGEFILE + CFLAGS += -D_LARGEFILE_SOURCE -D_LARGEFILE64_SOURCE -D_FILE_OFFSET_BITS=64 +endif + +ifdef LISP_FEATURE_SB_THREAD + OS_LIBS += -lpthread +endif GC_SRC = gencgc.c diff --git a/src/runtime/Config.x86_64-linux b/src/runtime/Config.x86_64-linux index a615c96..98d9787 100644 --- a/src/runtime/Config.x86_64-linux +++ b/src/runtime/Config.x86_64-linux @@ -30,9 +30,9 @@ OS_SRC = linux-os.c x86-64-linux-os.c LINKFLAGS += -Wl,--export-dynamic OS_LIBS = -ldl -OS_LIBS += $(shell if grep LISP_FEATURE_SB_THREAD genesis/config.h \ - > /dev/null 2>&1; \ - then echo "-lpthread"; fi) +ifdef LISP_FEATURE_SB_THREAD + OS_LIBS += -lpthread +endif CFLAGS += -fno-omit-frame-pointer diff --git a/src/runtime/GNUmakefile b/src/runtime/GNUmakefile index fa764d4..44a2c3a 100644 --- a/src/runtime/GNUmakefile +++ b/src/runtime/GNUmakefile @@ -27,6 +27,9 @@ CFLAGS = -g -Wall -O3 ASFLAGS = $(CFLAGS) CPPFLAGS = -I. +# Give make access to the target Lisp features. +include genesis/Makefile.features + # The Config file is the preferred place for tweaking options which # are appropriate for particular setups (OS, ARCH, whatever). Make a # Config-foo file for setup foo, then arrange for Config to be a @@ -35,7 +38,6 @@ CPPFLAGS = -I. # OS_SRC, OS_LIBS, OS_OBJS, OS_CLEAN_FILES include Config - COMMON_SRC = alloc.c backtrace.c breakpoint.c coreparse.c \ dynbind.c gc-common.c globals.c interr.c interrupt.c largefile.c \ monitor.c os-common.c parse.c print.c purify.c pthread-lutex.c \ diff --git a/tools-for-build/Makefile b/tools-for-build/Makefile index cbc8201..2f10a8b 100644 --- a/tools-for-build/Makefile +++ b/tools-for-build/Makefile @@ -7,6 +7,7 @@ # provided with absolutely no warranty. See the COPYING and CREDITS # files for more information. +-include genesis/Makefile.features -include Config CPPFLAGS:=-I../src/runtime diff --git a/version.lisp-expr b/version.lisp-expr index 009bd43..7c496ca 100644 --- a/version.lisp-expr +++ b/version.lisp-expr @@ -17,4 +17,4 @@ ;;; checkins which aren't released. (And occasionally for internal ;;; versions, especially for internal versions off the main CVS ;;; branch, it gets hairier, e.g. "0.pre7.14.flaky4.13".) -"0.9.18.48" +"0.9.18.49" -- 1.7.10.4