From 5ee5fafc3fdd1ab4691dfc96fc188f0fbc24ae01 Mon Sep 17 00:00:00 2001 From: Christophe de Dinechin Date: Wed, 3 May 2017 14:47:18 +0200 Subject: [PATCH] Some factorization --- Makefile | 3 ++- config.gnu.mk | 9 ++++++--- config.h | 1 + 3 files changed, 9 insertions(+), 4 deletions(-) diff --git a/Makefile b/Makefile index a8554ae..7060309 100644 --- a/Makefile +++ b/Makefile @@ -37,7 +37,8 @@ CONFIG= HAVE_ \ HAVE_ \ HAVE_clearenv \ HAVE_libm \ - HAVE_liboony + HAVE_liboony \ + HAVE_sbrk # Define what to test TESTS=product count-characters diff --git a/config.gnu.mk b/config.gnu.mk index bfde89c..e976fa0 100644 --- a/config.gnu.mk +++ b/config.gnu.mk @@ -84,6 +84,9 @@ AS_DEPEND= $(CC) $(CPPFLAGS) $(CPPFLAGS_$*) -MM -MP -MF $@ -MT $(@:.d=) $< # Configuration checks #------------------------------------------------------------------------------ -CC_CONFIG= mkdir -p "$$(dirname "$@")" ; echo '\#define HAVE_$*_H' $$($(CC) $(CFLAGS) $(CFLAGS_CONFIG_$*) "$<" -o "$<".exe > "$<".err 2>&1 && "$<".exe && echo 1 || echo 0) | tr '[:lower:]' '[:upper:]' | sed -e 's|[^[:alnum:]]|_|g' -e 's|_DEFINE_\(.*\)_0|/* \#undef \1 */|g' -e 's|_DEFINE_\(.*\)_1|\#define \1 1|g' > "$@" -CXX_CONFIG= mkdir -p "$$(dirname "$@")" ; echo '\#define HAVE_$*' $$($(CXX) $(CXXFLAGS) $(CXXFLAGS_CONFIG_$*) "$<" -o "$<".exe > "$<".err 2>&1 && "$<".exe && echo 1 || echo 0) | tr '[:lower:]' '[:upper:]' | sed -e 's|[^[:alnum:]]|_|g' -e 's|_DEFINE_\(.*\)_0|/* \#undef \1 */|g' -e 's|_DEFINE_\(.*\)_1|\#define \1 1|g' > "$@" -LIB_CONFIG= mkdir -p "$$(dirname "$@")" ; echo '\#define HAVE_LIB$*' $$($(CC) $(CCFLAGS) $(CXXFLAGS_CONFIG_$*) -l$* "$<" -o "$<".exe > "$<".err 2>&1 && "$<".exe && echo 1 || echo 0) | tr '[:lower:]' '[:upper:]' | sed -e 's|[^[:alnum:]]|_|g' -e 's|_DEFINE_\(.*\)_0|/* \#undef \1 */|g' -e 's|_DEFINE_\(.*\)_1|\#define \1 1|g' > "$@" +CONFIG_UPPER=$(shell echo -n "$*" | tr '[:lower:]' '[:upper:]' | tr -c '[:alnum:]' '_') +CONFIG_FLAGS=$(shell grep '// [A-Z]*FLAGS=' "$<" | sed -e 's|// [A-Z]*FLAGS=||g') + +CC_CONFIG= mkdir -p "$$(dirname "$@")" ; echo '\#define' HAVE_$(CONFIG_UPPER)_H $(shell $(CC) $(CFLAGS) $(CFLAGS_CONFIG_$*) $(CONFIG_FLAGS) "$<" -o "$<".exe > "$<".err 2>&1 && "$<".exe > "$<".out 2>&1 && echo 1 || echo 0) | sed -e 's|\#define \(.*\) 0|/* \#undef \1 */|g' > "$@" +CXX_CONFIG= mkdir -p "$$(dirname "$@")" ; echo '\#define' HAVE_$(CONFIG_UPPER) $(shell $(CXX) $(CXXFLAGS) $(CXXFLAGS_CONFIG_$*) $(CONFIG_FLAGS) "$<" -o "$<".exe > "$<".err 2>&1 && "$<".exe > "$<".out 2>&1 && echo 1 || echo 0) | sed -e 's|\#define \(.*\) 0|/* \#undef \1 */|g' > "$@" +LIB_CONFIG= mkdir -p "$$(dirname "$@")" ; echo '\#define HAVE_LIB'$(CONFIG_UPPER) $$($(CC) $(CCFLAGS) $(CFLAGS_CONFIG_$*) -l$* "$<" -o "$<".exe > "$<".err 2>&1 && "$<".exe && echo 1 || echo 0) | sed -e 's|\#define \(.*\) 0|/* \#undef \1 */|g' > "$@" diff --git a/config.h b/config.h index 85ff58a..8916b0d 100644 --- a/config.h +++ b/config.h @@ -7,3 +7,4 @@ /* #undef HAVE_CLEARENV_H */ #define HAVE_LIBM 1 /* #undef HAVE_LIBOONY */ +#define HAVE_SBRK_H 1