FUNCTIONS := $(shell grep -R "foreign" src/ | cut -d' ' -f4) HS_FILES := $(shell find src -type f -name '*.hs' -or -name '*.hs-boot') CABAL_OPTL := $(foreach function,$(FUNCTIONS),--ghc-option=-optl--export-function=$(function)) -f asterius AHCD_OPTL := $(foreach function,$(FUNCTIONS),--export-function=$(function)) CABAL := ahc-cabal AHCD := ahc-dist web/dist/cubical.wasm: web/dist/cubical.js cp dist-newstyle/cubical.wasm $@ web/dist/cubical.js: dist-newstyle/cubical.js cp dist-newstyle/cubical.js $@ dist-newstyle/cubical.js: dist-newstyle/cubical src/wrapper.mjs mkdir -p dist-newstyle/ahcd-spam $(AHCD) $(AHCD_OPTL) --input-exe $< --browser --bundle --input-mjs src/wrapper.mjs dist-newstyle/cubical: src/Presyntax/Lexer.hs src/Presyntax/Parser.hs $(HS_FILES) $(CABAL) v2-install $(CABAL_OPTL) --installdir dist-newstyle exe:cubical --overwrite-policy=always src/Presyntax/Lexer.hs: src/Presyntax/Lexer.x alex $< src/Presyntax/Parser.hs: src/Presyntax/Parser.y happy $<