about summary refs log tree commit diff homepage
path: root/lib/Support/Makefile
blob: 2b1b104cf56395894f83e12dcecfca6c27998282 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
#===-- lib/Support/Makefile --------------------------------*- Makefile -*--===#
#
#                     The KLEE Symbolic Virtual Machine
#
# This file is distributed under the University of Illinois Open Source
# License. See LICENSE.TXT for details.
#
#===------------------------------------------------------------------------===#

LEVEL=../..

LIBRARYNAME=kleeSupport
DONT_BUILD_RELINKED=1
BUILD_ARCHIVE=1
NO_INSTALL=1

# FIXME: This is nasty. We don't want to rebuild this library everytime
# but this was the only way I could find to make the build work.
#
# Note this rule has to go here so it is run first.
CompileTimeInfoFile:=../../include/klee/Config/CompileTimeInfo.h
all-local:: $(CompileTimeInfoFile)

include $(LEVEL)/Makefile.common


GIT_PRESENT:=$(shell [ -d "$(PROJ_SRC_ROOT)/.git" ] && echo 1 || echo 0)

ifeq ($(GIT_PRESENT),1)
GIT_TAGS:=$(shell cd $(PROJ_SRC_ROOT); git describe --tags 2> /dev/null 1>&2 && echo 1 || echo 0)
else
GIT_TAGS:=0
endif

.PHONY: $(CompileTimeInfoFile)
$(CompileTimeInfoFile):
	$(Verb) echo "Regenerating $(CompileTimeInfoFile)"
	$(Verb) echo '#define KLEE_BUILD_MODE "$(BuildMode)"' > $(CompileTimeInfoFile)
ifeq ($(GIT_PRESENT),1)
	$(Verb) echo '#define KLEE_BUILD_REVISION "'$(shell cd $(PROJ_SRC_ROOT); git rev-parse HEAD)'"' >> \
	$(CompileTimeInfoFile)
endif
ifeq ($(GIT_TAGS),1)
	$(Verb) echo '#define KLEE_BUILD_TAG "'$(shell cd $(PROJ_SRC_ROOT); git describe --tags)'"' >> \
	$(CompileTimeInfoFile)
endif