Makefile revision e0bd6b490d14919b958622a831bfadbf322397ba
0N/A# -- Constants -----------------------------------------------------------------
2362N/A
0N/A# Path to the "lib" directory of a Handlebars.js git checkout.
0N/AHANDLEBARS_LIB = $(PWD)/../../../handlebars.js/lib
0N/A
0N/A# Path to which YUI Handlebars source files should be written.
2362N/AOUTPUT_DIR = $(PWD)/js
0N/A
2362N/A# Comment to prepend to the imported source files.
0N/APREPEND_COMMENT = /* THIS FILE IS GENERATED BY A BUILD SCRIPT - DO NOT EDIT! */\n
0N/A
0N/A# Files that make up the handlebars-base module. We intentionally skip utils.js
0N/A# because we've reimplemented that for YUI.
0N/ABASE_FILES = \
0N/A $(HANDLEBARS_LIB)/handlebars/base.js \
0N/A $(HANDLEBARS_LIB)/handlebars/runtime.js
0N/A
0N/A# Files that make up the handlebars-compiler module.
0N/ACOMPILER_FILES = \
0N/A $(HANDLEBARS_LIB)/handlebars/compiler/parser.js \
2362N/A $(HANDLEBARS_LIB)/handlebars/compiler/base.js \
2362N/A $(HANDLEBARS_LIB)/handlebars/compiler/ast.js \
2362N/A $(HANDLEBARS_LIB)/handlebars/compiler/compiler.js
0N/A
0N/A# -- Targets -------------------------------------------------------------------
0N/A
0N/ABASE_TARGETS = $(addprefix $(OUTPUT_DIR)/handlebars-, $(notdir $(BASE_FILES)))
0N/ACOMPILER_TARGETS = $(addprefix $(OUTPUT_DIR)/handlebars-compiler-, $(notdir $(COMPILER_FILES)))
0N/A
0N/A# target: all - Default target.
0N/Aall: import
0N/A
0N/A# target: clean - Removes imported source files.
0N/Aclean:
0N/A rm -f $(BASE_TARGETS) $(COMPILER_TARGETS)
0N/A
0N/A# target: import - Imports Handlebars.js source files from a separate repo.
0N/Aimport: import-base import-compiler
0N/A
# target: import-base - Imports the source files that make up handlebars-base.
import-base: $(BASE_TARGETS)
# target: import-compiler - Imports the source files that make up handlebars-compiler.
import-compiler: $(COMPILER_TARGETS)
# target: help - Displays help.
help:
@egrep "^# target:" Makefile
$(OUTPUT_DIR)/handlebars-%.js: $(HANDLEBARS_LIB)/handlebars/%.js
@echo "$(notdir $@)"
@echo "$(PREPEND_COMMENT)" > $@
@sed -n '/^\/\/ BEGIN(BROWSER)$$/,/^\/\/ END(BROWSER)$$/p' $< >> $@
$(OUTPUT_DIR)/handlebars-compiler-%.js: $(HANDLEBARS_LIB)/handlebars/compiler/%.js
@echo "$(notdir $@)"
@echo "$(PREPEND_COMMENT)" > $@
@sed -n '/^\/\/ BEGIN(BROWSER)$$/,/^\/\/ END(BROWSER)$$/p' $< >> $@
$(OUTPUT_DIR)/handlebars-compiler-parser.js: $(HANDLEBARS_LIB)/handlebars/compiler/parser.js
@echo "$(notdir $@)"
@echo "$(PREPEND_COMMENT)" > $@
@cat $< >> $@