refactored makefile. now quicker and bsd/mac compatible

This commit is contained in:
Adam Shaw 2010-03-13 21:04:09 -08:00
parent 61af0d3d84
commit 38f67cf31d
4 changed files with 69 additions and 50 deletions

View file

@ -1,62 +1,81 @@
VER = `cat version.txt` SRC_DIR = src
DATE = `git log -1 | grep Date: | sed 's/[^:]*: *//'` EXAMPLES_DIR = examples
BUILD_DIR = build
DIST_DIR = dist
JS_SRC_FILES = \ JS_SRC_FILES = \
main.js\ ${SRC_DIR}/main.js \
grid.js\ ${SRC_DIR}/grid.js \
agenda.js\ ${SRC_DIR}/agenda.js \
view.js\ ${SRC_DIR}/view.js \
util.js ${SRC_DIR}/util.js
CSS_SRC_FILES = \ CSS_SRC_FILES = \
main.css\ ${SRC_DIR}/css/main.css \
grid.css\ ${SRC_DIR}/css/grid.css \
agenda.css ${SRC_DIR}/css/agenda.css
OTHER_FILES = \ OTHER_FILES = \
src/gcal.js\ ${SRC_DIR}/jquery \
src/jquery\
examples\
changelog.txt changelog.txt
zip: VER = `cat version.txt`
@rm -rf build/fullcalendar VER_SED = sed s/@VERSION/"${VER}"/
@rm -rf build/fullcalendar-* DATE = `git log -1 | grep Date: | sed 's/[^:]*: *//'`
@mkdir -p build/fullcalendar DATE_SED = sed s/@DATE/"${DATE}"/
@echo "building js & css..." zip:
@cd src; cat misc/head.txt ${JS_SRC_FILES} misc/foot.txt > ../build/fullcalendar/fullcalendar.js @rm -rf ${BUILD_DIR}/fullcalendar
@cd src/css; cat ${CSS_SRC_FILES} > ../../build/fullcalendar/fullcalendar.css @rm -rf ${BUILD_DIR}/fullcalendar-*
@cp -rt build/fullcalendar ${OTHER_FILES} @mkdir -p ${BUILD_DIR}/fullcalendar
@for f in build/fullcalendar/*.*; do\
sed -i "s/* FullCalendar/& v${VER}/" $$f;\ @echo "building js..."
sed -i "s/* Date:/& ${DATE}/" $$f;\ @cat ${SRC_DIR}/misc/head.txt ${JS_SRC_FILES} ${SRC_DIR}/misc/foot.txt \
done | ${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..." @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..." @echo "building examples..."
@for f in build/fullcalendar/examples/*.html; do\ @mkdir -p ${BUILD_DIR}/fullcalendar/examples
sed -i -n '1h;1!H;$${;g;s/<!--\s*<src>.*<\/src>\s*-->\s*//g;p;}' $$f;\ @for f in `cd ${EXAMPLES_DIR}; find . -mindepth 1 -maxdepth 1 -type f`; do \
sed -i -n '1h;1!H;$${;g;s/<!--\s*<dist>\s*//g;p;}' $$f;\ cat ${EXAMPLES_DIR}/$$f \
sed -i -n '1h;1!H;$${;g;s/<\/dist>\s*-->\s*//g;p;}' $$f;\ | sed -n '1h;1!H;$${;g;s/<!--\s*<src>.*<\/src>\s*-->\s*//g;p;}' \
| sed -n '1h;1!H;$${;g;s/<!--\s*<dist>\s*//g;p;}' \
| sed -n '1h;1!H;$${;g;s/<\/dist>\s*-->\s*//g;p;}' \
> ${BUILD_DIR}/fullcalendar/examples/$$f; \
done 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..." @echo "zipping..."
@mv build/fullcalendar build/fullcalendar-${VER} @mv ${BUILD_DIR}/fullcalendar ${BUILD_DIR}/fullcalendar-${VER}
@cd build; for f in fullcalendar-*; do\ @cd ${BUILD_DIR}; for f in fullcalendar-*; do \
zip -q -r $$f.zip $$f; \ zip -q -r $$f.zip $$f; \
done done
@mv build/fullcalendar-${VER} build/fullcalendar @mv ${BUILD_DIR}/fullcalendar-${VER} ${BUILD_DIR}/fullcalendar
@mkdir -p dist @mkdir -p ${DIST_DIR}
@mv build/fullcalendar-${VER}.zip dist @mv ${BUILD_DIR}/fullcalendar-${VER}.zip ${DIST_DIR}
@echo "done." @echo "done."
clean: clean:
@rm -rf build/fullcalendar @rm -rf ${BUILD_DIR}/fullcalendar
@rm -rf build/fullcalendar-* @rm -rf ${BUILD_DIR}/fullcalendar-*
@rm -rf dist/* @rm -rf ${DIST_DIR}/*

View file

@ -1,11 +1,11 @@
/* /*
* FullCalendar Stylesheet * FullCalendar v@VERSION Stylesheet
* *
* Feel free to edit this file to customize the look of FullCalendar. * Feel free to edit this file to customize the look of FullCalendar.
* When upgrading to newer versions, please upgrade this file as well, * When upgrading to newer versions, please upgrade this file as well,
* porting over any customizations afterwards. * porting over any customizations afterwards.
* *
* Date: * Date: @DATE
* *
*/ */

View file

@ -1,12 +1,12 @@
/* /*
* FullCalendar Google Calendar Extension * FullCalendar v@VERSION Google Calendar Extension
* *
* Copyright (c) 2009 Adam Shaw * Copyright (c) 2009 Adam Shaw
* Dual licensed under the MIT and GPL licenses: * Dual licensed under the MIT and GPL licenses:
* http://www.opensource.org/licenses/mit-license.php * http://www.opensource.org/licenses/mit-license.php
* http://www.gnu.org/licenses/gpl.html * http://www.gnu.org/licenses/gpl.html
* *
* Date: * Date: @DATE
* *
*/ */

View file

@ -1,6 +1,6 @@
/** /**
* @preserve * @preserve
* FullCalendar * FullCalendar v@VERSION
* http://arshaw.com/fullcalendar/ * http://arshaw.com/fullcalendar/
* *
* Use fullcalendar.css for basic styling. * Use fullcalendar.css for basic styling.
@ -12,7 +12,7 @@
* http://www.opensource.org/licenses/mit-license.php * http://www.opensource.org/licenses/mit-license.php
* http://www.gnu.org/licenses/gpl.html * http://www.gnu.org/licenses/gpl.html
* *
* Date: * Date: @DATE
* *
*/ */