summaryrefslogtreecommitdiffstats
path: root/lab3/build/util.mk
diff options
context:
space:
mode:
authorGustav Sörnäs <gustav@sornas.net>2022-02-14 17:18:38 +0100
committerGustav Sörnäs <gustav@sornas.net>2022-02-14 17:18:38 +0100
commit82197955991947fe0872712460bb988b6c2d0ef9 (patch)
tree3c91727a7ac088b197290fbf8486aba77ce8a9cf /lab3/build/util.mk
parent1ba036ef511af46a19fe81823b6e66bb4e98c45c (diff)
downloadtsea83-82197955991947fe0872712460bb988b6c2d0ef9.tar.gz
add rest of lab3
Diffstat (limited to 'lab3/build/util.mk')
-rwxr-xr-xlab3/build/util.mk59
1 files changed, 59 insertions, 0 deletions
diff --git a/lab3/build/util.mk b/lab3/build/util.mk
new file mode 100755
index 0000000..3bc84ca
--- /dev/null
+++ b/lab3/build/util.mk
@@ -0,0 +1,59 @@
+# Make sure we can include this from more than one place without any
+# issues:
+ifneq ($(UTILISINCLUDED),1)
+
+
+# The default shell for make is /bin/sh which doesn't work for some of
+# the commands used in these files.
+SHELL=/bin/bash
+
+
+# Make sure we are running at low priority...
+NICE = nice -n 19
+
+# Reverses the order of all arguments given to the function.
+reverse_order = $(if $(1), $(word $(words $(1)),$(1)) $(call reverse_order,$(wordlist 2,$(words $(1)),dummy $(1))),$(1))
+
+# Fix the path by inserting ../../.. if the path is relative. If absolute, do nothing
+fixpath3 = $(shell echo "$(1)" | sed 's,^\([^/]\),../../../\1,')
+
+# Fix the path by inserting ../.. if the path is relative. If absolute, do nothing
+fixpath2 = $(shell echo "$(1)" | sed 's,^\([^/]\),../../\1,')
+
+
+# Fix the path by inserting ../ if the path is relative. If absolute, do nothing
+fixpath1 = $(shell echo "$(1)" | sed 's,^\([^/]\),../\1,')
+
+export S
+export INCDIRS
+export T
+export U
+export PART
+export PROJNAME
+
+
+sanitycheckclock:
+ $(foreach i,$(S), bash sanitycheck.sh "$(i)" &&) true
+
+sanitychecksynth: sanitycheckclock
+ @if [ "$(S)" == "" ]; then echo 'ERROR: No synthesizable files specified!';false;fi
+
+sanitychecktb: sanitycheckclock
+ @if [ "$(T)" == "" ]; then echo 'ERROR: No testbench files specified!';false;fi
+ @if [ "$(S)" == "" ]; then echo 'WARNING: No synthesizable files specified!';fi
+
+
+
+%.clean:
+ rm -rf "$*-synthdir" "$*-simdir"
+
+
+
+clean:
+ rm -rf *synthdir *simdir *~
+
+
+
+UTILISINCLUDED=1
+endif
+