X-Git-Url: http://git.polytechnique.org/?a=blobdiff_plain;f=Makefile;h=3233b9fd24d1c250b93b83a1b86f21c50a87e2b3;hb=e97df22eacc433a9982aad507f980b303d5fa2c1;hp=4371c4389c2656265fc63a8717505e8a255137ed;hpb=4887dc9076011c9122c698866d71269cf52226fd;p=platal.git diff --git a/Makefile b/Makefile index 4371c43..3233b9f 100644 --- a/Makefile +++ b/Makefile @@ -1,8 +1,13 @@ + # $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') +BANANA := $(shell ( [ -d ../banana ] && echo `pwd`"/../banana" ) || echo "/home/web/dev/banana") + +VERSION = $(VERSNUM)$(VERSTAG) PKG_NAME = platal PKG_DIST = $(PKG_NAME)-$(VERSION) @@ -11,44 +16,74 @@ 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 -devel: build htdocs/valid.html +build: core conf static banana wiki openid medals jquery -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' ` +q: + @echo -e "Code statistics\n" + @sloccount $(filter-out wiki/ spool/, $(wildcard */)) 2> /dev/null | egrep '^[a-z]*:' -build: spool/templates_c wiki - -clean: - rm -rf include/platal/globals.inc.php - -%: %.in Makefile +%: %.in Makefile ChangeLog sed -e 's,@VERSION@,$(VERSION),g' $< > $@ ################################################################################ # targets -spool/templates_c spool/uploads: - mkdir -p $@ - chmod o+w $@ +## +## core +## -spool/wiki.d: +core: + [ -d core/.git ] || ( git submodule init && git submodule update ) + make -C core all + +## +## conf +## + +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: mkdir -p $@ chmod o+w $@ - cd $@ && ln -sf ../../install.d/wiki/wiki.d/* . -wiki/cookbook/e-protect.php: - cd wiki/cookbook && ln -sf ../../install.d/wiki/e-protect.php +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 \ -htdocs/valid.html: - touch spool/templates_c/valid.html - chmod o+w spool/templates_c/valid.html - cd htdocs && ln -sf ../spool/templates_c/valid.html +wiki: get-wiki build-wiki + +build-wiki: $(WIKI_NEEDS) | get-wiki htdocs/uploads: cd htdocs && ln -sf ../spool/uploads @@ -56,26 +91,98 @@ htdocs/uploads: htdocs/wiki: cd htdocs && ln -sf ../wiki/pub wiki + +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 ../../plugins/pmwiki.config.php farmconfig.php + cd wiki/local/ && ln -sf ../../include/wiki/farmconfig.php wiki/pub/skins/empty: - cd wiki/pub/skins/ && ln -sf ../../../install.d/wiki/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; \ - echo "¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯"; \ - echo "now please untar pmwiki into wiki/ and run make again"; \ - echo "_____________________________________________________"; \ - exit 1; \ + tar -xzvf pmwiki-latest.tgz; \ + rm pmwiki-latest.tgz; \ + mv pmwiki-* wiki; \ fi -build-wiki: wiki/local/farmconfig.php wiki/pub/skins/empty spool/wiki.d +## +## 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 include/banana/banana.inc.php +htdocs/images/banana: + cd $(@D) && ln -snf $(BANANA)/img $(@F) + +htdocs/css/banana.css: + cd $(@D) && ln -snf $(BANANA)/css/style.css $(@F) + +include/banana/banana.inc.php: + cd $(@D) && find $(BANANA)/banana/ -name '*.php' -exec ln -snf {} . ";" + +## +## 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_PLUGINS=color +JQUERY_PLUGINS_PATHES=$(addprefix htdocs/javascript/jquery.,$(addsuffix .js,$(JQUERY_PLUGINS))) + +# 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) + +htdocs/javascript/jquery.js: DOWNLOAD_SRC = http://jquery.com/src/jquery-latest.min.js +htdocs/javascript/jquery.js: + @$(download) -wiki: get-wiki build-wiki spool/uploads htdocs/uploads htdocs/wiki wiki/cookbook/e-protect.php +$(JQUERY_PLUGINS_PATHES): DOWNLOAD_SRC = http://plugins.jquery.com/files/$(@F).txt +$(JQUERY_PLUGINS_PATHES): + @$(download) ################################################################################ -.PHONY: build dist clean wiki build-wiki +.PHONY: build dist clean core wiki build-wiki banana htdocs/images/banana htdocs/css/banana.css include/banana/banana.inc.php http*