build: query git for version info and print consistently for each util

Signed-off-by: Kevin Shanahan <kmshanah@disenchant.net>
This commit is contained in:
Kevin Shanahan 2013-03-07 14:26:14 +10:30
parent e94d2b5cdd
commit 7b36c6fd2f
7 changed files with 60 additions and 60 deletions

View File

@ -14,6 +14,10 @@ OPTIMIZED_CFLAGS ?= Y# Enable compiler optimisations (if DEBUG != Y)
TARGET_OS ?= $(HOST_OS) TARGET_OS ?= $(HOST_OS)
# ============================================================================ # ============================================================================
TYRUTILS_RELEASE := v0.5
TYRUTILS_VERSION := $(shell \
git describe 2> /dev/null || printf '%s' $(TYRUTILS_RELEASE))
SYSNAME := $(shell uname -s) SYSNAME := $(shell uname -s)
TOPDIR := $(shell pwd) TOPDIR := $(shell pwd)
@ -203,14 +207,15 @@ APPS = \
all: $(patsubst %,$(BIN_DIR)/%,$(APPS)) all: $(patsubst %,$(BIN_DIR)/%,$(APPS))
COMMON_CPPFLAGS := -I$(TOPDIR)/include -DLINUX $(DPTHREAD) COMMON_CPPFLAGS := -DTYRUTILS_VERSION=$(TYRUTILS_VERSION)
COMMON_CPPFLAGS += -I$(TOPDIR)/include -DLINUX $(DPTHREAD)
ifeq ($(DEBUG),Y) ifeq ($(DEBUG),Y)
COMMON_CPPFLAGS += -DDEBUG COMMON_CPPFLAGS += -DDEBUG
else else
COMMON_CPPFLAGS += -DNDEBUG COMMON_CPPFLAGS += -DNDEBUG
endif endif
$(BUILD_DIR)/qbsp/%.o: CPPFLAGS = $(COMMON_CPPFLAGS) -DDOUBLEVEC_T -DQBSP_VERSION=$(QBSP_VERSION) $(BUILD_DIR)/qbsp/%.o: CPPFLAGS = $(COMMON_CPPFLAGS) -DDOUBLEVEC_T
$(BUILD_DIR)/common/%.o: CPPFLAGS = $(COMMON_CPPFLAGS) $(BUILD_DIR)/common/%.o: CPPFLAGS = $(COMMON_CPPFLAGS)
$(BUILD_DIR)/light/%.o: CPPFLAGS = $(COMMON_CPPFLAGS) $(BUILD_DIR)/light/%.o: CPPFLAGS = $(COMMON_CPPFLAGS)
$(BUILD_DIR)/vis/%.o: CPPFLAGS = $(COMMON_CPPFLAGS) $(BUILD_DIR)/vis/%.o: CPPFLAGS = $(COMMON_CPPFLAGS)
@ -298,7 +303,6 @@ $(BIN_DIR)/$(BIN_PFX)bsputil$(EXT): $(patsubst %,$(BUILD_DIR)/%,$(BSPUTIL_OBJS))
# Qbsp # # Qbsp #
######## ########
QBSP_VERSION = 0.4
QBSP_OBJECTS = \ QBSP_OBJECTS = \
brush.o \ brush.o \
bspfile.o \ bspfile.o \

View File

@ -27,8 +27,11 @@ main(int argc, char **argv)
int i; int i;
char source[1024]; char source[1024];
if (argc == 1) printf("---- bspinfo / TyrUtils " stringify(TYRUTILS_VERSION) " ----\n");
Error("usage: bspinfo bspfile [bspfiles]"); if (argc == 1) {
printf("usage: bspinfo bspfile [bspfiles]");
exit(1);
}
for (i = 1; i < argc; i++) { for (i = 1; i < argc; i++) {
printf("---------------------\n"); printf("---------------------\n");

View File

@ -101,9 +101,12 @@ main(int argc, char **argv)
char source[1024]; char source[1024];
FILE *f; FILE *f;
if (argc == 1) printf("---- bsputil / TyrUtils " stringify(TYRUTILS_VERSION) " ----\n");
Error("usage: bsputil [--extract-entities] [--extract-textures] " if (argc == 1) {
"bspfile"); printf("usage: bsputil [--extract-entities] [--extract-textures] "
"bspfile");
exit(1);
}
strcpy(source, argv[argc - 1]); strcpy(source, argv[argc - 1]);
DefaultExtension(source, ".bsp"); DefaultExtension(source, ".bsp");

View File

@ -28,6 +28,9 @@
#include <time.h> #include <time.h>
#include <stdarg.h> #include <stdarg.h>
#define stringify__(x) #x
#define stringify(x) stringify__(x)
typedef enum { false, true } qboolean; typedef enum { false, true } qboolean;
typedef unsigned char byte; typedef unsigned char byte;

View File

@ -186,11 +186,7 @@ main(int argc, const char **argv)
char source[1024]; char source[1024];
init_log("light.log"); init_log("light.log");
logprint("----- TyrLight v0.99e -----\n" logprint("---- light / TyrUtils " stringify(TYRUTILS_VERSION) " ----\n");
#if 0
"** Beta version " __DATE__ " " __TIME__ "\n"
#endif
);
numthreads = GetDefaultThreads(); numthreads = GetDefaultThreads();
@ -229,16 +225,18 @@ main(int argc, const char **argv)
break; break;
} }
if (i != argc - 1) {
printf("usage: light [-threads num] [-light num] [-extra|-extra4]\n"
" [-dist n] [-range n] [-gate n] [-lit] "
" [-compress] [-nominlimit] bspfile\n");
exit(1);
}
if (numthreads > 1) if (numthreads > 1)
logprint("running with %d threads\n", numthreads); logprint("running with %d threads\n", numthreads);
if (colored) if (colored)
logprint(".lit colored light output requested on command line.\n"); logprint(".lit colored light output requested on command line.\n");
if (i != argc - 1)
Error("usage: light [-threads num] [-light num] [-extra|-extra4]\n"
" [-dist n] [-range n] [-gate n] [-lit] [-compress]\n"
" [-nominlimit] bspfile\n");
start = I_FloatTime(); start = I_FloatTime();
strcpy(source, argv[i]); strcpy(source, argv[i]);

