diff options
-rw-r--r-- | Makefile | 4 | ||||
-rw-r--r-- | config.mk | 19 | ||||
-rw-r--r-- | docs/index.html | 2 | ||||
-rw-r--r-- | icebram/Makefile | 2 | ||||
-rw-r--r-- | icemulti/Makefile | 2 | ||||
-rw-r--r-- | icepack/Makefile | 8 | ||||
-rw-r--r-- | icepll/Makefile | 2 | ||||
-rw-r--r-- | icetime/Makefile | 18 |
8 files changed, 44 insertions, 13 deletions
@@ -1,7 +1,7 @@ -include config.mk - SUBDIRS = icebox icepack iceprog icemulti icepll icetime icebram +include config.mk + all clean install uninstall: for dir in $(SUBDIRS); do \ $(MAKE) -C $$dir $@ || exit; \ @@ -6,12 +6,18 @@ PKG_CONFIG ?= pkg-config C_STD ?= c99 CXX_STD ?= c++11 +ifeq ($(EMCC),1) +OPT_LEVEL ?= 2 +DBG_LEVEL ?= +else OPT_LEVEL ?= 0 +DBG_LEVEL ?= -ggdb +endif WARN_LEVEL ?= all LDLIBS = -lm -lstdc++ -CFLAGS += -MD -O$(OPT_LEVEL) -ggdb -W$(WARN_LEVEL) -std=$(C_STD) -I$(PREFIX)/include -CXXFLAGS += -MD -O$(OPT_LEVEL) -ggdb -W$(WARN_LEVEL) -std=$(CXX_STD) -I$(PREFIX)/include +CFLAGS += -MD -O$(OPT_LEVEL) $(DBG_LEVEL) -W$(WARN_LEVEL) -std=$(C_STD) -I$(PREFIX)/include +CXXFLAGS += -MD -O$(OPT_LEVEL) $(DBG_LEVEL) -W$(WARN_LEVEL) -std=$(CXX_STD) -I$(PREFIX)/include DESTDIR ?= CHIPDB_SUBDIR ?= icebox @@ -22,3 +28,12 @@ CXX = /usr/local/src/mxe/usr/bin/i686-w64-mingw32.static-gcc CC = $(CXX) PKG_CONFIG = /usr/local/src/mxe/usr/bin/i686-w64-mingw32.static-pkg-config endif + +ifeq ($(EMCC),1) +EXE = .js +CC = emcc +CXX = emcc +PREFIX = / +LDFLAGS = -O2 --memory-init-file 0 -s TOTAL_MEMORY=64*1024*1024 +SUBDIRS = icebox icepack icemulti icepll icetime icebram +endif diff --git a/docs/index.html b/docs/index.html index f6ba8e6..83f3788 100644 --- a/docs/index.html +++ b/docs/index.html @@ -184,7 +184,7 @@ after updating your IceStorm installation. bit-streams to a Lattice iCEstick and/or a Lattice iCE40-HX8K Breakout Board as unprivileged user: </p> -<pre style="padding-left: 3em">ACTION=="add", ATTR{idVendor}=="0403", ATTR{idProduct}=="6010", MODE:="666"</pre> +<pre style="padding-left: 3em">ATTRS{idVendor}=="0403", ATTRS{idProduct}=="6010", MODE="0660", GROUP="plugdev", TAG+="uaccess"</pre> <p> <b>Notes for Archlinux:</b> just install <a href="https://aur.archlinux.org/packages/icestorm-git/">icestorm-git</a>, <a href="https://aur.archlinux.org/packages/arachne-pnr-git/">arachne-pnr-git</a> and <a href="https://aur.archlinux.org/packages/yosys-git/">yosys-git</a> from the Arch User Repository (no need to follow the install instructions above). diff --git a/icebram/Makefile b/icebram/Makefile index 3904926..34801da 100644 --- a/icebram/Makefile +++ b/icebram/Makefile @@ -20,7 +20,7 @@ uninstall: rm -f $(DESTDIR)$(PREFIX)/bin/icebram$(EXE) clean: - rm -f icebram + rm -f icebram$(EXE) rm -f icebram.exe rm -f demo.* demo_*.* rm -f *.o *.d diff --git a/icemulti/Makefile b/icemulti/Makefile index 5302158..7e2fe1c 100644 --- a/icemulti/Makefile +++ b/icemulti/Makefile @@ -17,7 +17,7 @@ uninstall: rm -f $(DESTDIR)$(PREFIX)/bin/icemulti$(EXE) clean: - rm -f icemulti + rm -f icemulti$(EXE) rm -f icemulti.exe rm -f *.o *.d diff --git a/icepack/Makefile b/icepack/Makefile index 65d4c9a..3e8c774 100644 --- a/icepack/Makefile +++ b/icepack/Makefile @@ -10,8 +10,8 @@ all: icepack$(EXE) iceunpack$(EXE) icepack$(EXE): icepack.o $(CXX) -o $@ $(LDFLAGS) $^ $(LDLIBS) -iceunpack: icepack - ln -sf icepack iceunpack +iceunpack$(EXE): icepack$(EXE) + ln -sf icepack$(EXE) iceunpack$(EXE) iceunpack.exe: # no iceunpack.exe, use icepack -u @@ -26,8 +26,8 @@ uninstall: rm -f $(DESTDIR)$(PREFIX)/bin/iceunpack$(EXE) clean: - rm -f icepack - rm -f iceunpack + rm -f icepack$(EXE) + rm -f iceunpack$(EXE) rm -f icepack.exe rm -f *.o *.d diff --git a/icepll/Makefile b/icepll/Makefile index 87eabfa..13a1d81 100644 --- a/icepll/Makefile +++ b/icepll/Makefile @@ -17,7 +17,7 @@ uninstall: rm -f $(DESTDIR)$(PREFIX)/bin/icepll$(EXE) clean: - rm -f icepll + rm -f icepll$(EXE) rm -f icepll.exe rm -f *.o *.d diff --git a/icetime/Makefile b/icetime/Makefile index 5e959c7..d058153 100644 --- a/icetime/Makefile +++ b/icetime/Makefile @@ -8,6 +8,22 @@ endif all: icetime$(EXE) +ifeq ($(EXE),.js) +icetime$(EXE): | share/$(CHIPDB_SUBDIR)/chipdb-384.txt share/$(CHIPDB_SUBDIR)/chipdb-1k.txt share/$(CHIPDB_SUBDIR)/chipdb-8k.txt + +share/$(CHIPDB_SUBDIR)/chipdb-384.txt: ../icebox/chipdb-384.txt + mkdir -p share/$(CHIPDB_SUBDIR) + cp $< $@ +share/$(CHIPDB_SUBDIR)/chipdb-1k.txt: ../icebox/chipdb-1k.txt + mkdir -p share/$(CHIPDB_SUBDIR) + cp $< $@ +share/$(CHIPDB_SUBDIR)/chipdb-8k.txt: ../icebox/chipdb-8k.txt + mkdir -p share/$(CHIPDB_SUBDIR) + cp $< $@ + +override LDFLAGS += --embed-file share +endif + icetime$(EXE): icetime.o $(CXX) -o $@ $(LDFLAGS) $^ $(LDLIBS) @@ -46,7 +62,7 @@ test: test0 test1 test2 test3 test4 test5 test6 test7 test8 test9 show: show0 show1 show2 show3 show4 show5 show6 show7 show8 show9 clean: - rm -f icetime icetime.exe timings.inc *.o *.d + rm -f icetime$(EXE) icetime.exe timings.inc *.o *.d rm -rf test[0-9]* -include *.d |