[Listener] print_version(): print version number

Use git describe to generate a version label. One can also specify a
label:
  make OWLPS_VERSION=v3.14alpha
This commit is contained in:
Matteo Cypriani 2011-04-12 22:03:08 +02:00
parent 273c2adfc7
commit c23bddffae
3 changed files with 23 additions and 5 deletions

View File

@ -1,3 +1,8 @@
# Source version
ifndef OWLPS_VERSION
OWLPS_VERSION = $$(git describe || echo 'UNKNOWN_VERSION')
endif
# Répertoire d'installation # Répertoire d'installation
PREFIX=/usr/local PREFIX=/usr/local
INSTALL_DIR= $(PREFIX)/sbin INSTALL_DIR= $(PREFIX)/sbin
@ -27,7 +32,8 @@ CFLAGS = -O2 -Wall -Wextra -Wstrict-prototypes \
DEPFLAGS = -MMD DEPFLAGS = -MMD
XCFLAGS = $(CFLAGS) $(DEPFLAGS) $(WARN) $(HEADERS) XCFLAGS = $(CFLAGS) $(DEPFLAGS) $(WARN) $(HEADERS)
PICFLAG = -fPIC PICFLAG = -fPIC
OWLPSFLAGS = -D USE_CONFIG_FILE -lconfuse -D USE_PTHREAD -pthread OWLPSFLAGS = -D OWLPS_VERSION=\"$(OWLPS_VERSION)\" \
-D USE_CONFIG_FILE -lconfuse -D USE_PTHREAD -pthread
LIBS = -L$(LIBOWLPS_DIR) -lowlps \ LIBS = -L$(LIBOWLPS_DIR) -lowlps \
-L$(LIBOWLPSCLIENT_DIR) -lowlps-client \ -L$(LIBOWLPSCLIENT_DIR) -lowlps-client \
-lpcap -lpcap

View File

@ -1,3 +1,8 @@
# Source version
ifndef OWLPS_VERSION
OWLPS_VERSION = $$(git describe)
endif
# Emplacement de la suite de cross-compilation # Emplacement de la suite de cross-compilation
TOOLCHAIN_PREFIX = $$HOME/openwrt/atheros/8.09 TOOLCHAIN_PREFIX = $$HOME/openwrt/atheros/8.09
TOOLCHAIN_BIN = $(TOOLCHAIN_PREFIX)/staging_dir/toolchain-mips_gcc4.1.2/bin TOOLCHAIN_BIN = $(TOOLCHAIN_PREFIX)/staging_dir/toolchain-mips_gcc4.1.2/bin
@ -36,7 +41,8 @@ LOWLPSCLIENTA = $(LIBOWLPSCLIENT_DIR)/libowlps-client.a
LIBS = -lpcap -liw -lm $(LOWLPSCLIENTA) LIBS = -lpcap -liw -lm $(LOWLPSCLIENTA)
LATHEROS = -L$(TOOLCHAIN_USR)/lib -L$(TOOLCHAIN_USR_2)/lib LATHEROS = -L$(TOOLCHAIN_USR)/lib -L$(TOOLCHAIN_USR_2)/lib
IATHEROS = -I$(TOOLCHAIN_USR)/include -I$(TOOLCHAIN_USR_2)/include IATHEROS = -I$(TOOLCHAIN_USR)/include -I$(TOOLCHAIN_USR_2)/include
OWLPSFLAGS = -D USE_PTHREAD -pthread OWLPSFLAGS = -D OWLPS_VERSION=\"$(OWLPS_VERSION)\" \
-D USE_PTHREAD -pthread
#OWLPSFLAGS += -D USE_CONFIG_FILE -lconfuse #OWLPSFLAGS += -D USE_CONFIG_FILE -lconfuse
LDFLAGS = $(OWLPSFLAGS) $(LIBS) LDFLAGS = $(OWLPSFLAGS) $(LIBS)

View File

@ -1346,7 +1346,7 @@ void print_usage()
"Main options:\n" "Main options:\n"
"\t-h\t\tPrint this help.\n" "\t-h\t\tPrint this help.\n"
"\t-V\t\tShow version.\n" "\t-V\t\tShow version information.\n"
"\t-f config_file\tUse 'config_file' instead of the default" "\t-f config_file\tUse 'config_file' instead of the default"
" configuration file (%s). Available only if program was" " configuration file (%s). Available only if program was"
" compiled with libconfuse.\n" " compiled with libconfuse.\n"
@ -1411,12 +1411,18 @@ void print_usage()
void print_version() void print_version()
{ {
printf("This is OWLPS Listener, part of the Open Wireless Positioning" printf("This is OwlPS Listener, part of the Open Wireless Positioning"
" System project.\n" " System project.\n"
"\n" "Version: %s.\n"
"Compilation-time options:\n" "Compilation-time options:\n"
"\tSupport for POSIX threads: %s.\n" "\tSupport for POSIX threads: %s.\n"
"\tSupport for configuration file (libconfuse): %s.\n", "\tSupport for configuration file (libconfuse): %s.\n",
#ifdef OWLPS_VERSION
OWLPS_VERSION
#else // OWLPS_VERSION
"unknown version"
#endif // OWLPS_VERSION
,
#ifdef USE_PTHREAD #ifdef USE_PTHREAD
"YES" "YES"
#else // USE_PTHREAD #else // USE_PTHREAD