aboutsummaryrefslogtreecommitdiffstats
path: root/Makefile
diff options
context:
space:
mode:
authorKaz Kylheku <kaz@kylheku.com>2023-06-08 16:56:25 -0700
committerKaz Kylheku <kaz@kylheku.com>2023-06-08 16:56:25 -0700
commitf783a3d9b01b1214c3f928deddc86ae5a746ebd4 (patch)
tree5ad35446c17d0fc27798073699cd2ad04fd6751b /Makefile
parentdd79082a94b62e0d8c398dcfad19449e72c542da (diff)
downloadpw-f783a3d9b01b1214c3f928deddc86ae5a746ebd4.tar.gz
pw-f783a3d9b01b1214c3f928deddc86ae5a746ebd4.tar.bz2
pw-f783a3d9b01b1214c3f928deddc86ae5a746ebd4.zip
MacOS port.
- The poll function is broken on Darwin (won't handle devices). We make a macpoll out of select and use that. - Makefile adds _D_DARWIN_C_SOURCE to CFLAGS.
Diffstat (limited to 'Makefile')
-rw-r--r--Makefile6
1 files changed, 4 insertions, 2 deletions
diff --git a/Makefile b/Makefile
index f85adbf..9b507f4 100644
--- a/Makefile
+++ b/Makefile
@@ -1,5 +1,7 @@
PW_SHA256 := 7361c87eb5e55240a3afbf7f41bc2a08f93e392414103075d3929b5fd53e021c
+DARWIN = $(findstring Darwin,$(shell uname))
NEEDED_CFLAGS := -std=c99 -D_POSIX_C_SOURCE=200112L -D__EXTENSIONS__
+NEEDED_CFLAGS += $(if $(DARWIN),-D_DARWIN_C_SOURCE)
ifeq ($(shell sha256sum pw.c),$(PW_SHA256) pw.c)
PW_VERSION := 3
else
@@ -11,8 +13,8 @@ override CFLAGS += $(NEEDED_CFLAGS) -DCONFIG_PW_VER=\"$(PW_VERSION)\"
DESTDIR ?= /usr/local
.PHONY: all fixver
all: pw fixver
-pw:
-clean:; rm -f pw
+pw: $(if $(DARWIN),macpoll.o)
+clean:; rm -f pw macpoll.o
install:; install pw $(DESTDIR)/bin/pw; \
install -D pw.1 $(DESTDIR)/share/man/man1/pw.1; \
install -D pw-relnotes.5 $(DESTDIR)/share/man/man5/pw-relnotes.5