summaryrefslogtreecommitdiff
path: root/Makefile
diff options
context:
space:
mode:
authorJohn Hodge <tpg@ucc.asn.au>2018-08-05 00:10:39 +0800
committerJohn Hodge <tpg@ucc.asn.au>2018-08-05 00:10:39 +0800
commitec907f56199c495db061f2712a5be3977bcb11e8 (patch)
tree57ad89f8b82cfd23434bd2622a15ee6d0afe4a30 /Makefile
parentb5df909cdc61a10d750e2d9cb8ba11f4bdec6609 (diff)
downloadmrust-ec907f56199c495db061f2712a5be3977bcb11e8.tar.gz
Add version number (0.8 for now, because altough not stable, it works...)
Diffstat (limited to 'Makefile')
-rw-r--r--Makefile6
1 files changed, 5 insertions, 1 deletions
diff --git a/Makefile b/Makefile
index 256bb6c6..33509546 100644
--- a/Makefile
+++ b/Makefile
@@ -70,7 +70,7 @@ OBJDIR = .obj/
BIN := bin/mrustc$(EXESUF)
-OBJ := main.o
+OBJ := main.o version.o
OBJ += span.o rc_string.o debug.o ident.o
OBJ += ast/ast.o
OBJ += ast/types.o ast/crate.o ast/path.o ast/expr.o ast/pattern.o
@@ -314,6 +314,10 @@ $(OBJDIR)%.o: src/%.cpp
@mkdir -p $(dir $@)
@echo [CXX] -o $@
$V$(CXX) -o $@ -c $< $(CXXFLAGS) $(CPPFLAGS) -MMD -MP -MF $@.dep
+$(OBJDIR)version.o: $(OBJDIR)%.o: src/%.cpp $(filter-out $(OBJDIR)version.o,$(OBJ)) Makefile
+ @mkdir -p $(dir $@)
+ @echo [CXX] -o $@
+ $V$(CXX) -o $@ -c $< $(CXXFLAGS) $(CPPFLAGS) -MMD -MP -MF $@.dep -D VERSION_GIT_FULLHASH=\"$(shell git show --pretty=%H -s)\" -D VERSION_GIT_BRANCH="\"$(shell git symbolic-ref -q --short HEAD || git describe --tags --exact-match)\"" -D VERSION_GIT_SHORTHASH=\"$(shell git show -s --pretty=%h)\" -D VERSION_BUILDTIME="\"$(shell date -uR)\"" -D VERSION_GIT_ISDIRTY=$(shell git diff-index --quiet HEAD; echo $$?)
src/main.cpp: $(PCHS:%=src/%.gch)