aboutsummaryrefslogtreecommitdiffstats
path: root/contrib
diff options
context:
space:
mode:
authorbryan newbold <bnewbold@leaflabs.com>2013-11-13 11:49:47 -0500
committerbryan newbold <bnewbold@leaflabs.com>2013-11-13 11:49:47 -0500
commitdd227d103448274e1142119c0c9f657dcfc2ad18 (patch)
tree4824c8397de44269a0e82d1a61c5594f8882e683 /contrib
parent171eeca840ee34f4210471192845c1f21cad7c31 (diff)
downloadbasic-hdl-template-dd227d103448274e1142119c0c9f657dcfc2ad18.tar.gz
basic-hdl-template-dd227d103448274e1142119c0c9f657dcfc2ad18.zip
'untouchcores' target (see README)
Diffstat (limited to 'contrib')
-rw-r--r--contrib/README9
-rwxr-xr-xcontrib/git_untouch.sh40
-rw-r--r--contrib/xilinx.mk4
3 files changed, 53 insertions, 0 deletions
diff --git a/contrib/README b/contrib/README
index 5885aa9..d145490 100644
--- a/contrib/README
+++ b/contrib/README
@@ -5,6 +5,13 @@ By default, re-synthesis of a project (eg, after making a change to any HDL
files) will attempt to use the previous place-and-route netlist as a starting
point via the "smartguide" mechanism. 'make mostlyclean' will prevent this.
+By default, a git checkout will update timestamps on all files under version
+control. There are good reasons for this, but it can be particularly
+frustrating when there are large coregen cores in a project which must be
+rebuilt from scratch, even is the .xco files were not touched. The
+'untouchcores' target will try to cleverly reset timestamps to prevent this;
+run it after a git pull or checkout.
+
Changes to Makefiles will *not* necessarily result in a full rebuild; the
makefiles themselves are not a prerequisite of any targets. It is *strongly*
recommended that you 'make clean' (not just 'mostlyclean') after any
@@ -20,6 +27,8 @@ make lint - runs lint program on synthesizable Verilog files
make mostlyclean - cleans most sim and synth files
make clean - cleans all sim and synth files, incl. coregen'd
+make untouchcores - reset timestamps on .xco files to last change
+
make isim/<name>_tb - compiles sim files, then launches simulator GUI
make resim/<name>_tb - recompiles sim files w/o launching GUI
make test/<name>_tb - runs a single unit test
diff --git a/contrib/git_untouch.sh b/contrib/git_untouch.sh
new file mode 100755
index 0000000..c9d3ede
--- /dev/null
+++ b/contrib/git_untouch.sh
@@ -0,0 +1,40 @@
+#!/bin/bash -e
+
+# From http://stackoverflow.com/questions/1964470/whats-the-equivalent-of-use-commit-times-for-git
+# Modified to only run on files passed on command line
+
+OS=${OS:-`uname`}
+
+get_file_rev() {
+ git rev-list -n 1 HEAD "$1"
+}
+
+if [ "$OS" = 'FreeBSD' ]
+then
+ update_file_timestamp() {
+ file_time=`date -r "$(git show --pretty=format:%at --abbrev-commit "$(get_file_rev "$1")" | head -n 1)" '+%Y%m%d%H%M.%S'`
+ touch -h -t "$file_time" "$1"
+ }
+else
+ update_file_timestamp() {
+ file_time=`git show --pretty=format:%ai --abbrev-commit "$(get_file_rev "$1")" | head -n 1`
+ touch -d "$file_time" "$1"
+ }
+fi
+
+OLD_IFS=$IFS
+IFS=$'\n'
+
+for file in $@
+do
+ if [ ! `git status --ignored --porcelain $file` ]
+ then
+ update_file_timestamp "$file"
+ fi
+done
+
+IFS=$OLD_IFS
+
+git update-index --refresh &> /dev/null || true
+
+exit 0
diff --git a/contrib/xilinx.mk b/contrib/xilinx.mk
index 7c16cd7..2d5c0a5 100644
--- a/contrib/xilinx.mk
+++ b/contrib/xilinx.mk
@@ -132,6 +132,10 @@ $(coregen_work_dir)/$(project).cgp: contrib/template.cgp
@echo "SET speedgrade = $(speedgrade)" >> $@
@echo "SET workingdirectory = ./tmp/" >> $@
+untouchcores:
+ @echo "Resetting .xco timestamps so that cores won't be rebuilt"
+ ./contrib/git_untouch.sh $(xilinx_cores)
+
%.ngc %.v: %.xco $(coregen_work_dir)/$(project).cgp
@echo "=== rebuilding $@"
@bash -c "$(xil_env); \