X-Git-Url: http://git.polytechnique.org/?a=blobdiff_plain;f=Makefile;h=26f294edc0eea77ce845b279b59015ef1f48ee89;hb=c76545c351fae4e2298624ff9ee5bf854dc5a5b6;hp=ea72141de9313415bb4105dfe89f1dfea11598a8;hpb=0337d704b62718d7c77106c0e4c4e26fb02beacf;p=platal.git diff --git a/Makefile b/Makefile index ea72141..26f294e 100644 --- a/Makefile +++ b/Makefile @@ -1,8 +1,12 @@ + # $Id: Makefile,v 1.5 2004/11/25 20:18:39 x99laine Exp $ ################################################################################ # definitions -VERSION := $(shell grep VERSION ChangeLog | head -1 | sed -e "s/VERSION //;s/\t.*//") +VERSNUM := $(shell grep VERSION ChangeLog | head -1 | sed -e "s/VERSION //;s/ .*//") +VERSTAG := $(shell grep VERSION ChangeLog | head -1 | grep 'XX' > /dev/null 2> /dev/null && echo 'beta') + +VERSION = $(VERSNUM)$(VERSTAG) PKG_NAME = platal PKG_DIST = $(PKG_NAME)-$(VERSION) @@ -11,64 +15,231 @@ PKG_DIRS = configs htdocs include install.d plugins po scripts templates upgrade VCS_FILTER = ! -name .arch-ids ! -name CVS +define download +@echo "Downloading $@ from $(DOWNLOAD_SRC)" +wget $(DOWNLOAD_SRC) -O $@ -q || ($(RM) $@; exit 1) +endef + ################################################################################ # global targets all: build -headers: - headache -c install.d/platal-dev/templates/header.conf -h install.d/platal-dev/templates/header \ - `find templates -name '*.tpl' ! -path 'templates/xnet/skin.tpl' ! -path 'templates/skin/*.tpl' ! -name 'vcard.tpl' ` +build: core conf static banana wiki openid medals jquery -build: pkg-build +check: + @!(find . -name '*.php' -exec php -l {} ";" | grep -v 'No syntax errors detected') -dist: clean pkg-dist +test: + make -C core test -bzdist: clean pkg-bzdist +q: + @echo -e "Code statistics\n" + @sloccount $(filter-out wiki/ spool/, $(wildcard */)) 2> /dev/null | egrep '^[a-z]*:' -clean: - rm -rf include/platal/globals.inc.php - rm -f htdocs/banana/banana.css htdocs/valid.html include/banana htdocs/banana/img htdocs/banana/xface.php - -%: %.in Makefile +%: %.in Makefile ChangeLog sed -e 's,@VERSION@,$(VERSION),g' $< > $@ ################################################################################ -# devel targets -templates_c: - mkdir templates_c - chmod o+w templates_c +# targets -htdocs/valid.html: - touch templates_c/valid.html - ln -sf ../templates_c/valid.html htdocs/valid.html +## +## core +## -devel: build templates_c htdocs/valid.html +core: + [ -d core/.git ] || ( git submodule init && git submodule update ) + make -C core all +## +## conf +## -################################################################################ -# diogenes package targets +conf: spool/templates_c spool/mails_c classes/platalglobals.php configs/platal.cron htdocs/.htaccess spool/conf spool/tmp + +spool/templates_c spool/mails_c spool/uploads spool/conf spool/tmp spool/run: + mkdir -p $@ + chmod o+w $@ + +htdocs/.htaccess: htdocs/.htaccess.in Makefile + @REWRITE_BASE="/~$$(id -un)"; \ + test "$$REWRITE_BASE" = "/~web" && REWRITE_BASE="/"; \ + sed -e "s,@REWRITE_BASE@,$$REWRITE_BASE,g" $< > $@ + +## +## static content +## +static: htdocs/javascript@VERSION + +%@VERSION: % Makefile ChangeLog + cd $< && rm -f $(VERSION) && ln -sf . $(VERSION) + +## +## wiki +## + +WIKI_NEEDS = \ + wiki/local/farmconfig.php \ + wiki/pub/skins/empty \ + wiki/cookbook/e-protect.php \ + spool/wiki.d \ + htdocs/uploads \ + htdocs/wiki \ -pkg-build: include/platal/globals.inc.php +wiki: get-wiki build-wiki -$(PKG_DIST): pkg-build - mkdir $(PKG_DIST) - cp -a $(PKG_FILES) $(PKG_DIST) - for dir in `find $(PKG_DIRS) -type d $(VCS_FILTER)`; \ - do \ - mkdir -p $(PKG_DIST)/$$dir; \ - find $$dir -type f -maxdepth 1 -exec cp {} $(PKG_DIST)/$$dir \; ; \ - done +build-wiki: $(WIKI_NEEDS) | get-wiki -pkg-dist: $(PKG_DIST) - rm -f $(PKG_DIST).tar.gz - tar czf $(PKG_DIST).tar.gz $(PKG_DIST) - rm -rf $(PKG_DIST) +htdocs/uploads: + cd htdocs && ln -sf ../spool/uploads -pkg-bzdist: $(PKG_DIST) - rm -f $(PKG_DIST).tar.bz2 - tar cjf $(PKG_DIST).tar.bz2 $(PKG_DIST) - rm -rf $(PKG_DIST) +htdocs/wiki: + cd htdocs && ln -sf ../wiki/pub wiki -.PHONY: build dist clean pkg-build pkg-dist +spool/wiki.d: + mkdir -p $@ + chmod o+w $@ + cd $@ && ln -sf ../../include/wiki/wiki.d/* . + + +wiki/cookbook/e-protect.php: + cd wiki/cookbook && ln -sf ../../include/wiki/e-protect.php + +wiki/local/farmconfig.php: + cd wiki/local/ && ln -sf ../../include/wiki/farmconfig.php + +wiki/pub/skins/empty: + cd wiki/pub/skins/ && ln -sf ../../../include/wiki/empty + + +get-wiki: + @if ! test -d wiki; then \ + wget http://www.pmwiki.org/pub/pmwiki/pmwiki-latest.tgz; \ + tar -xzvf pmwiki-latest.tgz; \ + rm pmwiki-latest.tgz; \ + mv pmwiki-* wiki; \ + fi + +## +## openid +## + +openid: get-openid spool/openid/store + +# There is no obvious way to automatically use the latest version +OPENID_VERSION = 2.1.3 +get-openid: + @if ! test -d include/Auth; then \ + wget http://openidenabled.com/files/php-openid/packages/php-openid-$(OPENID_VERSION).tar.bz2; \ + tar -xjf php-openid-$(OPENID_VERSION).tar.bz2; \ + mv php-openid-$(OPENID_VERSION)/Auth include/; \ + rm php-openid-$(OPENID_VERSION).tar.bz2; \ + rm -r php-openid-$(OPENID_VERSION); \ + fi + +spool/openid/store: + mkdir -p $@ + chmod o+w $@ + +## +## banana +## +banana: htdocs/images/banana htdocs/css/banana.css +htdocs/images/banana: banana-sub + cd $(@D) && ln -snf ../../banana/img $(@F) + +htdocs/css/banana.css: banana-sub + cd $(@D) && ln -snf ../../banana/css/style.css $(@F) + +banana-sub: + make -C banana + +## +## Medal thumbnails +## +MEDAL_PICTURES=$(wildcard htdocs/images/medals/*.jpg) +MEDAL_THUMBNAILS=$(subst /medals/,/medals/thumb/,$(MEDAL_PICTURES)) + +medals: $(MEDAL_THUMBNAILS) + +$(MEDAL_THUMBNAILS): $(subst /medals/thumb/,/medals/,$(@F)) + convert -resize x50 $(subst /medals/thumb/,/medals/,$@) $@ + +## +## jquery +## +JQUERY_VERSION=1.4.2 +JQUERY_PLUGINS=color form +JQUERY_PLUGINS_PATHES=$(addprefix htdocs/javascript/jquery.,$(addsuffix .js,$(JQUERY_PLUGINS))) + +JQUERY_UI_VERSION=1.6 +JQUERY_UI=core tabs +JQUERY_UI_PATHES=$(addprefix htdocs/javascript/jquery.ui.,$(addsuffix .js,$(JQUERY_UI))) + +JSTREE_VERSION=1.0rc2 +JSTREE_PATH=htdocs/javascript/jquery.jstree.js + +# TODO: jquery.autocomplete.js should rather be downloaded from an official source. The issue +# is that the version we use is not available anymore on the Internet, and the latest version +# we could use is not backward compatible with our current code. +jquery: htdocs/javascript/jquery.js $(JQUERY_PLUGINS_PATHES) $(JQUERY_UI_PATHES) $(JSTREE_PATH) + +htdocs/javascript/jquery-$(JQUERY_VERSION).min.js: DOWNLOAD_SRC = http://jquery.com/src/$(@F) +htdocs/javascript/jquery-$(JQUERY_VERSION).min.js: + @-rm htdocs/javascript/jquery-*.min.js + @$(download) + +htdocs/javascript/jquery.js: htdocs/javascript/jquery-$(JQUERY_VERSION).min.js + ln -snf $(