From f365af1acaed41948572ff78df55300d87132e64 Mon Sep 17 00:00:00 2001 From: "B. Watson" Date: Wed, 3 Jan 2024 12:19:19 -0500 Subject: Define version only in the Makefile. --- Makefile | 26 +++++++++++++++++++------- 1 file changed, 19 insertions(+), 7 deletions(-) (limited to 'Makefile') 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: -- cgit v1.2.3