make load DRIVER=/home/michael/Raggedstone/usb-driver/libusb-driver.so
[raggedstone] / common / Makefile.common
index 51494f98fce9a90a0db6be70b2e7d85e5f7cf854..e573c1e92d13236197671a9a328108049db612fe 100644 (file)
@@ -3,10 +3,16 @@ PWD := $(shell pwd)
 #auto|lpt1|lpt2|lpt3|com1|com2|com3|com4|usb0|usb1|usb2|usb21|ttya|ttyb|tty00|tty01
 CABLE ?= auto
 
+#DRIVER = /home/michael/Raggedstone/usb-driver/libusb-driver.so
+
 INTSTYLE := silent
 
 SOURCES = $(wildcard sources/*.v source/*.vhd)
 
+ifdef DRIVER
+PRELOAD = LD_PRELOAD=$(DRIVER)
+endif
+
 all: $(PROJECT).bit final
 
 log:
@@ -16,7 +22,7 @@ xst: $(PROJECT).ngc
 
 ngdbuild: $(PROJECT).ngd
 
-$(PROJECT).ngc: $(SOURCES)
+$(PROJECT).ngc: $(SOURCES) $(PROJECT).prj $(PROJECT).ucf $(PROJECT).ut $(PROJECT).xst
        @# echo synclib > $(PROJECT).lso # hmm. things are different in ise 9.1
        echo work > $(PROJECT).lso
        xst -intstyle $(INTSTYLE) -ifn $(PROJECT).xst -ofn $(PROJECT).syr
@@ -54,13 +60,13 @@ burn: $(PROJECT).bit
        xc3sprog $(PROJECT).bit
 
 load: $(PROJECT).bit
-       @sed -e "s|%CABLE%|$(CABLE)|g" xc3s1500.batch >xc3s1500.batch.tmp
-       impact -batch xc3s1500.batch.tmp
+       @sed -e "s|%CABLE%|$(CABLE)|g" -e "s|%PROJECT%|$(PROJECT)|g" ../common/xc3s1500.batch >xc3s1500.batch.tmp
+       $(PRELOAD) impact -batch xc3s1500.batch.tmp
        @rm xc3s1500.batch.tmp
 
 flash: $(PROJECT)-xcf02s.mcs $(PROJECT)-xcf04s.mcs
-       @sed -e "s|%CABLE%|$(CABLE)|g" xcf.batch >xcf.batch.tmp
-       impact -batch xcf.batch.tmp
+       @sed -e "s|%CABLE%|$(CABLE)|g" -e "s|%PROJECT%|$(PROJECT)|g" ../common/xcf.batch >xcf.batch.tmp
+       $(PRELOAD) impact -batch xcf.batch.tmp
        @rm xcf.batch.tmp
 
 clean:
Impressum, Datenschutz