move globals.inc.php into include, no more include/platal \o/
[platal.git] / Makefile
index 31418c5..b1591ba 100644 (file)
--- a/Makefile
+++ b/Makefile
@@ -2,7 +2,7 @@
 ################################################################################
 # definitions
 
-VERSION := $(shell grep VERSION ChangeLog | head -1 | sed -e "s/VERSION //;s/\t.*//")
+VERSION := $(shell grep VERSION ChangeLog | head -1 | sed -e "s/VERSION //;s/\t.*//;s/ .*//")
 
 PKG_NAME = platal
 PKG_DIST = $(PKG_NAME)-$(VERSION)
@@ -16,59 +16,88 @@ VCS_FILTER = ! -name .arch-ids ! -name CVS
 
 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 banana wiki
 
-build: pkg-build 
-
-dist: clean pkg-dist
-
-bzdist: clean pkg-bzdist
-
-clean:
-       rm -rf include/platal/globals.inc.php
-       rm -f htdocs/banana/banana.css htdocs/valid.html include/banana htdocs/banana/img
+q:
+       @echo -e "Code statistics\n"
+       @sloccount $(filter-out wiki/ spool/, $(wildcard */)) 2> /dev/null | egrep '^[a-z]*:'
 
 %: %.in Makefile
        sed -e 's,@VERSION@,$(VERSION),g' $< > $@
 
 ################################################################################
-# devel targets
-templates_c:
-       mkdir templates_c
-       chmod o+w templates_c
+# targets
+
+##
+## core
+##
+
+core: spool/templates_c include/globals.inc.php
+
+spool/templates_c spool/uploads:
+       mkdir -p $@
+       chmod o+w $@
+
+
+##
+## wiki
+##
+
+WIKI_NEEDS = \
+     wiki/local/farmconfig.php      \
+     wiki/pub/skins/empty           \
+     wiki/cookbook/e-protect.php    \
+     spool/wiki.d                   \
+     htdocs/uploads                 \
+     htdocs/wiki                    \
+
+wiki: get-wiki build-wiki
+
+build-wiki: $(WIKI_NEEDS) | get-wiki
 
-htdocs/valid.html:
-       touch templates_c/valid.html
-       ln -sf ../templates_c/valid.html htdocs/valid.html
+htdocs/uploads: spool/uploads
+       cd htdocs && ln -sf ../spool/uploads
 
-devel: build templates_c htdocs/valid.html
+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 ../../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
+
+##
+## banana
+##
+
+banana: htdocs/images/banana htdocs/css/banana.css
+htdocs/images/banana:
+       cd $(@D) && ln -sf /usr/share/banana/img $(@F)
+
+htdocs/css/banana.css:
+       cd $(@D) && ln -sf /usr/share/banana/css/style.css $(@F)
+
 ################################################################################
-# diogenes package targets
-
-pkg-build: include/platal/globals.inc.php
-
-$(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
-
-pkg-dist: $(PKG_DIST)
-       rm -f $(PKG_DIST).tar.gz
-       tar czf $(PKG_DIST).tar.gz $(PKG_DIST)
-       rm -rf $(PKG_DIST)
-
-pkg-bzdist: $(PKG_DIST)
-       rm -f $(PKG_DIST).tar.bz2
-       tar cjf $(PKG_DIST).tar.bz2 $(PKG_DIST)
-       rm -rf $(PKG_DIST)
-
-.PHONY: build dist clean pkg-build pkg-dist
+
+.PHONY: build dist clean wiki build-wiki banana