From 7de22b92399504daf951c830b3b0d7d7cffc3d9f Mon Sep 17 00:00:00 2001 From: Andreas Baumann Date: Mon, 7 Dec 2009 19:55:42 +0100 Subject: moved makefiles --- makefiles/clean.mk | 35 ---------- makefiles/compiler.mk | 158 -------------------------------------------- makefiles/depend.mk | 30 --------- makefiles/gmake/clean.mk | 35 ++++++++++ makefiles/gmake/compiler.mk | 158 ++++++++++++++++++++++++++++++++++++++++++++ makefiles/gmake/depend.mk | 30 +++++++++ makefiles/gmake/guess_env | 106 +++++++++++++++++++++++++++++ makefiles/gmake/platform.mk | 34 ++++++++++ makefiles/gmake/sub.mk | 25 +++++++ makefiles/gmake/top.mk | 30 +++++++++ makefiles/guess_env | 106 ----------------------------- makefiles/platform.mk | 34 ---------- makefiles/sub.mk | 25 ------- makefiles/top.mk | 30 --------- 14 files changed, 418 insertions(+), 418 deletions(-) delete mode 100644 makefiles/clean.mk delete mode 100644 makefiles/compiler.mk delete mode 100644 makefiles/depend.mk create mode 100644 makefiles/gmake/clean.mk create mode 100644 makefiles/gmake/compiler.mk create mode 100644 makefiles/gmake/depend.mk create mode 100755 makefiles/gmake/guess_env create mode 100644 makefiles/gmake/platform.mk create mode 100644 makefiles/gmake/sub.mk create mode 100644 makefiles/gmake/top.mk delete mode 100755 makefiles/guess_env delete mode 100644 makefiles/platform.mk delete mode 100644 makefiles/sub.mk delete mode 100644 makefiles/top.mk (limited to 'makefiles') diff --git a/makefiles/clean.mk b/makefiles/clean.mk deleted file mode 100644 index efeef68..0000000 --- a/makefiles/clean.mk +++ /dev/null @@ -1,35 +0,0 @@ -# cleans up directories -# -# requires: -# - BINS, OBJS, CPPOBJS, BIN_OBJS -# - CMODULES, CPPMODULES -# - SUBDIRS -# -# provides: -# - target: clean -# - target: distclean - -.PHONY: clean_recursive clean local_clean - -clean_recursive: - @test -z "$(SUBDIRS)" || ( set -e; for d in $(SUBDIRS)""; do \ - (set -e; $(MAKE) -C $$d clean || exit 1); done) - -clean: clean_recursive local_clean - -@rm *.bak 2>/dev/null - -@rm *~ 2>/dev/null - -@rm *.d port/*.d 2>/dev/null - -@rm $(BINS) $(CPP_BINS) 2>/dev/null - -@rm $(OBJS) $(CPPOBJS) $(BIN_OBJS) $(CPP_BIN_OBJS) 2>/dev/null - -@rm exec/* - -@rm *.core - -@rm $(CMODULES) $(CPPMODULES) - -@rm $(CMODULES .o=.d) $(CPPMODULES .o=.d) - -.PHONY: distclean_recursive distclean local_distclean - -distclean_recursive: - @test -z "$(SUBDIRS)" || ( set -e; for d in $(SUBDIRS)""; do \ - (set -e; $(MAKE) -C $$d distclean || exit 1); done) - -distclean: distclean_recursive local_distclean clean diff --git a/makefiles/compiler.mk b/makefiles/compiler.mk deleted file mode 100644 index 4f93160..0000000 --- a/makefiles/compiler.mk +++ /dev/null @@ -1,158 +0,0 @@ -# sets compiler settings -# -# requires: -# - INCLUDE_DIRS -# -# provides: -# - BIN_OBJS: the object files we need for the binaries (containing the main) -# - -# -Wswitch-default: not good for switches with enums -# -Wsystem-headers: bad idea, as header files are usually happily broken :-) -# -Wtraditional: we don't want to program tradition K&R C anymore! -# -Wunsafe-loop-optimizations: ?? -# -Wno-attributes, -Wmissing-format-attribute: ?? later -# -Wpacked -Wpadded: ?? very questionable -# -Wunreachable-code: doesn't work -# -Wno-div-by-zero: we get NaN and friend over macros, so need for funny tricks :-) -# -Wstrict-overflow=5 is relatively new, later maybe -# -fstack-protector or -fstack-protector-all: should be used, but U -# have currently big problems to get it around compiler gcc and -lssl -# probing! FIXME later -# -fstack-protector-all: does something funny to the shared objects.. -# -Wstack-protector makes no sense without SSP -# everything implied by -Wall is not explicitly specified (gcc 4.2.3) -# -Waggregate-return: is for K&R code and mostly useless nowadays -# -funit-at-a-time: TODO check first gcc version it appears - -# compilation flags and compilers -COMMON_COMPILE_FLAGS = \ - -g -D_REENTRANT \ - -fstrict-aliasing \ - -pedantic -Wall -Werror \ - -Wunused -Wno-import \ - -Wformat -Wformat-y2k -Wformat-nonliteral -Wformat-security -Wformat-y2k \ - -Wswitch-enum -Wunknown-pragmas -Wfloat-equal \ - -Wundef -Wshadow -Wpointer-arith \ - -Wcast-qual -Wcast-align \ - -Wwrite-strings -Wconversion \ - -Wmissing-noreturn \ - -Wno-multichar -Wparentheses -Wredundant-decls \ - -Winline \ - -Wdisabled-optimization \ - $(INCLUDE_DIRS) - -ifeq "$(GCC_MAJOR_VERSION)" "4" -COMMON_COMPILE_FLAGS += \ - -Wfatal-errors -Wmissing-include-dirs -Wvariadic-macros \ - -Wvolatile-register-var \ - -Wstrict-aliasing=2 -Wextra -Winit-self -endif - -ifeq "$(GCC_MAJOR_VERSION)" "3" - -# gcc 3.3, testend on OpenBSD 4.2 -ifeq "$(GCC_MINOR_VERSION)" "3" -COMMON_COMPILE_FLAGS += \ - -W -endif - -# gcc 3.4, not tested yet -ifeq "$(GCC_MINOR_VERSION)" "4" -COMMON_COMPILE_FLAGS += \ - -Wstrict-aliasing=2 -Wextra -Winit-self -endif - -endif - -COMPILE_FLAGS = \ - $(COMMON_COMPILE_FLAGS) \ - -std=c99 \ - -Wnonnull \ - -Wbad-function-cast -Wstrict-prototypes \ - -Wmissing-prototypes -Wmissing-declarations \ - -Wnested-externs - -# gcc 4.x -ifeq "$(GCC_MAJOR_VERSION)" "4" -COMPILE_FLAGS += \ - -Wc++-compat -Wdeclaration-after-statement -Wold-style-definition -endif - -ifeq "$(GCC_MAJOR_VERSION)" "3" - -# gcc 3.4, not tested yet -ifeq "$(GCC_MINOR_VERSION)" "4" -COMPILE_FLAGS += \ - -Wdeclaration-after-statement -Wold-style-definition -endif - -# gcc 3.3, testend on OpenBSD 4.2 -ifeq "$(GCC_MINOR_VERSION)" "3" -#COMPILE_FLAGS += \ -# -Wdeclaration-after-statement -endif - - -endif - -CCPP_COMPILE_FLAGS = \ - $(COMMON_COMPILE_FLAGS) \ - -std=c++98 - -# gcc 4.x -ifeq "$(GCC_MAJOR_VERSION)" "4" -CCPP_COMPILE_FLAGS += \ - -Wno-invalid-offsetof \ - -funit-at-a-time -endif - -ifeq "$(GCC_MAJOR_VERSION)" "3" - -# gcc 3.4, not tested yet -ifeq "$(GCC_MINOR_VERSION)" "4" -CCPP_COMPILE_FLAGS += \ - -Wno-invalid-offsetof -endif - -# gcc 3.3, testend on OpenBSD 4.2 -ifeq "$(GCC_MINOR_VERSION)" "3" -#CCPP_COMPILE_FLAGS += \ -# -Wdeclaration-after-statement -endif - -endif - -CFLAGS = $(COMPILE_FLAGS) $(PLATFORM_COMPILE_FLAGS) $(DEBUGLEVELFLAGS) -CCPPFLAGS = $(CCPP_COMPILE_FLAGS) $(PLATFORM_COMPILE_FLAGS) $(DEBUGLEVELFLAGS) -CC = gcc -CCPP = g++ - -LDFLAGS = $(LDFLAGS_DIR) -LIBS = $(LIBS_DL) $(LIBS_SSP) $(LIBS_DIR) -LINK = $(CC) -CCPP_LINK = $(CCPP) - -%.o : %.c - $(CC) -c -o $@ $(CFLAGS) $< - -%.o : %.cpp - $(CCPP) -c -o $@ $(CCPPFLAGS) $< - -%$(EXE): %.o $(OBJS) - $(CCPP_LINK) -o $@ $(LIBS) $(OBJS) $< - -%.sho : %.c - $(CC) -c -o $@ -fPIC -DSHARED $(CFLAGS) $< - -%$(SO) : %.sho $(OBJS) - $(LINK) -shared -o $@ $(LDFLAGS) $(LIBS) $(OBJS) $< - -%.sho++ : %.cpp - $(CCPP) -c -o $@ -fPIC -DSHARED $(CCPPFLAGS) $< - -%$(SO) : %.sho++ $(OBJS) $(CPPOBJS) - $(CCPP_LINK) -shared -o $@ $(LDFLAGS) $(LIBS) $(OBJS) $(CPPOBJS) $< - -BIN_OBJS = $(BINS:$(EXE)=.o) -CPP_BIN_OBJS = $(CPP_BINS:$(EXE)=.o) diff --git a/makefiles/depend.mk b/makefiles/depend.mk deleted file mode 100644 index bd49fe1..0000000 --- a/makefiles/depend.mk +++ /dev/null @@ -1,30 +0,0 @@ -# provides generic rules for C/C++ dependeny generation using -# 'makedepend', 'gcc -MM' or similar mechanisms -# -# requires: -# - compilers CC and CCPP -# - INCLUDEDIRS -# - OBJS, CPP_OBJS and BIN_OBJS -# -# provides: -# - included dependency files -# -# author: Andreas Baumann, abaumann at yahoo dot com - -MAKEDEPEND = $(CC) -MM $(INCLUDE_DIRS) -CCPP_MAKEDEPEND = $(CCPP) -MM $(INCLUDE_DIRS) - -%.d : %.c - @echo Generating dependencies for $< - @$(MAKEDEPEND) $(CFLAGS) $< | \ - sed "s,\($*\.o\)[ :]*\(.*\),$@ : $$\(wildcard \2\)\&\&\&\1 : \2,g" | tr -s '&' "\n" > $@ - -%.d : %.cpp - @echo Generating dependencies for $< - @$(CCPP_MAKEDEPEND) $(CCPPFLAGS) $< | \ - sed "s,\($*\.o\)[ :]*\(.*\),$@ : $$\(wildcard \2\)\&\&\&\1 : \2,g" | tr -s '&' "\n" > $@ - --include $(OBJS:.o=.d) --include $(CPP_OBJS:.o=.d) --include $(BIN_OBJS:.o=.d) --include $(CPP_BIN_OBJS:.o=.d) diff --git a/makefiles/gmake/clean.mk b/makefiles/gmake/clean.mk new file mode 100644 index 0000000..efeef68 --- /dev/null +++ b/makefiles/gmake/clean.mk @@ -0,0 +1,35 @@ +# cleans up directories +# +# requires: +# - BINS, OBJS, CPPOBJS, BIN_OBJS +# - CMODULES, CPPMODULES +# - SUBDIRS +# +# provides: +# - target: clean +# - target: distclean + +.PHONY: clean_recursive clean local_clean + +clean_recursive: + @test -z "$(SUBDIRS)" || ( set -e; for d in $(SUBDIRS)""; do \ + (set -e; $(MAKE) -C $$d clean || exit 1); done) + +clean: clean_recursive local_clean + -@rm *.bak 2>/dev/null + -@rm *~ 2>/dev/null + -@rm *.d port/*.d 2>/dev/null + -@rm $(BINS) $(CPP_BINS) 2>/dev/null + -@rm $(OBJS) $(CPPOBJS) $(BIN_OBJS) $(CPP_BIN_OBJS) 2>/dev/null + -@rm exec/* + -@rm *.core + -@rm $(CMODULES) $(CPPMODULES) + -@rm $(CMODULES .o=.d) $(CPPMODULES .o=.d) + +.PHONY: distclean_recursive distclean local_distclean + +distclean_recursive: + @test -z "$(SUBDIRS)" || ( set -e; for d in $(SUBDIRS)""; do \ + (set -e; $(MAKE) -C $$d distclean || exit 1); done) + +distclean: distclean_recursive local_distclean clean diff --git a/makefiles/gmake/compiler.mk b/makefiles/gmake/compiler.mk new file mode 100644 index 0000000..4f93160 --- /dev/null +++ b/makefiles/gmake/compiler.mk @@ -0,0 +1,158 @@ +# sets compiler settings +# +# requires: +# - INCLUDE_DIRS +# +# provides: +# - BIN_OBJS: the object files we need for the binaries (containing the main) +# + +# -Wswitch-default: not good for switches with enums +# -Wsystem-headers: bad idea, as header files are usually happily broken :-) +# -Wtraditional: we don't want to program tradition K&R C anymore! +# -Wunsafe-loop-optimizations: ?? +# -Wno-attributes, -Wmissing-format-attribute: ?? later +# -Wpacked -Wpadded: ?? very questionable +# -Wunreachable-code: doesn't work +# -Wno-div-by-zero: we get NaN and friend over macros, so need for funny tricks :-) +# -Wstrict-overflow=5 is relatively new, later maybe +# -fstack-protector or -fstack-protector-all: should be used, but U +# have currently big problems to get it around compiler gcc and -lssl +# probing! FIXME later +# -fstack-protector-all: does something funny to the shared objects.. +# -Wstack-protector makes no sense without SSP +# everything implied by -Wall is not explicitly specified (gcc 4.2.3) +# -Waggregate-return: is for K&R code and mostly useless nowadays +# -funit-at-a-time: TODO check first gcc version it appears + +# compilation flags and compilers +COMMON_COMPILE_FLAGS = \ + -g -D_REENTRANT \ + -fstrict-aliasing \ + -pedantic -Wall -Werror \ + -Wunused -Wno-import \ + -Wformat -Wformat-y2k -Wformat-nonliteral -Wformat-security -Wformat-y2k \ + -Wswitch-enum -Wunknown-pragmas -Wfloat-equal \ + -Wundef -Wshadow -Wpointer-arith \ + -Wcast-qual -Wcast-align \ + -Wwrite-strings -Wconversion \ + -Wmissing-noreturn \ + -Wno-multichar -Wparentheses -Wredundant-decls \ + -Winline \ + -Wdisabled-optimization \ + $(INCLUDE_DIRS) + +ifeq "$(GCC_MAJOR_VERSION)" "4" +COMMON_COMPILE_FLAGS += \ + -Wfatal-errors -Wmissing-include-dirs -Wvariadic-macros \ + -Wvolatile-register-var \ + -Wstrict-aliasing=2 -Wextra -Winit-self +endif + +ifeq "$(GCC_MAJOR_VERSION)" "3" + +# gcc 3.3, testend on OpenBSD 4.2 +ifeq "$(GCC_MINOR_VERSION)" "3" +COMMON_COMPILE_FLAGS += \ + -W +endif + +# gcc 3.4, not tested yet +ifeq "$(GCC_MINOR_VERSION)" "4" +COMMON_COMPILE_FLAGS += \ + -Wstrict-aliasing=2 -Wextra -Winit-self +endif + +endif + +COMPILE_FLAGS = \ + $(COMMON_COMPILE_FLAGS) \ + -std=c99 \ + -Wnonnull \ + -Wbad-function-cast -Wstrict-prototypes \ + -Wmissing-prototypes -Wmissing-declarations \ + -Wnested-externs + +# gcc 4.x +ifeq "$(GCC_MAJOR_VERSION)" "4" +COMPILE_FLAGS += \ + -Wc++-compat -Wdeclaration-after-statement -Wold-style-definition +endif + +ifeq "$(GCC_MAJOR_VERSION)" "3" + +# gcc 3.4, not tested yet +ifeq "$(GCC_MINOR_VERSION)" "4" +COMPILE_FLAGS += \ + -Wdeclaration-after-statement -Wold-style-definition +endif + +# gcc 3.3, testend on OpenBSD 4.2 +ifeq "$(GCC_MINOR_VERSION)" "3" +#COMPILE_FLAGS += \ +# -Wdeclaration-after-statement +endif + + +endif + +CCPP_COMPILE_FLAGS = \ + $(COMMON_COMPILE_FLAGS) \ + -std=c++98 + +# gcc 4.x +ifeq "$(GCC_MAJOR_VERSION)" "4" +CCPP_COMPILE_FLAGS += \ + -Wno-invalid-offsetof \ + -funit-at-a-time +endif + +ifeq "$(GCC_MAJOR_VERSION)" "3" + +# gcc 3.4, not tested yet +ifeq "$(GCC_MINOR_VERSION)" "4" +CCPP_COMPILE_FLAGS += \ + -Wno-invalid-offsetof +endif + +# gcc 3.3, testend on OpenBSD 4.2 +ifeq "$(GCC_MINOR_VERSION)" "3" +#CCPP_COMPILE_FLAGS += \ +# -Wdeclaration-after-statement +endif + +endif + +CFLAGS = $(COMPILE_FLAGS) $(PLATFORM_COMPILE_FLAGS) $(DEBUGLEVELFLAGS) +CCPPFLAGS = $(CCPP_COMPILE_FLAGS) $(PLATFORM_COMPILE_FLAGS) $(DEBUGLEVELFLAGS) +CC = gcc +CCPP = g++ + +LDFLAGS = $(LDFLAGS_DIR) +LIBS = $(LIBS_DL) $(LIBS_SSP) $(LIBS_DIR) +LINK = $(CC) +CCPP_LINK = $(CCPP) + +%.o : %.c + $(CC) -c -o $@ $(CFLAGS) $< + +%.o : %.cpp + $(CCPP) -c -o $@ $(CCPPFLAGS) $< + +%$(EXE): %.o $(OBJS) + $(CCPP_LINK) -o $@ $(LIBS) $(OBJS) $< + +%.sho : %.c + $(CC) -c -o $@ -fPIC -DSHARED $(CFLAGS) $< + +%$(SO) : %.sho $(OBJS) + $(LINK) -shared -o $@ $(LDFLAGS) $(LIBS) $(OBJS) $< + +%.sho++ : %.cpp + $(CCPP) -c -o $@ -fPIC -DSHARED $(CCPPFLAGS) $< + +%$(SO) : %.sho++ $(OBJS) $(CPPOBJS) + $(CCPP_LINK) -shared -o $@ $(LDFLAGS) $(LIBS) $(OBJS) $(CPPOBJS) $< + +BIN_OBJS = $(BINS:$(EXE)=.o) +CPP_BIN_OBJS = $(CPP_BINS:$(EXE)=.o) diff --git a/makefiles/gmake/depend.mk b/makefiles/gmake/depend.mk new file mode 100644 index 0000000..bd49fe1 --- /dev/null +++ b/makefiles/gmake/depend.mk @@ -0,0 +1,30 @@ +# provides generic rules for C/C++ dependeny generation using +# 'makedepend', 'gcc -MM' or similar mechanisms +# +# requires: +# - compilers CC and CCPP +# - INCLUDEDIRS +# - OBJS, CPP_OBJS and BIN_OBJS +# +# provides: +# - included dependency files +# +# author: Andreas Baumann, abaumann at yahoo dot com + +MAKEDEPEND = $(CC) -MM $(INCLUDE_DIRS) +CCPP_MAKEDEPEND = $(CCPP) -MM $(INCLUDE_DIRS) + +%.d : %.c + @echo Generating dependencies for $< + @$(MAKEDEPEND) $(CFLAGS) $< | \ + sed "s,\($*\.o\)[ :]*\(.*\),$@ : $$\(wildcard \2\)\&\&\&\1 : \2,g" | tr -s '&' "\n" > $@ + +%.d : %.cpp + @echo Generating dependencies for $< + @$(CCPP_MAKEDEPEND) $(CCPPFLAGS) $< | \ + sed "s,\($*\.o\)[ :]*\(.*\),$@ : $$\(wildcard \2\)\&\&\&\1 : \2,g" | tr -s '&' "\n" > $@ + +-include $(OBJS:.o=.d) +-include $(CPP_OBJS:.o=.d) +-include $(BIN_OBJS:.o=.d) +-include $(CPP_BIN_OBJS:.o=.d) diff --git a/makefiles/gmake/guess_env b/makefiles/gmake/guess_env new file mode 100755 index 0000000..f11ef5a --- /dev/null +++ b/makefiles/gmake/guess_env @@ -0,0 +1,106 @@ +#!/bin/sh + +UNAME_SYSTEM=`(uname -s) 2>/dev/null` +UNAME_RELEASE=`(uname -r) 2>/dev/null` +UNAME_VERSION=`(uname -v) 2>/dev/null` +UNAME_MACHINE=`(uname -m) 2>/dev/null` + +# operating system and major, minor version, more should not be necessary +case "$UNAME_SYSTEM.$UNAME_RELEASE" in + Linux*) PLATFORM=LINUX + OS_MAJOR_VERSION=`echo $UNAME_RELEASE | cut -d . -f 1` + OS_MINOR_VERSION=`echo $UNAME_RELEASE | cut -d . -f 2` + LIBS_DL='-ldl' + ;; + + FreeBSD*) PLATFORM=FREEBSD + OS_MAJOR_VERSION=`echo $UNAME_RELEASE | cut -d . -f 1` + OS_MINOR_VERSION=`echo $UNAME_RELEASE | cut -d . -f 2 | cut -d - -f 1` + LIBS_DL= + LIBS_SSP= + ;; + + OpenBSD*) PLATFORM=OPENBSD + OS_MAJOR_VERSION=`echo $UNAME_RELEASE | cut -d . -f 1` + OS_MINOR_VERSION=`echo $UNAME_RELEASE | cut -d . -f 2 | cut -d - -f 1` + LIBS_DL= + LIBS_SSP= + ;; + + SunOS*) PLATFORM=SUNOS + OS_MAJOR_VERSION=`echo $UNAME_RELEASE | cut -d . -f 1` + OS_MINOR_VERSION=`echo $UNAME_RELEASE | cut -d . -f 2` + LIBS_DL='-ldl' + LIBS_SSP= + ;; + + CYGWIN_NT*) PLATFORM=CYGWIN + _tmp=`echo $UNAME_SYSTEM | cut -d - -f 2` + OS_MAJOR_VERSION=`echo $_tmp | cut -d . -f 1` + OS_MINOR_VERSION=`echo $_tmp | cut -d . -f 2` + LIBS_SSP= + ;; + + *) + PLATFORM=UNKNOWN + echo "Unknown platform '$UNAME_SYSTEM#$UNAME_RELEASE'" + exit 1 +esac + +# the architecture +case "$UNAME_MACHINE" in + i*86*) ARCH=x86 + ;; + + sun4u) ARCH=sun4u + ;; + + *) ARCH=UNKNOWN + echo "Unknown architecture '$UNAME_MACHINE'" + exit 1 + +esac + +# the compiler and version +GCC_VERSION=`gcc -dumpversion` +GCC_MAJOR_VERSION=`echo $GCC_VERSION | cut -d . -f 1` +GCC_MINOR_VERSION=`echo $GCC_VERSION | cut -d . -f 2` + +case "$1" in + --platform) echo $PLATFORM + ;; + + --os-major-version) echo $OS_MAJOR_VERSION + ;; + + --os-minor-version) echo $OS_MINOR_VERSION + ;; + + --arch) echo $ARCH + ;; + + --libs-dl) echo $LIBS_DL + ;; + + --libs-ssl) echo $LIBS_SSL + ;; + + --gcc-major-version) echo $GCC_MAJOR_VERSION + ;; + + --gcc-minor-version) echo $GCC_MINOR_VERSION + ;; + + *) + cat </dev/null` -UNAME_RELEASE=`(uname -r) 2>/dev/null` -UNAME_VERSION=`(uname -v) 2>/dev/null` -UNAME_MACHINE=`(uname -m) 2>/dev/null` - -# operating system and major, minor version, more should not be necessary -case "$UNAME_SYSTEM.$UNAME_RELEASE" in - Linux*) PLATFORM=LINUX - OS_MAJOR_VERSION=`echo $UNAME_RELEASE | cut -d . -f 1` - OS_MINOR_VERSION=`echo $UNAME_RELEASE | cut -d . -f 2` - LIBS_DL='-ldl' - ;; - - FreeBSD*) PLATFORM=FREEBSD - OS_MAJOR_VERSION=`echo $UNAME_RELEASE | cut -d . -f 1` - OS_MINOR_VERSION=`echo $UNAME_RELEASE | cut -d . -f 2 | cut -d - -f 1` - LIBS_DL= - LIBS_SSP= - ;; - - OpenBSD*) PLATFORM=OPENBSD - OS_MAJOR_VERSION=`echo $UNAME_RELEASE | cut -d . -f 1` - OS_MINOR_VERSION=`echo $UNAME_RELEASE | cut -d . -f 2 | cut -d - -f 1` - LIBS_DL= - LIBS_SSP= - ;; - - SunOS*) PLATFORM=SUNOS - OS_MAJOR_VERSION=`echo $UNAME_RELEASE | cut -d . -f 1` - OS_MINOR_VERSION=`echo $UNAME_RELEASE | cut -d . -f 2` - LIBS_DL='-ldl' - LIBS_SSP= - ;; - - CYGWIN_NT*) PLATFORM=CYGWIN - _tmp=`echo $UNAME_SYSTEM | cut -d - -f 2` - OS_MAJOR_VERSION=`echo $_tmp | cut -d . -f 1` - OS_MINOR_VERSION=`echo $_tmp | cut -d . -f 2` - LIBS_SSP= - ;; - - *) - PLATFORM=UNKNOWN - echo "Unknown platform '$UNAME_SYSTEM#$UNAME_RELEASE'" - exit 1 -esac - -# the architecture -case "$UNAME_MACHINE" in - i*86*) ARCH=x86 - ;; - - sun4u) ARCH=sun4u - ;; - - *) ARCH=UNKNOWN - echo "Unknown architecture '$UNAME_MACHINE'" - exit 1 - -esac - -# the compiler and version -GCC_VERSION=`gcc -dumpversion` -GCC_MAJOR_VERSION=`echo $GCC_VERSION | cut -d . -f 1` -GCC_MINOR_VERSION=`echo $GCC_VERSION | cut -d . -f 2` - -case "$1" in - --platform) echo $PLATFORM - ;; - - --os-major-version) echo $OS_MAJOR_VERSION - ;; - - --os-minor-version) echo $OS_MINOR_VERSION - ;; - - --arch) echo $ARCH - ;; - - --libs-dl) echo $LIBS_DL - ;; - - --libs-ssl) echo $LIBS_SSL - ;; - - --gcc-major-version) echo $GCC_MAJOR_VERSION - ;; - - --gcc-minor-version) echo $GCC_MINOR_VERSION - ;; - - *) - cat <