File: Makefile

package info (click to toggle)
arachne-pnr 0.1+20160813git52e69ed-1
  • links: PTS, VCS
  • area: main
  • in suites: stretch
  • size: 956 kB
  • sloc: cpp: 9,258; python: 228; sh: 148; makefile: 96
file content (123 lines) | stat: -rw-r--r-- 4,155 bytes parent folder | download
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
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123

# build with default C/C++ compiler
# CC = clang
# CXX = clang++

# build optimized without -DNDEBUG
# OPTDEBUGFLAGS = -O0 -fno-inline -g
# OPTDEBUGFLAGS = -O3 -DNDEBUG
OPTDEBUGFLAGS = -O2
SRC = src

# clang only: -Wglobal-constructors
CXXFLAGS += -I$(SRC) -std=c++11 -Wall -Wshadow -Wsign-compare -Werror
LIBS = -lm

DESTDIR = /usr/local
ICEBOX = /usr/share/fpga-icestorm/chipdb

.PHONY: all
all: bin/arachne-pnr share/arachne-pnr/chipdb-1k.bin share/arachne-pnr/chipdb-8k.bin

VER = 0.1+20151224git1a4fdf9
GIT_REV = 1a4fdf9

VER_HASH = $(shell echo "$(VER) $(GIT_REV)" | sum | cut -d ' ' -f -1)

src/version_$(VER_HASH).cc:
	echo "const char *version_str = \"arachne-pnr $(VER) (git sha1 $(GIT_REV), $(notdir $(CXX)) `$(CXX) --version | tr ' ()' '\n' | grep '^[0-9]' | head -n1` $(filter -f% -m% -O% -DNDEBUG,$(CXXFLAGS)))\";" > src/version_$(VER_HASH).cc

bin/arachne-pnr: src/arachne-pnr.o src/netlist.o src/blif.o src/pack.o src/place.o src/util.o src/io.o src/route.o src/chipdb.o src/location.o src/configuration.o src/line_parser.o src/pcf.o src/global.o src/constant.o src/designstate.o src/version_$(VER_HASH).o
	$(CXX) $(CXXFLAGS) $(LDFLAGS) -o $@ $^ $(LIBS)

share/arachne-pnr/chipdb-1k.bin: bin/arachne-pnr $(ICEBOX)/chipdb-1k.txt
	mkdir -p share/arachne-pnr
	bin/arachne-pnr -d 1k -c $(ICEBOX)/chipdb-1k.txt --write-binary-chipdb share/arachne-pnr/chipdb-1k.bin

share/arachne-pnr/chipdb-8k.bin: bin/arachne-pnr $(ICEBOX)/chipdb-8k.txt
	mkdir -p share/arachne-pnr
	bin/arachne-pnr -d 8k -c $(ICEBOX)/chipdb-8k.txt --write-binary-chipdb share/arachne-pnr/chipdb-8k.bin

tests/test_bv: tests/test_bv.o
	$(CXX) $(CXXFLAGS) $(LDFLAGS) -o $@ $^

tests/test_us: tests/test_us.o
	$(CXX) $(CXXFLAGS) $(LDFLAGS) -o $@ $^

# assumes icestorm installed
simpletest: all tests/test_bv tests/test_us
	./tests/test_bv
	./tests/test_us
	cd tests/simple && ICEBOX=$(ICEBOX) bash run-test.sh
	cd tests/regression && bash run-test.sh
	cd tests/blif && bash run-test.sh
	cd tests/error && bash run-test.sh
	@echo
	@echo 'All tests passed.'
	@echo

# assumes icestorm, yosys installed
#test: all tests/test_bv ./tests/test_us
#	./tests/test_bv
#	./tests/test_us
#	make -C examples/rot clean && make -C examples/rot
#	cd tests/simple && ICEBOX=$(ICEBOX) bash run-test.sh
#	cd tests/regression && bash run-test.sh
#	cd tests/blif && bash run-test.sh
#	cd tests/error && bash run-test.sh
#	cd tests/fsm && bash run-test.sh
#	cd tests/combinatorial && bash run-test.sh
#	@echo
#	@echo 'All tests passed.'
#	@echo

# assumes valgrind installed
testvg:
	cd tests/simple && bash run-valgrind-test.sh
	@echo
	@echo 'All tests passed.'
	@echo

fuzz-pcf: all
	afl-fuzz -t 2500 -m 500 -x fuzz/pcf/pcf.dict -i fuzz/pcf/testcases -o fuzz/pcf/findings bin/arachne-pnr -p @@ fuzz/pcf/rot.blif -o /dev/null

fuzz-blif: all
	afl-fuzz -t 2500 -m 500 -x fuzz/blif/blif.dict -i fuzz/blif/testcases -o fuzz/blif/findings bin/arachne-pnr @@ -o /dev/null

-include src/*.d

.PHONY: mxebin
mxebin:
	$(MAKE) clean
	rm -rf arachne-pnr-win32
	rm -f arachne-pnr-win32.zip
	mkdir -p arachne-pnr-win32
	$(MAKE) share/arachne-pnr/chipdb-1k.bin share/arachne-pnr/chipdb-8k.bin
	mv share/arachne-pnr/chipdb-1k.bin arachne-pnr-win32/
	mv share/arachne-pnr/chipdb-8k.bin arachne-pnr-win32/
	$(MAKE) clean
	$(MAKE) CC=/usr/local/src/mxe/usr/bin/i686-w64-mingw32.static-gcc CXX=/usr/local/src/mxe/usr/bin/i686-w64-mingw32.static-g++ bin/arachne-pnr
	mv bin/arachne-pnr arachne-pnr-win32/arachne-pnr.exe
	zip -r arachne-pnr-win32.zip arachne-pnr-win32/
	rm -rf arachne-pnr-win32
	$(MAKE) clean

.PHONY: install
install: all
	mkdir -p $(DESTDIR)/usr/bin
	cp bin/arachne-pnr $(DESTDIR)/usr/bin/arachne-pnr
	mkdir -p $(DESTDIR)/usr/share/arachne-pnr
	cp share/arachne-pnr/chipdb-1k.bin $(DESTDIR)/usr/share/arachne-pnr/chipdb-1k.bin
	cp share/arachne-pnr/chipdb-8k.bin $(DESTDIR)/usr/share/arachne-pnr/chipdb-8k.bin

.PHONY: uninstall
uninstall:
	rm -f $(DESTDIR)/usr/bin/arachne-pnr
	rm -f $(DESTDIR)/usr/bin/share/arachne-pnr/*.bin

.PHONY: clean
clean:
	rm -f src/*.o tests/*.o src/*.d tests/*.d bin/arachne-pnr
	rm -f tests/test_bv tests/test_us
	rm -f share/arachne-pnr/*.bin
	rm -f src/version_*