summaryrefslogtreecommitdiffstats
path: root/lab4/build/util.mk
blob: 3bc84ca0efca61df39a6886138522ebdee513671 (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
47
48
49
50
51
52
53
54
55
56
57
58
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