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
tmueller@96
     1
root@2
     2
#
tmueller@201
     3
#	LOona Makefile
tmueller@163
     4
#	Written by Timm S. Mueller <tmueller at neoscientists.org>
tmueller@163
     5
#	See copyright notice in COPYRIGHT
tmueller@198
     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@238
    33
	@echo "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
tmueller@198
    41
	@echo "fastcgi-run ... Run as FastCGI external server"
tmueller@238
    42
	@echo "                See cgi-bin/loona_fastcgi.lua for configuration options"
tmueller@198
    43
	@echo
tmueller@0
    44
	@echo "NOTE .......... Set environment variables to complement your setup, e.g."
tmueller@0
    45
	@echo "                % LANGUAGE=de WWWUSER=wwwrun make help"
root@2
    46
	@echo "                or make settings persistent by changing them in the Makefile"
tmueller@0
    47
	@echo
tmueller@0
    48
tmueller@96
    49
tmueller@251
    50
all: modules
tmueller@251
    51
tmueller@251
    52
tmueller@198
    53
clean install modules:
tmueller@0
    54
	$(MAKE) -C cgi-bin $@
tmueller@0
    55
tmueller@96
    56
tmueller@0
    57
setup:
tmueller@0
    58
	mkdir -p $(CONTENTDIR)
tmueller@149
    59
	-cd $(CONTENTDIR) && mkdir work_$(LANGUAGE)
tmueller@152
    60
	-cd $(CONTENTDIR) && ln -sn work_$(LANGUAGE) current_$(LANGUAGE)
tmueller@133
    61
	mkdir -p $(VARDIR)/sessions $(VARDIR)/htmlcache
tmueller@152
    62
	if test ! -f $(CONTENTDIR)/work_$(LANGUAGE)/markup; then cp README $(CONTENTDIR)/work_$(LANGUAGE)/home; fi
tmueller@152
    63
	if test ! -f $(CONTENTDIR)/work_$(LANGUAGE)/copyright; then cp COPYRIGHT $(CONTENTDIR)/work_$(LANGUAGE)/copyright; fi
tmueller@152
    64
	if test ! -f $(CONTENTDIR)/work_$(LANGUAGE)/markup; then cp MARKUP $(CONTENTDIR)/work_$(LANGUAGE)/markup; fi
tmueller@152
    65
	if test ! -f $(CONTENTDIR)/work_$(LANGUAGE)/login; then echo -e 'INCLUDE(login)' >> $(CONTENTDIR)/work_$(LANGUAGE)/login; fi
tmueller@152
    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
tmueller@0
    67
tmueller@96
    68
tmueller@0
    69
permissions:
tmueller@0
    70
	chmod -R 664 *
tmueller@0
    71
	chown -R :$(GROUP) *
tmueller@0
    72
	find . -type d | xargs chmod ugo+x
tmueller@249
    73
	chmod ugo+x $(CGIDIR)/loona.cgi $(CGIDIR)/loona_fastcgi.lua
tmueller@133
    74
	chown -R $(WWWUSER) $(VARDIR)/sessions $(VARDIR)/htmlcache
tmueller@135
    75
	chown -R $(WWWUSER) $(CONTENTDIR) $(HTDIR)
tmueller@0
    76
	find . -name CVS -type d | xargs -r chmod g+rw
tmueller@0
    77
tmueller@96
    78
tmueller@207
    79
distclean: clean
tmueller@0
    80
	-rm -Rf $(CONTENTDIR)
tmueller@0
    81
	-rm -Rf $(VARDIR)
tmueller@141
    82
	-rm -f $(HTDIR)/*.html $(HTDIR)/*.html.*
tmueller@198
    83
tmueller@198
    84
tmueller@198
    85
fastcgi-run:
tmueller@198
    86
	$(MAKE) -C cgi-bin $@
tmueller@249
    87
tmueller@249
    88
tmueller@249
    89
kdiff:
tmueller@249
    90
	-(a=$$(mktemp -du) && hg clone $$PWD $$a && kdiff3 $$a $$PWD; rm -rf $$a)
tmueller@249
    91