mirror of
git://projects.qi-hardware.com/eda-tools.git
synced 2024-11-22 15:44:05 +02:00
eeshow/: eeshow -V prints the commit from which eeshow was built
This commit is contained in:
parent
84de6b9ce6
commit
a6640058ff
@ -11,7 +11,7 @@
|
|||||||
#
|
#
|
||||||
|
|
||||||
NAME = eeshow
|
NAME = eeshow
|
||||||
OBJS = main.o \
|
OBJS = main.o version.o \
|
||||||
kicad/sch-parse.o kicad/sch-render.o kicad/lib-parse.o \
|
kicad/sch-parse.o kicad/sch-render.o kicad/lib-parse.o \
|
||||||
kicad/lib-render.o kicad/dwg.o kicad/delta.o \
|
kicad/lib-render.o kicad/dwg.o kicad/delta.o \
|
||||||
gui/gui.o gui/over.o gui/style.o gui/aoi.o gui/fmt-pango.o gui/input.o \
|
gui/gui.o gui/over.o gui/style.o gui/aoi.o gui/fmt-pango.o gui/input.o \
|
||||||
@ -33,6 +33,10 @@ LDLIBS = -lm \
|
|||||||
`pkg-config --libs libgit2` \
|
`pkg-config --libs libgit2` \
|
||||||
`pkg-config --libs gtk+-3.0`
|
`pkg-config --libs gtk+-3.0`
|
||||||
|
|
||||||
|
GIT_VERSION = $(shell git log -1 --format='%h' -s .)
|
||||||
|
GIT_STATUS = $(shell [ -z "`git status -s -uno`" ] || echo +)
|
||||||
|
CFLAGS += -DVERSION='"$(GIT_VERSION)$(GIT_STATUS)"'
|
||||||
|
|
||||||
ifneq ($(USE_WEBKIT),)
|
ifneq ($(USE_WEBKIT),)
|
||||||
CFLAGS += -DUSE_WEBKIT `pkg-config --cflags webkit2gtk-4.0`
|
CFLAGS += -DUSE_WEBKIT `pkg-config --cflags webkit2gtk-4.0`
|
||||||
LDLIBS += `pkg-config --libs webkit2gtk-4.0`
|
LDLIBS += `pkg-config --libs webkit2gtk-4.0`
|
||||||
@ -44,10 +48,12 @@ endif
|
|||||||
include ../common/Makefile.c-common
|
include ../common/Makefile.c-common
|
||||||
|
|
||||||
.PHONY: test neo900 sch test testref png pngref pdf diff view newref
|
.PHONY: test neo900 sch test testref png pngref pdf diff view newref
|
||||||
|
.PHONY: version.c
|
||||||
|
|
||||||
all:: $(NAME)
|
all:: $(NAME)
|
||||||
|
|
||||||
$(NAME): $(OBJS)
|
$(NAME): $(OBJS)
|
||||||
|
$(MAKE) version.o
|
||||||
$(CC) -o $(NAME) $(OBJS) $(LDLIBS)
|
$(CC) -o $(NAME) $(OBJS) $(LDLIBS)
|
||||||
|
|
||||||
help.inc: $(HELP_TEXT) Makefile
|
help.inc: $(HELP_TEXT) Makefile
|
||||||
|
@ -31,6 +31,7 @@
|
|||||||
#include "gui/fmt-pango.h"
|
#include "gui/fmt-pango.h"
|
||||||
#include "file/git-hist.h"
|
#include "file/git-hist.h"
|
||||||
#include "gui/gui.h"
|
#include "gui/gui.h"
|
||||||
|
#include "version.h"
|
||||||
#include "main.h"
|
#include "main.h"
|
||||||
|
|
||||||
|
|
||||||
@ -50,6 +51,7 @@ void usage(const char *name)
|
|||||||
" %*s[-- driver_spec]\n"
|
" %*s[-- driver_spec]\n"
|
||||||
" %s [-v ...] -C [rev:]file\n"
|
" %s [-v ...] -C [rev:]file\n"
|
||||||
" %s [-v ...] -H path_into_repo\n"
|
" %s [-v ...] -H path_into_repo\n"
|
||||||
|
" %s -V\n"
|
||||||
" %s gdb ...\n"
|
" %s gdb ...\n"
|
||||||
"\n"
|
"\n"
|
||||||
" rev git revision\n"
|
" rev git revision\n"
|
||||||
@ -58,6 +60,7 @@ void usage(const char *name)
|
|||||||
" -C 'cat' the file to standard output\n"
|
" -C 'cat' the file to standard output\n"
|
||||||
" -H show history of repository on standard output\n"
|
" -H show history of repository on standard output\n"
|
||||||
" -N n limit history to n revisions (unlimited if omitted or 0)\n"
|
" -N n limit history to n revisions (unlimited if omitted or 0)\n"
|
||||||
|
" -V print revision (version) number and exit\n"
|
||||||
" gdb run eeshow under gdb\n"
|
" gdb run eeshow under gdb\n"
|
||||||
"\n"
|
"\n"
|
||||||
"No driver spec: enter GUI\n"
|
"No driver spec: enter GUI\n"
|
||||||
@ -83,7 +86,7 @@ void usage(const char *name)
|
|||||||
" diff [-o output.pdf] [-s scale] [file.lib ...] file.sch\n"
|
" diff [-o output.pdf] [-s scale] [file.lib ...] file.sch\n"
|
||||||
"\n"
|
"\n"
|
||||||
" see PNG\n"
|
" see PNG\n"
|
||||||
, name, name, (int) strlen(name) + 1, "", name, name, name);
|
, name, name, (int) strlen(name) + 1, "", name, name, name, name);
|
||||||
exit(1);
|
exit(1);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -127,7 +130,7 @@ int main(int argc, char **argv)
|
|||||||
if (!have_dashdash)
|
if (!have_dashdash)
|
||||||
gtk_init(&argc, &argv);
|
gtk_init(&argc, &argv);
|
||||||
|
|
||||||
while ((c = getopt(dashdash, argv, "rvC:F:H:N:")) != EOF)
|
while ((c = getopt(dashdash, argv, "rvC:F:H:N:V")) != EOF)
|
||||||
switch (c) {
|
switch (c) {
|
||||||
case 'r':
|
case 'r':
|
||||||
recurse = 1;
|
recurse = 1;
|
||||||
@ -147,6 +150,9 @@ int main(int argc, char **argv)
|
|||||||
case 'N':
|
case 'N':
|
||||||
limit = atoi(optarg);
|
limit = atoi(optarg);
|
||||||
break;
|
break;
|
||||||
|
case 'V':
|
||||||
|
fprintf(stderr, "%s\n", version);
|
||||||
|
return 1;
|
||||||
default:
|
default:
|
||||||
usage(*argv);
|
usage(*argv);
|
||||||
}
|
}
|
||||||
|
16
eeshow/version.c
Normal file
16
eeshow/version.c
Normal file
@ -0,0 +1,16 @@
|
|||||||
|
/*
|
||||||
|
* version.c - GIT version
|
||||||
|
*
|
||||||
|
* Written 2016 by Werner Almesberger
|
||||||
|
* Copyright 2016 by Werner Almesberger
|
||||||
|
*
|
||||||
|
* This program is free software; you can redistribute it and/or modify
|
||||||
|
* it under the terms of the GNU General Public License as published by
|
||||||
|
* the Free Software Foundation; either version 2 of the License, or
|
||||||
|
* (at your option) any later version.
|
||||||
|
*/
|
||||||
|
|
||||||
|
#include "version.h"
|
||||||
|
|
||||||
|
|
||||||
|
const char *version = VERSION;
|
18
eeshow/version.h
Normal file
18
eeshow/version.h
Normal file
@ -0,0 +1,18 @@
|
|||||||
|
/*
|
||||||
|
* version.h - GIT version
|
||||||
|
*
|
||||||
|
* Written 2016 by Werner Almesberger
|
||||||
|
* Copyright 2016 by Werner Almesberger
|
||||||
|
*
|
||||||
|
* This program is free software; you can redistribute it and/or modify
|
||||||
|
* it under the terms of the GNU General Public License as published by
|
||||||
|
* the Free Software Foundation; either version 2 of the License, or
|
||||||
|
* (at your option) any later version.
|
||||||
|
*/
|
||||||
|
|
||||||
|
#ifndef VERSION_H
|
||||||
|
#define VERSION_H
|
||||||
|
|
||||||
|
extern const char *version;
|
||||||
|
|
||||||
|
#endif /* !VERSION_H */
|
Loading…
Reference in New Issue
Block a user