summaryrefslogtreecommitdiffstats
path: root/Makefile
blob: c36959999dda80cc3b68e738670af5f2015860a8 (plain)
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
PREFIX=${PWD}


default:src/tools.stamp src/evb-yosys-demo.stamp src/vhdl-demo.stamp

src/vhdl-demo.stamp: src/tools.stamp
	${MAKE} -C src/vhdl-demo
	touch $@

src/evb-yosys-demo.stamp: src/tools.stamp
	${MAKE} -C src/evb-yosys-demo/ice40hx8k-evb 
	${MAKE} -C src/evb-yosys-demo/ice40-io-video
	touch $@

src/tools.stamp: src/nextpnr.stamp src/yosys.stamp src/flashrom.stamp src/ghdl-yosys-plugin.stamp  src/ghdl.stamp
	touch $@


src/ghdl-yosys-plugin.stamp: src/ghdl.stamp src/yosys.stamp
	${MAKE} -C src/ghdl-yosys-plugin GHDL=${PREFIX}/bin/ghdl YOSYS_CONFIG=${PREFIX}/bin/yosys-config 
	${MAKE} -C src/ghdl-yosys-plugin GHDL=${PREFIX}/bin/ghdl YOSYS_CONFIG=${PREFIX}/bin/yosys-config install
	touch $@

src/ghdl.stamp:  src/ghdl-build/Makefile
	${MAKE} -C src/ghdl-build
	${MAKE} -C src/ghdl-build install
	touch $@

src/ghdl-build/Makefile:
	mkdir -p src/ghdl-build
	(cd src/ghdl-build && ../ghdl/configure --prefix=${PREFIX})

src/yosys.stamp:#src/yosys/Makefile
	# the muppets did not make this easy
	if [ -d src/yosys/abc]; then ln -s ../abc src/yosys/abc; fi
	(cd src/abc && rm -f .gitcommit && git checkout .gitcommit && git log -1 --pretty=format:"%h" > .gitcommit )
	${MAKE} -C src/yosys PREFIX=${PREFIX} -j 16 
	${MAKE} -C src/yosys PREFIX=${PREFIX} install
	(cd src/abc && rm -f .gitcommit && git checkout .gitcommit)
	/bin/rm -f src/abc/abc-*
	touch $@

#src/yosys/Makefile:
#	git clone https://github.com/YosysHQ/yosys src/yosys


src/nextpnr.stamp: src/nextpnr/build/Makefile
	${MAKE} -C src/nextpnr/build 
	${MAKE} -C src/nextpnr/build install
	touch $@

src/nextpnr/build/Makefile:src/icestorm.stamp #src/nextpnr/CMakeLists.txt
	mkdir -p src/nextpnr/build
	(cd src/nextpnr/build && cmake .. -DARCH=ice40 -DICESTORM_INSTALL_PREFIX=${PREFIX} -DCMAKE_INSTALL_PREFIX=${PREFIX})


#src/nextpnr/CMakeLists.tdxt:
#	git clone https://github.com/YosysHQ/nextpnr src/nextpnr
#	(cd src/nextpnr && git submodule init)
#	(cd src/nextpnr && git submodule update)


src/icestorm.stamp: #src/icestorm/config.mk
	${MAKE} -C src/icestorm PREFIX=${PREFIX}
	${MAKE} -C src/icestorm PREFIX=${PREFIX} install
	touch $@
	
src/flashrom.stamp: #src/flashrom/Makefile
	${MAKE} -C src/flashrom PREFIX=${PREFIX}
	if [ ! -d src/flashrom/man8 ]; then ln -s . src/flashrom/man8; fi
	${MAKE} -C src/flashrom PREFIX=${PREFIX} install
	/bin/rm -f src/flashrom/man8
	touch $@



	


#icestorm/config.mk:
#	git clone https://github.com/YosysHQ/icestorm src/icestorm