From 18eb4842536d1c9df278e7f65c16ce5679b99d39 Mon Sep 17 00:00:00 2001 From: midipix Date: Fri, 25 Sep 2015 22:17:03 -0400 Subject: makefile replacement: step 2/2: use the midipix build template. --- sysinfo/host/host.sh | 49 ++++++++++++++++++++++++++++++++++++ sysinfo/host/i686-nt32-midipix.mk | 5 ++++ sysinfo/host/i686-unknown-linux.mk | 5 ++++ sysinfo/host/i686-w64-mingw32.mk | 5 ++++ sysinfo/host/native.mk | 46 +++++++++++++++++++++++++++++++++ sysinfo/host/x86_64-nt64-midipix.mk | 5 ++++ sysinfo/host/x86_64-unknown-linux.mk | 5 ++++ sysinfo/host/x86_64-w64-mingw32.mk | 5 ++++ sysinfo/os/bsd.mk | 10 ++++++++ sysinfo/os/darwin.mk | 10 ++++++++ sysinfo/os/linux.mk | 10 ++++++++ sysinfo/os/midipix.mk | 12 +++++++++ sysinfo/os/mingw.mk | 14 +++++++++++ sysinfo/toolchain/clang.mk | 34 +++++++++++++++++++++++++ sysinfo/toolchain/gcc.mk | 25 ++++++++++++++++++ 15 files changed, 240 insertions(+) create mode 100755 sysinfo/host/host.sh create mode 100644 sysinfo/host/i686-nt32-midipix.mk create mode 100644 sysinfo/host/i686-unknown-linux.mk create mode 100644 sysinfo/host/i686-w64-mingw32.mk create mode 100644 sysinfo/host/native.mk create mode 100644 sysinfo/host/x86_64-nt64-midipix.mk create mode 100644 sysinfo/host/x86_64-unknown-linux.mk create mode 100644 sysinfo/host/x86_64-w64-mingw32.mk create mode 100644 sysinfo/os/bsd.mk create mode 100644 sysinfo/os/darwin.mk create mode 100644 sysinfo/os/linux.mk create mode 100644 sysinfo/os/midipix.mk create mode 100644 sysinfo/os/mingw.mk create mode 100644 sysinfo/toolchain/clang.mk create mode 100644 sysinfo/toolchain/gcc.mk (limited to 'sysinfo') diff --git a/sysinfo/host/host.sh b/sysinfo/host/host.sh new file mode 100755 index 0000000..1fe2515 --- /dev/null +++ b/sysinfo/host/host.sh @@ -0,0 +1,49 @@ +#!/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 +} + + +# 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 + + +# 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..465a01b --- /dev/null +++ b/sysinfo/host/native.mk @@ -0,0 +1,46 @@ +include $(PROJECT_DIR)/sysinfo/os/$(NATIVE_OS).mk + +CC = $(CROSS_COMPILE)$(NATIVE_CC) +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 = '' diff --git a/sysinfo/os/bsd.mk b/sysinfo/os/bsd.mk new file mode 100644 index 0000000..3fe6711 --- /dev/null +++ b/sysinfo/os/bsd.mk @@ -0,0 +1,10 @@ +OS = bsd +OS_APP_PREFIX = +OS_APP_SUFFIX = +OS_LIB_PREFIX = lib +OS_LIB_SUFFIX = .so +OS_IMPLIB_EXT = .invalid +OS_LIBDEF_EXT = .invalid +OS_ARCHIVE_EXT = .a + +.PHONY: $(SHARED_IMPLIB) diff --git a/sysinfo/os/darwin.mk b/sysinfo/os/darwin.mk new file mode 100644 index 0000000..b27a486 --- /dev/null +++ b/sysinfo/os/darwin.mk @@ -0,0 +1,10 @@ +OS = darwin +OS_APP_PREFIX = +OS_APP_SUFFIX = +OS_LIB_PREFIX = lib +OS_LIB_SUFFIX = .dylib +OS_IMPLIB_EXT = .invalid +OS_LIBDEF_EXT = .invalid +OS_ARCHIVE_EXT = .a + +.PHONY: $(SHARED_IMPLIB) diff --git a/sysinfo/os/linux.mk b/sysinfo/os/linux.mk new file mode 100644 index 0000000..d6221cf --- /dev/null +++ b/sysinfo/os/linux.mk @@ -0,0 +1,10 @@ +OS = linux +OS_APP_PREFIX = +OS_APP_SUFFIX = +OS_LIB_PREFIX = lib +OS_LIB_SUFFIX = .so +OS_IMPLIB_EXT = .invalid +OS_LIBDEF_EXT = .invalid +OS_ARCHIVE_EXT = .a + +.PHONY: $(SHARED_IMPLIB) diff --git a/sysinfo/os/midipix.mk b/sysinfo/os/midipix.mk new file mode 100644 index 0000000..4e197b9 --- /dev/null +++ b/sysinfo/os/midipix.mk @@ -0,0 +1,12 @@ +OS = midipix +OS_APP_PREFIX = +OS_APP_SUFFIX = +OS_LIB_PREFIX = lib +OS_LIB_SUFFIX = .so +OS_IMPLIB_EXT = .lib.a +OS_LIBDEF_EXT = .so.def +OS_ARCHIVE_EXT = .a + +install-implib: shared-implib + mkdir -p $(DESTDIR)/./$(PREFIX)/./$(LIBDIR) + cp $(SHARED_IMPLIB) $(DESTDIR)/./$(PREFIX)/./$(LIBDIR) diff --git a/sysinfo/os/mingw.mk b/sysinfo/os/mingw.mk new file mode 100644 index 0000000..196dbd8 --- /dev/null +++ b/sysinfo/os/mingw.mk @@ -0,0 +1,14 @@ +OS = mingw +OS_APP_PREFIX = +OS_APP_SUFFIX = .exe +OS_LIB_PREFIX = lib +OS_LIB_SUFFIX = .dll +OS_IMPLIB_EXT = .dll.a +OS_LIBDEF_EXT = .def +OS_ARCHIVE_EXT = .a + +CFLAGS_PIC = + +install-implib: shared-implib + mkdir -p $(DESTDIR)/./$(PREFIX)/./$(LIBDIR) + cp $(SHARED_IMPLIB) $(DESTDIR)/./$(PREFIX)/./$(LIBDIR) diff --git a/sysinfo/toolchain/clang.mk b/sysinfo/toolchain/clang.mk new file mode 100644 index 0000000..d239319 --- /dev/null +++ b/sysinfo/toolchain/clang.mk @@ -0,0 +1,34 @@ +ifeq ($(CROSS_COMPILE)x,x) + CROSS_HOST = + CROSS_HOST_SPEC = +else + CROSS_HOST = $(HOST) + CROSS_HOST_SPEC = --target=$(HOST) +endif + + +CC = $(NATIVE_CC) $(CROSS_HOST_SPEC) +CPP = $(NATIVE_CC) $(CROSS_HOST_SPEC) +CXX = $(NATIVE_CC)++ $(CROSS_HOST_SPEC) + + +AS = $(CROSS_COMPILE)as +AR = $(CROSS_COMPILE)ar +LD = $(CROSS_COMPILE)ld +NM = $(CROSS_COMPILE)nm +OBJDUMP = $(CROSS_COMPILE)objdump +RANLIB = $(CROSS_COMPILE)ranlib +SIZE = $(CROSS_COMPILE)size +STRIP = $(CROSS_COMPILE)strip +STRINGS = $(CROSS_COMPILE)strings + + +ADDR2LINE = $(CROSS_COMPILE)addr2line +COV = $(CROSS_COMPILE)gcov +CXXFILT = $(CROSS_COMPILE)c++filt +ELFEDIT = $(CROSS_COMPILE)elfedit +OBJCOPY = $(CROSS_COMPILE)objcopy +READELF = $(CROSS_COMPILE)readelf + + +CFLAGS_PIC = -fPIC diff --git a/sysinfo/toolchain/gcc.mk b/sysinfo/toolchain/gcc.mk new file mode 100644 index 0000000..441a2ca --- /dev/null +++ b/sysinfo/toolchain/gcc.mk @@ -0,0 +1,25 @@ +CC = $(CROSS_COMPILE)gcc +CPP = $(CROSS_COMPILE)cpp +CXX = $(CROSS_COMPILE)c++ + + +AS = $(CROSS_COMPILE)as +AR = $(CROSS_COMPILE)ar +LD = $(CROSS_COMPILE)ld +NM = $(CROSS_COMPILE)nm +OBJDUMP = $(CROSS_COMPILE)objdump +RANLIB = $(CROSS_COMPILE)ranlib +SIZE = $(CROSS_COMPILE)size +STRIP = $(CROSS_COMPILE)strip +STRINGS = $(CROSS_COMPILE)strings + + +ADDR2LINE = $(CROSS_COMPILE)addr2line +COV = $(CROSS_COMPILE)gcov +CXXFILT = $(CROSS_COMPILE)c++filt +ELFEDIT = $(CROSS_COMPILE)elfedit +OBJCOPY = $(CROSS_COMPILE)objcopy +READELF = $(CROSS_COMPILE)readelf + + +CFLAGS_PIC = -fPIC -- cgit v1.2.3