aboutsummaryrefslogtreecommitdiffstats
path: root/mk
diff options
context:
space:
mode:
Diffstat (limited to 'mk')
-rw-r--r--mk/os-Darwin.mk5
-rw-r--r--mk/os-Linux.mk20
-rw-r--r--mk/os.mk2
-rw-r--r--mk/prog.mk11
4 files changed, 12 insertions, 26 deletions
diff --git a/mk/os-Darwin.mk b/mk/os-Darwin.mk
new file mode 100644
index 0000000..f2c3104
--- /dev/null
+++ b/mk/os-Darwin.mk
@@ -0,0 +1,5 @@
+# Setup OS specific variables
+# Copyright 2008 Roy Marples <roy@marples.name>
+
+include ${MK}/os-BSD.mk
+LINK_RPATH= --rpath
diff --git a/mk/os-Linux.mk b/mk/os-Linux.mk
index 16f0f60..2d316b1 100644
--- a/mk/os-Linux.mk
+++ b/mk/os-Linux.mk
@@ -6,23 +6,3 @@ SRC_IF= if-linux.c
CPPFLAGS+= -D_BSD_SOURCE -D_XOPEN_SOURCE=600
LIBRT= -lrt
-
-# Work out if our fork() works or not.
-# If cross-compiling, you'll need to set HAVE_FORK to yes or no depending
-# on your target arch.
-_HAVE_FORK_SH= if test "${HAVE_FORK}" = "yes"; then \
- echo ""; \
- elif test -n "${HAVE_FORK}"; then \
- echo "-DTHERE_IS_NO_FORK"; \
- else \
- printf '\#include <stdlib.h>\n\#include <unistd.h>\nint main (void) { pid_t pid = fork(); if (pid == -1) exit (-1); exit (0); }\n' > .fork.c; \
- ${CC} .fork.c -o .fork >/dev/null 2>&1; \
- if ./.fork; then \
- echo ""; \
- else \
- echo "-DTHERE_IS_NO_FORK"; \
- fi; \
- rm -f .fork.c .fork; \
- fi;
-_HAVE_FORK!= ${_HAVE_FORK_SH}
-CPPFLAGS+= ${_HAVE_FORK}$(shell ${_HAVE_FORK_SH})
diff --git a/mk/os.mk b/mk/os.mk
index f2a83f4..f3426e4 100644
--- a/mk/os.mk
+++ b/mk/os.mk
@@ -1,7 +1,7 @@
# Setup OS specific variables
# Copyright 2008 Roy Marples <roy@marples.name>
-_OS_SH= case `uname -s` in Linux) echo "Linux";; *) echo "BSD";; esac
+_OS_SH= case `uname -s` in Linux) echo "Linux";; Darwin) echo "Darwin";; *) echo "BSD";; esac
_OS!= ${_OS_SH}
OS= ${_OS}$(shell ${_OS_SH})
include ${MK}/os-${OS}.mk
diff --git a/mk/prog.mk b/mk/prog.mk
index 3f763b8..d970b2d 100644
--- a/mk/prog.mk
+++ b/mk/prog.mk
@@ -7,18 +7,19 @@ include ${MK}/cc.mk
OBJS+= ${SRCS:.c=.o}
-# This is for NetBSD which has a different libc in /lib which we need
-# to link to if installing in /
+# If building for /, ensure we use the libc in / if different from
+# the default one in /usr/lib
+LINK_RPATH?= -Wl,-rpath
_RPATH_SH= if test "${PREFIX}" = "" -o "${PREIX}" = "/"; then \
- echo "-Wl,-rpath=${PREFIX}/${LIBNAME}"; \
+ echo "${LINK_RPATH}=${PREFIX}/${LIBNAME}"; \
else \
echo ""; \
fi
_RPATH!= ${_RPATH_SH}
LDFLAGS+= ${_RPATH}$(shell ${_RPATH_SH})
-# This is for NetBSD which has different dynamic linker in /lib which we need
-# to use to if installing in /
+# If building for /, ensure we use the linker in /libexec if different from
+# the default one in /usr/libexec
_DYNLINK_SH= if test "${PREFIX}" = "" -o "${PREFIX}" = "/" && test -e /libexec/ld.elf_so; then \
echo "-Wl,-dynamic-linker=/libexec/ld.elf_so"; \
else \