.POSIX: DATE = 1970-01-01 VERSION = 0.1.0 NAME = chat.papo.im NAME_UC = $(NAME) LANGUAGES = en ## Installation prefix. Defaults to "/usr". PREFIX = /usr BINDIR = $(PREFIX)/bin LIBDIR = $(PREFIX)/lib INCLUDEDIR = $(PREFIX)/include SRCDIR = $(PREFIX)/src/$(NAME) SHAREDIR = $(PREFIX)/share LOCALEDIR = $(SHAREDIR)/locale MANDIR = $(SHAREDIR)/man DOCDIR = $(SHAREDIR)/doc/$(NAME) HTMLDIR = $(SHAREDIR)/html/$(NAME) EXEC = ./ ## Where to store the installation. Empty by default. DESTDIR = LDLIBS = .SUFFIXES: .SUFFIXES: .js all: include deps.mk sources = \ src/content/papo.js \ src/content/style.css \ src/content/index.html \ src/content/sw.js \ $(img.svg) \ contents = \ src/content/papo.js \ src/content/style.css \ src/content/index.html \ src/content/sw.js \ src/content/images.js \ src/content/service-worker.js \ $(img.svg) \ derived-assets = \ src/content/images.js.next \ src/content/papo.exported.js \ src/content/sw.exported.js \ side-assets = \ ## Default target. Builds all artifacts required for testing ## and installation. all: $(derived-assets) src/content/images.js.next: Makefile deps.mk printf 'const IMG_PATHS = [\n' > $@ printf '\t"%s",\n' $(img.svg) >> $@ printf '];\n' >> $@ src/content/papo.exported.js src/content/sw.exported.js: \ Makefile src/exported.sh src/content/papo.exported.js: src/content/papo.js src/content/sw.exported.js: src/content/sw.js src/content/papo.exported.js src/content/sw.exported.js: sh src/exported.sh $(@D)/`basename $@ .exported.js`.js > $@ .PRECIOUS: src/content/images.js src/content/images.js: ALWAYS src/content/images.js.next diff -U10 $@ $*.js.next .SUFFIXES: .js-check tests/papo.js-check: src/content/papo.exported.js tests/sw.js-check: src/content/sw.exported.js tests/papo.js-check tests/sw.js-check: node tests/node-driver.js $*.js check-unit: tests/papo.js-check tests/sw.js-check check-unit: src/content/images.js integration-tests = \ .PRECIOUS: $(integration-tests) $(integration-tests): ALWAYS sh $@ check-integration: $(integration-tests) ## Run all tests. Each test suite is isolated, so that a parallel ## build can run tests at the same time. The required artifacts ## are created if missing. check: check-unit check-integration ## Remove *all* derived artifacts produced during the build. ## A dedicated test asserts that this is always true. clean: rm -rf $(derived-assets) $(side-assets) ## Installs into $(DESTDIR)$(PREFIX). Its dependency target ## ensures that all installable artifacts are crafted beforehand. install: all for f in $(contents); do \ dir='$(DESTDIR)$(HTMLDIR)'/"`dirname "$${f#src/content/}"`"; \ mkdir -p "$$dir"; \ cp -P "$$f" "$$dir"; \ done for f in $(sources); do \ dir='$(DESTDIR)$(SRCDIR)'/"`dirname "$${f#src/content/}"`"; \ mkdir -p "$$dir"; \ cp -P "$$f" "$$dir"; \ done ## Uninstalls from $(DESTDIR)$(PREFIX). This is a perfect mirror ## of the "install" target, and removes *all* that was installed. ## A dedicated test asserts that this is always true. uninstall: rm -rf \ '$(DESTDIR)$(SRCDIR)' \ '$(DESTDIR)$(HTMLDIR)' \ PORT = 3334 ## Run file server for local static files. run: serve -n -p $(PORT) -d '$(DESTDIR)$(HTMLDIR)' ALWAYS: