From 38f67cf31dacb7e4202c82ca0907898c371cd427 Mon Sep 17 00:00:00 2001 From: Adam Shaw Date: Sat, 13 Mar 2010 21:04:09 -0800 Subject: [PATCH] refactored makefile. now quicker and bsd/mac compatible --- Makefile | 107 +++++++++++++++++++++++++++------------------- src/css/main.css | 4 +- src/gcal.js | 4 +- src/misc/head.txt | 4 +- 4 files changed, 69 insertions(+), 50 deletions(-) diff --git a/Makefile b/Makefile index 78be47c..6334788 100644 --- a/Makefile +++ b/Makefile @@ -1,62 +1,81 @@ -VER = `cat version.txt` -DATE = `git log -1 | grep Date: | sed 's/[^:]*: *//'` +SRC_DIR = src +EXAMPLES_DIR = examples +BUILD_DIR = build +DIST_DIR = dist -JS_SRC_FILES =\ - main.js\ - grid.js\ - agenda.js\ - view.js\ - util.js +JS_SRC_FILES = \ + ${SRC_DIR}/main.js \ + ${SRC_DIR}/grid.js \ + ${SRC_DIR}/agenda.js \ + ${SRC_DIR}/view.js \ + ${SRC_DIR}/util.js -CSS_SRC_FILES =\ - main.css\ - grid.css\ - agenda.css +CSS_SRC_FILES = \ + ${SRC_DIR}/css/main.css \ + ${SRC_DIR}/css/grid.css \ + ${SRC_DIR}/css/agenda.css -OTHER_FILES =\ - src/gcal.js\ - src/jquery\ - examples\ +OTHER_FILES = \ + ${SRC_DIR}/jquery \ changelog.txt + +VER = `cat version.txt` +VER_SED = sed s/@VERSION/"${VER}"/ +DATE = `git log -1 | grep Date: | sed 's/[^:]*: *//'` +DATE_SED = sed s/@DATE/"${DATE}"/ zip: - @rm -rf build/fullcalendar - @rm -rf build/fullcalendar-* - @mkdir -p build/fullcalendar - - @echo "building js & css..." - @cd src; cat misc/head.txt ${JS_SRC_FILES} misc/foot.txt > ../build/fullcalendar/fullcalendar.js - @cd src/css; cat ${CSS_SRC_FILES} > ../../build/fullcalendar/fullcalendar.css - @cp -rt build/fullcalendar ${OTHER_FILES} - @for f in build/fullcalendar/*.*; do\ - sed -i "s/* FullCalendar/& v${VER}/" $$f;\ - sed -i "s/* Date:/& ${DATE}/" $$f;\ - done + @rm -rf ${BUILD_DIR}/fullcalendar + @rm -rf ${BUILD_DIR}/fullcalendar-* + @mkdir -p ${BUILD_DIR}/fullcalendar + @echo "building js..." + @cat ${SRC_DIR}/misc/head.txt ${JS_SRC_FILES} ${SRC_DIR}/misc/foot.txt \ + | ${VER_SED} | ${DATE_SED} \ + > ${BUILD_DIR}/fullcalendar/fullcalendar.js + @cat ${SRC_DIR}/gcal.js \ + | ${VER_SED} | ${DATE_SED} \ + > ${BUILD_DIR}/fullcalendar/gcal.js + @echo "compressing js..." - @java -jar build/compiler.jar --js build/fullcalendar/fullcalendar.js > build/fullcalendar/fullcalendar.min.js - + @java -jar ${BUILD_DIR}/compiler.jar --js ${BUILD_DIR}/fullcalendar/fullcalendar.js \ + > ${BUILD_DIR}/fullcalendar/fullcalendar.min.js + + @echo "building css..." + @cat ${CSS_SRC_FILES} \ + | ${VER_SED} | ${DATE_SED} \ + > ${BUILD_DIR}/fullcalendar/fullcalendar.css + @echo "building examples..." - @for f in build/fullcalendar/examples/*.html; do\ - sed -i -n '1h;1!H;$${;g;s/\s*//g;p;}' $$f;\ - sed -i -n '1h;1!H;$${;g;s/\s*//g;p;}' $$f;\ + @mkdir -p ${BUILD_DIR}/fullcalendar/examples + @for f in `cd ${EXAMPLES_DIR}; find . -mindepth 1 -maxdepth 1 -type f`; do \ + cat ${EXAMPLES_DIR}/$$f \ + | sed -n '1h;1!H;$${;g;s/\s*//g;p;}' \ + | sed -n '1h;1!H;$${;g;s/\s*//g;p;}' \ + > ${BUILD_DIR}/fullcalendar/examples/$$f; \ done - + @for d in `cd ${EXAMPLES_DIR}; find . -mindepth 1 -maxdepth 1 -type d`; do \ + cp -r ${EXAMPLES_DIR}/$$d ${BUILD_DIR}/fullcalendar/examples/$$d; \ + done + + @echo "copying other files..." + @cp -r ${OTHER_FILES} ${BUILD_DIR}/fullcalendar + @echo "zipping..." - @mv build/fullcalendar build/fullcalendar-${VER} - @cd build; for f in fullcalendar-*; do\ - zip -q -r $$f.zip $$f;\ + @mv ${BUILD_DIR}/fullcalendar ${BUILD_DIR}/fullcalendar-${VER} + @cd ${BUILD_DIR}; for f in fullcalendar-*; do \ + zip -q -r $$f.zip $$f; \ done - @mv build/fullcalendar-${VER} build/fullcalendar + @mv ${BUILD_DIR}/fullcalendar-${VER} ${BUILD_DIR}/fullcalendar - @mkdir -p dist - @mv build/fullcalendar-${VER}.zip dist + @mkdir -p ${DIST_DIR} + @mv ${BUILD_DIR}/fullcalendar-${VER}.zip ${DIST_DIR} @echo "done." clean: - @rm -rf build/fullcalendar - @rm -rf build/fullcalendar-* - @rm -rf dist/* + @rm -rf ${BUILD_DIR}/fullcalendar + @rm -rf ${BUILD_DIR}/fullcalendar-* + @rm -rf ${DIST_DIR}/* diff --git a/src/css/main.css b/src/css/main.css index f4d773d..0ac9438 100644 --- a/src/css/main.css +++ b/src/css/main.css @@ -1,11 +1,11 @@ /* - * FullCalendar Stylesheet + * FullCalendar v@VERSION Stylesheet * * Feel free to edit this file to customize the look of FullCalendar. * When upgrading to newer versions, please upgrade this file as well, * porting over any customizations afterwards. * - * Date: + * Date: @DATE * */ diff --git a/src/gcal.js b/src/gcal.js index 1f49b09..fc6a49f 100644 --- a/src/gcal.js +++ b/src/gcal.js @@ -1,12 +1,12 @@ /* - * FullCalendar Google Calendar Extension + * FullCalendar v@VERSION Google Calendar Extension * * Copyright (c) 2009 Adam Shaw * Dual licensed under the MIT and GPL licenses: * http://www.opensource.org/licenses/mit-license.php * http://www.gnu.org/licenses/gpl.html * - * Date: + * Date: @DATE * */ diff --git a/src/misc/head.txt b/src/misc/head.txt index c586499..dc6c022 100644 --- a/src/misc/head.txt +++ b/src/misc/head.txt @@ -1,6 +1,6 @@ /** * @preserve - * FullCalendar + * FullCalendar v@VERSION * http://arshaw.com/fullcalendar/ * * Use fullcalendar.css for basic styling. @@ -12,7 +12,7 @@ * http://www.opensource.org/licenses/mit-license.php * http://www.gnu.org/licenses/gpl.html * - * Date: + * Date: @DATE * */