Makefile
author Timm S. Mueller <tmueller@neoscientists.org>
Sun, 29 Apr 2007 14:29:44 +0200
changeset 184 d6dab49fa14a
parent 152 9a7522fda28b
child 198 87a4de7c7457
permissions -rw-r--r--
Internal links are now always treated lowercase
     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 "Loona make 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 "all ........... All of the above: modules, setup, permissions"
    42 	@echo
    43 	@echo "NOTE .......... Set environment variables to complement your setup, e.g."
    44 	@echo "                % LANGUAGE=de WWWUSER=wwwrun make help"
    45 	@echo "                or make settings persistent by changing them in the Makefile"
    46 	@echo
    47 
    48 
    49 clean install modules: 
    50 	$(MAKE) -C cgi-bin $@
    51 
    52 
    53 setup:
    54 	mkdir -p $(CONTENTDIR)
    55 	-cd $(CONTENTDIR) && mkdir work_$(LANGUAGE)
    56 	-cd $(CONTENTDIR) && ln -sn work_$(LANGUAGE) current_$(LANGUAGE)
    57 	mkdir -p $(VARDIR)/sessions $(VARDIR)/htmlcache
    58 	if test ! -f $(CONTENTDIR)/work_$(LANGUAGE)/markup; then cp README $(CONTENTDIR)/work_$(LANGUAGE)/home; fi
    59 	if test ! -f $(CONTENTDIR)/work_$(LANGUAGE)/copyright; then cp COPYRIGHT $(CONTENTDIR)/work_$(LANGUAGE)/copyright; fi
    60 	if test ! -f $(CONTENTDIR)/work_$(LANGUAGE)/markup; then cp MARKUP $(CONTENTDIR)/work_$(LANGUAGE)/markup; fi
    61 	if test ! -f $(CONTENTDIR)/work_$(LANGUAGE)/login; then echo -e 'INCLUDE(login)' >> $(CONTENTDIR)/work_$(LANGUAGE)/login; fi
    62 	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
    63 
    64 
    65 permissions:
    66 	chmod -R 664 *
    67 	chown -R :$(GROUP) *
    68 	find . -type d | xargs chmod ugo+x
    69 	chmod ugo+x $(CGIDIR)/loona.cgi
    70 	chown -R $(WWWUSER) $(VARDIR)/sessions $(VARDIR)/htmlcache
    71 	chown -R $(WWWUSER) $(CONTENTDIR) $(HTDIR)
    72 	find . -name CVS -type d | xargs -r chmod g+rw
    73 	-chown $(WWWUSER):$(GROUP) $(ETCDIR)/passwd.lua
    74 	-chmod 460 $(ETCDIR)/passwd.lua
    75 
    76 
    77 all: modules setup permissions
    78 
    79 
    80 distclean: 
    81 	-rm -Rf $(CONTENTDIR)
    82 	-rm -Rf $(VARDIR)
    83 	-rm cgi-bin/tek/*.o cgi-bin/tek/*.so cgi-bin/tek/web/*.o cgi-bin/tek/web/*.so
    84 	-rm -f $(HTDIR)/*.html $(HTDIR)/*.html.*