#!/usr/bin/make -f # # This is free and unencumbered software released into the public # domain. To the extent possible under law, the author of this file # waives all copyright and related or neighboring rights to it. nwjs-version := 0.12.1 stampprefix := build/stamp/ include rules/default.mk $(call include-once,rules/*.mk) .PHONY: all check clean distclean lint test dist APPLICATION := pwl6 DISTDIR := build/dist/ VERSION := $(call git-describe) DISTROOT := $(DISTDIR)$(APPLICATION)_$(VERSION) MY_SOURCES := $(call find-js,src -path 'src/ext' -prune -o) TEST_SOURCES := $(call find-js,test/spec) VPATH := src ICONS := $(call iconset>icons,$(call find-iconsets,src)) XCFS := $(call find-xcfs,src) OBJPNGS := $(call xcf>png,$(XCFS)) PNGS := $(call find-files,src,-name '*.png') $(OBJPNGS) BUILT := $(ICONS) $(OBJPNGS) CRUSHABLE := $(call pngcrush-stampify,$(PNGS)) LINTABLE := $(call jshint-stampify,$(MY_SOURCES)) TESTABLE := $(call jstest-stampify,$(TEST_SOURCES)) DISTFILES := $(addprefix $(DISTROOT)-,$(nwjs-platforms)) all:: check $(BUILT) $(CRUSHABLE) dist: $(DISTFILES) test/spec/%.js:: %.js touch $@ lint:: $(LINTABLE) test:: $(TESTABLE) check:: lint test clean:: $(RM) $(DISTFILES) $(RM) $(BUILT) $(RM) $(LINTABLE) $(RM) $(TESTABLE) $(RM) $(CRUSHABLE) $(call rmdir-r,build) distclean:: clean $(RM) -r node_modules $(DISTROOT)-src.zip $(DISTROOT)-src.tar.gz: | .git $(MKDIR) $(@D) $(call git-archive,$@,$(notdir $(DISTROOT))/) $(DISTROOT).bare.zip: | .git $(RM) $@ $(RM) -r $@.tmp $(MKDIR) $@.tmp cd src && $(GIT) archive $(call git-describe) . | tar -x -C ../$@.tmp $(MAKE) $(BUILT:src/%=$@.tmp/%) $(RM) $(XCFS:src/%=$@.tmp/%) cd $@.tmp && $(ZIP) ../$(@F) -r . $(RM) -r $@.tmp %.appcache: %.bare.zip tools/generate-appcache $(RM) -r $@.tmp $@ $(UNZIP) -d $@.tmp $< tools/generate-appcache $@.tmp mv $@.tmp $@ # Python's zipfile module generates zipfiles that NW.js cannot read, # so delegate to a real zip tool. %.nw: %.bare.zip tools/generate-nw $(RM) -r $@ $@.tmp $(UNZIP) -d $@.tmp $< tools/generate-nw $@.tmp `echo $(*F) | sed -E 's/.+_[^0-9]+//'` cd $@.tmp && $(ZIP) -r ../$(@F) . $(RM) -r $@.tmp