1
0
Fork 0
forked from murx/murx
murx/Makefile

56 lines
1.4 KiB
Makefile
Raw Permalink Normal View History

2026-10-29 18:12:51 +01:00
CC ?= cc
CFLAGS ?= -O2
CFLAGS += -std=c99 -Wall -Wextra
PREFIX ?= /usr/local
BINDIR = $(PREFIX)/bin
2026-11-16 01:23:23 +01:00
MANDIR ?= $(PREFIX)/share/man
2026-10-29 18:12:51 +01:00
# openpty(3) lives in libutil on the BSDs, but in libc on Linux and macOS
# (and in musl). Resolve it in the shell so this Makefile works with both
# GNU make and BSD make.
PTY_LIB_SH = uname -s | grep -Eq 'BSD|DragonFly' && echo -lutil
all: murx
2026-10-29 18:12:51 +01:00
murx: murx.c
$(CC) $(CPPFLAGS) $(CFLAGS) $(LDFLAGS) -o $@ murx.c $(LDLIBS) `$(PTY_LIB_SH)`
2026-10-29 18:12:51 +01:00
install: murx murx.1
2026-11-16 01:23:23 +01:00
install -d "$(DESTDIR)$(BINDIR)" "$(DESTDIR)$(MANDIR)/man1"
install -m 755 murx "$(DESTDIR)$(BINDIR)/murx"
install -m 644 murx.1 "$(DESTDIR)$(MANDIR)/man1/murx.1"
2026-10-29 18:12:51 +01:00
uninstall:
rm -f "$(DESTDIR)$(BINDIR)/murx"
rm -f "$(DESTDIR)$(MANDIR)/man1/murx.1"
2026-10-29 18:12:51 +01:00
clean:
rm -f murx
2026-10-29 18:12:51 +01:00
pkgclean:
rm -rf *.apk
rm -rf *.xz
2026-11-19 11:29:34 +01:00
pkgalpine: pkgclean
abuild checksum
abuild -r
pkgarch: pkgclean
updpkgsums
makepkg
pkgsums:
@version=$$(sed -n 's/^#define MURX_VERSION "\([^"]*\)"$$/\1/p' murx.c); \
if [ -z "$$version" ]; then \
echo "Could not read MURX_VERSION from murx.c" >&2; exit 1; \
fi; \
tmp=$$(mktemp .pkgsums.XXXXXX) || exit 1; \
trap 'rm -f "$$tmp"' 0; \
for recipe in APKBUILD PKGBUILD; do \
sed "s/^pkgver=.*/pkgver=$$version/" "$$recipe" > "$$tmp" && \
cat "$$tmp" > "$$recipe" || exit 1; \
done
2026-11-19 11:29:34 +01:00
abuild checksum
updpkgsums
.PHONY: all install uninstall clean pkgclean pkgalpine pkgarch pkgsums