Skip to content

Commit 91d702e

Browse files
committed
makefile: add vars target
This allows generating vars.sh/tcl/gdb files, which is useful when debugging, openroad command line can be copied and pasted after sourcing vars.sh. Also, it could be useful in separating the concern of executing ORFS stages and checking dependencies, opening the road implementing Bazel support on top of ORFS with a minimal maintenance burden for ORFS and the Bazel support. Signed-off-by: Øyvind Harboe <[email protected]>
1 parent 979d6e7 commit 91d702e

File tree

4 files changed

+35
-23
lines changed

4 files changed

+35
-23
lines changed

flow/.gitignore

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1 +1,4 @@
11
settings.mk
2+
vars.sh
3+
vars.gdb
4+
vars.tcl

flow/Makefile

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -846,6 +846,9 @@ nuke: clean_test clean_issues
846846
rm -rf *.rpt *.rpt.old *.def.v pin_dumper.log
847847
rm -rf versions.txt
848848

849+
.PHONY: vars
850+
vars:
851+
$(UTILS_DIR)/generate-vars.sh vars
849852

850853
# DEF/GDS/OAS viewer shortcuts
851854
#-------------------------------------------------------------------------------

flow/util/generate-vars.sh

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
#!/bin/bash
2+
set -euo pipefail
3+
DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"
4+
5+
# exclude system and CI variables
6+
EXCLUDED_VARS="MAKE|PYTHONPATH|PKG_CONFIG_PATH|PERL5LIB|PCP_DIR|PATH|MANPATH"
7+
EXCLUDED_VARS+="|LD_LIBRARY_PATH|INFOPATH|HOME|PWD|MAIL|TIME_CMD|QT_QPA_PLATFORM"
8+
9+
printf '%s\n' "$ISSUE_VARIABLES" | while read -r V;
10+
do
11+
if [[ ! ${V%=*} =~ ^[[:digit:]] && ${V} == *"="* && ! -z ${V#*=} && ${V%=*} != *"MAKEFILE"* && ! ${V%=*} =~ ^(${EXCLUDED_VARS})$ ]] ; then
12+
rhs=`sed -e 's/^"//' -e 's/"$//' <<<"${V#*=}"`
13+
# handle special case where the variable needs to be splitted in Tcl code
14+
if [[ "${V%=*}" == "GND_NETS_VOLTAGES" || "${V%=*}" == "PWR_NETS_VOLTAGES" ]]; then
15+
echo "export "${V%=*}"='"\"${rhs}"\"'" >> $1.sh;
16+
else
17+
echo "export "${V%=*}"='"${rhs}"'" >> $1.sh;
18+
fi
19+
echo "set env("${V%=*}") \""${rhs}\""" >> $1.tcl;
20+
echo "set env "${V%=*}" "${rhs}"" >> $1.gdb;
21+
fi
22+
done
23+
24+
# remove variables starting with a dot
25+
sed -i -e '/export \./d' $1.sh
26+
sed -i -e '/set env(\./d' $1.tcl
27+
sed -i -e '/set env \./d' $1.gdb

flow/util/makeIssue.sh

Lines changed: 2 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
#!/bin/bash
22

33
set -euo pipefail
4+
DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"
45

56
currentDate=$(date +"%Y-%m-%d_%H-%M")
67
ISSUE_TAG=${ISSUE_TAG:-"${DESIGN_NICKNAME}_${PLATFORM}_${FLOW_VARIANT}_${currentDate}"}
@@ -72,29 +73,7 @@ chmod +x ${RUN_ME_SCRIPT}
7273
echo "Creating ${VARS_BASENAME}.sh/tcl script"
7374
rm -f ${VARS_BASENAME}.sh ${VARS_BASENAME}.tcl ${VARS_BASENAME}.gdb || true
7475

75-
# exclude system and CI variables
76-
EXCLUDED_VARS="MAKE|PYTHONPATH|PKG_CONFIG_PATH|PERL5LIB|PCP_DIR|PATH|MANPATH"
77-
EXCLUDED_VARS+="|LD_LIBRARY_PATH|INFOPATH|HOME|PWD|MAIL|TIME_CMD|QT_QPA_PLATFORM"
78-
79-
printf '%s\n' "$ISSUE_VARIABLES" | while read -r V;
80-
do
81-
if [[ ! ${V%=*} =~ ^[[:digit:]] && ${V} == *"="* && ! -z ${V#*=} && ${V%=*} != *"MAKEFILE"* && ! ${V%=*} =~ ^(${EXCLUDED_VARS})$ ]] ; then
82-
rhs=`sed -e 's/^"//' -e 's/"$//' <<<"${V#*=}"`
83-
# handle special case where the variable needs to be splitted in Tcl code
84-
if [[ "${V%=*}" == "GND_NETS_VOLTAGES" || "${V%=*}" == "PWR_NETS_VOLTAGES" ]]; then
85-
echo "export "${V%=*}"='"\"${rhs}"\"'" >> ${VARS_BASENAME}.sh;
86-
else
87-
echo "export "${V%=*}"='"${rhs}"'" >> ${VARS_BASENAME}.sh;
88-
fi
89-
echo "set env("${V%=*}") \""${rhs}\""" >> ${VARS_BASENAME}.tcl;
90-
echo "set env "${V%=*}" "${rhs}"" >> ${VARS_BASENAME}.gdb;
91-
fi
92-
done
93-
94-
# remove variables starting with a dot
95-
sed -i -e '/export \./d' ${VARS_BASENAME}.sh
96-
sed -i -e '/set env(\./d' ${VARS_BASENAME}.tcl
97-
sed -i -e '/set env \./d' ${VARS_BASENAME}.gdb
76+
$DIR/generate-vars.sh ${VARS_BASENAME}
9877

9978
echo "Archiving issue to $1_${ISSUE_TAG}.tar.gz"
10079
tar --ignore-failed-read -czhf $1_${ISSUE_TAG}.tar.gz \

0 commit comments

Comments
 (0)