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
tmueller@96
     1
root@2
     2
#
root@2
     3
#	Loona Makefile
tmueller@163
     4
#	Written by Timm S. Mueller <tmueller at neoscientists.org>
tmueller@163
     5
#	See copyright notice in COPYRIGHT
root@2
     6
#	
tmueller@0
     7
tmueller@163
     8
###############################################################################
tmueller@163
     9
tmueller@163
    10
tmueller@163
    11
# Name of the user under which the web server is running:
tmueller@0
    12
WWWUSER ?= apache
tmueller@163
    13
tmueller@163
    14
# Group of administrators of this web site (or your own group):
tmueller@0
    15
GROUP ?= apache
tmueller@163
    16
tmueller@163
    17
# Default language of the planned web site:
tmueller@0
    18
LANGUAGE ?= en
tmueller@0
    19
root@2
    20
tmueller@163
    21
###############################################################################
tmueller@163
    22
tmueller@163
    23
tmueller@0
    24
CONTENTDIR ?= content
tmueller@0
    25
VARDIR ?= var
tmueller@0
    26
CGIDIR ?= cgi-bin
tmueller@0
    27
ETCDIR ?= etc
tmueller@133
    28
HTDIR ?= htdocs
tmueller@0
    29
tmueller@96
    30
tmueller@0
    31
help:
tmueller@0
    32
	@echo
tmueller@0
    33
	@echo "Loona make targets"
tmueller@0
    34
	@echo "-------------------------------------------------------------------------------"
tmueller@0
    35
	@echo "help .......... This help"
root@2
    36
	@echo
tmueller@0
    37
	@echo "modules ....... Build modules"
tmueller@0
    38
	@echo "setup ......... Create initial site structure [LANGUAGE: $(LANGUAGE)]"
tmueller@0
    39
	@echo "permissions ... Set permissions [WWWUSER: $(WWWUSER), GROUP: $(GROUP)]"
root@2
    40
	@echo
root@2
    41
	@echo "all ........... All of the above: modules, setup, permissions"
tmueller@0
    42
	@echo
tmueller@0
    43
	@echo "NOTE .......... Set environment variables to complement your setup, e.g."
tmueller@0
    44
	@echo "                % LANGUAGE=de WWWUSER=wwwrun make help"
root@2
    45
	@echo "                or make settings persistent by changing them in the Makefile"
tmueller@0
    46
	@echo
tmueller@0
    47
tmueller@96
    48
tmueller@0
    49
clean install modules: 
tmueller@0
    50
	$(MAKE) -C cgi-bin $@
tmueller@0
    51
tmueller@96
    52
tmueller@0
    53
setup:
tmueller@0
    54
	mkdir -p $(CONTENTDIR)
tmueller@149
    55
	-cd $(CONTENTDIR) && mkdir work_$(LANGUAGE)
tmueller@152
    56
	-cd $(CONTENTDIR) && ln -sn work_$(LANGUAGE) current_$(LANGUAGE)
tmueller@133
    57
	mkdir -p $(VARDIR)/sessions $(VARDIR)/htmlcache
tmueller@152
    58
	if test ! -f $(CONTENTDIR)/work_$(LANGUAGE)/markup; then cp README $(CONTENTDIR)/work_$(LANGUAGE)/home; fi
tmueller@152
    59
	if test ! -f $(CONTENTDIR)/work_$(LANGUAGE)/copyright; then cp COPYRIGHT $(CONTENTDIR)/work_$(LANGUAGE)/copyright; fi
tmueller@152
    60
	if test ! -f $(CONTENTDIR)/work_$(LANGUAGE)/markup; then cp MARKUP $(CONTENTDIR)/work_$(LANGUAGE)/markup; fi
tmueller@152
    61
	if test ! -f $(CONTENTDIR)/work_$(LANGUAGE)/login; then echo -e 'INCLUDE(login)' >> $(CONTENTDIR)/work_$(LANGUAGE)/login; fi
tmueller@152
    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
tmueller@0
    63
tmueller@96
    64
tmueller@0
    65
permissions:
tmueller@0
    66
	chmod -R 664 *
tmueller@0
    67
	chown -R :$(GROUP) *
tmueller@0
    68
	find . -type d | xargs chmod ugo+x
tmueller@93
    69
	chmod ugo+x $(CGIDIR)/loona.cgi
tmueller@133
    70
	chown -R $(WWWUSER) $(VARDIR)/sessions $(VARDIR)/htmlcache
tmueller@135
    71
	chown -R $(WWWUSER) $(CONTENTDIR) $(HTDIR)
tmueller@0
    72
	find . -name CVS -type d | xargs -r chmod g+rw
tmueller@129
    73
	-chown $(WWWUSER):$(GROUP) $(ETCDIR)/passwd.lua
tmueller@129
    74
	-chmod 460 $(ETCDIR)/passwd.lua
tmueller@0
    75
tmueller@96
    76
tmueller@96
    77
all: modules setup permissions
tmueller@96
    78
tmueller@0
    79
tmueller@0
    80
distclean: 
tmueller@0
    81
	-rm -Rf $(CONTENTDIR)
tmueller@0
    82
	-rm -Rf $(VARDIR)
tmueller@112
    83
	-rm cgi-bin/tek/*.o cgi-bin/tek/*.so cgi-bin/tek/web/*.o cgi-bin/tek/web/*.so
tmueller@141
    84
	-rm -f $(HTDIR)/*.html $(HTDIR)/*.html.*