aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorB. Watson <urchlay@slackware.uk>2024-12-16 18:35:17 -0500
committerB. Watson <urchlay@slackware.uk>2024-12-16 18:35:17 -0500
commitc4998b99e1142924292773d13bca50d0e2626a99 (patch)
tree966cf3e66a420080814dc02a9ea167c6aa91054a
parenta151adc4ce1473dc66a38d4800b54f9d56065419 (diff)
downloaduxd-c4998b99e1142924292773d13bca50d0e2626a99.tar.gz
Makefile: remove GNU make specific constructs
-rw-r--r--Makefile20
1 files changed, 13 insertions, 7 deletions
diff --git a/Makefile b/Makefile
index f7d2c72..90cbc1b 100644
--- a/Makefile
+++ b/Makefile
@@ -1,9 +1,12 @@
# Makefile for uxd, by B. Watson. WTFPL.
-# Requires GNU make aka gmake. BSD make won't work, sorry.
+# Tested with GNU make, BSD make, makepp, and Schily's dmake and smake.
### Override these variables as needed. Don't override CFLAGS; use
# MYCFLAGS instead.
MYCFLAGS=-O2 -fPIC
+LDFLAGS=
+LIBS=
+RST2MAN=rst2man
# These only affect the 'install' target (they don't get compiled
# into the binary).
@@ -25,12 +28,14 @@ VERSION=0.1.0
DEFINES=-DVERSION='"$(VERSION)"'
WARNFLAGS=-std=c89 -Wall -pedantic -Wextra
CFLAGS=$(DEFINES) $(WARNFLAGS) $(MYCFLAGS)
+SRCS=uxd.c getopt.c usage.c
.PHONY: all test man clean install g++ clang++ clang
all: uxd man
-uxd: uxd.c getopt.c usage.c
+uxd: $(SRCS)
+ $(CC) $(CFLAGS) $(LDFLAGS) -o uxd $(SRCS) $(LIBS)
usage.c: uxd.rst mkusage.pl
perl mkusage.pl uxd.rst > usage.c
@@ -38,9 +43,7 @@ usage.c: uxd.rst mkusage.pl
install: all
mkdir -p $(DESTDIR)$(BINDIR) $(DESTDIR)$(MAN1DIR)
$(INSTALL_DATA) uxd.1 $(DESTDIR)$(MAN1DIR)
-ifeq ($(GZIP_MAN),yes)
- $(GZIP) $(DESTDIR)$(MAN1DIR)/uxd.1
-endif
+ [ "$(GZIP_MAN)" = "yes" ] && $(GZIP) $(DESTDIR)$(MAN1DIR)/uxd.1 || true
$(INSTALL_PROGRAM) uxd $(DESTDIR)$(BINDIR)
test: uxd
@@ -49,13 +52,16 @@ test: uxd
man: uxd.1
uxd.1: uxd.rst ver.rst
- rst2man uxd.rst > uxd.1
+ $(RST2MAN) uxd.rst > uxd.1
ver.rst:
echo '.. |version| replace:: $(VERSION)' > ver.rst
clean:
- rm -f uxd
+ rm -f uxd *.o
+
+realclean: clean
+ rm -f uxd.1 usage.c
# the rest of the targets are for portability testing.