-
Notifications
You must be signed in to change notification settings - Fork 34
/
system_shared.mk
84 lines (77 loc) · 3 KB
/
system_shared.mk
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
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
##############################################################################
## This file is part of 'SLAC Firmware Standard Library'.
## It is subject to the license terms in the LICENSE.txt file found in the
## top-level directory of this distribution and at:
## https://confluence.slac.stanford.edu/display/ppareg/LICENSE.html.
## No part of 'SLAC Firmware Standard Library', including this file,
## may be copied, modified, propagated, or distributed except according to
## the terms contained in the LICENSE.txt file.
##############################################################################
ifndef PRJ_VERSION
export PRJ_VERSION = 0xFFFFFFFF
endif
# Check for /u1 drive
BUILD_EXIST=$(shell [ -e $(TOP_DIR)/build/ ] && echo 1 || echo 0 )
U1_EXIST=$(shell [ -e /u1/ ] && echo 1 || echo 0 )
ifeq ($(U1_EXIST), 1)
$(shell mkdir -p /u1/$(USER) )
$(shell mkdir -p /u1/$(USER)/build )
ifeq ($(BUILD_EXIST), 0)
$(shell ln -s /u1/$(USER)/build $(TOP_DIR)/build )
endif
endif
U1_EXIST=$(shell [ -e /u1/$(USER)/build ] && echo 1 || echo 0 )
ifeq ($(U1_EXIST), 1)
export TMP_DIR=/u1/$(USER)/build
else
export TMP_DIR=/tmp/build
endif
# Generate build string
export BUILD_SYS_NAME = $(shell uname -n)
export BUILD_SVR_TYPE = $(shell uname -m)
export BUILD_USER = $(shell whoami)
BUILD_DATE := $(shell date)
BUILD_TIME := $(shell date +%Y%m%d%H%M%S)
export BUILD_STRING = $(PROJECT): Vivado v$(VIVADO_VERSION), $(BUILD_SYS_NAME) ($(BUILD_SVR_TYPE)), Built $(BUILD_DATE) by $(BUILD_USER)
# Check the GIT status
export GIT_STATUS = $(shell git diff-index --name-only HEAD)
# Check for non-dirty git clone
ifeq ($(GIT_STATUS),)
export GIT_HASH_LONG = $(shell git rev-parse HEAD)
export GIT_HASH_SHORT = $(shell git rev-parse --short HEAD)
export GIT_HASH_MSG = $(GIT_HASH_LONG)
ifeq ($(RECONFIG_STATIC_HASH), 0)
export IMAGENAME = $(PROJECT)-$(PRJ_VERSION)-$(BUILD_TIME)-$(USER)-$(GIT_HASH_SHORT)
else
export IMAGENAME = $(PROJECT)-$(PRJ_VERSION)-$(BUILD_TIME)-$(USER)-$(GIT_HASH_SHORT)_$(RECONFIG_STATIC_HASH)
endif
else
export GIT_HASH_MSG = dirty
# Check if we are using GIT tagging
ifeq ($(GIT_BYPASS), 0)
export GIT_HASH_LONG =
export GIT_HASH_SHORT =
else
export GIT_STATUS =
export GIT_HASH_LONG = 0
export GIT_HASH_SHORT = 0
endif
ifeq ($(RECONFIG_STATIC_HASH), 0)
export IMAGENAME = $(PROJECT)-$(PRJ_VERSION)-$(BUILD_TIME)-$(USER)-dirty
else
export IMAGENAME = $(PROJECT)-$(PRJ_VERSION)-$(BUILD_TIME)-$(USER)-dirty_$(RECONFIG_STATIC_HASH)
endif
endif
# Build System Header
define ACTION_HEADER
@echo
@echo "============================================================================="
@echo $(1)
@echo " Project = $(PROJECT)"
@echo " Out Dir = $(OUT_DIR)"
@echo " Version = $(PRJ_VERSION)"
@echo " Build String = $(BUILD_STRING)"
@echo " GIT Hash = $(GIT_HASH_MSG)"
@echo "============================================================================="
@echo
endef