diff options
Diffstat (limited to 'sysinfo/host')
-rwxr-xr-x | sysinfo/host/host.sh | 82 | ||||
-rw-r--r-- | sysinfo/host/i686-nt32-midipix.mk | 5 | ||||
-rw-r--r-- | sysinfo/host/i686-unknown-linux.mk | 5 | ||||
-rw-r--r-- | sysinfo/host/i686-w64-mingw32.mk | 5 | ||||
-rw-r--r-- | sysinfo/host/native.mk | 45 | ||||
-rw-r--r-- | sysinfo/host/x86_64-nt64-midipix.mk | 5 | ||||
-rw-r--r-- | sysinfo/host/x86_64-unknown-linux.mk | 5 | ||||
-rw-r--r-- | sysinfo/host/x86_64-w64-mingw32.mk | 5 |
8 files changed, 157 insertions, 0 deletions
diff --git a/sysinfo/host/host.sh b/sysinfo/host/host.sh new file mode 100755 index 0000000..5d963c9 --- /dev/null +++ b/sysinfo/host/host.sh @@ -0,0 +1,82 @@ +#!/bin/sh + +error_msg() +{ + echo $@ >&2 +} + +host_test() +{ + mb_hdrdir=$(pwd)/build + mkdir -p $mb_hdrdir || exit 2 + + if [ x"$mb_compiler" = x ]; then + echo "config error: compiler not set." + exit 2 + fi + + $mb_compiler -dM -E - < /dev/null > /dev/null && return 0 + + error_msg "config error: invalid compiler." + exit 2 +} + +host_endian_h() +{ + mb_header='endian.h' + rm -f "$mb_hdrdir"/$mb_header + + # portable + printf "#include <$mb_header>" | $mb_compiler $mb_cflags \ + -E - > /dev/null 2>/dev/null \ + && return 0 + + # non-portable + mb_hosthdr= + + [ -z $mb_hosthdr ] && printf "#include <sys/$mb_header>" | $mb_compiler $mb_cflags \ + -E - > /dev/null 2>/dev/null \ + && mb_hosthdr='sys/'$mb_header + + [ -z $mb_hosthdr ] && printf "#include <machine/$mb_header>" | $mb_compiler $mb_cflags \ + -E - > /dev/null 2>/dev/null \ + && mb_hosthdr='machine/'$mb_header + + if [ x"$mb_hosthdr" = x ]; then + error_msg "config error: could not find an alternate <$mb_header>." + exit 2 + fi + + printf "#include <%s>\\n" $mb_hosthdr > "$mb_hdrdir"/$mb_header || exit 2 +} + + +# one: args +for arg ; do + case "$arg" in + --help) usage + ;; + --compiler=*) + mb_compiler=${arg#*=} + ;; + --cflags=*) + mb_cflags=${arg#*=} + ;; + *) + error_msg ${arg#}: "unsupported config argument." + exit 2 + ;; + esac +done + + +# two: test +host_test + + +# three: headers +host_endian_h + + +# all done +exit 0 diff --git a/sysinfo/host/i686-nt32-midipix.mk b/sysinfo/host/i686-nt32-midipix.mk new file mode 100644 index 0000000..df3185b --- /dev/null +++ b/sysinfo/host/i686-nt32-midipix.mk @@ -0,0 +1,5 @@ +include $(PROJECT_DIR)/sysinfo/os/midipix.mk + +ARCH = nt32 +HOST_BITS = 32 +HOST_UNDERSCORE = '_' diff --git a/sysinfo/host/i686-unknown-linux.mk b/sysinfo/host/i686-unknown-linux.mk new file mode 100644 index 0000000..79d497b --- /dev/null +++ b/sysinfo/host/i686-unknown-linux.mk @@ -0,0 +1,5 @@ +include $(PROJECT_DIR)/sysinfo/os/linux.mk + +ARCH = i386 +HOST_BITS = 32 +HOST_UNDERSCORE = '_' diff --git a/sysinfo/host/i686-w64-mingw32.mk b/sysinfo/host/i686-w64-mingw32.mk new file mode 100644 index 0000000..b8ba461 --- /dev/null +++ b/sysinfo/host/i686-w64-mingw32.mk @@ -0,0 +1,5 @@ +include $(PROJECT_DIR)/sysinfo/os/mingw.mk + +ARCH = w32 +HOST_BITS = 32 +HOST_UNDERSCORE = '_' diff --git a/sysinfo/host/native.mk b/sysinfo/host/native.mk new file mode 100644 index 0000000..08b02b6 --- /dev/null +++ b/sysinfo/host/native.mk @@ -0,0 +1,45 @@ +include $(PROJECT_DIR)/sysinfo/os/$(NATIVE_OS).mk + +OS = $(NATIVE_OS) +HOST_BITS = $(NATIVE_OS_BITS) +HOST_UNDERSCORE = $(NATIVE_OS_UNDERSCORE) + +ifeq ($(OS),linux) + ifeq ($(HOST_BITS),32) + ARCH = i386 + else ifeq ($(HOST_BITS),64) + ARCH = x86_64 + endif +endif + +ifeq ($(OS),midipix) + ifeq ($(HOST_BITS),32) + ARCH = nt32 + else ifeq ($(HOST_BITS),64) + ARCH = nt64 + endif +endif + +ifeq ($(OS),mingw) + ifeq ($(HOST_BITS),32) + ARCH = w32 + else ifeq ($(HOST_BITS),64) + ARCH = w64 + endif +endif + +ifeq ($(OS),bsd) + ifeq ($(HOST_BITS),32) + ARCH = bsd32 + else ifeq ($(HOST_BITS),64) + ARCH = bsd64 + endif +endif + +ifeq ($(OS),darwin) + ifeq ($(HOST_BITS),32) + ARCH = dw32 + else ifeq ($(HOST_BITS),64) + ARCH = dw64 + endif +endif diff --git a/sysinfo/host/x86_64-nt64-midipix.mk b/sysinfo/host/x86_64-nt64-midipix.mk new file mode 100644 index 0000000..fef6345 --- /dev/null +++ b/sysinfo/host/x86_64-nt64-midipix.mk @@ -0,0 +1,5 @@ +include $(PROJECT_DIR)/sysinfo/os/midipix.mk + +ARCH = nt64 +HOST_BITS = 64 +HOST_UNDERSCORE = '' diff --git a/sysinfo/host/x86_64-unknown-linux.mk b/sysinfo/host/x86_64-unknown-linux.mk new file mode 100644 index 0000000..76afb56 --- /dev/null +++ b/sysinfo/host/x86_64-unknown-linux.mk @@ -0,0 +1,5 @@ +include $(PROJECT_DIR)/sysinfo/os/linux.mk + +ARCH = x86_64 +HOST_BITS = 64 +HOST_UNDERSCORE = '' diff --git a/sysinfo/host/x86_64-w64-mingw32.mk b/sysinfo/host/x86_64-w64-mingw32.mk new file mode 100644 index 0000000..7cded15 --- /dev/null +++ b/sysinfo/host/x86_64-w64-mingw32.mk @@ -0,0 +1,5 @@ +include $(PROJECT_DIR)/sysinfo/os/mingw.mk + +ARCH = w64 +HOST_BITS = 64 +HOST_UNDERSCORE = '' |