Some fixes to the makefiles

-- 'make install' failed on Unix systems die to ampersand as
command-separator
-- 'make' would fail if target directories didn't exist; now creating
them (but Unix is untested)
This commit is contained in:
Ian Prest 2015-07-27 19:47:25 -04:00
parent d989d34e86
commit 5e915c4379

View file

@ -1,24 +1,36 @@
ifeq ($(OS),Windows_NT)
export NODE_PATH=$(APPDATA)/npm/node_modules
cp = copy /y $(subst /,\,$1) $(subst /,\,$2)
cp = copy /y "$(subst /,\,$1)" "$(subst /,\,$2)"
mkdir = @if not exist "$(subst /,\,$1)" mkdir "$(subst /,\,$1)"
& = &
else
cp = cp $1 $2
cp = cp "$1" "$2"
mkdir = @if [ ! -d "$1" ]; then mkdir "$1"; fi
& = ;
endif
all: js css bower_copy
all: js_files css_files bower_copy
.PHONY: js_files css_files bower_copy
# Rules to minify our .js files
js: js/jsonl.min.js
js_files: js/jsonl.min.js
js/%.min.js: js/%.js
$(call mkdir,$(dir $@))
uglifyjs "$^" > "$@"
js/%.js: %.grammar.js
$(call mkdir,$(dir $@))
node "$^" > "$@"
.PRECIOUS: js/%.js
# Rules to run Stylus on our .css files
css_files: css/kb.css
css/%.css: %.css
$(call mkdir,$(dir $@))
stylus --out css -c -m --inline --with {limit:1024} $^
# Rules to copy stuff from bower_components to our folders
bower_copy:
.PHONY: bower_copy
_BOWER_DIR[.js] = js
_BOWER_DIR[.css] = css
_BOWER_DIR[*] = fonts
@ -26,7 +38,8 @@ _BOWER_TARGET = $(or $(_BOWER_DIR[$(suffix $(1))]),$(_BOWER_DIR[*]))/$(notdir $(
define _BOWER
bower_copy: $(call _BOWER_TARGET,$(1))
$(call _BOWER_TARGET,$(1)): $1
$$(call cp,"$$<","$$@")
$$(call mkdir,$$(dir $$@))
$$(call cp,$$<,$$@)
endef
BOWER = $(eval $(call _BOWER,$1,$2))
@ -63,12 +76,6 @@ $(call BOWER,bower_components/doT/doT.min.js)
$(call BOWER,bower_components/URLON/src/urlon.js)
# Rules to run Stylus on our .css files
css: css/kb.css
css/%.css: %.css
stylus --out css -c -m --inline --with {limit:1024} $^
# Rules to generate a webfont from our source .svg files
fonts: fonts/kbd-custom.ttf
@ -103,7 +110,7 @@ test:
install:
bower install
cd bower_components/angular-ui-bootstrap & npm install
cd bower_components/angular-ui-bootstrap & grunt before-test after-test
cd bower_components/angular-ui-utils & npm install
cd bower_components/angular-ui-utils & grunt build
cd bower_components/angular-ui-bootstrap $& npm install
cd bower_components/angular-ui-bootstrap $& grunt before-test after-test
cd bower_components/angular-ui-utils $& npm install
cd bower_components/angular-ui-utils $& grunt build