Makefile
author Timm S. Mueller <tmueller@neoscientists.org>
Fri, 24 Oct 2008 01:35:27 +0200
changeset 251 2de5931b723d
parent 249 2407b197ed8b
permissions -rw-r--r--
tek.os.posix has been moved to tek.lib.posix, module initialization procedure
simplified, added statvfs() under Linux
     1 
     2 #
     3 #	LOona Makefile
     4 #	Written by Timm S. Mueller <tmueller at neoscientists.org>
     5 #	See copyright notice in COPYRIGHT
     6 #
     7 
     8 ###############################################################################
     9 
    10 
    11 # Name of the user under which the web server is running:
    12 WWWUSER ?= apache
    13 
    14 # Group of administrators of this web site (or your own group):
    15 GROUP ?= apache
    16 
    17 # Default language of the planned web site:
    18 LANGUAGE ?= en
    19 
    20 
    21 ###############################################################################
    22 
    23 
    24 CONTENTDIR ?= content
    25 VARDIR ?= var
    26 CGIDIR ?= cgi-bin
    27 ETCDIR ?= etc
    28 HTDIR ?= htdocs
    29 
    30 
    31 help:
    32 	@echo
    33 	@echo "Targets"
    34 	@echo "-------------------------------------------------------------------------------"
    35 	@echo "help .......... This help"
    36 	@echo
    37 	@echo "modules ....... Build modules"
    38 	@echo "setup ......... Create initial site structure [LANGUAGE: $(LANGUAGE)]"
    39 	@echo "permissions ... Set permissions [WWWUSER: $(WWWUSER), GROUP: $(GROUP)]"
    40 	@echo
    41 	@echo "fastcgi-run ... Run as FastCGI external server"
    42 	@echo "                See cgi-bin/loona_fastcgi.lua for configuration options"
    43 	@echo
    44 	@echo "NOTE .......... Set environment variables to complement your setup, e.g."
    45 	@echo "                % LANGUAGE=de WWWUSER=wwwrun make help"
    46 	@echo "                or make settings persistent by changing them in the Makefile"
    47 	@echo
    48 
    49 
    50 all: modules
    51 
    52 
    53 clean install modules:
    54 	$(MAKE) -C cgi-bin $@
    55 
    56 
    57 setup:
    58 	mkdir -p $(CONTENTDIR)
    59 	-cd $(CONTENTDIR) && mkdir work_$(LANGUAGE)
    60 	-cd $(CONTENTDIR) && ln -sn work_$(LANGUAGE) current_$(LANGUAGE)
    61 	mkdir -p $(VARDIR)/sessions $(VARDIR)/htmlcache
    62 	if test ! -f $(CONTENTDIR)/work_$(LANGUAGE)/markup; then cp README $(CONTENTDIR)/work_$(LANGUAGE)/home; fi
    63 	if test ! -f $(CONTENTDIR)/work_$(LANGUAGE)/copyright; then cp COPYRIGHT $(CONTENTDIR)/work_$(LANGUAGE)/copyright; fi
    64 	if test ! -f $(CONTENTDIR)/work_$(LANGUAGE)/markup; then cp MARKUP $(CONTENTDIR)/work_$(LANGUAGE)/markup; fi
    65 	if test ! -f $(CONTENTDIR)/work_$(LANGUAGE)/login; then echo -e 'INCLUDE(login)' >> $(CONTENTDIR)/work_$(LANGUAGE)/login; fi
    66 	if test ! -f $(CONTENTDIR)/work_$(LANGUAGE)/.sections; then echo -e '[1] = { name = "home" },\n[2] = { name = "copyright" },\n[3] = { name = "markup" },\n[4] = { name = "login", dynamic = { main = true } },' >> $(CONTENTDIR)/work_$(LANGUAGE)/.sections; fi
    67 
    68 
    69 permissions:
    70 	chmod -R 664 *
    71 	chown -R :$(GROUP) *
    72 	find . -type d | xargs chmod ugo+x
    73 	chmod ugo+x $(CGIDIR)/loona.cgi $(CGIDIR)/loona_fastcgi.lua
    74 	chown -R $(WWWUSER) $(VARDIR)/sessions $(VARDIR)/htmlcache
    75 	chown -R $(WWWUSER) $(CONTENTDIR) $(HTDIR)
    76 	find . -name CVS -type d | xargs -r chmod g+rw
    77 
    78 
    79 distclean: clean
    80 	-rm -Rf $(CONTENTDIR)
    81 	-rm -Rf $(VARDIR)
    82 	-rm -f $(HTDIR)/*.html $(HTDIR)/*.html.*
    83 
    84 
    85 fastcgi-run:
    86 	$(MAKE) -C cgi-bin $@
    87 
    88 
    89 kdiff:
    90 	-(a=$$(mktemp -du) && hg clone $$PWD $$a && kdiff3 $$a $$PWD; rm -rf $$a)
    91