make load DRIVER=/home/michael/Raggedstone/usb-driver/libusb-driver.so
[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 = $(wildcard sources/*.v source/*.vhd)
11
12 ifdef DRIVER
13 PRELOAD = LD_PRELOAD=$(DRIVER)
14 endif
15
16 all: $(PROJECT).bit final
17
18 log:
19 time make all &>build.log
20
21 xst: $(PROJECT).ngc
22
23 ngdbuild: $(PROJECT).ngd
24
25 $(PROJECT).ngc: $(SOURCES) $(PROJECT).prj $(PROJECT).ucf $(PROJECT).ut $(PROJECT).xst
26 @# echo synclib > $(PROJECT).lso # hmm. things are different in ise 9.1
27 echo work > $(PROJECT).lso
28 xst -intstyle $(INTSTYLE) -ifn $(PROJECT).xst -ofn $(PROJECT).syr
29 @#cat $(PROJECT).syr
30
31 $(PROJECT).ngd: $(PROJECT).ngc
32 ngdbuild -intstyle $(INTSTYLE) -dd "$(PWD)/_ngo" -nt timestamp -uc $(PROJECT).ucf -p xc3s1500-fg456-4 $(PROJECT).ngc $(PROJECT).ngd
33
34 $(PROJECT)_map.ngm $(PROJECT).pcf: $(PROJECT).ngd
35 map -intstyle $(INTSTYLE) -p xc3s1500-fg456-4 -cm area -pr b -k 4 -c 100 -o $(PROJECT)_map.ncd $(PROJECT).ngd $(PROJECT).pcf
36
37 $(PROJECT).ncd: $(PROJECT)_map.ngm $(PROJECT).pcf
38 @#par -w -intstyle $(INTSTYLE) -ol std -n 4 -t 1 $(PROJECT)_map.ncd $(PROJECT).dir $(PROJECT).pcf
39 par -w -intstyle $(INTSTYLE) -ol std -t 1 $(PROJECT)_map.ncd $(PROJECT).ncd $(PROJECT).pcf
40
41 $(PROJECT).twx: $(PROJECT).ncd
42 trce -intstyle $(INTSTYLE) -e 3 -l 3 -s 4 -xml $(PROJECT) $(PROJECT).ncd -o $(PROJECT).twr $(PROJECT).pcf
43 @#cat $(PROJECT).twr
44
45 $(PROJECT).bit: $(PROJECT).ncd
46 bitgen -intstyle $(INTSTYLE) -f $(PROJECT).ut $(PROJECT).ncd
47 @# cp $(PROJECT).bit ../jcarr_last.bit
48 @#cat $(PROJECT).drc
49 @#cat $(PROJECT).bgn
50
51 $(PROJECT)-xcf02s.mcs $(PROJECT)-xcf04s.mcs: $(PROJECT).bit
52 promgen -intstyle $(INTSTYLE) -w -p mcs -u 0 $(PROJECT) -o $(PROJECT)-xcf02s $(PROJECT)-xcf04s -x xcf02s xcf04s
53
54 final:
55 -@grep -A 8 -B 1 ^Selected\ Device $(PROJECT).syr
56 -@grep -A 8 -B 1 ^Timing\ Summary $(PROJECT).syr
57 -@grep -A 21 -B 1 ^Design\ Summary $(PROJECT)_map.map
58
59 burn: $(PROJECT).bit
60 xc3sprog $(PROJECT).bit
61
62 load: $(PROJECT).bit
63 @sed -e "s|%CABLE%|$(CABLE)|g" -e "s|%PROJECT%|$(PROJECT)|g" ../common/xc3s1500.batch >xc3s1500.batch.tmp
64 $(PRELOAD) impact -batch xc3s1500.batch.tmp
65 @rm xc3s1500.batch.tmp
66
67 flash: $(PROJECT)-xcf02s.mcs $(PROJECT)-xcf04s.mcs
68 @sed -e "s|%CABLE%|$(CABLE)|g" -e "s|%PROJECT%|$(PROJECT)|g" ../common/xcf.batch >xcf.batch.tmp
69 $(PRELOAD) impact -batch xcf.batch.tmp
70 @rm xcf.batch.tmp
71
72 clean:
73 @rm -rf *.bit *.bgn *.mcs *.prm *.bld *.drc *.mcs *.ncd *.ngc *.ngd \
74 *.ngr *.pad *.par *.pcf *.prm *.syr *.twr *.twx *.xpi *.lso *.prm *.mcs _impact* \
75 $(PROJECT)_map.* $(PROJECT)_pad.* \
76 _ngo xst \
77 build.log \
78 $(PROJECT).unroutes *.xml
79
80 .PHONY: all final burn load flash clean xst ngdbuild log
Impressum, Datenschutz