summaryrefslogtreecommitdiff
path: root/Makefile
diff options
context:
space:
mode:
authorWerner Almesberger <werner@almesberger.net>2016-08-19 19:53:32 -0300
committerWerner Almesberger <werner@almesberger.net>2016-08-19 19:53:32 -0300
commit74400a651a461cd6181ed20e4074cc1b3bd04aab (patch)
treea46ac0e17e0e40bfa02f17abe01650dc6d1e5e4c /Makefile
parent5eab5cf2cc5c7e19b05dc2c0c88fa5c975e5230c (diff)
downloadeeshow-74400a651a461cd6181ed20e4074cc1b3bd04aab.tar.gz
eeshow-74400a651a461cd6181ed20e4074cc1b3bd04aab.tar.bz2
eeshow-74400a651a461cd6181ed20e4074cc1b3bd04aab.zip
eeshow/: eeshow -V prints the commit from which eeshow was built
Diffstat (limited to 'Makefile')
-rw-r--r--Makefile8
1 files changed, 7 insertions, 1 deletions
diff --git a/Makefile b/Makefile
index ece7f79..f1b9e7c 100644
--- a/Makefile
+++ b/Makefile
@@ -11,7 +11,7 @@
#
NAME = eeshow
-OBJS = main.o \
+OBJS = main.o version.o \
kicad/sch-parse.o kicad/sch-render.o kicad/lib-parse.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 \
@@ -33,6 +33,10 @@ LDLIBS = -lm \
`pkg-config --libs libgit2` \
`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),)
CFLAGS += -DUSE_WEBKIT `pkg-config --cflags webkit2gtk-4.0`
LDLIBS += `pkg-config --libs webkit2gtk-4.0`
@@ -44,10 +48,12 @@ endif
include ../common/Makefile.c-common
.PHONY: test neo900 sch test testref png pngref pdf diff view newref
+.PHONY: version.c
all:: $(NAME)
$(NAME): $(OBJS)
+ $(MAKE) version.o
$(CC) -o $(NAME) $(OBJS) $(LDLIBS)
help.inc: $(HELP_TEXT) Makefile