aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPaul LeoNerd Evans <leonerd@leonerd.org.uk>2008-11-16 12:28:38 +0000
committerPaul LeoNerd Evans <leonerd@leonerd.org.uk>2008-11-16 12:28:38 +0000
commitc2dd9675d6af30ab5129519325bac68491087cc1 (patch)
tree4a594fd1d97d74c24f3dc519116ca5d69b921195
parent4a108d491670b0da98cfdbafbc87dd69f1b3acc2 (diff)
downloadtermo-c2dd9675d6af30ab5129519325bac68491087cc1.tar.gz
termo-c2dd9675d6af30ab5129519325bac68491087cc1.tar.xz
termo-c2dd9675d6af30ab5129519325bac68491087cc1.zip
Store major and minor version number in Makefile; substitute #defines in termkey.h at build time
-rw-r--r--.bzrignore1
-rw-r--r--Makefile12
-rw-r--r--termkey.h.in (renamed from termkey.h)3
3 files changed, 14 insertions, 2 deletions
diff --git a/.bzrignore b/.bzrignore
new file mode 100644
index 0000000..b5bdf38
--- /dev/null
+++ b/.bzrignore
@@ -0,0 +1 @@
+termkey.h
diff --git a/Makefile b/Makefile
index a24a716..97441a1 100644
--- a/Makefile
+++ b/Makefile
@@ -3,7 +3,10 @@ CFLAGS?=
CFLAGS_DEBUG=
-SONAME=libtermkey.so.0
+VERSION_MAJOR=0
+VERSION_MINOR=0
+
+SONAME=libtermkey.so.$(VERSION_MAJOR)
PREFIX=/usr/local
LIBDIR=$(PREFIX)/lib
@@ -15,7 +18,12 @@ ifeq ($(DEBUG),1)
CFLAGS_DEBUG=-ggdb -DDEBUG
endif
-all: demo demo-async doc
+all: termkey.h demo demo-async doc
+
+termkey.h: termkey.h.in Makefile
+ sed -e 's/@@VERSION_MAJOR@@/$(VERSION_MAJOR)/g' \
+ -e 's/@@VERSION_MINOR@@/$(VERSION_MINOR)/g' \
+ $< >$@
demo: libtermkey.so demo.c
$(CC) $(CFLAGS) $(CFLAGS_DEBUG) -o $@ $^
diff --git a/termkey.h b/termkey.h.in
index 4227518..4849923 100644
--- a/termkey.h
+++ b/termkey.h.in
@@ -4,6 +4,9 @@
#include <stdint.h>
#include <stdlib.h>
+#define TERMKEY_VERSION_MAJOR @@VERSION_MAJOR@@
+#define TERMKEY_VERSION_MINOR @@VERSION_MINOR@@
+
typedef enum {
TERMKEY_SYM_UNKNOWN = -1,
TERMKEY_SYM_NONE = 0,