Store major and minor version number in Makefile; substitute #defines in termkey.h at build time

This commit is contained in:
Paul LeoNerd Evans 2008-11-16 12:28:38 +00:00
parent 4a108d4916
commit c2dd9675d6
3 changed files with 14 additions and 2 deletions

1
.bzrignore Normal file
View File

@ -0,0 +1 @@
termkey.h

View File

@ -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 $@ $^

View File

@ -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,