From c51851cfb8c10868cfca4d103d56053d7c953400 Mon Sep 17 00:00:00 2001 From: nishi Date: Thu, 16 May 2024 23:31:53 +0000 Subject: [PATCH] better platform git-svn-id: file:///raid/svn-main/nishi-dataworks/trunk@10 d4a5a174-5a4a-5b4b-b672-37683c10d7d5 --- GNUmakefile | 4 +++- Library/Makefile | 2 +- Library/dataworks.c | 9 +++++---- Makefile | 4 +++- 4 files changed, 12 insertions(+), 7 deletions(-) diff --git a/GNUmakefile b/GNUmakefile index 74060d3..56b9446 100644 --- a/GNUmakefile +++ b/GNUmakefile @@ -6,12 +6,14 @@ LIBS = LIB_PREFIX = lib LIB_SUFFIX = .so EXEC_SUFFIX = +PLATFORM_M = `uname -m` +PLATFORM_P = `uname -p` ifneq ("$(PLATFORM)", "") include Platforms/$(PLATFORM).mk endif -COMPILE_FLAGS = CC="$(CC)" CFLAGS="$(CFLAGS)" LDFLAGS="$(LDFLAGS)" LIBS="$(LIBS)" LIB_PREFIX="$(LIB_PREFIX)" LIB_SUFFIX="$(LIB_SUFFIX)" EXEC_SUFFIX="$(EXEC_SUFFIX)" +COMPILE_FLAGS = CC="$(CC)" CFLAGS="$(CFLAGS)" LDFLAGS="$(LDFLAGS)" LIBS="$(LIBS)" LIB_PREFIX="$(LIB_PREFIX)" LIB_SUFFIX="$(LIB_SUFFIX)" EXEC_SUFFIX="$(EXEC_SUFFIX)" PLATFORM_M="$(PLATFORM_M)" PLATFORM_P="$(PLATFORM_P)" .PHONY: all no-doc replace format clean ./Library ./Client ./Document diff --git a/Library/Makefile b/Library/Makefile index 390ab50..dd91494 100644 --- a/Library/Makefile +++ b/Library/Makefile @@ -11,7 +11,7 @@ $(LIB_PREFIX)dataworks$(LIB_SUFFIX): $(OBJS) $(CC) -shared $(LDFLAGS) -o $@ $(OBJS) $(LIBS) .c.o: - $(CC) $(CFLAGS) -fPIC -c -o $@ $< + $(CC) $(CFLAGS) -DPLATFORM_M=\"$(PLATFORM_M)\" -DPLATFORM_P=\"$(PLATFORM_P)\" -fPIC -c -o $@ $< clean: rm -f *.o *.so *.dll diff --git a/Library/dataworks.c b/Library/dataworks.c index eab3582..899d43e 100644 --- a/Library/dataworks.c +++ b/Library/dataworks.c @@ -32,14 +32,15 @@ const char* dataworks_version = "0.0.0"; const char* dataworks_compile_date = __DATE__; #if defined(__MINGW32__) -const char* dataworks_platform = "Windows"; +const char* dataworks_platform = "Windows/" #elif defined(__NetBSD__) -const char* dataworks_platform = "NetBSD"; +const char* dataworks_platform = "NetBSD/" #elif defined(__linux__) -const char* dataworks_platform = "Linux"; +const char* dataworks_platform = "Linux/" #else -const char* dataworks_platform = "Unknown"; +const char* dataworks_platform = "Unknown/" #endif +PLATFORM_M " (" PLATFORM_P ")"; const char* dataworks_get_version(void) { return dataworks_version; } const char* dataworks_get_compile_date(void) { return dataworks_compile_date; } diff --git a/Makefile b/Makefile index d6da39d..be92580 100644 --- a/Makefile +++ b/Makefile @@ -6,12 +6,14 @@ LIBS = LIB_PREFIX = lib LIB_SUFFIX = .so EXEC_SUFFIX = +PLATFORM_M = `uname -m` +PLATFORM_P = `uname -p` .if "$(PLATFORM)" != "" .include Platforms/$(PLATFORM).mk .endif -COMPILE_FLAGS = CC="$(CC)" CFLAGS="$(CFLAGS)" LDFLAGS="$(LDFLAGS)" LIBS="$(LIBS)" LIB_PREFIX="$(LIB_PREFIX)" LIB_SUFFIX="$(LIB_SUFFIX)" EXEC_SUFFIX="$(EXEC_SUFFIX)" +COMPILE_FLAGS = CC="$(CC)" CFLAGS="$(CFLAGS)" LDFLAGS="$(LDFLAGS)" LIBS="$(LIBS)" LIB_PREFIX="$(LIB_PREFIX)" LIB_SUFFIX="$(LIB_SUFFIX)" EXEC_SUFFIX="$(EXEC_SUFFIX)" PLATFORM_M="$(PLATFORM_M)" PLATFORM_P="$(PLATFORM_P)" .PHONY: all no-doc replace format clean ./Library ./Client ./Document -- 2.43.0