Skip to content

Commit

Permalink
new es6 target
Browse files Browse the repository at this point in the history
  • Loading branch information
dfober committed Mar 20, 2024
1 parent 1516d7f commit 29b93a1
Showing 1 changed file with 16 additions and 8 deletions.
24 changes: 16 additions & 8 deletions lang/javascript/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -36,19 +36,21 @@ OPT ?= -O3
CXXFLAGS += $(addprefix -I, $(subprojects)) $(SMUFLDEF) -DMSLIGHT -DINDEPENDENTSVG -DJSON_ONLY -DCANVASSYSTEM $(OPT) -std=c++11 --llvm-opts "['-O3']"


library = libGUIDOEngine
target = $(library).js
library := libGUIDOEngine
target := $(library).js
es6target := $(library).mjs


OPTIONS := -s ALLOW_MEMORY_GROWTH=1 -s DISABLE_EXCEPTION_CATCHING=1 -s ASSERTIONS=0 -s MODULARIZE=1 -s EXPORT_NAME="'GuidoModule'"
OPT1 := -O3 --bind --memory-init-file 0 --llvm-opts "['-O3']"

all: $(library).js
all: $(target)

help :
@echo "Guido Engine Wasm makefile"
@echo "Available argets are :"
@echo " all (default): build the libGUIDOEngine wasm library"
@echo " es6 : build the libGUIDOEngine as ES6 library"
@echo " clean : remove objects and output files"
@echo " depend : recompute dependencies"
@echo " test : run API tests"
Expand All @@ -61,12 +63,18 @@ help :
##############################################################
# building the library as wasm library
##############################################################
$(library).js : $(objects) $(midiobj)
emcc $(OPT1) $(objects) $(midiobj) -o $(library).js $(OPTIONS) -s WASM=1
cp $(library).js $(library).wasm $(npmdir)
es6 : $(es6target)

$(es6target) : $(objects) $(midiobj)
emcc $(OPT1) $(objects) $(midiobj) -o $(es6target) $(OPTIONS) -s WASM=1
cp $(es6target) $(library).wasm $(npmdir)

$(target) : $(objects) $(midiobj)
emcc $(OPT1) $(objects) $(midiobj) -o $(target) $(OPTIONS) -s WASM=1
cp $(target) $(library).wasm $(npmdir)

clean:
rm -f $(objects) $(midiobj) $(target) $(library).wasm.*
rm -f $(objects) $(midiobj) $(target) $(es6target) $(library).wasm.*

##############################################################
# testing
Expand Down Expand Up @@ -108,7 +116,7 @@ $(webfont) : ../../src/guido2.ttf
##############################################################
# building the library as web assembly
##############################################################
$(library).wasm.js : $(objects)
$(library).wasm.js : $(target) $(objects)
emcc $(OPT) --bind --memory-init-file 0 $(objects) -o $(target) $(OPTIONS) -s WASM=1

depend :
Expand Down

0 comments on commit 29b93a1

Please sign in to comment.