summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--COPYING.SOFORT26
-rw-r--r--Makefile.in456
-rw-r--r--config.project71
-rw-r--r--config.usage155
-rwxr-xr-xconfigure849
-rw-r--r--project/arch.mk0
-rw-r--r--project/common.mk3
-rw-r--r--project/depends.mk0
-rw-r--r--project/extras.mk0
-rw-r--r--project/headers.mk5
-rw-r--r--project/osforce.mk0
-rw-r--r--project/overrides.mk0
-rw-r--r--project/tagver.mk5
-rw-r--r--project/tree.mk2
-rw-r--r--sofort/custom.mk76
-rw-r--r--sofort/defs.mk66
-rw-r--r--sofort/pkgconf.mk40
-rwxr-xr-xsofort/pkgconf.sh92
-rw-r--r--sofort/version.mk63
-rw-r--r--sysinfo/compiler/any-compiler.mk29
-rw-r--r--sysinfo/compiler/clang.mk31
-rw-r--r--sysinfo/compiler/cparser.mk31
-rw-r--r--sysinfo/compiler/gcc.mk24
-rw-r--r--sysinfo/host/any-host.mk7
-rwxr-xr-xsysinfo/host/host.sh48
-rw-r--r--sysinfo/host/i686-nt32-midipix.mk5
-rw-r--r--sysinfo/host/i686-unknown-linux.mk5
-rw-r--r--sysinfo/host/i686-w64-mingw32.mk5
-rw-r--r--sysinfo/host/native.mk45
-rw-r--r--sysinfo/host/x86_64-nt64-midipix.mk5
-rw-r--r--sysinfo/host/x86_64-unknown-linux.mk5
-rw-r--r--sysinfo/host/x86_64-w64-mingw32.mk5
-rw-r--r--sysinfo/os/any-os.mk16
-rw-r--r--sysinfo/os/bsd.mk16
-rw-r--r--sysinfo/os/cygwin.mk17
-rw-r--r--sysinfo/os/darwin.mk18
-rw-r--r--sysinfo/os/elf.mk2
-rw-r--r--sysinfo/os/linux.mk16
-rw-r--r--sysinfo/os/midipix.mk15
-rw-r--r--sysinfo/os/mingw.mk18
-rw-r--r--sysinfo/os/mingw32.mk1
-rw-r--r--sysinfo/os/mingw64.mk1
-rw-r--r--sysinfo/os/msys.mk18
-rw-r--r--sysinfo/os/pe.mk96
-rw-r--r--sysinfo/toolchain/binutils.mk22
-rw-r--r--sysinfo/toolchain/llvm.mk22
-rwxr-xr-xsysinfo/version.sh62
47 files changed, 2494 insertions, 0 deletions
diff --git a/COPYING.SOFORT b/COPYING.SOFORT
new file mode 100644
index 0000000..a68af9e
--- /dev/null
+++ b/COPYING.SOFORT
@@ -0,0 +1,26 @@
+/*****************************************************************************/
+/* */
+/* sofort: portable software project template */
+/* */
+/* Copyright (C) 2015--2017 Z. Gilboa */
+/* */
+/* Permission is hereby granted, free of charge, to any person obtaining */
+/* a copy of this software and associated documentation files (the */
+/* "Software"), to deal in the Software without restriction, including */
+/* without limitation the rights to use, copy, modify, merge, publish, */
+/* distribute, sublicense, and/or sell copies of the Software, and to */
+/* permit persons to whom the Software is furnished to do so, subject to */
+/* the following conditions: */
+/* */
+/* The above copyright notice and this permission notice shall be included */
+/* in all copies or substantial portions of the Software. */
+/* */
+/* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS */
+/* OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF */
+/* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. */
+/* IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY */
+/* CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, */
+/* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE */
+/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
+/* */
+/*****************************************************************************/
diff --git a/Makefile.in b/Makefile.in
new file mode 100644
index 0000000..abe70c5
--- /dev/null
+++ b/Makefile.in
@@ -0,0 +1,456 @@
+PACKAGE = @package@
+NICKNAME = @nickname@
+PROJECT_DIR = @project_dir@
+SOURCE_DIR = @source_dir@
+GIT_REFERENCE_INDEX = @git_reference_index@
+CUSTOM_INSTALL_HEADERS = @custom_install_headers@
+AVOID_VERSION = @avoid_version@
+
+PKGNAME = @pkgname@
+PKGDESC = @pkgdesc@
+PKGUSRC = @pkgusrc@
+PKGREPO = @pkgrepo@
+PKGPSRC = @pkgpsrc@
+PKGDURL = @pkgdurl@
+PKGDEFS = @pkgdefs@
+PKGLIBS = @pkglibs@
+
+BUILD = @build@
+HOST = @host@
+CCHOST = @cchost@
+TARGET = @target@
+ARCH = @arch@
+COMPILER = @compiler@
+TOOLCHAIN = @toolchain@
+SYSROOT = @sysroot@
+CROSS_COMPILE = @cross_compile@
+SHELL = @shell@
+
+CFLAGS_COMMON = @cflags_common@
+CFLAGS_DEBUG = @cflags_debug@
+CFLAGS_CMDLINE = @cflags_cmdline@
+CFLAGS_CONFIG = @cflags_config@
+CFLAGS_SYSROOT = @cflags_sysroot@
+CFLAGS_OS = @cflags_os@
+CFLAGS_SITE = @cflags_site@
+CFLAGS_PATH = @cflags_path@
+CFLAGS_STRICT = @cflags_strict@
+CFLAGS_UTIL = @cflags_util@
+CFLAGS_LAST = @cflags_last@
+CFLAGS_ONCE = @cflags_once@
+
+LDFLAGS_COMMON = @ldflags_common@
+LDFLAGS_DEBUG = @ldflags_debug@
+LDFLAGS_CMDLINE = @ldflags_cmdline@
+LDFLAGS_CONFIG = @ldflags_config@
+LDFLAGS_SYSROOT = @ldflags_sysroot@
+LDFLAGS_PATH = @ldflags_path@
+LDFLAGS_STRICT = @ldflags_strict@
+LDFLAGS_UTIL = @ldflags_util@
+LDFLAGS_LAST = @ldflags_last@
+LDFLAGS_ONCE = @ldflags_once@
+
+PE_SUBSYSTEM = @pe_subsystem@
+PE_IMAGE_BASE = @pe_image_base@
+PE_CONFIG_DEFS = @pe_config_defs@
+
+ELF_EH_FRAME = @elf_eh_frame@
+ELF_HASH_STYLE = @elf_hash_style@
+ELF_CONFIG_DEFS = @elf_config_defs@
+
+PREFIX = @prefix@
+EXEC_PREFIX = @exec_prefix@
+BINDIR = @bindir@
+SBINDIR = @sbindir@
+LIBDIR = @libdir@
+INCLUDEDIR = @includedir@
+OLDINCLUDEDIR = @oldincludedir@
+MANDIR = @mandir@
+DOCDIR = @docdir@
+LIBEXECDIR = @libexecdir@
+
+SYSCONFDIR = @sysconfdir@
+SHAREDSTATEDIR = @sharedstatedir@
+LOCALSTATEDIR = @localstatedir@
+RUNSTATEDIR = @runstatedir@
+DATAROOTDIR = @datarootdir@
+DATADIR = @datadir@
+INFODIR = @infodir@
+LOCALEDIR = @localedir@
+HTMLDIR = @htmldir@
+DVIDIR = @dvidir@
+PDFDIR = @pdfdir@
+PSDIR = @psdir@
+
+NATIVE_CC = @native_cc@
+NATIVE_OS = @native_os@
+NATIVE_OS_BITS = @native_os_bits@
+NATIVE_OS_UNDERSCORE = @native_os_underscore@
+
+USER_CC = @user_cc@
+USER_CPP = @user_cpp@
+USER_CXX = @user_cxx@
+
+ALL_SHARED = @all_shared@
+ALL_STATIC = @all_static@
+DISABLE_FRONTEND = @disable_frontend@
+DISABLE_SHARED = @disable_shared@
+DISABLE_STATIC = @disable_static@
+
+all:
+install:
+shared:
+static:
+
+install-extras:
+install-app-extras:
+
+include $(PROJECT_DIR)/sysinfo/host/$(HOST).mk
+include $(PROJECT_DIR)/sysinfo/compiler/$(COMPILER).mk
+include $(PROJECT_DIR)/sysinfo/toolchain/$(TOOLCHAIN).mk
+include $(PROJECT_DIR)/sysinfo/os/$(OS).mk
+
+include $(PROJECT_DIR)/project/osforce.mk
+
+include $(PROJECT_DIR)/sofort/defs.mk
+include $(PROJECT_DIR)/sofort/version.mk
+include $(PROJECT_DIR)/sofort/custom.mk
+include $(PROJECT_DIR)/sofort/pkgconf.mk
+
+include $(PROJECT_DIR)/project/tree.mk
+include $(PROJECT_DIR)/project/depends.mk
+include $(PROJECT_DIR)/project/headers.mk
+include $(PROJECT_DIR)/project/common.mk
+include $(PROJECT_DIR)/project/arch.mk
+include $(PROJECT_DIR)/project/extras.mk
+include $(PROJECT_DIR)/project/overrides.mk
+
+
+
+$(APP_SRCS:%.c=%.o): CFLAGS_STATIC = $(CFLAGS_APP)
+
+src/%.lo: $(SOURCE_DIR)/src/%.c $(ALL_HEADERS) host.tag tree.tag
+ $(CC) -c -o $@ $< $(CFLAGS_SHARED)
+
+src/%.o: $(SOURCE_DIR)/src/%.c $(ALL_HEADERS) host.tag tree.tag
+ $(CC) -c -o $@ $< $(CFLAGS_STATIC)
+
+lib/%$(OS_LIB_PREFIXED_SUFFIX)$(VER_XYZ)$(OS_LIB_SUFFIXED_SUFFIX):
+ $(CC) -shared -o $@ $^ $(LDFLAGS_SHARED)
+
+lib/%$(OS_ARCHIVE_EXT):
+ rm -f $@
+ $(AR) rcs $@ $^
+
+
+
+all: package-shared package-static app
+
+install: package-install-app
+install: package-install-extras
+install: install-libs
+
+app: app-tag
+
+app.tag:
+ cp $(PACKAGE_APP) $(APP)
+ touch app.tag
+
+install-libs: package-install-shared
+install-libs: package-install-static
+
+install-headers-default:
+ mkdir -p $(DESTDIR)$(INCLUDEDIR)/$(PACKAGE)
+ cp $(API_HEADERS) $(DESTDIR)$(INCLUDEDIR)/$(PACKAGE)
+
+install-shared: shared install-lib install-implib
+install-shared: package-install-soname package-install-solink
+install-shared: install-headers
+
+install-lib: shared
+ mkdir -p $(DESTDIR)$(LIBDIR)
+ cp $(SHARED_LIB) $(DESTDIR)$(LIBDIR)
+
+install-static: static install-headers
+ mkdir -p $(DESTDIR)$(LIBDIR)
+ cp $(STATIC_LIB) $(DESTDIR)$(LIBDIR)
+
+install-app: app install-app-extras
+ mkdir -p $(DESTDIR)$(BINDIR)
+ cp $(APP) $(DESTDIR)$(BINDIR)
+
+install-static-app: static-app install-app-extras
+ mkdir -p $(DESTDIR)$(BINDIR)
+ cp $(STATIC_APP) $(DESTDIR)$(BINDIR)/$(NICKNAME)$(OS_APP_SUFFIX)
+
+
+
+shared: shared-lib implib
+shared: package-shared-soname package-shared-solink
+
+static: static-lib
+
+shared-lib: shared-objs $(SHARED_LIB)
+
+shared-soname: shared-lib $(SHARED_SONAME)
+
+shared-solink: shared-lib $(SHARED_SOLINK)
+
+static-lib: static-objs $(STATIC_LIB)
+
+
+
+default-app: version.tag static-objs $(DEFAULT_APP)
+
+shared-app: version.tag shared $(SHARED_APP)
+
+static-app: version.tag static-objs $(STATIC_APP)
+
+
+
+shared-objs: dirs $(SHARED_OBJS)
+
+static-objs: dirs $(STATIC_OBJS)
+
+app-objs: dirs $(APP_OBJS)
+
+
+
+$(SHARED_LIB): $(SHARED_OBJS)
+
+$(STATIC_LIB): $(STATIC_OBJS)
+
+$(APP): $(PACKAGE_APP)
+
+$(DEFAULT_APP): $(STATIC_OBJS) $(APP_OBJS)
+ rm -f app.tag
+ $(CC) -o $@ $^ $(LDFLAGS_APP)
+
+$(SHARED_APP): $(SHARED_LIB) $(APP_OBJS) $(SHARED_SOLINK)
+ rm -f app.tag
+ $(CC) -o $@ $(APP_OBJS) $(LDFLAGS_SHARED) -l$(PACKAGE)
+
+$(STATIC_APP): $(STATIC_OBJS) $(APP_OBJS)
+ rm -f app.tag
+ $(CC) -static -o $@ $^ $(LDFLAGS_STATIC)
+
+
+dirs: dirs.tag
+
+dirs.tag:
+ mkdir -p bin
+ mkdir -p lib
+ touch dirs.tag
+
+cchost:
+ $(PROJECT_DIR)/sysinfo/host/host.sh --compiler="$(CC)" --cflags="$(CFLAGS)"
+
+host.tag: Makefile
+ $(PROJECT_DIR)/sysinfo/host/host.sh --compiler="$(CC)" --cflags="$(CFLAGS)"
+ touch host.tag
+
+version.tag: $(GIT_REFERENCE_INDEX)
+ $(PROJECT_DIR)/sysinfo/version.sh \
+ -s $(SOURCE_DIR) \
+ -o build/$(PACKAGE)_version.h \
+ -p $(PACKAGE)
+ touch version.tag
+
+distclean: clean
+ rm -f Makefile
+
+clean: clean-implib
+ rm -f tree.tag
+ rm -f dirs.tag
+ rm -f host.tag
+ rm -f version.tag
+ rm -f app.tag
+ rm -f $(SHARED_OBJS)
+ rm -f $(STATIC_OBJS)
+ rm -f $(APP_OBJS)
+ rm -f $(SHARED_LIB)
+ rm -f $(SHARED_SONAME)
+ rm -f $(SHARED_SOLINK)
+ rm -f $(STATIC_LIB)
+ rm -f $(APP)
+ rm -f $(DEFAULT_APP)
+ rm -f $(SHARED_APP)
+ rm -f $(STATIC_APP)
+
+
+.display: .display-project .display-pkgconf .display-env \
+ .display-tools .display-flags .display-pe .display-elf \
+ .display-dirs .display-build .display-config
+
+.conf: PAGER ?= less
+.conf:
+ $(MAKE) .display | $(PAGER)
+
+.display-project:
+ @echo PACKAGE:' '$(PACKAGE)
+ @echo NICKNAME:' '$(NICKNAME)
+ @echo PROJECT_DIR:' '$(PROJECT_DIR)
+ @echo SOURCE_DIR:' '$(SOURCE_DIR)
+ @echo BUILD_DIR:' '$(CURDIR)
+ @echo
+
+.display-pkgconf:
+ @echo PKGNAME:' '$(PKGNAME)
+ @echo PKGDESC:' '$(PKGDESC)
+ @echo PKGUSRC:' '$(PKGUSRC)
+ @echo PKGREPO:' '$(PKGREPO)
+ @echo PKGPSRC:' '$(PKGPSRC)
+ @echo PKGDURL:' '$(PKGDURL)
+ @echo PKGDEFS:' '$(PKGDEFS)
+ @echo PKGLIBS:' '$(PKGLIBS)
+ @echo
+
+.display-env:
+ @echo BUILD:' '$(BUILD)
+ @echo HOST:' '$(HOST)
+ @echo CCHOST:' '$(CCHOST)
+ @echo TARGET:' '$(TARGET)
+ @echo ARCH:' '$(ARCH)
+ @echo COMPILER:' '$(COMPILER)
+ @echo TOOLCHAIN:' '$(TOOLCHAIN)
+ @echo SYSROOT:' '$(SYSROOT)
+ @echo CROSS_COMPILE:' '$(CROSS_COMPILE)
+ @echo SHELL:' '$(SHELL)
+ @echo
+
+.display-tools:
+ @echo CC:' '$(CC)
+ @echo CPP:' '$(CPP)
+ @echo CXX:' '$(CXX)
+ @echo
+ @echo AS:' '$(AS)
+ @echo AR:' '$(AR)
+ @echo LD:' '$(LD)
+ @echo NM:' '$(NM)
+ @echo OBJDUMP:' '$(OBJDUMP)
+ @echo RANLIB:' '$(RANLIB)
+ @echo SIZE:' '$(SIZE)
+ @echo STRIP:' '$(STRIP)
+ @echo STRINGS:' '$(STRINGS)
+ @echo
+ @echo ADDR2LINE:' '$(ADDR2LINE)
+ @echo COV:' '$(COV)
+ @echo CXXFILT' '$(CXXFILT)
+ @echo ELFEDIT:' '$(ELFEDIT)
+ @echo OBJCOPY:' '$(OBJCOPY)
+ @echo READELF:' '$(READELF)
+ @echo
+
+.display-flags:
+ @echo CFLAGS_COMMON:' '$(CFLAGS_COMMON)
+ @echo CFLAGS_DEBUG:' '$(CFLAGS_DEBUG)
+ @echo CFLAGS_VERSION:' '$(CFLAGS_VERSION)
+ @echo CFLAGS_CMDLINE:' '$(CFLAGS_CMDLINE)
+ @echo CFLAGS_CONFIG:' '$(CFLAGS_CONFIG)
+ @echo CFLAGS_SYSROOT:' '$(CFLAGS_SYSROOT)
+ @echo CFLAGS_OS:' '$(CFLAGS_OS)
+ @echo CFLAGS_SITE:' '$(CFLAGS_SITE)
+ @echo CFLAGS_PATH:' '$(CFLAGS_PATH)
+ @echo CFLAGS_STRICT:' '$(CFLAGS_STRICT)
+ @echo CFLAGS_UTIL:' '$(CFLAGS_UTIL)
+ @echo CFLAGS_LAST:' '$(CFLAGS_LAST)
+ @echo CFLAGS_ONCE:' '$(CFLAGS_ONCE)
+ @echo
+ @echo LDFLAGS_COMMON:' '$(LDFLAGS_COMMON)
+ @echo LDFLAGS_DEBUG:' '$(LDFLAGS_DEBUG)
+ @echo LDFLAGS_CMDLINE:' '$(LDFLAGS_CMDLINE)
+ @echo LDFLAGS_CONFIG:' '$(LDFLAGS_CONFIG)
+ @echo LDFLAGS_SYSROOT:' '$(LDFLAGS_SYSROOT)
+ @echo LDFLAGS_PATH:' '$(LDFLAGS_PATH)
+ @echo LDFLAGS_STRICT:' '$(LDFLAGS_STRICT)
+ @echo LDFLAGS_UTIL:' '$(LDFLAGS_UTIL)
+ @echo LDFLAGS_LAST:' '$(LDFLAGS_LAST)
+ @echo LDFLAGS_ONCE:' '$(LDFLAGS_ONCE)
+ @echo
+
+.display-pe:
+ @echo PE_SUBSYSTEM:' '$(PE_SUBSYSTEM)
+ @echo PE_IMAGE_BASE:' '$(PE_IMAGE_BASE)
+ @echo PE_CONFIG_DEFS:' '$(PE_CONFIG_DEFS)
+ @echo
+
+.display-elf:
+ @echo ELF_EH_FRAME:' '$(ELF_EH_FRAME)
+ @echo ELF_HASH_STYLE:' '$(ELF_HASH_STYLE)
+ @echo ELF_CONFIG_DEFS:' '$(ELF_CONFIG_DEFS)
+ @echo
+
+.display-dirs:
+ @echo PREFIX:' '$(PREFIX)
+ @echo EXEC_PREFIX:' '$(EXEC_PREFIX)
+ @echo BINDIR:' '$(BINDIR)
+ @echo SBINDIR:' '$(SBINDIR)
+ @echo LIBDIR:' '$(LIBDIR)
+ @echo INCLUDEDIR:' '$(INCLUDEDIR)
+ @echo OLDINCLUDEDIR:' '$(OLDINCLUDEDIR)
+ @echo MANDIR:' '$(MANDIR)
+ @echo DOCDIR:' '$(DOCDIR)
+ @echo LIBEXECDIR:' '$(LIBEXECDIR)
+ @echo
+
+.display-exdirs:
+ @echo SYSCONFDIR' '$(SYSCONFDIR)
+ @echo SHAREDSTATEDIR' '$(SHAREDSTATEDIR)
+ @echo LOCALSTATEDIR' '$(LOCALSTATEDIR)
+ @echo RUNSTATEDIR' '$(RUNSTATEDIR)
+ @echo DATAROOTDIR' '$(DATAROOTDIR)
+ @echo DATADIR' '$(DATADIR)
+ @echo INFODIR' '$(INFODIR)
+ @echo LOCALEDIR' '$(LOCALEDIR)
+ @echo HTMLDIR' '$(HTMLDIR)
+ @echo DVIDIR' '$(DVIDIR)
+ @echo PDFDIR' '$(PDFDIR)
+ @echo PSDIR' '$(PSDIR)
+
+.display-build:
+ @echo NATIVE_CC:' '$(NATIVE_CC)
+ @echo NATIVE_OS:' '$(NATIVE_OS)
+ @echo NATIVE_OS_BITS:' '$(NATIVE_OS_BITS)
+ @echo NATIVE_OS_UNDERSCORE:' '$(NATIVE_OS_UNDERSCORE)
+ @echo
+ @echo USER_CC:' '$(USER_CC)
+ @echo USER_CPP:' '$(USER_CPP)
+ @echo USER_CXX:' '$(USER_CXX)
+ @echo
+
+.display-config:
+ @echo ALL_SHARED:' '$(ALL_SHARED)
+ @echo ALL_STATIC:' '$(ALL_STATIC)
+ @echo DISABLE_FRONTEND:' '$(DISABLE_FRONTEND)
+ @echo DISABLE_SHARED:' '$(DISABLE_SHARED)
+ @echo DISABLE_STATIC:' '$(DISABLE_STATIC)
+
+.display-host:
+ @$(CC) $(CFLAGS) -dumpmachine
+
+.display-cc:
+ @echo $(CC)
+
+.display-cflags:
+ @echo $(CFLAGS)
+
+
+.PHONY: cchost package-app \
+ all install shared static app \
+ shared-objs shared-lib \
+ shared-soname shared-solink \
+ package-shared-soname package-shared-solink \
+ static-objs static-lib \
+ default-app shared-app static-app \
+ install-shared install-static \
+ install-soname install-solink \
+ package-install-soname package-install-solink \
+ install-headers install-app \
+ install-headers-default install-headers-custom \
+ clean distclean clean-implib version \
+ .display .conf \
+ .display-project .display-env .display-tools .display-flags \
+ .display-pe .display-elf .display-dirs .display-build \
+ implib implib-ver implib-soname implib-solink \
+ install-implib install-implib-ver \
+ install-implib-soname install-implib-solink
diff --git a/config.project b/config.project
new file mode 100644
index 0000000..ad41b51
--- /dev/null
+++ b/config.project
@@ -0,0 +1,71 @@
+# project
+mb_package=python2.7
+mb_require_out_of_tree=no
+mb_custom_install_headers=no
+mb_avoid_version=no
+
+# pkgconfig
+mb_pkgname='python2.7'
+mb_pkgdesc='python2.7'
+mb_pkgusrc=
+mb_pkgrepo='git://midipix.org/bpython2'
+mb_pkgpsrc=
+mb_pkgdurl=
+mb_pkgdefs=
+mb_pkglibs=
+
+# build
+mb_default_build=
+mb_default_host=
+mb_default_cchost=
+mb_default_target=
+mb_default_arch=
+mb_default_compiler=
+mb_default_toolchain=
+mb_default_sysroot=
+mb_default_cross_compile=
+mb_default_shell=sh
+
+
+# switches
+mb_default_cflags_common="-std=c99 -D_XOPEN_SOURCE=600"
+mb_default_cflags_common="$mb_default_cflags_common -I\$(PROJECT_DIR)/src/internal"
+mb_default_cflags_common="$mb_default_cflags_common -I\$(PROJECT_DIR)/include"
+mb_default_cflags_common="$mb_default_cflags_common -Ibuild"
+
+mb_default_cflags_debug=
+mb_default_cflags_cmdline=
+mb_default_cflags_config=
+mb_default_cflags_sysroot=
+mb_default_cflags_path=
+mb_default_cflags_strict=
+mb_default_cflags_util=
+mb_default_cflags_last=
+mb_default_cflags_once=
+
+mb_default_ldflags_common="-Llib"
+mb_default_ldflags_debug=
+mb_default_ldflags_cmdline=
+mb_default_ldflags_config=
+mb_default_ldflags_sysroot=
+mb_default_ldflags_path=
+mb_default_ldflags_strict=
+mb_default_ldflags_util=
+mb_default_ldflags_last=
+mb_default_ldflags_once=
+
+mb_default_pe_subsystem=windows
+mb_default_pe_image_base=
+mb_default_pe_config_defs=
+
+mb_default_elf_eh_frame=
+mb_default_elf_hash_style=
+mb_default_elf_config_defs=
+
+
+# config
+mb_all_static=
+mb_all_shared=
+mb_disable_frontend=yes
+mb_disable_static=yes
+mb_disable_shared=
diff --git a/config.usage b/config.usage
new file mode 100644
index 0000000..50f0a3f
--- /dev/null
+++ b/config.usage
@@ -0,0 +1,155 @@
+configure: a skinny configuration script.
+
+supported switches:
+-------------------
+ --help
+
+ --nickname
+ --program-prefix
+ --avoid-version
+ --source-dir
+
+ --pkgname
+ --pkgdesc
+ --pkgusrc
+ --pkgrepo
+ --pkgpsrc
+ --pkgdurl
+ --pkgdefs
+ --pkglibs
+
+ --prefix
+ --exec-prefix
+ --bindir
+ --sbindir
+ --libdir
+ --includedir
+ --oldincludedir
+ --mandir
+ --docdir
+ --libexecdir
+
+ --sysconfdir
+ --sharedstatedir
+ --localstatedir
+ --runstatedir
+ --datarootdir
+ --datadir
+ --infodir
+ --localedir
+ --htmldir
+ --dvidir
+ --pdfdir
+ --psdir
+
+ --build
+ --host
+ --cchost
+ --target
+ --arch
+ --compiler
+ --toolchain
+ --sysroot
+ --cross-compile
+ --shell
+ --debug
+
+ --strict
+ --ccstrict
+ --ldstrict
+
+ --all-static
+ --all-shared
+ --enable-static
+ --enable-shared
+ --disable-static
+ --disable-shared
+
+ --enable-app
+ --enable-frontend
+ --disable-app
+ --disable-frontend
+
+ --enable-dependency-tracking
+ --disable-dependency-tracking
+
+
+supported variables:
+--------------------
+ NICKNAME
+ SOURCE_DIR
+
+ PREFIX
+ EXEC_PREFIX
+ BINDIR
+ SBINDIR
+ LIBDIR
+ INCLUDEDIR
+ MANDIR
+ DOCDIR
+ LIBEXECDIR
+
+ SYSCONFDIR
+ SHAREDSTATEDIR
+ LOCALSTATEDIR
+ RUNSTATEDIR
+ DATAROOTDIR
+ DATADIR
+ INFODIR
+ LOCALEDIR
+ HTMLDIR
+ DVIDIR
+ PDFDIR
+ PSDIR
+
+ CC
+ CPP
+ CXX
+
+ BUILD
+ HOST
+ CCHOST
+ TARGET
+ ARCH
+ COMPILER
+ TOOLCHAIN
+ SYSROOT
+ CROSS_COMPILE
+ SHELL
+
+ CFLAGS
+ CFLAGS_DEBUG
+ CFLAGS_COMMON
+ CFLAGS_CMDLINE
+ CFLAGS_CONFIG
+ CFLAGS_SYSROOT
+ CFLAGS_PATH
+ CFLAGS_STRICT
+ CFLAGS_UTIL
+ CFLAGS_LAST
+ CFLAGS_ONCE
+
+ LDFLAGS
+ LDFLAGS_DEBUG
+ LDFLAGS_COMMON
+ LDFLAGS_CMDLINE
+ LDFLAGS_CONFIG
+ LDFLAGS_SYSROOT
+ LDFLAGS_PATH
+ LDFLAGS_STRICT
+ LDFLAGS_UTIL
+ LDFLAGS_LAST
+ LDFLAGS_ONCE
+
+ PE_SUBSYSTEM
+ PE_IMAGE_BASE
+ PE_CONFIG_DEFS
+
+ ELF_EH_FRAME
+ ELF_HASH_STYLE
+ ELF_CONFIG_DEFS
+
+ NATIVE_CC
+ NATIVE_OS
+ NATIVE_OS_BITS
+ NATIVE_OS_UNDERSCORE
diff --git a/configure b/configure
new file mode 100755
index 0000000..ddea6d3
--- /dev/null
+++ b/configure
@@ -0,0 +1,849 @@
+#!/bin/sh
+# we are no longer lazy.
+
+# this script respects both CFLAGS and CFLAGS_CMDLINE,
+# as well as both LDFLAGS and LDFLAGS_CMDLINE, however
+# the latter variable of each pair should be preferred.
+
+usage()
+{
+ cat "$mb_project_dir"/config.usage
+ exit $?
+}
+
+error_msg()
+{
+ echo "$@" >&2
+}
+
+warning_msg()
+{
+ echo "$@" >&2
+}
+
+
+init_vars()
+{
+ mb_project_dir=$(cd "$(dirname $0)" ; pwd)
+ mb_pwd=`pwd`
+
+ if [ -z "$mb_config" ]; then
+ . $mb_project_dir/config.project || exit 2
+ else
+ . "$mb_config" || exit 2
+ fi
+
+ # project
+ mb_nickname=$NICKNAME
+ mb_source_dir=$SOURCE_DIR
+
+ # dirs
+ mb_prefix=$PREFIX
+ mb_exec_prefix=$EXEC_PREFIX
+ mb_bindir=$BINDIR
+ mb_sbindir=$SBINDIR
+ mb_libdir=$LIBDIR
+ mb_includedir=$INCLUDEDIR
+ mb_oldincludedir=$OLDINCLUDEDIR
+ mb_mandir=$MANDIR
+ mb_docdir=$DOCDIR
+ mb_libexecdir=$LIBEXECDIR
+
+ mb_sysconfdir=$SYSCONFDIR
+ mb_sharedstatedir=$SHAREDSTATEDIR
+ mb_localstatedir=$LOCALSTATEDIR
+ mb_runstatedir=$RUNSTATEDIR
+ mb_datarootdir=$DATAROOTDIR
+ mb_datadir=$DATADIR
+ mb_infodir=$INFODIR
+ mb_localedir=$LOCALEDIR
+ mb_htmldir=$HTMLDIR
+ mb_dvidir=$DVIDIR
+ mb_pdfdir=$PDFDIR
+ mb_psdir=$PSDIR
+
+
+ # build
+ mb_build=$BUILD
+ mb_host=$HOST
+ mb_cchost=$CCHOST
+ mb_target=$TARGET
+ mb_arch=$ARCH
+ mb_compiler=$COMPILER
+ mb_toolchain=$TOOLCHAIN
+ mb_sysroot=$SYSROOT
+ mb_cross_compile=$CROSS_COMPILE
+ mb_shell=$SHELL
+
+ # switches
+ mb_cflags=$CFLAGS
+ mb_cflags_debug=$CFLAGS_DEBUG
+ mb_cflags_common=$CFLAGS_COMMON
+ mb_cflags_cmdline=$CFLAGS_CMDLINE
+ mb_cflags_config=$CFLAGS_CONFIG
+ mb_cflags_sysroot=$CFLAGS_SYSROOT
+ mb_cflags_os=$CFLAGS_OS
+ mb_cflags_site=$CFLAGS_SITE
+ mb_cflags_path=$CFLAGS_PATH
+ mb_cflags_strict=$CFLAGS_STRICT
+ mb_cflags_util=$CFLAGS_UTIL
+ mb_cflags_last=$CFLAGS_LAST
+ mb_cflags_once=$CFLAGS_ONCE
+
+ mb_ldflags=$LDFLAGS
+ mb_ldflags_debug=$LDFLAGS_DEBUG
+ mb_ldflags_common=$LDFLAGS_COMMON
+ mb_ldflags_cmdline=$LDFLAGS_CMDLINE
+ mb_ldflags_config=$LDFLAGS_CONFIG
+ mb_ldflags_sysroot=$LDFLAGS_SYSROOT
+ mb_ldflags_path=$LDFLAGS_PATH
+ mb_ldflags_strict=$LDFLAGS_STRICT
+ mb_ldflags_util=$LDFLAGS_UTIL
+ mb_ldflags_last=$LDFLAGS_LAST
+ mb_ldflags_once=$LDFLAGS_ONCE
+
+ mb_pe_subsystem=$PE_SUBSYSTEM
+ mb_pe_image_base=$PE_IMAGE_BASE
+ mb_pe_config_defs=$PE_CONFIG_DEFS
+
+ mb_elf_eh_frame=$ELF_EH_FRAME
+ mb_elf_hash_style=$ELF_HASH_STYLE
+ mb_elf_config_defs=$ELF_CONFIG_DEFS
+
+ # overrides
+ mb_native_cc=$NATIVE_CC
+ mb_native_os=$NATIVE_OS
+ mb_native_os_bits=$NATIVE_OS_BITS
+ mb_native_os_underscore=$NATIVE_OS_UNDERSCORE
+
+ mb_user_cc=$CC
+ mb_user_cpp=$CPP
+ mb_user_cxx=$CXX
+}
+
+
+verify_build_directory()
+{
+ if [ "$mb_project_dir" = "$mb_pwd" ]; then
+ if [ "$mb_require_out_of_tree" = yes ]; then
+ error_msg "$mb_package: out-of-tree builds are required."
+ error_msg "please invoke configure again from a clean build directory."
+ exit 2
+ else
+ mb_project_dir='.'
+ fi
+ fi
+}
+
+
+verify_source_directory()
+{
+ if [ -z "$mb_source_dir" ]; then
+ if [ "$mb_require_source_dir" = yes ]; then
+ error_msg "$mb_package: specifying an external source directory is required."
+ error_msg "you can set the source directory either via --source-dir=<path>,"
+ error_msg "or by setting the SOURCE_DIR variable."
+ exit 2
+ fi
+ fi
+}
+
+
+common_defaults()
+{
+ # git
+ if [ -n "$mb_source_dir" ]; then
+ if [ -d "$mb_source_dir/.git" ]; then
+ mb_git_reference_index="\$(SOURCE_DIR)/.git/index"
+ fi
+ elif [ -d "$mb_project_dir/.git" ]; then
+ mb_git_reference_index="\$(PROJECT_DIR)/.git/index"
+ fi
+
+ # project
+ [ -z "$mb_nickname" ] && mb_nickname=$mb_package
+ [ -z "$mb_source_dir" ] && mb_source_dir=$mb_project_dir
+ [ -z "$mb_avoid_version" ] && mb_avoid_version='no'
+
+ # pkgconfig
+ [ -z "$mb_pkgname" ] && mb_pkgname="$mb_default_pkgname"
+ [ -z "$mb_pkgdesc" ] && mb_pkgdesc="$mb_default_pkgdesc"
+ [ -z "$mb_pkgusrc" ] && mb_pkgusrc="$mb_default_pkgusrc"
+ [ -z "$mb_pkgrepo" ] && mb_pkgrepo="$mb_default_pkgrepo"
+ [ -z "$mb_pkgpsrc" ] && mb_pkgpsrc="$mb_default_pkgpsrc"
+ [ -z "$mb_pkgdurl" ] && mb_pkgdurl="$mb_default_pkgdurl"
+ [ -z "$mb_pkgdefs" ] && mb_pkgdefs="$mb_default_pkgdefs"
+ [ -z "$mb_pkglibs" ] && mb_pkglibs="$mb_default_pkglibs"
+
+ # dirs
+ [ -z "$mb_prefix" ] && [ -z "$mb_prefix_set" ] \
+ && mb_prefix='/usr/local'
+
+ [ -z "$mb_exec_prefix" ] && [ -z "$mb_exec_prefix_set" ] \
+ && mb_exec_prefix=$mb_prefix
+
+ [ -z "$mb_bindir" ] && [ -z "$mb_bindir_set" ] \
+ && [ -z "$mb_bindir_basename" ] \
+ && mb_bindir=$mb_exec_prefix/bin
+
+ [ -z "$mb_bindir" ] && [ -z "$mb_bindir_set" ] \
+ && mb_bindir=$mb_exec_prefix/$mb_bindir_basename
+
+ [ -z "$mb_sbindir" ] && mb_sbindir=$mb_exec_prefix/sbin
+ [ -z "$mb_libdir" ] && mb_libdir=$mb_exec_prefix/lib
+ [ -z "$mb_includedir" ] && mb_includedir=$mb_prefix/include
+ [ -z "$mb_oldincludedir" ] && mb_oldincludedir=$mb_prefix/include
+ [ -z "$mb_datarootdir" ] && mb_datarootdir=$mb_prefix/share
+ [ -z "$mb_mandir" ] && mb_mandir=$mb_datarootdir/man
+ [ -z "$mb_docdir" ] && mb_docdir=$mb_datarootdir/doc
+ [ -z "$mb_libexecdir" ] && mb_libexecdir=$mb_exec_prefix/libexec
+
+ [ -z "$mb_sysconfdir" ] && mb_sysconfdir=$mb_exec_prefix/etc
+ [ -z "$mb_sharedstatedir" ] && mb_sharedstatedir=$mb_prefix/com
+ [ -z "$mb_localstatedir" ] && mb_localstatedir=$mb_prefix/var
+ [ -z "$mb_runstatedir" ] && mb_runstatedir=$mb_localstatedir/run
+ [ -z "$mb_datarootdir" ] && mb_datarootdir=$mb_prefix/share
+ [ -z "$mb_datadir" ] && mb_datadir=$mb_datarootdir
+ [ -z "$mb_infodir" ] && mb_infodir=$mb_datarootdir/info
+ [ -z "$mb_localedir" ] && mb_localedir=$mb_datarootdir/locale
+ [ -z "$mb_htmldir" ] && mb_htmldir=$mb_docdir
+ [ -z "$mb_dvidir" ] && mb_dvidir=$mb_docdir
+ [ -z "$mb_pdfdir" ] && mb_pdfdir=$mb_docdir
+ [ -z "$mb_psdir" ] && mb_psdir=$mb_docdir
+
+
+ # build
+ [ -z "$mb_build" ] && mb_build=$mb_default_build
+ [ -z "$mb_host" ] && mb_host=$mb_default_host
+ [ -z "$mb_cchost" ] && mb_cchost=$mb_default_cchost
+ [ -z "$mb_target" ] && mb_target=$mb_default_target
+ [ -z "$mb_arch" ] && mb_arch=$mb_default_arch
+ [ -z "$mb_compiler" ] && mb_compiler=$mb_default_compiler
+ [ -z "$mb_toolchain" ] && mb_toolchain=$mb_default_toolchain
+ [ -z "$mb_sysroot" ] && mb_sysroot=$mb_default_sysroot
+ [ -z "$mb_cross_compile" ] && mb_cross_compile=$mb_default_cross_compile
+ [ -z "$mb_shell" ] && mb_shell=$mb_default_shell
+
+ # switches
+ [ -z "$mb_cflags_debug" ] && mb_cflags_debug=$mb_default_cflags_debug
+ [ -z "$mb_cflags_common" ] && mb_cflags_common=$mb_default_cflags_common
+ [ -z "$mb_cflags_cmdline" ] && mb_cflags_cmdline=$mb_default_cflags_cmdline
+ [ -z "$mb_cflags_config" ] && mb_cflags_config=$mb_default_cflags_config
+ [ -z "$mb_cflags_sysroot" ] && mb_cflags_sysroot=$mb_default_cflags_sysroot
+ [ -z "$mb_cflags_os" ] && mb_cflags_os=$mb_default_cflags_os
+ [ -z "$mb_cflags_site" ] && mb_cflags_site=$mb_default_cflags_site
+ [ -z "$mb_cflags_path" ] && mb_cflags_path=$mb_default_cflags_path
+ [ -z "$mb_cflags_strict" ] && mb_cflags_strict=$mb_default_cflags_strict
+ [ -z "$mb_cflags_util" ] && mb_cflags_util=$mb_default_cflags_util
+ [ -z "$mb_cflags_last" ] && mb_cflags_last=$mb_default_cflags_last
+ [ -z "$mb_cflags_once" ] && mb_cflags_once=$mb_default_cflags_once
+
+ [ -z "$mb_ldflags_debug" ] && mb_ldflags_debug=$mb_default_ldflags_debug
+ [ -z "$mb_ldflags_common" ] && mb_ldflags_common=$mb_default_ldflags_common
+ [ -z "$mb_ldflags_cmdline" ] && mb_ldflags_cmdline=$mb_default_ldflags_cmdline
+ [ -z "$mb_ldflags_config" ] && mb_ldflags_config=$mb_default_ldflags_config
+ [ -z "$mb_ldflags_sysroot" ] && mb_ldflags_sysroot=$mb_default_ldflags_sysroot
+ [ -z "$mb_ldflags_path" ] && mb_ldflags_path=$mb_default_ldflags_path
+ [ -z "$mb_ldflags_strict" ] && mb_ldflags_strict=$mb_default_ldflags_strict
+ [ -z "$mb_ldflags_util" ] && mb_ldflags_util=$mb_default_ldflags_util
+ [ -z "$mb_ldflags_last" ] && mb_ldflags_last=$mb_default_ldflags_last
+ [ -z "$mb_ldflags_once" ] && mb_ldflags_once=$mb_default_ldflags_once
+
+ [ -z "$mb_pe_subsystem" ] && mb_pe_subsystem=$mb_default_pe_subsystem
+ [ -z "$mb_pe_image_base" ] && mb_pe_image_base=$mb_default_pe_image_base
+ [ -z "$mb_pe_config_defs" ] && mb_pe_config_defs=$mb_default_pe_config_defs
+
+ [ -z "$mb_elf_eh_frame" ] && mb_elf_eh_frame=$mb_default_elf_eh_frame
+ [ -z "$mb_elf_hash_style" ] && mb_elf_hash_style=$mb_default_elf_hash_style
+ [ -z "$mb_elf_config_defs" ] && mb_elf_config_defs=$mb_default_elf_config_defs
+
+ # config
+ [ -z "$mb_all_static" ] && mb_all_static='no'
+ [ -z "$mb_all_shared" ] && mb_all_shared='no'
+ [ -z "$mb_disable_frontend" ] && mb_disable_frontend='no'
+ [ -z "$mb_disable_static" ] && mb_disable_static='no'
+ [ -z "$mb_disable_shared" ] && mb_disable_shared='no'
+
+ # host/target
+ [ -z "$mb_host" ] && mb_host=$mb_target
+ [ -z "$mb_target" ] && mb_target=$mb_host
+
+ # sysroot
+ if [ -n "$mb_sysroot" ]; then
+ if [ -z "$mb_cflags_sysroot" ]; then
+ mb_cflags_sysroot="--sysroot=$mb_sysroot"
+ fi
+
+ if [ -z "$mb_ldflags_sysroot" ]; then
+ mb_ldflags_sysroot="--sysroot=$mb_sysroot"
+ fi
+ fi
+
+ # debug
+ if [ "$mb_debug" = yes ]; then
+ if [ -z "$mb_cflags_debug" ]; then
+ mb_cflags_debug='-g3 -O0'
+ fi
+ fi
+
+ # compiler
+ if [ -n "$mb_compiler" ]; then
+ if [ -z "$mb_native_cc" ]; then
+ mb_native_cc=$mb_compiler
+ fi
+ fi
+
+ # toolchain
+ if [ -z "$mb_toolchain" ]; then
+ mb_toolchain='binutils'
+ fi
+
+ # fallback host recipe
+ if [ -n "$mb_host" ]; then
+ if ! [ -f $mb_project_dir/sysinfo/host/$mb_host.mk ]; then
+ if [ -z "$mb_cross_compile" ]; then
+ mb_cross_compile=$mb_host-
+ fi
+
+ mb_host='any-host';
+ fi
+ fi
+
+ # fallback compiler recipe
+ if [ -n "$mb_compiler" ]; then
+ if ! [ -f $mb_project_dir/sysinfo/compiler/$mb_compiler.mk ]; then
+ mb_compiler='any-compiler'
+ fi
+ fi
+}
+
+
+native_defaults()
+{
+ # CC (when set, must be valid)
+ if [ -n "$CC" ]; then
+ $CC -dM -E - < /dev/null > /dev/null || exit 2
+ fi
+
+ # compiler
+ [ -z "$mb_native_cc" ] && mb_native_cc=$CC
+ [ -z "$mb_native_cc" ] && mb_native_cc='cc'
+ $mb_native_cc -dM -E - < /dev/null > /dev/null 2>/dev/null || mb_native_cc=
+
+ [ -z "$mb_native_cc" ] && mb_native_cc='gcc'
+ $mb_native_cc -dM -E - < /dev/null > /dev/null 2>/dev/null || mb_native_cc=
+
+ [ -z "$mb_native_cc" ] && mb_native_cc='clang'
+ $mb_native_cc -dM -E - < /dev/null > /dev/null 2>/dev/null || mb_native_cc=
+
+ [ -z "$mb_native_cc" ] && mb_native_cc='cparser'
+ $mb_native_cc -dM -E - < /dev/null > /dev/null 2>/dev/null || mb_native_cc=
+
+ if [ -z "$mb_native_cc" ]; then
+ echo "configure: info: could not find a working native compiler."
+ mb_native_cc='false'
+ fi
+
+ if [ -z "$mb_compiler" ]; then
+ $mb_native_cc -dM -E - < /dev/null | grep -q '__clang__' && mb_compiler='clang'
+ fi
+
+ if [ -z "$mb_compiler" ]; then
+ $mb_native_cc -dM -E - < /dev/null | grep -q '__GCC' && mb_compiler='gcc'
+ fi
+
+ if [ -z "$mb_compiler" ]; then
+ $mb_native_cc -dM -E - < /dev/null | grep -q "^gcc" && mb_compiler='gcc'
+ fi
+
+ if [ -z "$mb_compiler" ]; then
+ $mb_native_cc -dM -E - < /dev/null | grep -q '__CPARSER__' && mb_compiler='cparser'
+ fi
+
+ if [ -z "$mb_compiler" ]; then
+ echo "configure: info: could not identify the native compiler."
+ mb_compiler='any-compiler'
+ fi
+
+
+ # host
+ if [ -z "$mb_host" ]; then
+ mb_host='native'
+ fi
+
+
+ # target
+ if [ -z "$mb_target" ]; then
+ mb_target='native'
+ fi
+
+
+ # os
+ if [ -z "$mb_native_os" ]; then
+ mb_native_os=`uname | tr '[:upper:]' '[:lower:]'`
+ fi
+
+ mb_native_os_sizeof_pointer=`$mb_native_cc -dM -E - < /dev/null \
+ | awk '$2 == "__SIZEOF_POINTER__" { print $3 }'`
+
+ mb_native_os_bits=$((8 * ${mb_native_os_sizeof_pointer:-0}))
+
+ if [ $mb_native_os_bits = 32 ]; then
+ mb_native_os_underscore='_'
+ else
+ mb_native_os_underscore=''
+ fi
+
+ if [ -z "$mb_native_os_sizeof_pointer" ]; then
+ warning_msg "config error: could not determine size of pointer on native system."
+ fi
+
+ # grumpily support crooked uname output
+ if ! [ -f $mb_project_dir/sysinfo/os/$mb_native_os.mk ]; then
+ mb_native_os=`echo $mb_native_os | cut -d'_' -f1`
+ fi
+
+ # fallback os recipe
+ if ! [ -f $mb_project_dir/sysinfo/os/$mb_native_os.mk ]; then
+ mb_native_os='any-os';
+ fi
+}
+
+
+cross_defaults()
+{
+ if [ -z "$mb_cross_compile" ] && [ "$mb_host" != native ]; then
+ mb_cross_compile=$mb_host'-'
+ fi
+}
+
+
+config_flags()
+{
+ mb_ldflags_tmp=" $mb_ldflags "
+ mb_ldflags_libs=`echo "$mb_ldflags_tmp" | sed 's/ -static / /g'`
+
+ if [ "$mb_ldflags_tmp" != "$mb_ldflags_libs" ]; then
+ mb_ldflags="$mb_ldflags_libs"
+ mb_ldflags_util="$mb_ldflags_util -static"
+ fi
+
+ # ccstrict
+ if [ "$mb_ccstrict" = 'yes' ]; then
+ mb_cflags_strict='-Wall -Werror -Wextra -Wundef'
+ fi
+
+ # ldstrict
+ if [ "$mb_ldstrict" = 'yes' ]; then
+ mb_ldflags_strict='-Wl,--no-undefined'
+ fi
+}
+
+
+config_copy()
+{
+ sed -e 's^@package@^'"$mb_package"'^g' \
+ -e 's^@nickname@^'"$mb_nickname"'^g' \
+ -e 's^@project_dir@^'"$mb_project_dir"'^g' \
+ -e 's^@source_dir@^'"$mb_source_dir"'^g' \
+ -e 's^@git_reference_index@^'"$mb_git_reference_index"'^g' \
+ -e 's^@custom_install_headers@^'"$mb_custom_install_headers"'^g' \
+ -e 's^@avoid_version@^'"$mb_avoid_version"'^g' \
+ \
+ -e 's^@pkgname@^'"$mb_pkgname"'^g' \
+ -e 's^@pkgdesc@^'"$mb_pkgdesc"'^g' \
+ -e 's^@pkgusrc@^'"$mb_pkgusrc"'^g' \
+ -e 's^@pkgrepo@^'"$mb_pkgrepo"'^g' \
+ -e 's^@pkgpsrc@^'"$mb_pkgpsrc"'^g' \
+ -e 's^@pkgdurl@^'"$mb_pkgdurl"'^g' \
+ -e 's^@pkgdefs@^'"$mb_pkgdefs"'^g' \
+ -e 's^@pkglibs@^'"$mb_pkglibs"'^g' \
+ \
+ -e 's^@build@^'"$mb_build"'^g' \
+ -e 's^@host@^'"$mb_host"'^g' \
+ -e 's^@target@^'"$mb_target"'^g' \
+ -e 's^@arch@^'"$mb_arch"'^g' \
+ -e 's^@compiler@^'"$mb_compiler"'^g' \
+ -e 's^@toolchain@^'"$mb_toolchain"'^g' \
+ -e 's^@sysroot@^'"$mb_sysroot"'^g' \
+ -e 's^@cross_compile@^'"$mb_cross_compile"'^g' \
+ -e 's^@shell@^'"$mb_shell"'^g' \
+ \
+ -e 's^@cflags@^'"$mb_cflags"'^g' \
+ -e 's^@cflags_debug@^'"$mb_cflags_debug"'^g' \
+ -e 's^@cflags_common@^'"$mb_cflags_common"'^g' \
+ -e 's^@cflags_cmdline@^'"$mb_cflags $mb_cflags_cmdline"'^g' \
+ -e 's^@cflags_config@^'"$mb_cflags_config"'^g' \
+ -e 's^@cflags_sysroot@^'"$mb_cflags_sysroot"'^g' \
+ -e 's^@cflags_os@^'"$mb_cflags_os"'^g' \
+ -e 's^@cflags_site@^'"$mb_cflags_site"'^g' \
+ -e 's^@cflags_path@^'"$mb_cflags_path"'^g' \
+ -e 's^@cflags_strict@^'"$mb_cflags_strict"'^g' \
+ -e 's^@cflags_util@^'"$mb_cflags_util"'^g' \
+ -e 's^@cflags_last@^'"$mb_cflags_last"'^g' \
+ -e 's^@cflags_once@^'"$mb_cflags_once"'^g' \
+ \
+ -e 's^@ldflags@^'"$mb_ldflags"'^g' \
+ -e 's^@ldflags_debug@^'"$mb_ldflags_debug"'^g' \
+ -e 's^@ldflags_common@^'"$mb_ldflags_common"'^g' \
+ -e 's^@ldflags_cmdline@^'"$mb_ldflags $mb_ldflags_cmdline"'^g' \
+ -e 's^@ldflags_config@^'"$mb_ldflags_config"'^g' \
+ -e 's^@ldflags_sysroot@^'"$mb_ldflags_sysroot"'^g' \
+ -e 's^@ldflags_path@^'"$mb_ldflags_path"'^g' \
+ -e 's^@ldflags_strict@^'"$mb_ldflags_strict"'^g' \
+ -e 's^@ldflags_util@^'"$mb_ldflags_util"'^g' \
+ -e 's^@ldflags_last@^'"$mb_ldflags_last"'^g' \
+ -e 's^@ldflags_once@^'"$mb_ldflags_once"'^g' \
+ \
+ -e 's^@pe_subsystem@^'"$mb_pe_subsystem"'^g' \
+ -e 's^@pe_image\_base@^'"$mb_pe_image_base"'^g' \
+ -e 's^@pe_config\_defs@^'"$mb_pe_config_defs"'^g' \
+ \
+ -e 's^@elf_eh\_frame@^'"$mb_elf_eh_frame"'^g' \
+ -e 's^@elf_hash\_style@^'"$mb_elf_hash_style"'^g' \
+ -e 's^@elf_config\_defs@^'"$mb_elf_config_defs"'^g' \
+ \
+ -e 's^@prefix@^'"$mb_prefix"'^g' \
+ -e 's^@exec_prefix@^'"$mb_exec_prefix"'^g' \
+ -e 's^@bindir@^'"$mb_bindir"'^g' \
+ -e 's^@sbindir@^'"$mb_sbindir"'^g' \
+ -e 's^@libdir@^'"$mb_libdir"'^g' \
+ -e 's^@includedir@^'"$mb_includedir"'^g' \
+ -e 's^@oldincludedir@^'"$mb_oldincludedir"'^g' \
+ -e 's^@mandir@^'"$mb_mandir"'^g' \
+ -e 's^@docdir@^'"$mb_docdir"'^g' \
+ -e 's^@libexecdir@^'"$mb_libexecdir"'^g' \
+ \
+ -e 's^@sysconfdir@^'"$mb_sysconfdir"'^g' \
+ -e 's^@sharedstatedir@^'"$mb_sharedstatedir"'^g' \
+ -e 's^@localstatedir@^'"$mb_localstatedir"'^g' \
+ -e 's^@runstatedir@^'"$mb_runstatedir"'^g' \
+ -e 's^@datarootdir@^'"$mb_datarootdir"'^g' \
+ -e 's^@datadir@^'"$mb_datadir"'^g' \
+ -e 's^@infodir@^'"$mb_infodir"'^g' \
+ -e 's^@localedir@^'"$mb_localedir"'^g' \
+ -e 's^@htmldir@^'"$mb_htmldir"'^g' \
+ -e 's^@dvidir@^'"$mb_dvidir"'^g' \
+ -e 's^@pdfdir@^'"$mb_pdfdir"'^g' \
+ -e 's^@psdir@^'"$mb_psdir"'^g' \
+ \
+ -e 's^@native_cc@^'"$mb_native_cc"'^g' \
+ -e 's^@native_os@^'"$mb_native_os"'^g' \
+ -e 's^@native_os_bits@^'"$mb_native_os_bits"'^g' \
+ -e 's^@native_os_underscore@^'"$mb_native_os_underscore"'^g' \
+ \
+ -e 's^@user_cc@^'"$mb_user_cc"'^g' \
+ -e 's^@user_cpp@^'"$mb_user_cpp"'^g' \
+ -e 's^@user_cxx@^'"$mb_user_cxx"'^g' \
+ \
+ -e 's^@all_static@^'"$mb_all_static"'^g' \
+ -e 's^@all_shared@^'"$mb_all_shared"'^g' \
+ -e 's^@disable_frontend@^'"$mb_disable_frontend"'^g' \
+ -e 's^@disable_static@^'"$mb_disable_static"'^g' \
+ -e 's^@disable_shared@^'"$mb_disable_shared"'^g' \
+ $mb_project_dir/Makefile.in > $mb_pwd/Makefile.tmp || exit 2
+
+ if [ -z "$mb_cchost" ]; then
+ if [ "$mb_host" = 'native' ]; then
+ mb_cchost=`make -s -f $mb_pwd/Makefile.tmp cchost`
+ else
+ mb_cchost=$mb_host
+ fi
+ fi
+
+ sed -e 's^@cchost@^'"$mb_cchost"'^g' $mb_pwd/Makefile.tmp \
+ > $mb_pwd/Makefile.host || exit 2
+
+ rm $mb_pwd/Makefile.tmp || exit 2
+ mv $mb_pwd/Makefile.host $mb_pwd/Makefile || exit 2
+}
+
+
+config_support()
+{
+ [ "$mb_disable_shared" = 'yes' ] && return 0
+
+ mbt_cc=`make .display-cc`
+ mbt_cflags=`make .display-cflags`
+ mbt_source='int foo(int x){return ++x;}'
+ mbt_result='no'
+
+ rm -f a.out
+ echo "$mbt_source" | "$mbt_cc" -shared -o a.out -xc -
+ stat a.out >/dev/null 2>&1 && mbt_result='yes'
+ rm -f a.out
+
+ if [ "$mbt_result" = 'no' ]; then
+ mb_disable_shared='yes'
+ config_copy
+ fi
+}
+
+
+config_host()
+{
+ make -s host.tag && return 0
+
+ error_msg "configure was able to generate a Makefile for the selected host,"
+ error_msg "however the host-targeting compiler was found to be missing"
+ error_msg "at least one of the required headers or features."
+ exit 2
+}
+
+
+config_status()
+{
+ printf "\n\n"
+ make .display
+ printf "\nconfiguration completed successfully.\n\n"
+}
+
+# one: init
+init_vars
+verify_build_directory
+
+
+# two: args
+for arg ; do
+ case "$arg" in
+ --help) usage
+ ;;
+
+ # dirs
+ --prefix=*)
+ mb_prefix_set=yes
+ mb_prefix=${arg#*=}
+ ;;
+ --exec-prefix=*)
+ mb_exec_prefix_set=yes
+ mb_exec_prefix=${arg#*=}
+ ;;
+ --bindir=*)
+ mb_bindir_set=yes
+ mb_bindir=${arg#*=}
+ ;;
+ --sbindir=*)
+ mb_sbindir=${arg#*=}
+ ;;
+ --libdir=*)
+ mb_libdir=${arg#*=}
+ ;;
+ --includedir=*)
+ mb_includedir=${arg#*=}
+ ;;
+ --oldincludedir=*)
+ mb_oldincludedir=${arg#*=}
+ ;;
+ --mandir=*)
+ mb_mandir=${arg#*=}
+ ;;
+ --libexecdir=*)
+ mb_libexecdir=${arg#*=}
+ ;;
+
+
+ --sysconfdir=*)
+ mb_sysconfdir=${arg#*=}
+ ;;
+ --sharedstatedir=*)
+ mb_sharedstatedir=${arg#*=}
+ ;;
+ --localstatedir=*)
+ mb_localstatedir=${arg#*=}
+ ;;
+ --runstatedir=*)
+ mb_runstatedir=${arg#*=}
+ ;;
+ --datarootdir=*)
+ mb_datarootdir=${arg#*=}
+ ;;
+ --datadir=*)
+ mb_datadir=${arg#*=}
+ ;;
+ --infodir=*)
+ mb_infodir=${arg#*=}
+ ;;
+ --localedir=*)
+ mb_localedir=${arg#*=}
+ ;;
+ --htmldir=*)
+ mb_htmldir=${arg#*=}
+ ;;
+ --dvidir=*)
+ mb_dvidir=${arg#*=}
+ ;;
+ --pdfdir=*)
+ mb_pdfdir=${arg#*=}
+ ;;
+ --psdir=*)
+ mb_psdir=${arg#*=}
+ ;;
+
+
+ # build
+ --build=*)
+ mb_build=${arg#*=}
+ ;;
+ --host=*)
+ mb_host=${arg#*=}
+ ;;
+ --cchost=*)
+ mb_cchost=${arg#*=}
+ ;;
+ --target=*)
+ mb_target=${arg#*=}
+ ;;
+ --arch=*)
+ mb_arch=${arg#*=}
+ ;;
+ --compiler=*)
+ mb_compiler=${arg#*=}
+ ;;
+ --toolchain=*)
+ mb_toolchain=${arg#*=}
+ ;;
+ --sysroot=*)
+ mb_sysroot=${arg#*=}
+ ;;
+ --cross-compile=*)
+ mb_cross_compile=${arg#*=}
+ ;;
+ --shell=*)
+ mb_shell=${arg#*=}
+ ;;
+ --debug)
+ mb_debug='yes'
+ ;;
+
+ # config
+ --all-static)
+ mb_all_static='yes'
+ ;;
+ --all-shared)
+ mb_all_shared='yes'
+ ;;
+ --disable-frontend)
+ mb_disable_frontend='yes'
+ ;;
+ --disable-app)
+ mb_disable_frontend='yes'
+ ;;
+ --enable-frontend)
+ mb_disable_frontend='no'
+ ;;
+ --enable-app)
+ mb_disable_frontend='no'
+ ;;
+ --disable-static)
+ mb_disable_static='yes'
+ ;;
+ --disable-shared)
+ mb_disable_shared='yes'
+ ;;
+ --enable-static)
+ mb_disable_static='no'
+ ;;
+ --enable-shared)
+ mb_disable_shared='no'
+ ;;
+
+ # convenience
+ --strict)
+ mb_ccstrict='yes'
+ mb_ldstrict='yes'
+ ;;
+ --ccstrict)
+ mb_ccstrict='yes'
+ ;;
+ --ldstrict)
+ mb_ldstrict='yes'
+ ;;
+
+ # project
+ --nickname=*)
+ mb_nickname=${arg#*=}
+ ;;
+ --program-prefix=*)
+ mb_program_prefix=${arg#*=}
+ ;;
+ --avoid-version)
+ mb_avoid_version='yes'
+ ;;
+ --source-dir=*)
+ mb_source_dir=${arg#*=}
+ ;;
+
+ # pkgconfig
+ --pkgname=*)
+ mb_pkgname=${arg#*=}
+ ;;
+
+ --pkgdesc=*)
+ mb_pkgdesc=${arg#*=}
+ ;;
+
+ --pkgusrc=*)
+ mb_pkgusrc=${arg#*=}
+ ;;
+
+ --pkgrepo=*)
+ mb_pkgrepo=${arg#*=}
+ ;;
+
+ --pkgpsrc=*)
+ mb_pkgpsrc=${arg#*=}
+ ;;
+
+ --pkgdurl=*)
+ mb_pkgdurl=${arg#*=}
+ ;;
+
+ --pkgdefs=*)
+ mb_pkgdefs=${arg#*=}
+ ;;
+
+ --pkglibs=*)
+ mb_pkglibs=${arg#*=}
+ ;;
+
+ # compatibility
+ --enable-dependency-tracking)
+ ;;
+ --disable-dependency-tracking)
+ ;;
+
+ *)
+ error_msg ${arg#}: "unsupported config argument."
+ exit 2
+ ;;
+ esac
+done
+
+
+
+# three: validation
+verify_source_directory
+
+if ! [ -z "$mb_program_prefix" ]; then
+ error_msg "--program-prefix is not yet fully support (must be null)."
+fi
+
+
+
+# four: defaults
+common_defaults
+native_defaults
+cross_defaults
+
+
+
+# five: config
+config_flags
+config_copy
+config_support
+config_host
+config_status
+
+
+# all done
+exit 0
diff --git a/project/arch.mk b/project/arch.mk
new file mode 100644
index 0000000..e69de29
--- /dev/null
+++ b/project/arch.mk
diff --git a/project/common.mk b/project/common.mk
new file mode 100644
index 0000000..3dc0727
--- /dev/null
+++ b/project/common.mk
@@ -0,0 +1,3 @@
+APP_SRCS = \
+
+COMMON_SRCS = \
diff --git a/project/depends.mk b/project/depends.mk
new file mode 100644
index 0000000..e69de29
--- /dev/null
+++ b/project/depends.mk
diff --git a/project/extras.mk b/project/extras.mk
new file mode 100644
index 0000000..e69de29
--- /dev/null
+++ b/project/extras.mk
diff --git a/project/headers.mk b/project/headers.mk
new file mode 100644
index 0000000..9d50ee3
--- /dev/null
+++ b/project/headers.mk
@@ -0,0 +1,5 @@
+API_HEADERS = \
+
+INTERNAL_HEADERS = \
+
+ALL_HEADERS = $(API_HEADERS) $(INTERNAL_HEADERS)
diff --git a/project/osforce.mk b/project/osforce.mk
new file mode 100644
index 0000000..e69de29
--- /dev/null
+++ b/project/osforce.mk
diff --git a/project/overrides.mk b/project/overrides.mk
new file mode 100644
index 0000000..e69de29
--- /dev/null
+++ b/project/overrides.mk
diff --git a/project/tagver.mk b/project/tagver.mk
new file mode 100644
index 0000000..cc894fd
--- /dev/null
+++ b/project/tagver.mk
@@ -0,0 +1,5 @@
+VER_NAMESPACE = BPY2
+
+VER_MAJOR = 1
+VER_MINOR = 0
+VER_PATCH = 0
diff --git a/project/tree.mk b/project/tree.mk
new file mode 100644
index 0000000..52f79f7
--- /dev/null
+++ b/project/tree.mk
@@ -0,0 +1,2 @@
+tree.tag:
+ touch tree.tag
diff --git a/sofort/custom.mk b/sofort/custom.mk
new file mode 100644
index 0000000..8e0bbc4
--- /dev/null
+++ b/sofort/custom.mk
@@ -0,0 +1,76 @@
+ifeq ($(OS_BINFMT),PE)
+include $(PROJECT_DIR)/sysinfo/os/pe.mk
+endif
+
+ifeq ($(OS_BINFMT),ELF)
+include $(PROJECT_DIR)/sysinfo/os/elf.mk
+endif
+
+
+
+ifeq ($(DISABLE_STATIC),yes)
+package-static:
+package-install-static:
+else
+package-static: static
+package-install-static: install-static
+endif
+
+ifeq ($(DISABLE_SHARED),yes)
+package-shared:
+package-install-shared:
+else
+package-shared: shared
+package-install-shared: install-shared
+endif
+
+
+
+ifeq ($(DISABLE_FRONTEND),yes)
+app-tag:
+package-install-app:
+package-install-extras:
+else
+app-tag: package-app app.tag
+package-install-app: install-app
+package-install-extras: install-extras
+endif
+
+
+
+ifeq ($(ALL_STATIC),yes)
+
+package-app: static-app
+app: PACKAGE_APP = $(STATIC_APP)
+app-tag: PACKAGE_APP = $(STATIC_APP)
+app.tag: $(STATIC_APP)
+
+
+else ifeq ($(ALL_SHARED),yes)
+
+package-app: shared-app
+app: PACKAGE_APP = $(SHARED_APP)
+app-tag: PACKAGE_APP = $(SHARED_APP)
+app.tag: $(SHARED_APP)
+
+
+else
+
+package-app: default-app
+app: PACKAGE_APP = $(DEFAULT_APP)
+app-tag: PACKAGE_APP = $(DEFAULT_APP)
+app.tag: $(DEFAULT_APP)
+
+endif
+
+
+
+ifeq ($(CUSTOM_INSTALL_HEADERS),yes)
+
+install-headers:install-headers-custom
+
+else
+
+install-headers:install-headers-default
+
+endif
diff --git a/sofort/defs.mk b/sofort/defs.mk
new file mode 100644
index 0000000..151bc3d
--- /dev/null
+++ b/sofort/defs.mk
@@ -0,0 +1,66 @@
+SHARED_LIB_DEPS =
+SHARED_APP_DEPS =
+STATIC_APP_DEPS =
+
+COMMON_LOBJS = $(COMMON_SRCS:.c=.lo)
+COMMON_OBJS = $(COMMON_SRCS:.c=.o)
+
+ARCH_LOBJS = $(ARCH_SRCS:.c=.lo)
+ARCH_OBJS = $(ARCH_SRCS:.c=.o)
+
+APP_LOBJS = $(APP_SRCS:.c=.lo)
+APP_OBJS = $(APP_SRCS:.c=.o)
+
+SHARED_OBJS = $(COMMON_LOBJS) $(ARCH_LOBJS)
+STATIC_OBJS = $(COMMON_OBJS) $(ARCH_OBJS)
+
+STATIC_LIB_NAME = $(OS_LIB_PREFIX)$(PACKAGE)$(OS_ARCHIVE_EXT)
+STATIC_LIB = lib/$(STATIC_LIB_NAME)
+
+DSO_VER = $(OS_LIB_PREFIX)$(PACKAGE)$(OS_LIB_PREFIXED_SUFFIX)$(VER_XYZ)$(OS_LIB_SUFFIXED_SUFFIX)
+DSO_SONAME = $(OS_LIB_PREFIX)$(PACKAGE)$(OS_LIB_PREFIXED_SUFFIX)$(VER_SONAME)$(OS_LIB_SUFFIXED_SUFFIX)
+DSO_SOLINK = $(OS_LIB_PREFIX)$(PACKAGE)$(OS_LIB_SUFFIX)
+
+SHARED_LIB = lib/$(DSO_VER)
+SHARED_SONAME = lib/$(DSO_SONAME)
+SHARED_SOLINK = lib/$(DSO_SOLINK)
+
+IMP_DEF = $(OS_LIB_PREFIX)$(PACKAGE)$(VER_XYZ)$(OS_LIBDEF_EXT)
+IMP_VER = $(OS_LIB_PREFIX)$(PACKAGE)$(VER_XYZ)$(OS_IMPLIB_EXT)
+IMP_SONAME = $(OS_LIB_PREFIX)$(PACKAGE)$(VER_SONAME)$(OS_IMPLIB_EXT)
+IMP_SOLINK = $(OS_LIB_PREFIX)$(PACKAGE)$(OS_IMPLIB_EXT)
+
+IMPLIB_DEF = lib/$(IMP_DEF)
+IMPLIB_VER = lib/$(IMP_VER)
+IMPLIB_SONAME = lib/$(IMP_SONAME)
+IMPLIB_SOLINK = lib/$(IMP_SOLINK)
+
+APP = bin/$(OS_APP_PREFIX)$(NICKNAME)$(OS_APP_SUFFIX)
+DEFAULT_APP = bin/$(OS_APP_PREFIX)$(NICKNAME)-default$(OS_APP_SUFFIX)
+SHARED_APP = bin/$(OS_APP_PREFIX)$(NICKNAME)-shared$(OS_APP_SUFFIX)
+STATIC_APP = bin/$(OS_APP_PREFIX)$(NICKNAME)-static$(OS_APP_SUFFIX)
+
+CFLAGS = $(CFLAGS_DEBUG) $(CFLAGS_CONFIG) $(CFLAGS_SYSROOT) \
+ $(CFLAGS_COMMON) $(CFLAGS_CMDLINE) $(CFLAGS_HOST) \
+ $(CFLAGS_PATH) $(CFLAGS_OS) $(CFLAGS_SITE) \
+ $(CFLAGS_VERSION) $(CFLAGS_STRICT) \
+ $(CFLAGS_LAST) $(CFLAGS_ONCE)
+
+CFLAGS_SHARED = $(CFLAGS) $(CFLAGS_PIC) $(CFLAGS_SHARED_ATTR)
+CFLAGS_STATIC = $(CFLAGS) $(CFLAGS_OBJ) $(CFLAGS_STATIC_ATTR)
+CFLAGS_APP = $(CFLAGS) $(CFLAGS_OBJ) $(CFLAGS_APP_ATTR) $(CFLAGS_UTIL)
+
+LDFLAGS_SHARED = $(LDFLAGS_DEBUG) $(LDFLAGS_CONFIG) $(LDFLAGS_SYSROOT) \
+ $(LDFLAGS_COMMON) $(LDFLAGS_CMDLINE) $(LDFLAGS_HOST) \
+ $(LDFLAGS_PATH) $(SHARED_LIB_DEPS) $(LDFLAGS_STRICT) \
+ $(LDFLAGS_LAST) $(LDFLAGS_ONCE)
+
+LDFLAGS_APP = $(LDFLAGS_DEBUG) $(LDFLAGS_CONFIG) $(LDFLAGS_SYSROOT) \
+ $(LDFLAGS_COMMON) $(LDFLAGS_CMDLINE) $(LDFLAGS_HOST) \
+ $(LDFLAGS_PATH) $(SHARED_APP_DEPS) $(LDFLAGS_STRICT) \
+ $(LDFLAGS_UTIL) $(LDFLAGS_LAST) $(LDFLAGS_ONCE)
+
+LDFLAGS_STATIC = $(LDFLAGS_DEBUG) $(LDFLAGS_CONFIG) $(LDFLAGS_SYSROOT) \
+ $(LDFLAGS_COMMON) $(LDFLAGS_CMDLINE) $(LDFLAGS_HOST) \
+ $(LDFLAGS_PATH) $(STATIC_APP_DEPS) $(LDFLAGS_STRICT) \
+ $(LDFLAGS_LAST) $(LDFLAGS_ONCE)
diff --git a/sofort/pkgconf.mk b/sofort/pkgconf.mk
new file mode 100644
index 0000000..59a54e0
--- /dev/null
+++ b/sofort/pkgconf.mk
@@ -0,0 +1,40 @@
+ifeq ($(PKGCONF),no)
+
+install-pkgconf:
+
+else
+
+PKGCONF_VERSION = $(VER_MAJOR).$(VER_MINOR).$(VER_PATCH)
+
+build/$(PACKAGE).pc: .pkgconf
+
+build/$(PACKAGE).pc:
+ @touch $@
+ @chmod 0644 $@
+ PKGCONF_NAME='$(PKGNAME)' \
+ PKGCONF_DESC='$(PKGDESC)' \
+ PKGCONF_USRC='$(PKGUSRC)' \
+ PKGCONF_REPO='$(PKGREPO)' \
+ PKGCONF_PSRC='$(PKGPSRC)' \
+ PKGCONF_DURL='$(PKGDURL)' \
+ PKGCONF_DEFS='$(PKGDEFS)' \
+ PKGCONF_LIBS='$(PKGLIBS)' \
+ \
+ PKGCONF_EXEC_PREFIX='$(EXEC_PREFIX)' \
+ PKGCONF_PREFIX='$(PREFIX)' \
+ PKGCONF_LIBDIR='$(LIBDIR)' \
+ PKGCONF_INCLUDEDIR='$(INCLUDEDIR)' \
+ PKGCONF_VERSION='$(PKGCONF_VERSION)' \
+ $(PROJECT_DIR)/sofort/pkgconf.sh > $@
+
+install-pkgconf: build/$(PACKAGE).pc
+ mkdir -p $(DESTDIR)$(LIBDIR)/pkgconfig
+ cp -p build/$(PACKAGE).pc $(DESTDIR)$(LIBDIR)/pkgconfig
+
+install-shared: install-pkgconf
+
+install-static: install-pkgconf
+
+.PHONY: .pkgconf install-pkgconf
+
+endif
diff --git a/sofort/pkgconf.sh b/sofort/pkgconf.sh
new file mode 100755
index 0000000..a3f8eb0
--- /dev/null
+++ b/sofort/pkgconf.sh
@@ -0,0 +1,92 @@
+#!/bin/sh
+
+# prefix, exec_prefix
+if [ "$PKGCONF_PREFIX" = "$PKGCONF_EXEC_PREFIX" ]; then
+ echo 'prefix='${PKGCONF_PREFIX}
+ echo 'exec_prefix=${prefix}'
+else
+ echo 'prefix='${PKGCONF_PREFIX}
+ echo 'exec_prefix='${PKGCONF_EXEC_PREFIX}
+fi
+
+
+# (relative) includedir
+prefix=`dirname "$PKGCONF_INCLUDEDIR"`
+base=`basename "$PKGCONF_INCLUDEDIR"`
+
+if [ "$prefix/$base" = "$PKGCONF_PREFIX/$base" ]; then
+ echo 'includedir=${prefix}/'${base}
+else
+ echo 'includedir='${PKGCONF_INCLUDEDIR}
+fi
+
+if [ "$prefix/$base" = "$PKGCONF_PREFIX/include" ]; then
+ CFLAGS=
+else
+ CFLAGS='-I{includedir}'
+fi
+
+
+# (relative) libdir
+prefix=`dirname "$PKGCONF_LIBDIR"`
+base=`basename "$PKGCONF_LIBDIR"`
+
+if [ "$prefix/$base" = "$PKGCONF_EXEC_PREFIX/$base" ]; then
+ echo 'libdir=${prefix}/'${base}
+else
+ echo 'libdir='${PKGCONF_LIBDIR}
+fi
+
+if [ "$prefix/$base" = "$PKGCONF_EXEC_PREFIX/lib" ]; then
+ LDFLAGS='-l'${PKGCONF_NAME}
+elif [ "$prefix/$base" = "$PKGCONF_EXEC_PREFIX/lib64" ]; then
+ LDFLAGS='-l'${PKGCONF_NAME}
+else
+ LDFLAGS='-L'${PKGCONF_LIBDIR} '-l'${PKGCONF_NAME}
+fi
+
+
+# name, description, url, version
+echo
+echo 'Name: '${PKGCONF_NAME}
+echo 'Description: '${PKGCONF_DESC}
+echo 'URL: '${PKGCONF_USRC}
+echo 'Version: '${PKGCONF_VERSION}
+
+
+# repo (optional)
+if ! [ -z "$PKGCONF_REPO" ]; then
+ echo 'Repo: '${PKGCONF_REPO}
+fi
+
+
+# patches (optional)
+if ! [ -z "$PKGCONF_PSRC" ]; then
+ echo 'Patches: '${PKGCONF_PSRC}
+fi
+
+
+# disto (optional)
+if ! [ -z "$PKGCONF_DURL" ]; then
+ echo 'Distro: '${PKGCONF_DURL}
+fi
+
+
+# Cflags
+if [ -z "$PKGCONF_DEFS" ] && [ -z "$CFLAGS" ]; then
+ echo 'Cflags:'
+elif [ -z "$PKGCONF_DEFS" ]; then
+ echo 'Cflags: '${CFLAGS}
+elif [ -z "$CFLAGS" ]; then
+ echo 'Cflags: '${PKGCONF_DEFS}
+else
+ echo 'Cflags: '${PKGCONF_DEFS} ${CFLAGS}
+fi
+
+
+# Libs
+if [ -z "$PKGCONF_LIBS" ]; then
+ echo 'Libs: '${LDFLAGS}
+else
+ echo 'Libs: '${PKGCONF_LIBS} ${LDFLAGS}
+fi
diff --git a/sofort/version.mk b/sofort/version.mk
new file mode 100644
index 0000000..5ef0ee2
--- /dev/null
+++ b/sofort/version.mk
@@ -0,0 +1,63 @@
+include $(PROJECT_DIR)/project/tagver.mk
+
+CFLAGS_VERSION += -D$(VER_NAMESPACE)_TAG_VER_MAJOR=$(VER_MAJOR)
+CFLAGS_VERSION += -D$(VER_NAMESPACE)_TAG_VER_MINOR=$(VER_MINOR)
+CFLAGS_VERSION += -D$(VER_NAMESPACE)_TAG_VER_PATCH=$(VER_PATCH)
+
+ifeq ($(AVOID_VERSION),yes)
+
+VER_XYZ =
+VER_SONAME =
+
+package-shared-soname:
+package-shared-solink:
+package-install-soname:
+package-install-solink:
+
+else
+
+VER_XYZ = .$(VER_MAJOR).$(VER_MINOR).$(VER_PATCH)
+VER_SONAME = .$(VER_MAJOR)
+
+package-shared-soname: shared-soname
+package-shared-solink: shared-solink
+package-install-soname: install-soname
+package-install-solink: install-solink
+
+
+
+# libfoo.so (common)
+install-solink: install-lib
+ rm -f $(SHARED_SOLINK).tmp
+ ln -s $(DSO_VER) $(SHARED_SOLINK).tmp
+ mv $(SHARED_SOLINK).tmp $(DESTDIR)$(LIBDIR)/$(DSO_SOLINK)
+
+$(SHARED_SOLINK): $(SHARED_LIB)
+ rm -f $@.tmp
+ ln -s $(DSO_VER) $@.tmp
+ mv $@.tmp $@
+
+# libfoo.so.x (symlink)
+ifeq ($(OS_SONAME),symlink)
+$(SHARED_SONAME): $(SHARED_LIB)
+ rm -f $@.tmp
+ ln -s $(DSO_VER) $@.tmp
+ mv $@.tmp $@
+
+install-soname: install-lib
+ rm -f $(SHARED_SONAME).tmp
+ ln -s $(DSO_VER) $(SHARED_SONAME).tmp
+ mv $(SHARED_SONAME).tmp $(DESTDIR)$(LIBDIR)/$(DSO_SONAME)
+endif
+
+
+# libfoo.so.x (copy)
+ifeq ($(OS_SONAME),copy)
+install-soname: install-lib
+ cp $(SHARED_LIB) $(DESTDIR)$(LIBDIR)/$(DSO_SONAME)
+
+$(SHARED_SONAME): $(SHARED_LIB)
+ cp $(SHARED_LIB) $(SHARED_SONAME)
+endif
+
+endif
diff --git a/sysinfo/compiler/any-compiler.mk b/sysinfo/compiler/any-compiler.mk
new file mode 100644
index 0000000..4c98621
--- /dev/null
+++ b/sysinfo/compiler/any-compiler.mk
@@ -0,0 +1,29 @@
+ifeq ($(CROSS_COMPILE)x,x)
+ CROSS_HOST =
+ CROSS_HOST_SPEC =
+else
+ CROSS_HOST =
+ CROSS_HOST_SPEC =
+endif
+
+
+ifeq ($(USER_CC)x,x)
+ CC = $(NATIVE_CC) $(CROSS_HOST_SPEC)
+else
+ CC = $(USER_CC) $(CROSS_HOST_SPEC)
+endif
+
+ifeq ($(USER_CPP)x,x)
+ CPP = $(NATIVE_CC) $(CROSS_HOST_SPEC) -E
+else
+ CPP = $(USER_CPP) $(CROSS_HOST_SPEC) -E
+endif
+
+ifeq ($(USER_CXX)x,x)
+ CXX = $(NATIVE_CC) $(CROSS_HOST_SPEC) -std=c++
+else
+ CXX = $(USER_CXX) $(CROSS_HOST_SPEC) -std=c++
+endif
+
+
+CFLAGS_PIC = -fPIC
diff --git a/sysinfo/compiler/clang.mk b/sysinfo/compiler/clang.mk
new file mode 100644
index 0000000..77b4b86
--- /dev/null
+++ b/sysinfo/compiler/clang.mk
@@ -0,0 +1,31 @@
+ifeq ($(CROSS_COMPILE)x,x)
+ CROSS_HOST =
+ CROSS_HOST_SPEC =
+else ifeq ($(CROSS_HOST)x,x)
+ CROSS_HOST = $(HOST)
+ CROSS_HOST_SPEC = --target=$(HOST)
+else
+ CROSS_HOST_SPEC = --target=$(CROSS_HOST)
+endif
+
+
+ifeq ($(USER_CC)x,x)
+ CC = $(NATIVE_CC) $(CROSS_HOST_SPEC)
+else
+ CC = $(USER_CC) $(CROSS_HOST_SPEC)
+endif
+
+ifeq ($(USER_CPP)x,x)
+ CPP = $(NATIVE_CC) $(CROSS_HOST_SPEC) -E
+else
+ CPP = $(USER_CPP) $(CROSS_HOST_SPEC) -E
+endif
+
+ifeq ($(USER_CXX)x,x)
+ CXX = $(NATIVE_CC)++ $(CROSS_HOST_SPEC)
+else
+ CXX = $(USER_CXX) $(CROSS_HOST_SPEC)
+endif
+
+
+CFLAGS_PIC = -fPIC
diff --git a/sysinfo/compiler/cparser.mk b/sysinfo/compiler/cparser.mk
new file mode 100644
index 0000000..6c4dc8e
--- /dev/null
+++ b/sysinfo/compiler/cparser.mk
@@ -0,0 +1,31 @@
+ifeq ($(CROSS_COMPILE)x,x)
+ CROSS_HOST =
+ CROSS_HOST_SPEC =
+else ifeq ($(CROSS_HOST)x,x)
+ CROSS_HOST = $(HOST)
+ CROSS_HOST_SPEC = --target=$(HOST)
+else
+ CROSS_HOST_SPEC = --target=$(CROSS_HOST)
+endif
+
+
+ifeq ($(USER_CC)x,x)
+ CC = $(NATIVE_CC) $(CROSS_HOST_SPEC) -Wno-experimental -integrated-cpp
+else
+ CC = $(USER_CC) $(CROSS_HOST_SPEC) -Wno-experimental -integrated-cpp
+endif
+
+ifeq ($(USER_CPP)x,x)
+ CPP = $(NATIVE_CC) $(CROSS_HOST_SPEC) -Wno-experimental -integrated-cpp -E
+else
+ CPP = $(USER_CPP) $(CROSS_HOST_SPEC) -Wno-experimental -integrated-cpp -E
+endif
+
+ifeq ($(USER_CXX)x,x)
+ CXX = $(NATIVE_CC) $(CROSS_HOST_SPEC) -Wno-experimental -integrated-cpp -std=c++
+else
+ CXX = $(USER_CXX) $(CROSS_HOST_SPEC) -Wno-experimental -integrated-cpp -std=c++
+endif
+
+
+CFLAGS_PIC = -fPIC
diff --git a/sysinfo/compiler/gcc.mk b/sysinfo/compiler/gcc.mk
new file mode 100644
index 0000000..d14d8dc
--- /dev/null
+++ b/sysinfo/compiler/gcc.mk
@@ -0,0 +1,24 @@
+ifeq ($(USER_CC)x,x)
+ ifeq ($(CROSS_COMPILE)x,x)
+ CC = $(CROSS_COMPILE)$(NATIVE_CC)
+ else
+ CC = $(CROSS_COMPILE)gcc
+ endif
+else
+ CC = $(USER_CC)
+endif
+
+ifeq ($(USER_CPP)x,x)
+ CPP = $(CROSS_COMPILE)cpp
+else
+ CPP = $(USER_CPP)
+endif
+
+ifeq ($(USER_CXX)x,x)
+ CXX = $(CROSS_COMPILE)c++
+else
+ CXX = $(USER_CXX)
+endif
+
+
+CFLAGS_PIC = -fPIC
diff --git a/sysinfo/host/any-host.mk b/sysinfo/host/any-host.mk
new file mode 100644
index 0000000..acb606a
--- /dev/null
+++ b/sysinfo/host/any-host.mk
@@ -0,0 +1,7 @@
+include $(PROJECT_DIR)/sysinfo/os/any-os.mk
+
+ARCH =
+HOST_BITS =
+HOST_UNDERSCORE =
+
+CROSS_HOST = $(TARGET)
diff --git a/sysinfo/host/host.sh b/sysinfo/host/host.sh
new file mode 100755
index 0000000..686edca
--- /dev/null
+++ b/sysinfo/host/host.sh
@@ -0,0 +1,48 @@
+#!/bin/sh
+
+error_msg()
+{
+ echo $@ >&2
+}
+
+host_test()
+{
+ mb_hdrdir=$(pwd)/build
+ mkdir -p $mb_hdrdir || exit 2
+
+ if [ -z "$mb_compiler" ]; then
+ echo "config error: compiler not set."
+ exit 2
+ fi
+
+ $mb_compiler $mb_cflags -dumpmachine && 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..fd4b8f8
--- /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..bec437c
--- /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..b18e2e3
--- /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..f0cf720
--- /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..d0e1d52
--- /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..4bd1bff
--- /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..a86f9b0
--- /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/any-os.mk b/sysinfo/os/any-os.mk
new file mode 100644
index 0000000..6c5a2af
--- /dev/null
+++ b/sysinfo/os/any-os.mk
@@ -0,0 +1,16 @@
+OS = any-os
+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
+OS_SONAME = symlink
+OS_BINFMT = ELF
+
+.PHONY: $(IMPLIB_DEF) $(IMPLIB_VER) $(IMPLIB_SONAME) $(IMPLIB_SOLINK)
+
+# dso suffix notation
+OS_LIB_PREFIXED_SUFFIX = $(OS_LIB_SUFFIX)
+OS_LIB_SUFFIXED_SUFFIX =
diff --git a/sysinfo/os/bsd.mk b/sysinfo/os/bsd.mk
new file mode 100644
index 0000000..61a3a05
--- /dev/null
+++ b/sysinfo/os/bsd.mk
@@ -0,0 +1,16 @@
+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
+OS_SONAME = symlink
+OS_BINFMT = ELF
+
+.PHONY: $(IMPLIB_DEF) $(IMPLIB_VER) $(IMPLIB_SONAME) $(IMPLIB_SOLINK)
+
+# dso suffix notation
+OS_LIB_PREFIXED_SUFFIX = $(OS_LIB_SUFFIX)
+OS_LIB_SUFFIXED_SUFFIX =
diff --git a/sysinfo/os/cygwin.mk b/sysinfo/os/cygwin.mk
new file mode 100644
index 0000000..290aa0d
--- /dev/null
+++ b/sysinfo/os/cygwin.mk
@@ -0,0 +1,17 @@
+OS = cygwin
+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
+OS_SONAME = copy
+OS_BINFMT = PE
+OS_IMPLIB_TOOL = dlltool
+
+CFLAGS_PIC =
+
+# dso suffix notation
+OS_LIB_PREFIXED_SUFFIX = $(OS_LIB_SUFFIX)
+OS_LIB_SUFFIXED_SUFFIX =
diff --git a/sysinfo/os/darwin.mk b/sysinfo/os/darwin.mk
new file mode 100644
index 0000000..abc9bc7
--- /dev/null
+++ b/sysinfo/os/darwin.mk
@@ -0,0 +1,18 @@
+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
+OS_SONAME = symlink
+OS_BINFMT = MACHO
+
+CFLAGS_OS += -D_DARWIN_C_SOURCE
+
+.PHONY: $(IMPLIB_DEF) $(IMPLIB_VER) $(IMPLIB_SONAME) $(IMPLIB_SOLINK)
+
+# dso suffix notation
+OS_LIB_PREFIXED_SUFFIX =
+OS_LIB_SUFFIXED_SUFFIX = $(OS_LIB_SUFFIX)
diff --git a/sysinfo/os/elf.mk b/sysinfo/os/elf.mk
new file mode 100644
index 0000000..5a3940f
--- /dev/null
+++ b/sysinfo/os/elf.mk
@@ -0,0 +1,2 @@
+LDFLAGS_SHARED += -Wl,-soname
+LDFLAGS_SHARED += -Wl,$(DSO_SONAME)
diff --git a/sysinfo/os/linux.mk b/sysinfo/os/linux.mk
new file mode 100644
index 0000000..fffe324
--- /dev/null
+++ b/sysinfo/os/linux.mk
@@ -0,0 +1,16 @@
+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
+OS_SONAME = symlink
+OS_BINFMT = ELF
+
+.PHONY: $(IMPLIB_DEF) $(IMPLIB_VER) $(IMPLIB_SONAME) $(IMPLIB_SOLINK)
+
+# dso suffix notation
+OS_LIB_PREFIXED_SUFFIX = $(OS_LIB_SUFFIX)
+OS_LIB_SUFFIXED_SUFFIX =
diff --git a/sysinfo/os/midipix.mk b/sysinfo/os/midipix.mk
new file mode 100644
index 0000000..d23d387
--- /dev/null
+++ b/sysinfo/os/midipix.mk
@@ -0,0 +1,15 @@
+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
+OS_SONAME = symlink
+OS_BINFMT = PE
+OS_IMPLIB_TOOL = mdso
+
+# dso suffix notation
+OS_LIB_PREFIXED_SUFFIX = $(OS_LIB_SUFFIX)
+OS_LIB_SUFFIXED_SUFFIX =
diff --git a/sysinfo/os/mingw.mk b/sysinfo/os/mingw.mk
new file mode 100644
index 0000000..1a352ba
--- /dev/null
+++ b/sysinfo/os/mingw.mk
@@ -0,0 +1,18 @@
+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
+OS_SONAME = copy
+OS_BINFMT = PE
+OS_IMPLIB_TOOL = dlltool
+
+CFLAGS_PIC =
+CFLAGS_OS += -U__STRICT_ANSI__
+
+# dso suffix notation
+OS_LIB_PREFIXED_SUFFIX = $(OS_LIB_SUFFIX)
+OS_LIB_SUFFIXED_SUFFIX =
diff --git a/sysinfo/os/mingw32.mk b/sysinfo/os/mingw32.mk
new file mode 100644
index 0000000..542b6a9
--- /dev/null
+++ b/sysinfo/os/mingw32.mk
@@ -0,0 +1 @@
+include $(PROJECT_DIR)/sysinfo/os/mingw.mk
diff --git a/sysinfo/os/mingw64.mk b/sysinfo/os/mingw64.mk
new file mode 100644
index 0000000..542b6a9
--- /dev/null
+++ b/sysinfo/os/mingw64.mk
@@ -0,0 +1 @@
+include $(PROJECT_DIR)/sysinfo/os/mingw.mk
diff --git a/sysinfo/os/msys.mk b/sysinfo/os/msys.mk
new file mode 100644
index 0000000..70fcd68
--- /dev/null
+++ b/sysinfo/os/msys.mk
@@ -0,0 +1,18 @@
+OS = msys
+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
+OS_SONAME = copy
+OS_BINFMT = PE
+OS_IMPLIB_TOOL = dlltool
+
+CFLAGS_PIC =
+CFLAGS_OS += -U__STRICT_ANSI__
+
+# dso suffix notation
+OS_LIB_PREFIXED_SUFFIX = $(OS_LIB_SUFFIX)
+OS_LIB_SUFFIXED_SUFFIX =
diff --git a/sysinfo/os/pe.mk b/sysinfo/os/pe.mk
new file mode 100644
index 0000000..e8e1759
--- /dev/null
+++ b/sysinfo/os/pe.mk
@@ -0,0 +1,96 @@
+LDFLAGS_IMPLIB += -Wl,--output-def
+LDFLAGS_IMPLIB += -Wl,$(IMPLIB_DEF)
+LDFLAGS_SHARED += $(LDFLAGS_IMPLIB)
+
+LDFLAGS_SONAME += -Wl,-soname
+LDFLAGS_SONAME += -Wl,$(DSO_SONAME)
+LDFLAGS_SHARED += $(LDFLAGS_SONAME)
+
+DSO_LIBPATH ?= loader
+PE_SUBSYSTEM ?= windows
+LDFLAGS_COMMON += -Wl,--subsystem=$(PE_SUBSYSTEM)
+
+implib: implib-ver package-implib-soname package-implib-solink
+
+implib-ver: shared-lib $(IMPLIB_VER)
+
+implib-soname: shared-lib $(IMPLIB_SONAME)
+
+implib-solink: shared-lib $(IMPLIB_SOLINK)
+
+$(IMPLIB_DEF): shared-lib
+
+install-implib: install-implib-ver \
+ package-install-implib-soname \
+ package-install-implib-solink
+
+install-implib-ver: implib-ver
+ mkdir -p $(DESTDIR)$(LIBDIR)
+ cp $(IMPLIB_VER) $(DESTDIR)$(LIBDIR)
+
+clean-implib:
+ rm -f $(SHARED_LIB)
+ rm -f $(IMPLIB_DEF)
+ rm -f $(IMPLIB_VER)
+ rm -f $(IMPLIB_SONAME)
+ rm -f $(IMPLIB_SOLINK)
+
+
+ifeq ($(OS_IMPLIB_TOOL),mdso)
+
+$(IMPLIB_VER): $(IMPLIB_DEF)
+ $(MDSO) -m $(HOST_BITS) -i $(IMPLIB_VER) -n $(DSO_VER) -l $(DSO_LIBPATH) $<
+
+else ifeq ($(OS_IMPLIB_TOOL),dlltool)
+
+$(IMPLIB_VER): $(IMPLIB_DEF)
+ $(DLLTOOL) -l $(IMPLIB_VER) -d $(IMPLIB_DEF) -D $(DSO_VER)
+
+endif
+
+
+
+ifeq ($(AVOID_VERSION),yes)
+
+package-implib-soname:
+package-implib-solink:
+package-install-implib-soname:
+package-install-implib-solink:
+
+else
+
+package-implib-soname: implib-soname
+package-implib-solink: implib-solink
+package-install-implib-soname: install-implib-soname
+package-install-implib-solink: install-implib-solink
+
+
+ifeq ($(OS_IMPLIB_TOOL),mdso)
+
+$(IMPLIB_SONAME): $(IMPLIB_DEF)
+ $(MDSO) -m $(HOST_BITS) -i $(IMPLIB_SONAME) -n $(DSO_SONAME) $(IMPLIB_DEF)
+
+else ifeq ($(OS_IMPLIB_TOOL),dlltool)
+
+$(IMPLIB_SONAME): $(IMPLIB_DEF)
+ $(DLLTOOL) -l $(IMPLIB_SONAME) -d $(IMPLIB_DEF) -D $(DSO_SONAME)
+
+endif
+
+
+$(IMPLIB_SOLINK): $(IMPLIB_SONAME)
+ rm -f $(IMPLIB_SOLINK).tmp
+ ln -s $(IMP_SONAME) $(IMPLIB_SOLINK).tmp
+ mv $(IMPLIB_SOLINK).tmp $(IMPLIB_SOLINK)
+
+install-implib-soname: implib-soname
+ mkdir -p $(DESTDIR)$(LIBDIR)
+ cp $(IMPLIB_SONAME) $(DESTDIR)$(LIBDIR)
+
+install-implib-solink: implib-soname
+ mkdir -p $(DESTDIR)$(LIBDIR)
+ rm -f $(IMPLIB_SOLINK).tmp
+ ln -s $(IMP_SONAME) $(IMPLIB_SOLINK).tmp
+ mv $(IMPLIB_SOLINK).tmp $(DESTDIR)$(LIBDIR)/$(IMP_SOLINK)
+
+endif
diff --git a/sysinfo/toolchain/binutils.mk b/sysinfo/toolchain/binutils.mk
new file mode 100644
index 0000000..9cb532a
--- /dev/null
+++ b/sysinfo/toolchain/binutils.mk
@@ -0,0 +1,22 @@
+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
+DLLTOOL = $(CROSS_COMPILE)dlltool
+MDSO = $(CROSS_COMPILE)mdso
+PERK = $(CROSS_COMPILE)perk
+MC = $(CROSS_COMPILE)windmc
+RC = $(CROSS_COMPILE)windres
diff --git a/sysinfo/toolchain/llvm.mk b/sysinfo/toolchain/llvm.mk
new file mode 100644
index 0000000..8082c0a
--- /dev/null
+++ b/sysinfo/toolchain/llvm.mk
@@ -0,0 +1,22 @@
+AS = llvm-mc -filetype=obj
+AR = llvm-ar
+LD = lld
+NM = llvm-nm
+OBJDUMP = llvm-objdump
+RANLIB = llvm-ranlib
+SIZE = llvm-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
+DLLTOOL = $(CROSS_COMPILE)dlltool
+MDSO = $(CROSS_COMPILE)mdso
+PERK = $(CROSS_COMPILE)perk
+MC = $(CROSS_COMPILE)windmc
+RC = $(CROSS_COMPILE)windres
diff --git a/sysinfo/version.sh b/sysinfo/version.sh
new file mode 100755
index 0000000..0b948bc
--- /dev/null
+++ b/sysinfo/version.sh
@@ -0,0 +1,62 @@
+#!/bin/sh
+
+usage()
+{
+cat << EOF >&2
+
+Usage:
+ -h show this HELP message
+ -s SRCDIR set source directory
+ -o OUTPUT set output header
+ -p PREFIX set macro prefix
+
+EOF
+exit 1
+}
+
+
+# one
+workdir=$(pwd)
+srcdir=
+output=
+prefix=
+
+
+while getopts "hs:o:p:" opt; do
+ case $opt in
+ h)
+ usage
+ ;;
+ s)
+ srcdir="$OPTARG"
+ ;;
+ o)
+ output="$OPTARG"
+ ;;
+ p)
+ prefix="$OPTARG"
+ ;;
+ \?)
+ printf "Invalid option: -%s" "$OPTARG" >&2
+ usage
+ ;;
+ esac
+done
+
+
+# two
+if [ -z "$srcdir" ] || [ -z "$output" ] || [ -z "$prefix" ]; then
+ usage
+fi
+
+cd "$srcdir" || exit 2
+
+gitver=`git rev-parse --verify HEAD 2>/dev/null` || gitver="unknown"
+macro=`echo "$prefix"_GIT_VERSION | tr '[:lower:]' '[:upper:]'`
+
+cd "$workdir" || exit 2
+mkdir -p `dirname "$output"` || exit 2
+printf "#define $macro\t\"$gitver\"\n" > "$output"
+
+# all done
+exit 0