aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorB. Watson <urchlay@slackware.uk>2024-12-13 07:03:08 -0500
committerB. Watson <urchlay@slackware.uk>2024-12-13 07:03:08 -0500
commit049360816bd760d229463ed461b443b2a7d212fe (patch)
treee3583a6cf5ea32ac78255f8f0b71045d1b3d46db
parentd77820c5a04d9bb930ee95df2fbc28bfca87ddfe (diff)
downloaduxd-049360816bd760d229463ed461b443b2a7d212fe.tar.gz
add version info, use MYCFLAGS for user flags
-rw-r--r--Makefile18
-rw-r--r--uxd.c7
2 files changed, 21 insertions, 4 deletions
diff --git a/Makefile b/Makefile
index 4eae860..0417ed8 100644
--- a/Makefile
+++ b/Makefile
@@ -1,7 +1,11 @@
-CFLAGS=-O2 -fPIC -Wall
+# Makefile for uxd, by B. Watson. WTFPL.
-# these only affect the 'install' target (they don't get compiled
-# into the binary).
+### Override these variables as needed. Don't override CFLAGS; use
+# MYCFLAGS instead.
+MYCFLAGS=-O2 -fPIC -Wall
+
+# These only affect the 'install' target (they don't get compiled
+# into the binary).
PREFIX=/usr
MANDIR=$(PREFIX)/man
MAN1DIR=$(MANDIR)/man1
@@ -12,6 +16,14 @@ INSTALL_PROGRAM=install -s -m0755
GZIP=gzip -9
GZIP_MAN=yes
+#
+### No user-serviceable parts below.
+
+VERSION=0.1.0
+
+DEFINES=-DVERSION='"$(VERSION)"'
+CFLAGS=$(MYCFLAGS) $(DEFINES)
+
.PHONY: all test man clean install
all: uxd man
diff --git a/uxd.c b/uxd.c
index 41a390b..9aaf83e 100644
--- a/uxd.c
+++ b/uxd.c
@@ -41,6 +41,10 @@ fe ff, it's UTF-16 big-endian. We detect these and print a warning
on stderr.
*/
+#ifndef VERSION
+#define VERSION "(unknown version)"
+#endif
+
/* ANSI colors */
#define BLACK 0 /* don't use (could be the background color) */
#define RED 1
@@ -72,7 +76,8 @@ int dump_column = 0;
int filepos = 0;
void usage(void) {
- printf("Usage: %s <file>\n", self);
+ printf("uxd (Utf-8 heX Dump) v"VERSION" by B. Watson. WTFPL.\n");
+ printf("Usage: %s [<file>]\n", self);
printf(" With no <file>, or with -, read standard input.\n");
exit(0);
}