ref: 24f272e4c39a32d244cd004e254b3dfdfb0cd00a
parent: 227313ff07836155cf17a43ad5792830d1dbb8b5
author: Roberto E. Vargas Caballero <k0ga@shike2.com>
date: Sun Aug 18 14:57:44 EDT 2019
Add HOST variable This variable is automatically detected by the top level Makefile and it allows to set variables that depend of the host system where scc is compiled.
--- a/Makefile
+++ b/Makefile
@@ -23,6 +23,7 @@
@rm -f $@; \
trap 'r=$?;rm -f $$$$.tmp;exit $r' EXIT HUP INT QUIT TERM; \
echo PATH=$$PATH:$$PWD/$(SCRIPTDIR):. > $$$$.tmp && \
+ echo HOST=`uname | tr 'A-Z' 'a-z'` >> $$$$.tmp && \
echo NM=\"$(NM)\" >> $$$$.tmp && \
echo AR=\"$(AR)\" >> $$$$.tmp && \
echo RL=\"$(RL)\" >> $$$$.tmp && \
--- a/config/amd64-darwin.mk
+++ b/config/amd64-darwin.mk
@@ -1,4 +1,3 @@
ARCH = amd64
SYS = darwin
ABI = amd64-darwin
-DRIVER = posix
--- a/config/amd64-dragonfly.mk
+++ b/config/amd64-dragonfly.mk
@@ -1,4 +1,3 @@
ARCH = amd64
SYS = dragonfly
ABI = amd64-posix
-DRIVER = posix
--- a/config/amd64-linux.mk
+++ b/config/amd64-linux.mk
@@ -1,4 +1,3 @@
ARCH = amd64
SYS = linux
ABI = amd64-posix
-DRIVER = posix
--- a/config/amd64-netbsd.mk
+++ b/config/amd64-netbsd.mk
@@ -1,4 +1,3 @@
ARCH = amd64
SYS = netbsd
ABI = amd64-posix
-DRIVER = posix
--- a/config/amd64-openbsd.mk
+++ b/config/amd64-openbsd.mk
@@ -1,4 +1,3 @@
ARCH = amd64
SYS = openbsd
ABI = amd64-posix
-DRIVER = posix
--- a/config/arm32-linux.mk
+++ b/config/arm32-linux.mk
@@ -1,4 +1,3 @@
ARCH = arm32
SYS = linux
ABI = arm32-posix
-DRIVER = posix
--- a/config/arm64-linux.mk
+++ b/config/arm64-linux.mk
@@ -1,4 +1,3 @@
ARCH = arm64
SYS = linux
ABI = arm64-posix
-DRIVER = posix
--- /dev/null
+++ b/config/host/bsd.mk
@@ -1,0 +1,2 @@
+DRIVER = posix
+HOSTCFLAGS = -D_ISOC99_SOURCE -D_ANSI_SOURCE
--- /dev/null
+++ b/config/host/darwin.mk
@@ -1,0 +1,1 @@
+include $(PROJECTDIR)/config/host/bsd.mk
--- /dev/null
+++ b/config/host/dragonfly.mk
@@ -1,0 +1,1 @@
+include $(PROJECTDIR)/config/host/bsd.mk
--- /dev/null
+++ b/config/host/linux.mk
@@ -1,0 +1,1 @@
+DRIVER = posix
--- /dev/null
+++ b/config/host/netbsd.mk
@@ -1,0 +1,1 @@
+include $(PROJECTDIR)/config/host/bsd.mk
--- /dev/null
+++ b/config/host/openbsd.mk
@@ -1,0 +1,1 @@
+include $(PROJECTDIR)/config/host/bsd.mk
--- /dev/null
+++ b/config/host/unix.mk
@@ -1,0 +1,1 @@
+DRIVER = posix
--- a/scripts/rules.mk
+++ b/scripts/rules.mk
@@ -1,7 +1,9 @@
CONF=amd64-linux
TOOL=unix
+HOST=unix
include $(PROJECTDIR)/config/$(CONF).mk
include $(PROJECTDIR)/config/toolchain/$(TOOL).mk
+include $(PROJECTDIR)/config/host/$(HOST).mk
LIBDIR = $(PROJECTDIR)/lib/scc
SCRIPTDIR = $(PROJECTDIR)/scripts
@@ -23,6 +25,7 @@
SCC_CFLAGS = $(MORECFLAGS) \
$(TOOLCFLAGS) \
+ $(HOSTCFLAGS) \
$(SYSCFLAGS) \
$(INCLUDE) \
-g \
@@ -30,6 +33,7 @@
SCC_LDFLAGS = $(MORELFLAGS) \
$(TOOLLDFLAGS) \
+ $(HOSTLDFLAGS) \
$(SYSLDFLAGS) \
-L$(LIBDIR) \
-g \
@@ -37,6 +41,7 @@
SCC_ASFLAGS = $(MOREASFLAGS) \
$(TOOLASFLAGS) \
+ $(HOSTASFLAGS) \
$(SYSASFLAGS) \
$(ASFLAGS)