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