Permalink
Browse files

Auto version information inside tcplim, checkinstall target

  • Loading branch information...
1 parent 10a53aa commit d2e130af4a39058c39d2a8f9358a22ba40406dc5 Vitaly _Vi Shukela committed Oct 31, 2010
Showing with 28 additions and 3 deletions.
  1. +4 −0 .gitignore
  2. +19 −2 Makefile
  3. +1 −0 description-pak
  4. +4 −1 parse_argv.c
View
@@ -2,3 +2,7 @@
tcplim
.*.swp
~*
+VERSION
+/s
+/valerr
+*.deb
View
@@ -1,4 +1,21 @@
all: tcplim
-tcplim: *.c
- gcc -O2 -g3 tcplim.c -o tcplim
+tcplim: *.c VERSION
+ gcc -O2 -g3 tcplim.c -o tcplim
+
+githead=$(wildcard .git/HEAD)
+
+ifeq (${githead}, .git/HEAD)
+VERSION: .git
+ ( echo -n '#define VERSION "'; git describe --dirty 2> /dev/null | tr -d '\n'; echo '"' ) > VERSION
+else
+VERSION:
+ echo '#define VERSION "unknown"' > VERSION
+endif
+
+clean:
+ rm -f VERSION tcplim *.o
+
+#install target for checkinstall
+install: tcplim
+ install -o root -g staff tcplim /usr/bin/
View
@@ -0,0 +1 @@
+User-space TCP bandwidth limiter
View
@@ -1,9 +1,12 @@
#include <limits.h>
+#include "VERSION"
static void parse_argv(int argc, char* argv[]) {
if (argc != 10) {
printf
- ("Usage: tcplim 0.0.0.0 1236 80.83.124.150 2222 65536 65536 32768 32768 50\n"
+ (
+ "tcplim version " VERSION "\n"
+ "Usage: tcplim 0.0.0.0 1236 80.83.124.150 2222 65536 65536 32768 32768 50\n"
" bind_ip port connect_ip connect_port total_upload_limit t_download_l per_connection_upload_limit p_c_download_l timetick\n"
"\n"
"limits are in bytes per second. 0 means Umlimited [converted to INT_MAX internally]\nTimetick is in milliseconds.\n"

0 comments on commit d2e130a

Please sign in to comment.