dyna3/Makefile

63 lines
1.5 KiB
Makefile

GENEXT = src/helpers/pkglock_to_externals.litcoffee
GENDOC = doc/gendoc.litcoffee
DOCFILES = $(shell coffee $(GENDOC) -list)
COFFILES = $(wildcard src/*.litcoffee)
JSFILES = $(patsubst src/%.litcoffee,site/%.js,$(COFFILES))
HTMLSRC = $(wildcard src/*.html)
HTMLSITE = $(patsubst src/%,site/%,$(HTMLSRC))
BLDTARGS = $(JSFILES) site/externals.js site/doc/dyna3.html $(HTMLSITE) site/node_modules
TESTCOFF = $(wildcard coffeetest/*.coffee)
TESTJS = $(patsubst coffeetest/%.coffee,__tests__/%.js,$(TESTCOFF))
build: $(BLDTARGS)
site/externals.js: $(GENEXT) package.json package-lock.json
mkdir -p site
coffee $(GENEXT) > $@
site/%.js: src/%.litcoffee
coffee -o $@ -c -m $<
docbuild/extlist.md: $(GENEXT) package.json package-lock.json
mkdir -p docbuild
coffee $(GENEXT) --doc > $@
site/doc/dyna3.md: $(DOCFILES)
mkdir -p site/doc
coffee $(GENDOC) > $@
site/doc/dyna3.html: site/doc/dyna3.md
pandoc -s --metadata title='dyna3' --toc $< > $@
site/%.html: src/%.html
mkdir -p site
cp $< $@
site/node_modules: node_modules package.json package-lock.json
rm -rf tmpproj
mkdir tmpproj
mkdir -p site
cp package.json package-lock.json tmpproj
cd tmpproj && npm install --production
cp -r tmpproj/node_modules site
dyna3.zip: $(BLDTARGS)
zip -r $@ site
__tests__/%.js: coffeetest/%.coffee
coffee -o $@ -c -m $<
$(BLDTARGS) $(TESTJS): Makefile
doc: site/doc/dyna3.md
dist: dyna3.zip
pretest: $(BLDTARGS) $(TESTJS)
test: $(BLDTARGS) $(TESTJS)
npm test
clean:
rm -rf site docbuild tmpproj __tests__ coverage dyna3.zip