aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorClifford Wolf <clifford@clifford.at>2017-11-18 16:53:19 +0100
committerClifford Wolf <clifford@clifford.at>2017-11-18 16:53:19 +0100
commitb8832a2cda1b1bf0fe5a7c3f1f2833e516f1d136 (patch)
treeb31cd8bd5577be421fb75bc6c65770d57d178f32
parent95bdd0a29bf508388b1fe9fc95893ae8bca04718 (diff)
parent05440e4d62f9b0c242c1c040cb864ffe49a6908d (diff)
downloadicestorm-b8832a2cda1b1bf0fe5a7c3f1f2833e516f1d136.tar.gz
icestorm-b8832a2cda1b1bf0fe5a7c3f1f2833e516f1d136.tar.bz2
icestorm-b8832a2cda1b1bf0fe5a7c3f1f2833e516f1d136.zip
Merge commit '05440e4'
-rw-r--r--Makefile4
-rw-r--r--config.mk19
-rw-r--r--icebram/Makefile2
-rw-r--r--icemulti/Makefile2
-rw-r--r--icepack/Makefile8
-rw-r--r--icepll/Makefile2
-rw-r--r--icetime/Makefile18
7 files changed, 43 insertions, 12 deletions
diff --git a/Makefile b/Makefile
index 79e7a7f..518e08c 100644
--- a/Makefile
+++ b/Makefile
@@ -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; \
diff --git a/config.mk b/config.mk
index d6daca6..7b3b494 100644
--- a/config.mk
+++ b/config.mk
@@ -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/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