View File

@ -24,7 +24,8 @@
#include "qbsp.h" #include "qbsp.h"
#include "wad.h" #include "wad.h"
static const char *IntroString = "TyrQBSP v" stringify(QBSP_VERSION) "\n\n"; static const char *IntroString =
"---- qbsp / TyrUtils " stringify(TYRUTILS_VERSION) " ----\n";
// command line flags // command line flags
options_t options; options_t options;
@ -345,27 +346,28 @@ PrintOptions
static void static void
PrintOptions(void) PrintOptions(void)
{ {
printf("QBSP performs geometric level processing of Quake .MAP files to create\n"); printf("\n"
printf("Quake .BSP files.\n\n"); "qbsp performs geometric level processing of Quake .MAP files to create\n"
printf("qbsp [options] sourcefile [destfile]\n\n"); "Quake .BSP files.\n\n"
printf("Options:\n"); "qbsp [options] sourcefile [destfile]\n\n"
printf(" -nofill Doesn't perform outside filling\n"); "Options:\n"
printf(" -noclip Doesn't build clip hulls\n"); " -nofill Doesn't perform outside filling\n"
printf(" -onlyents Only updates .MAP entities\n"); " -noclip Doesn't build clip hulls\n"
printf(" -verbose Print out more .MAP information\n"); " -onlyents Only updates .MAP entities\n"
printf(" -noverbose Print out almost no information at all\n"); " -verbose Print out more .MAP information\n"
printf(" -splitspecial Doesn't combine sky and water faces into one large face\n"); " -noverbose Print out almost no information at all\n"
printf(" -transwater Computes portal information for transparent water\n"); " -splitspecial Doesn't combine sky and water faces into one large face\n"
printf(" -transsky Computes portal information for transparent sky\n"); " -transwater Computes portal information for transparent water\n"
printf(" -oldaxis Uses original QBSP texture alignment algorithm\n"); " -transsky Computes portal information for transparent sky\n"
printf(" -bspleak Creates a .POR file, used in the BSP editor for leaky maps\n"); " -oldaxis Uses original QBSP texture alignment algorithm\n"
printf(" -oldleak Create an old-style QBSP .PTS file (default is new style)\n"); " -bspleak Creates a .POR file, used in the BSP editor for leaky maps\n"
printf(" -nopercent Prevents output of percent completion information\n"); " -oldleak Create an old-style QBSP .PTS file (default is new style)\n"
printf(" -leakdist [n] Space between leakfile points (default 2)\n"); " -nopercent Prevents output of percent completion information\n"
printf(" -subdivide [n] Use different texture subdivision (default 240)\n"); " -leakdist [n] Space between leakfile points (default 2)\n"
printf(" -wadpath <dir> Search this directory for wad files\n"); " -subdivide [n] Use different texture subdivision (default 240)\n"
printf(" sourcefile .MAP file to process\n"); " -wadpath <dir> Search this directory for wad files\n"
printf(" destfile .BSP file to output\n"); " sourcefile .MAP file to process\n"
" destfile .BSP file to output\n");
exit(1); exit(1);
} }

View File

@ -1156,27 +1156,14 @@ int
main(int argc, char **argv) main(int argc, char **argv)
{ {
int i, bsp_version; int i, bsp_version;
qboolean credits = false;
init_log("vis.log"); init_log("vis.log");
logprint("---- TyrVis v1.0 ---- " logprint("---- vis / TyrUtils " stringify(TYRUTILS_VERSION) " ----\n");
#if 0
"(Beta version " __DATE__ " " __TIME__ ")"
#endif
"\n");
numthreads = GetDefaultThreads(); numthreads = GetDefaultThreads();
for (i = 1; i < argc; i++) { for (i = 1; i < argc; i++) {
if (!strcmp(argv[i], "-credits")) { if (!strcmp(argv[i], "-threads")) {
logprint("Original source supplied no obligation by iD Software "
"12th September 96\n"
"Modification by Antony Suter, TeamFortress Software "
"<antony@teamfortress.com>\n"
"Additional Modification by Kevin Shanahan, Aka "
"Tyrann <tyrann@disenchant.net>\n");
credits = true;
} else if (!strcmp(argv[i], "-threads")) {
numthreads = atoi(argv[i + 1]); numthreads = atoi(argv[i + 1]);
i++; i++;
} else if (!strcmp(argv[i], "-fast")) { } else if (!strcmp(argv[i], "-fast")) {
@ -1198,11 +1185,11 @@ main(int argc, char **argv)
break; break;
} }
if (i == argc && credits) if (i != argc - 1) {
return 0; printf("usage: vis [-threads #] [-level 0-4] [-fast] [-v|-vv] "
else if (i != argc - 1) "[-credits] bspfile");
Error("usage: vis [-threads #] [-level 0-4] [-fast] [-v|-vv] " exit(1);
"[-credits] bspfile"); }
logprint("running with %d threads\n", numthreads); logprint("running with %d threads\n", numthreads);