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)
# ============================================================================
TYRUTILS_RELEASE := v0.5
TYRUTILS_VERSION := $(shell \
git describe 2> /dev/null || printf '%s' $(TYRUTILS_RELEASE))
SYSNAME := $(shell uname -s)
TOPDIR := $(shell pwd)
@ -203,14 +207,15 @@ 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)
COMMON_CPPFLAGS += -DDEBUG
else
COMMON_CPPFLAGS += -DNDEBUG
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)/light/%.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_VERSION = 0.4
QBSP_OBJECTS = \
brush.o \
bspfile.o \

View File

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

View File

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

View File

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

View File

@ -186,11 +186,7 @@ main(int argc, const char **argv)
char source[1024];
init_log("light.log");
logprint("----- TyrLight v0.99e -----\n"
#if 0
"** Beta version " __DATE__ " " __TIME__ "\n"
#endif
);
logprint("---- light / TyrUtils " stringify(TYRUTILS_VERSION) " ----\n");
numthreads = GetDefaultThreads();
@ -229,16 +225,18 @@ main(int argc, const char **argv)
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)
logprint("running with %d threads\n", numthreads);
if (colored)
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();
strcpy(source, argv[i]);

View File

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

View File

@ -1156,27 +1156,14 @@ int
main(int argc, char **argv)
{
int i, bsp_version;
qboolean credits = false;
init_log("vis.log");
logprint("---- TyrVis v1.0 ---- "
#if 0
"(Beta version " __DATE__ " " __TIME__ ")"
#endif
"\n");
logprint("---- vis / TyrUtils " stringify(TYRUTILS_VERSION) " ----\n");
numthreads = GetDefaultThreads();
for (i = 1; i < argc; i++) {
if (!strcmp(argv[i], "-credits")) {
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")) {
if (!strcmp(argv[i], "-threads")) {
numthreads = atoi(argv[i + 1]);
i++;
} else if (!strcmp(argv[i], "-fast")) {
@ -1198,11 +1185,11 @@ main(int argc, char **argv)
break;
}
if (i == argc && credits)
return 0;
else if (i != argc - 1)
Error("usage: vis [-threads #] [-level 0-4] [-fast] [-v|-vv] "
"[-credits] bspfile");
if (i != argc - 1) {
printf("usage: vis [-threads #] [-level 0-4] [-fast] [-v|-vv] "
"[-credits] bspfile");
exit(1);
}
logprint("running with %d threads\n", numthreads);