]> git.zerfleddert.de Git - raggedstone/blob - common/Makefile.common
only regenerate cores when needed, and not on every build
[raggedstone] / common / Makefile.common
1 PWD := $(shell pwd)
2
3 #auto|lpt1|lpt2|lpt3|com1|com2|com3|com4|usb0|usb1|usb2|usb21|ttya|ttyb|tty00|tty01
4 CABLE ?= auto
5
6 #DRIVER = /home/michael/Raggedstone/usb-driver/libusb-driver.so
7
8 INTSTYLE := silent
9
10 SOURCES := $(shell find . -wholename './tmp' -prune -o -name "*.vhd" -print) $(shell find . -wholename './tmp' -prune -o -name "*.v" -print)
11 PART ?= xc3s1500-fg456-4
12 TARGET ?= bit
13 CLEANFILES ?=
14
15 ifdef DRIVER
16 PRELOAD = LD_PRELOAD=$(DRIVER)
17 endif
18
19 all: $(PROJECT).$(TARGET) final
20
21 log:
22 time make all &>build.log
23
24 xst: $(PROJECT).ngc
25
26 ngdbuild: $(PROJECT).ngd
27
28 $(PROJECT).ngc: $(SOURCES) $(PROJECT).prj $(PROJECT).ucf $(PROJECT).xst
29 @# echo synclib > $(PROJECT).lso # hmm. things are different in ise 9.1
30 echo work > $(PROJECT).lso
31 xst -intstyle $(INTSTYLE) -ifn $(PROJECT).xst -ofn $(PROJECT).syr
32 @#cat $(PROJECT).syr
33
34 $(PROJECT).ngd: $(PROJECT).ngc
35 ngdbuild -intstyle $(INTSTYLE) -dd "$(PWD)/_ngo" -nt timestamp -uc $(PROJECT).ucf -p $(PART) $(PROJECT).ngc $(PROJECT).ngd
36
37 $(PROJECT)_map.ngm $(PROJECT).pcf: $(PROJECT).ngd
38 map -intstyle $(INTSTYLE) -p $(PART) -cm area -pr b -k 4 -c 100 -o $(PROJECT)_map.ncd $(PROJECT).ngd $(PROJECT).pcf
39
40 $(PROJECT).ncd: $(PROJECT)_map.ngm $(PROJECT).pcf
41 @#par -w -intstyle $(INTSTYLE) -ol std -n 4 -t 1 $(PROJECT)_map.ncd $(PROJECT).dir $(PROJECT).pcf
42 par -w -intstyle $(INTSTYLE) -ol std -t 1 $(PROJECT)_map.ncd $(PROJECT).ncd $(PROJECT).pcf
43
44 $(PROJECT).twx: $(PROJECT).ncd
45 trce -intstyle $(INTSTYLE) -e 3 -l 3 -s 4 -xml $(PROJECT) $(PROJECT).ncd -o $(PROJECT).twr $(PROJECT).pcf
46 @#cat $(PROJECT).twr
47
48 $(PROJECT).bit: $(PROJECT).ncd
49 bitgen -intstyle $(INTSTYLE) -f $(PROJECT).ut $(PROJECT).ncd
50 @# cp $(PROJECT).bit ../jcarr_last.bit
51 @#cat $(PROJECT).drc
52 @#cat $(PROJECT).bgn
53
54 $(PROJECT).vm6: $(PROJECT).ngd
55 cpldfit -intstyle $(INTSTYLE) -p $(PART) -ofmt vhdl -optimize speed -loc on -slew fast -init low -inputs 54 -pterms 25 -unused float -power std -terminate keeper $(PROJECT).ngd
56
57 $(PROJECT).jed: $(PROJECT).vm6
58 hprep6 -intstyle $(INTSTYLE) -s IEEE1149 -n $(PROJECT) -i $(PROJECT)
59
60 $(PROJECT)-xcf02s.mcs $(PROJECT)-xcf04s.mcs: $(PROJECT).bit
61 promgen -intstyle $(INTSTYLE) -w -p mcs -u 0 $(PROJECT) -o $(PROJECT)-xcf02s $(PROJECT)-xcf04s -x xcf02s xcf04s
62
63 final:
64 -@grep -A 8 -B 1 ^Selected\ Device $(PROJECT).syr
65 -@grep -A 8 -B 1 ^Timing\ Summary $(PROJECT).syr
66 -@grep -A 21 -B 1 ^Design\ Summary $(PROJECT)_map.map
67
68 burn: $(PROJECT).bit
69 xc3sprog $(PROJECT).bit
70
71 load: $(PROJECT).bit
72 @sed -e "s|%CABLE%|$(CABLE)|g" -e "s|%PROJECT%|$(PROJECT)|g" ../common/xc3s1500.batch >xc3s1500.batch.tmp
73 $(PRELOAD) impact -batch xc3s1500.batch.tmp
74 @rm xc3s1500.batch.tmp
75
76 flash:
77 @echo "NO"
78
79 i-really-want-to-flash: $(PROJECT)-xcf02s.mcs $(PROJECT)-xcf04s.mcs
80 @sed -e "s|%CABLE%|$(CABLE)|g" -e "s|%PROJECT%|$(PROJECT)|g" ../common/xcf.batch >xcf.batch.tmp
81 $(PRELOAD) impact -batch xcf.batch.tmp
82 @rm xcf.batch.tmp
83
84 analyzer:
85 $(CHIPSCOPE)/bin/lin/analyzer.sh -project $(PWD)/$(PROJECT).cpj
86
87 clean:
88 @rm -rf *.bit *.bgn *.mcs *.prm *.bld *.drc *.mcs *.ncd *.ngc *.ngd *.edn *.ncf *.ngo *.cdc \
89 *.ngr *.pad *.par *.pcf *.prm *.syr *.twr *.twx *.xpi *.lso *.prm *.mcs _impact* \
90 *.vm6 *.jed *.gyd *.mfd *.pnx *.rpt *.err *.log \
91 $(PROJECT)_map.* $(PROJECT)_pad.* \
92 _ngo xst \
93 build.log \
94 $(PROJECT).unroutes *.xml $(CLEANFILES)
95
96 .PHONY: all final burn load flash clean xst ngdbuild log analyzer i-really-want-to-flash
Impressum, Datenschutz