diff options
author | Alexey 'Cluster' Avdyukhin <clusterrr@clusterrr.com> | 2018-08-26 22:03:38 +0300 |
---|---|---|
committer | Alexey 'Cluster' Avdyukhin <clusterrr@clusterrr.com> | 2018-08-26 22:09:50 +0300 |
commit | 3afee38e52af284fd059f0b9d83954a1c4ec7618 (patch) | |
tree | 524bbcb5f1983990b764295a01db65c35c17b8a9 | |
parent | 64bc473d5f68f4e1ef4018243d91dde05eeb420d (diff) |
More verbose version info
-rw-r--r-- | source/Makefile | 16 | ||||
-rw-r--r-- | source/main.c | 12 |
2 files changed, 24 insertions, 4 deletions
diff --git a/source/Makefile b/source/Makefile index a3b55ac..1a77fc7 100644 --- a/source/Makefile +++ b/source/Makefile @@ -1,5 +1,6 @@ RM = rm -f CC = gcc +COMMIT_INFO = commit.h CFLAGS = -O2 -Wall ifeq ($(OS),Windows_NT) @@ -12,6 +13,12 @@ OBJS = main.o input.o assemble.o expr.o code.o command.o\ EXEDIR = .. +COMMIT = $(shell git rev-parse --short HEAD) +COMMIT_DIRTY = $(shell git diff-index HEAD) +ifneq ($(COMMIT_DIRTY),) + COMMIT += (dirty) +endif + ifeq ($(OS),Windows_NT) TARGNES = $(EXEDIR)/nesasm.exe else @@ -28,19 +35,24 @@ default: $(TARGNES) # clean: - $(RM) *.o + $(RM) *.o $(RM) $(TARGNES) + $(RM) $(COMMIT_INFO) # ASSEMBLER # $(OBJS) : defs.h externs.h protos.h -main.o : inst.h vars.h +main.o : inst.h vars.h $(COMMIT_INFO) expr.o : expr.h nes.o : nes.h %.o : %.c $(CC) $(CFLAGS) -o $@ -c $< +.PHONY: $(COMMIT_INFO) +$(COMMIT_INFO): + @echo "#define COMMIT \"$(COMMIT)\"" > $(COMMIT_INFO) + # EXE # diff --git a/source/main.c b/source/main.c index 4a1aea6..915fa05 100644 --- a/source/main.c +++ b/source/main.c @@ -24,6 +24,10 @@ * Alexey Avdyukhin * */ + +#define VERSION "v3.0" +#define DESCRIPTION "a 6502 assembler with specific NES support" +#define GITHUB_URL "https://github.com/ClusterM/nesasm/" #include <stdio.h> #include <stdlib.h> @@ -36,6 +40,7 @@ #include "protos.h" #include "vars.h" #include "inst.h" +#include "commit.h" /* variables */ unsigned char ipl_buffer[4096]; @@ -60,9 +65,9 @@ int list_level; /* output level */ int asm_opt[8]; /* assembler options */ /* Program description. */ -static char program_desc[] = "nesasm CE v3.0 - a 6502 assembler with specific NES support"; +static char program_desc[256]; const char *argp_program_version = program_desc; -const char *argp_program_bug_address = "https://github.com/ClusterM/nesasm/"; +const char *argp_program_bug_address = GITHUB_URL; /* Program arguments description. */ static char argp_program_args_desc[] = "<source.asm>"; @@ -159,6 +164,9 @@ main(int argc, char **argv) char *p; int i, j; int ram_bank; + + sprintf(program_desc, "nesasm %s - %s\ncommit: %s @ %s", + VERSION, DESCRIPTION, COMMIT, GITHUB_URL); if (argc == 1) fprintf(stderr, "%s\n", program_desc); |