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

107
Makefile
View file

@ -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*<src>.*<\/src>\s*-->\s*//g;p;}' $$f;\
sed -i -n '1h;1!H;$${;g;s/<!--\s*<dist>\s*//g;p;}' $$f;\
sed -i -n '1h;1!H;$${;g;s/<\/dist>\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*<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
@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}/*

View file

@ -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
*
*/

View file

@ -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
*
*/

View file

@ -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
*
*/