Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

add version information into build

  • Loading branch information...
commit cc27c05af4705802f9b1e22d074cd968f1418cc0 1 parent 6211fcd
@wertarbyte authored
Showing with 16 additions and 2 deletions.
  1. +1 −0  .gitignore
  2. +7 −1 Makefile
  3. +3 −0  th-cmd.c
  4. +4 −1 thd.c
  5. +1 −0  version.inc
View
1  .gitignore
@@ -5,3 +5,4 @@ th-cmd.1
*.o
/*.d
evtable_*.h
+version.h
View
8 Makefile
@@ -3,6 +3,8 @@ DESTDIR:=/
BINDIR:=$(DESTDIR)/$(PREFIX)/sbin/
MANDIR:=$(DESTDIR)/$(PREFIX)/share/man/man1/
+VERSION:=$(shell cat version.inc)
+
THD_COMPS := thd keystate trigger eventnames devices cmdsocket obey ignore uinput
THCMD_COMPS := th-cmd cmdsocket
@@ -22,16 +24,20 @@ th-cmd: $(THCMD_COMPS:%=%.o)
pod2man \
--center="Triggerhappy daemon" \
--section=1 \
- --release="" \
+ --release="$(VERSION)" \
$< > $@
evtable_%.h: $(LINUX_INPUT_H)
awk '/^#define $*_/ && $$2 !~ /_(MAX|CNT|VERSION)$$/ {print "EV_MAP("$$2"),"}' $< > $@
+version.h: version.inc
+ sed -r 's!(.*)!#define TH_VERSION "\1"!' $< > $@
+
clean:
rm -f *.d
rm -f *.o
rm -f evtable_*.h
+ rm -f version.h
rm -f thd th-cmd
rm -f thd.1 th-cmd.1
View
3  th-cmd.c
@@ -12,7 +12,10 @@
#include "command.h"
#include "cmdsocket.h"
+#include "version.h"
+
void show_help(void) {
+ fprintf( stderr, "Triggerhappy command " TH_VERSION "\n");
fprintf( stderr, "Use:\n");
fprintf( stderr, " th-cmd --socket <socket> [--grab] [--passfd] --add <devices...>\n");
fprintf( stderr, " th-cmd --socket <socket> --remove <devices...>\n");
View
5 thd.c
@@ -33,6 +33,9 @@
#include "ignore.h"
#include "uinput.h"
+/* version information */
+#include "version.h"
+
/* command channel & FD */
static char *cmd_file = NULL;
static int cmd_fd = -1;
@@ -201,7 +204,7 @@ static struct option long_options[] = {
};
void show_help(void) {
- printf( "Triggerhappy event daemon\n\n" );
+ printf( "Triggerhappy event daemon " TH_VERSION "\n\n" );
printf( "Usage:\n" );
printf( " thd [switches] [devices]\n\n" );
printf( "Command line switches:\n" );
View
1  version.inc
@@ -0,0 +1 @@
+0.2.0
Please sign in to comment.
Something went wrong with that request. Please try again.