Skip to content

Commit

Permalink
Auto version information inside tcplim, checkinstall target
Browse files Browse the repository at this point in the history
  • Loading branch information
Vitaly _Vi Shukela committed Oct 31, 2010
1 parent 10a53aa commit d2e130a
Show file tree
Hide file tree
Showing 4 changed files with 28 additions and 3 deletions.
4 changes: 4 additions & 0 deletions .gitignore
Original file line number Original file line Diff line number Diff line change
Expand Up @@ -2,3 +2,7 @@
tcplim tcplim
.*.swp .*.swp
~* ~*
VERSION
/s
/valerr
*.deb
21 changes: 19 additions & 2 deletions Makefile
Original file line number Original file line Diff line number Diff line change
@@ -1,4 +1,21 @@
all: tcplim all: tcplim


tcplim: *.c tcplim: *.c VERSION
gcc -O2 -g3 tcplim.c -o tcplim 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/
1 change: 1 addition & 0 deletions description-pak
Original file line number Original file line Diff line number Diff line change
@@ -0,0 +1 @@
User-space TCP bandwidth limiter
5 changes: 4 additions & 1 deletion parse_argv.c
Original file line number Original file line Diff line number Diff line change
@@ -1,9 +1,12 @@
#include <limits.h> #include <limits.h>
#include "VERSION"


static void parse_argv(int argc, char* argv[]) { static void parse_argv(int argc, char* argv[]) {
if (argc != 10) { if (argc != 10) {
printf 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" " bind_ip port connect_ip connect_port total_upload_limit t_download_l per_connection_upload_limit p_c_download_l timetick\n"
"\n" "\n"
"limits are in bytes per second. 0 means Umlimited [converted to INT_MAX internally]\nTimetick is in milliseconds.\n" "limits are in bytes per second. 0 means Umlimited [converted to INT_MAX internally]\nTimetick is in milliseconds.\n"
Expand Down

0 comments on commit d2e130a

Please sign in to comment.