From 9226465b95aba8363b18df7ca8fcdf00333297d9 Mon Sep 17 00:00:00 2001 From: ccd0 Date: Mon, 11 Apr 2016 18:29:06 -0700 Subject: [PATCH] Create directories for targets in Makefile. --- Makefile | 38 +++++++++++++++++++++++++------------- tools/cat.js | 4 ++-- tools/templates.coffee | 4 ++-- 3 files changed, 29 insertions(+), 17 deletions(-) diff --git a/Makefile b/Makefile index 2f0512ab8..898c176be 100644 --- a/Makefile +++ b/Makefile @@ -4,12 +4,12 @@ ifeq "$(OS)" "Windows_NT" BIN := $(subst /,\,node_modules/.bin/) RMDIR := -rmdir /s /q RM := -del - CP = mkdir $(subst /,\,$(dir $@)) & copy /y $(subst /,\,$<) $(subst /,\,$@) + CP = copy /y $(subst /,\,$<) $(subst /,\,$@) else BIN := node_modules/.bin/ RMDIR := rm -rf RM := rm -rf - CP = mkdir -p $(dir $@) && cp $< $@ + CP = cp $< $@ endif coffee := $(BIN)coffee -c --no-header @@ -18,9 +18,9 @@ template := $(BIN)coffee tools/templates.coffee template_deps := \ package.json version.json \ tools/templates.coffee \ - node_modules/coffee-script/package.json node_modules/fs-extra/package.json node_modules/lodash/package.json + node_modules/coffee-script/package.json node_modules/lodash/package.json cat := node tools/cat.js -cat_deps := tools/cat.js node_modules/fs-extra/package.json +cat_deps := tools/cat.js jshint_deps := .jshintrc node_modules/jshint/package.json sources := \ @@ -109,7 +109,10 @@ node_modules/%/package.json : .events/npm .tests_enabled : echo false> .tests_enabled -tmp/script.coffee : $(sources) $(cat_deps) +tmp : + mkdir $@ + +tmp/script.coffee : $(sources) $(cat_deps) | tmp $(cat) $(sources) $@ tmp/script-%.coffee : tmp/script.coffee $(imports) $(template_deps) @@ -118,24 +121,30 @@ tmp/script-%.coffee : tmp/script.coffee $(imports) $(template_deps) tmp/script-%.js : tmp/script-%.coffee $(coffee_deps) $(coffee) $< -tmp/eventPage.js : src/General/eventPage.coffee $(coffee_deps) +tmp/eventPage.js : src/General/eventPage.coffee $(coffee_deps) | tmp $(coffee) -o tmp src/General/eventPage.coffee +testbuilds : + mkdir $@ + define rules_channel -testbuilds/crx$1/script.js : src/meta/botproc.js LICENSE src/meta/usestrict.js tmp/script-crx.js $(cat_deps) +testbuilds/crx$1 : | testbuilds + mkdir $$@ + +testbuilds/crx$1/script.js : src/meta/botproc.js LICENSE src/meta/usestrict.js tmp/script-crx.js $(cat_deps) | testbuilds/crx$1 $(cat) src/meta/botproc.js LICENSE src/meta/usestrict.js tmp/script-crx.js $$@ -testbuilds/crx$1/eventPage.js : tmp/eventPage.js +testbuilds/crx$1/eventPage.js : tmp/eventPage.js | testbuilds/crx$1 $$(CP) -testbuilds/crx$1/icon%.png : src/meta/icon%.png +testbuilds/crx$1/icon%.png : src/meta/icon%.png | testbuilds/crx$1 $$(CP) -testbuilds/crx$1/manifest.json : src/meta/manifest.json $(template_deps) +testbuilds/crx$1/manifest.json : src/meta/manifest.json $(template_deps) | testbuilds/crx$1 $(template) $$< $$@ type=crx channel=$1 -testbuilds/updates$1.xml : src/meta/updates.xml $(template_deps) +testbuilds/updates$1.xml : src/meta/updates.xml $(template_deps) | testbuilds/crx$1 $(template) $$< $$@ type=crx channel=$1 testbuilds/$(name)$1.crx.zip : \ @@ -146,7 +155,7 @@ testbuilds/$(name)$1.crx.zip : \ testbuilds/$(name)$1.crx : testbuilds/$(name)$1.crx.zip package.json tools/sign.js node_modules/crx/package.json node tools/sign.js $1 -testbuilds/$(name)$1.meta.js : src/meta/metadata.js src/meta/icon48.png $(template_deps) +testbuilds/$(name)$1.meta.js : src/meta/metadata.js src/meta/icon48.png $(template_deps) | testbuilds $(template) $$< $$@ type=userscript channel=$1 testbuilds/$(name)$1.user.js : src/meta/botproc.js testbuilds/$(name)$1.meta.js LICENSE src/meta/usestrict.js tmp/script-userscript.js $(cat_deps) @@ -161,7 +170,10 @@ $(eval $(call rules_channel,-noupdate)) testbuilds/$(name).zip : testbuilds/$(name)-noupdate.crx.zip $(CP) -builds/% : testbuilds/% $(jshint) +builds : + mkdir $@ + +builds/% : testbuilds/% $(jshint) | builds $(CP) test.html : README.md template.jst tools/markdown.js node_modules/marked/package.json node_modules/lodash/package.json diff --git a/tools/cat.js b/tools/cat.js index 1e0932dd4..5478c3dcb 100644 --- a/tools/cat.js +++ b/tools/cat.js @@ -1,7 +1,7 @@ -var fs = require('fs-extra'); +var fs = require('fs'); var text = process.argv.slice(2, -1).map(x => fs.readFileSync(x, 'utf8')).join('\n'); text = text.replace(/\r\n/g, '\n'); var outName = process.argv[process.argv.length - 1]; -fs.outputFileSync(outName, text); +fs.writeFileSync(outName, text); diff --git a/tools/templates.coffee b/tools/templates.coffee index d492bfa3a..e777e3e75 100644 --- a/tools/templates.coffee +++ b/tools/templates.coffee @@ -1,4 +1,4 @@ -fs = require 'fs-extra' +fs = require 'fs' _ = require 'lodash' # disable ES6 delimiters @@ -84,4 +84,4 @@ for arg in process.argv[4..] text = read process.argv[2] text = _.template(text)(pkg) -fs.outputFileSync process.argv[3], text +fs.writeFileSync process.argv[3], text