X-Git-Url: https://git.yukkurigames.com/?p=pwl6.git;a=blobdiff_plain;f=Makefile;h=6113ab6be2ba802a630017307909e2cd5dbd4986;hp=06f7e3f6ac2be81ea6fba0c08ae0b03a23c075ec;hb=HEAD;hpb=d2962105772fbdc548118bd65cd5bb4934e66085 diff --git a/Makefile b/Makefile index 06f7e3f..6113ab6 100644 --- a/Makefile +++ b/Makefile @@ -1,88 +1,72 @@ #!/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. -node-webkit-version := 0.10.2 -node-webkit-version-win-ia32.zip := 0.8.6 +nwjs-version := 0.12.2 +stampprefix := build/stamp/ -.DELETE_ON_ERROR: -include rules/programs.mk -include rules/javascript.mk -include rules/icons.mk -include rules/git.mk -include rules/node-webkit.mk -include rules/pngcrush.mk +include rules/default.mk +$(call include-once,rules/*.mk) -.PHONY: all check distclean lint test dist clean serve +.PHONY: all check clean distclean lint test dist APPLICATION := pwl6 -DISTDIR := build/dist +DISTDIR := build/dist/ VERSION := $(call git-describe) -DISTROOT := $(DISTDIR)/$(APPLICATION)-$(VERSION) +DISTROOT := $(DISTDIR)$(APPLICATION)_$(VERSION) -FIND_FILES := -type f ! -name '.*' -FIND_JS := -type f -name '*.js' +MY_SOURCES := $(call find-js,src -path 'src/ext' -prune -o) +TEST_SOURCES := $(call find-js,test/spec) -SOURCES := $(shell cd src && find . $(FIND_FILES)) -MY_SOURCES := $(shell cd src && find . $(FIND_JS) -not -path './ext/*') - -TEST_SOURCES := $(shell find test/spec $(FIND_JS)) - -LINT_TARGETS := $(call jshint-stampify,$(MY_SOURCES)) -TEST_TARGETS := $(call jstest-stampify,$(TEST_SOURCES)) - -JSHINTCONFIG := test/jshint.config -JSTEST_NODE_PATH := src VPATH := src -ICONSETS := $(shell find src -type d -name '*.iconset') -ICONS := $(ICONSETS:.iconset=.icns) $(ICONSETS:.iconset=.ico) - -IMAGEGZSRC := $(shell find src -type f -name '*.xcf.gz') -IMAGESRC := $(shell find src -type f -name '*.xcf') -IMAGES := $(IMAGEGZSRC:.xcf.gz=.png) $(IMAGESRC:.xcf=.png) +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) $(IMAGES) +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)) -HTTP_SERVER_PORT ?= 8000 +all:: check $(BUILT) $(CRUSHABLE) -all: check $(BUILT) $(call pngcrush-stampify,$(IMAGES)) +dist: $(DISTFILES) -$(DISTDIR): - mkdir -p $@ - -dist: $(addprefix $(DISTROOT),-src.zip -src.tar.gz .appcache .nw -osx-ia32.zip -osx-x64.zip -linux-ia32.tar.gz -linux-x64.tar.gz -win-ia32.zip) - -test/spec/%.js: %.js +test/spec/%.js:: %.js touch $@ -lint: $(LINT_TARGETS) - -test: $(TEST_TARGETS) - -check: lint test +lint:: $(LINTABLE) +test:: $(TESTABLE) -serve: | $(npmbindir)/http-server - $(npmbindir)/http-server $(@D) -p $(HTTP_SERVER_PORT) -c-1 +check:: lint test -clean: - $(RM) $(IMAGES) - $(RM) $(ICONS) - $(RM) -r build +clean:: + $(RM) $(DISTFILES) + $(RM) $(BUILT) + $(RM) $(LINTABLE) + $(RM) $(TESTABLE) + $(RM) $(CRUSHABLE) + $(call rmdir-r,build) -distclean: clean +distclean:: clean $(RM) -r node_modules - $(RM) $(node-webkit-archives) $(DISTROOT)-src.zip $(DISTROOT)-src.tar.gz: | .git - mkdir -p $(@D) + $(MKDIR) $(@D) $(call git-archive,$@,$(notdir $(DISTROOT))/) $(DISTROOT).bare.zip: | .git $(RM) $@ $(RM) -r $@.tmp - mkdir -p $@.tmp - cd src && $(GIT) archive $(call git-describe) . | tar -x -C ../$@.tmp + $(MKDIR) $@.tmp + $(GIT) archive $(call git-describe) src | tar -x --strip-components 1 -C $@.tmp $(MAKE) $(BUILT:src/%=$@.tmp/%) - $(RM) $(IMAGESRC:src/%=$@.tmp/%) $(IMAGEGZSRC:src/%=$@.tmp/%) + $(RM) $(XCFS:src/%=$@.tmp/%) cd $@.tmp && $(ZIP) ../$(@F) -r . $(RM) -r $@.tmp @@ -92,11 +76,11 @@ $(DISTROOT).bare.zip: | .git tools/generate-appcache $@.tmp mv $@.tmp $@ -# Python's zipfile module generates zipfiles that node-webkit cannot -# read, so delegate to a real zip tool. +# 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 + tools/generate-nw $@.tmp `echo $(*F) | sed -E 's/.+_[^0-9]+//'` cd $@.tmp && $(ZIP) -r ../$(@F) . $(RM) -r $@.tmp