aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--Makefile26
-rw-r--r--VERSION1
-rw-r--r--hcalc.h6
-rw-r--r--hcalc.rst2
-rw-r--r--version.h1
-rw-r--r--version.rst1
6 files changed, 26 insertions, 11 deletions
diff --git a/Makefile b/Makefile
index 5f57395..9c52c75 100644
--- a/Makefile
+++ b/Makefile
@@ -26,6 +26,7 @@ GZIP = gzip
# End of user-ovverideable stuff. No user-serviceable parts below this line.
PROJ = hcalc
+VERSION = 1.2u1
MANPAGE = $(PROJ).1
DOCS = README CHANGES TODO COPYING
OBJS = \
@@ -38,22 +39,33 @@ OBJS = \
all: $(PROJ) $(MANPAGE)
-hcalc.o: hcalc.c hcalc.h
+hcalc.o: hcalc.c hcalc.h version.h
-input.o: input.c hcalc.h
+input.o: input.c hcalc.h version.h
-setupx.o: setupx.c hcalc.h
+setupx.o: setupx.c hcalc.h version.h
-draw.o: draw.c hcalc.h
+draw.o: draw.c hcalc.h version.h
-config.o: config.c hcalc.h
+config.o: config.c hcalc.h version.h
-images.o: images.c hcalc.h xpm/*.xpm
+images.o: images.c hcalc.h xpm/*.xpm version.h
+
+VERSION:
+ifneq ($(shell cat VERSION 2>/dev/null),$(VERSION))
+ echo "$(VERSION)" > VERSION
+endif
+
+version.rst: VERSION
+ echo ".. |version| replace:: $(VERSION)" > version.rst
+
+version.h: VERSION
+ echo '#define VERSION "$(VERSION)"' > version.h
$(PROJ): $(OBJS)
$(CC) -o $@ $^ $(LDFLAGS) -lXpm -lX11 $(LIBS)
-$(MANPAGE): $(PROJ).rst
+$(MANPAGE): $(PROJ).rst version.rst
rst2man $(PROJ).rst > $(MANPAGE)
clean:
diff --git a/VERSION b/VERSION
new file mode 100644
index 0000000..ef5a3f9
--- /dev/null
+++ b/VERSION
@@ -0,0 +1 @@
+1.2u1
diff --git a/hcalc.h b/hcalc.h
index db70249..a469c9a 100644
--- a/hcalc.h
+++ b/hcalc.h
@@ -6,15 +6,15 @@
More revisions copyright 2023, B. Watson <urchlay@slackware.uk>
*/
-#define SELF "HCalc"
-#define VERSION "1.2u1"
-
#include <stdio.h>
#include <X11/Xlib.h>
#include <X11/Xutil.h>
#include <X11/keysym.h>
#include <X11/Xatom.h>
+#define SELF "HCalc"
+#include "version.h"
+
extern Display *display;
extern int screen;
extern Visual *visual;
diff --git a/hcalc.rst b/hcalc.rst
index ef7a715..0dd2235 100644
--- a/hcalc.rst
+++ b/hcalc.rst
@@ -1,7 +1,7 @@
.. RST source for hcalc(1) man page. Convert with:
.. rst2man.py hcalc.rst > hcalc.1
-.. |version| replace:: 1.2u1
+.. include:: version.rst
.. |date| date::
=====
diff --git a/version.h b/version.h
new file mode 100644
index 0000000..1ab0b17
--- /dev/null
+++ b/version.h
@@ -0,0 +1 @@
+#define VERSION "1.2u1"
diff --git a/version.rst b/version.rst
new file mode 100644
index 0000000..1fba6c0
--- /dev/null
+++ b/version.rst
@@ -0,0 +1 @@
+.. |version| replace:: 1.2u1