PageRenderTime 22ms CodeModel.GetById 16ms app.highlight 5ms RepoModel.GetById 0ms app.codeStats 0ms

/Makefile

http://github.com/candy-chat/candy
Makefile | 103 lines | 75 code | 17 blank | 11 comment | 0 complexity | ab61287a2852f0ede5dd01a7350b2c15 MD5 | raw file
  1#
  2# Makefile for Candy
  3# Candy - Chats are not dead yet
  4#
  5# Copyright:
  6# (c) 2011 Amiado Group AG
  7#
  8# Authors:
  9#   - Patrick Stadler <patrick.stadler@gmail.com>
 10#   - Michael Weibel <michael.weibel@gmail.com>
 11#
 12
 13SHELL=/bin/bash
 14
 15DOC_DIR = docs
 16NDPROJ_DIR = .ndproj
 17SRC_DIR = src
 18LIBS_DIR = libs
 19
 20CANDY_BUNDLE = candy.bundle.js
 21CANDY_BUNDLE_MIN = candy.min.js
 22CANDY_BUNDLE_LIBRARIES = libs/libs.bundle.js
 23CANDY_BUNDLE_LIBRARIES_MIN = libs/libs.min.js
 24CANDY_FILES = $(SRC_DIR)/candy.js $(SRC_DIR)/core.js $(SRC_DIR)/view.js $(SRC_DIR)/util.js $(SRC_DIR)/core/action.js $(SRC_DIR)/core/chatRoom.js $(SRC_DIR)/core/chatRoster.js $(SRC_DIR)/core/chatUser.js $(SRC_DIR)/core/event.js $(SRC_DIR)/view/event.js $(SRC_DIR)/view/observer.js $(SRC_DIR)/view/pane.js $(SRC_DIR)/view/template.js $(SRC_DIR)/view/translation.js
 25CANDY_LIBS_FILES = $(LIBS_DIR)/strophejs/strophe.js $(LIBS_DIR)/strophejs-plugins/muc/strophe.muc.js $(LIBS_DIR)/mustache.js/mustache.js $(LIBS_DIR)/jquery-i18n/jquery.i18n.js $(LIBS_DIR)/dateformat/dateFormat.js
 26CANDY_FILES_BUNDLE = $(CANDY_FILES:.js=.bundle)
 27CANDY_LIBS_FILES_BUNDLE = $(CANDY_LIBS_FILES:.js=.libs-bundle)
 28
 29all: bundle min
 30
 31bundle: clean-bundle $(CANDY_FILES_BUNDLE)
 32
 33%.bundle: %.js
 34	@@echo -n "Bundling" $< "..."
 35	@@cat $< >> $(CANDY_BUNDLE)
 36	@@echo "done"
 37
 38min: $(CANDY_BUNDLE)
 39	@@echo -n "Compressing" $(CANDY_BUNDLE) "..."
 40ifdef YUI_COMPRESSOR
 41	@@java -jar $(YUI_COMPRESSOR) --type js $(CANDY_BUNDLE) -o $(CANDY_BUNDLE_MIN) --charset utf-8
 42	@@echo "done ("$(CANDY_BUNDLE_MIN)")"
 43else
 44	@@echo "aborted"
 45	@@echo "** You can safely use the uncompressed bundle ("$(CANDY_BUNDLE)")"
 46	@@echo "** YUI Compressor is required to build the minified version."
 47	@@echo "** Please set YUI_COMPRESSOR to the path to the jar file."
 48endif
 49
 50libs: libs-bundle libs-min
 51
 52libs-bundle: clean-libs $(CANDY_LIBS_FILES_BUNDLE)
 53
 54%.libs-bundle: %.js
 55	@@echo -n "Bundling" $< "..."
 56	@@cat $< >> $(CANDY_BUNDLE_LIBRARIES)
 57	@@echo "done"
 58
 59libs-min: $(CANDY_BUNDLE_LIBRARIES)
 60	@@echo -n "Compressing" $(CANDY_BUNDLE_LIBRARIES) "..."
 61ifdef YUI_COMPRESSOR
 62	@@java -jar $(YUI_COMPRESSOR) --type js $(CANDY_BUNDLE_LIBRARIES) -o $(CANDY_BUNDLE_LIBRARIES_MIN) --charset utf-8
 63	@@echo "done ("$(CANDY_BUNDLE_LIBRARIES_MIN)")"
 64else
 65	@@echo "aborted"
 66	@@echo "** You can safely use the uncompressed bundle ("$(CANDY_BUNDLE_LIBRARIES)")"
 67	@@echo "** YUI Compressor is required to build the minified version."
 68	@@echo "** Please set YUI_COMPRESSOR to the path to the jar file."
 69endif
 70
 71docs:
 72	@@echo "Building candy documentation ..."
 73ifdef NATURALDOCS_DIR
 74	@@if [ ! -d $(NDPROJ_DIR) ]; then mkdir $(NDPROJ_DIR); fi
 75	@@if [ ! -d $(DOC_DIR) ]; then mkdir $(DOC_DIR); fi
 76	@@$(NATURALDOCS_DIR)/NaturalDocs -q --exclude-source libs --exclude-source res --exclude-source candy.min.js --exclude-source candy.bundle.js -i . -o html $(DOC_DIR) -p $(NDPROJ_DIR)
 77	@@rm -r $(NDPROJ_DIR)
 78	@@echo "Documentation built."
 79	@@echo
 80else
 81	@@echo "aborted"
 82	@@echo "** NaturalDocs is required to build the documentation."
 83	@@echo "** Please set NATURALDOCS_DIR to the path to the NaturalDocs executable"
 84endif
 85
 86clean: clean-bundle clean-libs
 87
 88clean-bundle:
 89	@@echo -n "Cleaning bundles ..."
 90	@@rm -f $(CANDY_BUNDLE) $(CANDY_BUNDLE_MIN)
 91	@@echo "done"
 92
 93clean-libs:
 94	@@echo -n "Cleaning library bundles ..."
 95	@@rm -f $(CANDY_BUNDLE_LIBRARIES) $(CANDY_BUNDLE_LIBRARIES_MIN)
 96	@@echo "done"
 97
 98clean-docs:
 99	@@echo -n "Cleaning documentation ..."
100	@@rm -rf $(NDPROJ_DIR) $(DOC_DIR)
101	@@echo "done"
102
103.PHONY: all docs clean libs