Skip to content

Instantly share code, notes, and snippets.

@wilsonpage
Created December 8, 2011 17:22
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save wilsonpage/1447701 to your computer and use it in GitHub Desktop.
Save wilsonpage/1447701 to your computer and use it in GitHub Desktop.
My first Makefile
#========================================
# Static Asset Build Makefile
#
# Author: Wilson Page
#========================================
# Shortcuts
build-tools = build/tools/
css-dir = static/css/
css-target = $(css-dir)style-built.css
css-files = $(css-dir)*.less
js-dir = static/js/
js-target = $(js-dir)script-built.js
js-files = $(js-dir)*.js
google-cc-jar = $(build-tools)google-cc.jar
# This is done when we type 'make'
all: clean $(css-target) $(js-target)
# CSS Compilation
$(css-target): $(css-files)
@rm -f $(css-target)
@echo "Merging LESS files..."
@cat $(css-files) > $(css-dir)style.tmp
@$(build-tools)/lessc.exe -m $(css-dir)style.tmp $(css-target)
@echo "[ Done ]"
@rm -f $(css-dir)style.tmp
# JS Compilation
$(js-target): $(js-files)
@rm -f $(js-target)
@echo "Merging JS files..."
@cat $(js-files) > $(js-dir)script.tmp
@java -jar $(google-cc-jar) --js $(js-dir)script.tmp --js_output_file $(js-target)
@echo "[ Done ]"
@rm -f $(js-dir)script.tmp
# This is done when we type 'clean'
clean:
@rm -f $(css-target)
@rm -f $(js-target)
@echo "Built files deleted"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment