Makefile
author Timm S. Mueller <tmueller@neoscientists.org>
Fri, 23 Nov 2007 01:46:43 +0100
changeset 201 d52b05a9fe9c
parent 199 8b5fc485edf4
child 206 450cd443de9f
permissions -rw-r--r--
Added permission for lua.cgi in Makefile; FastCGI class added; improved
configuration and statistics output in FastCGI runner; versionstring format
changed; inheritance is now based on tek.class - Atom class removed; Debug
library added; removed "attr" permission
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@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@198
    43
	@echo "fastcgi-run ... Run as FastCGI external server"
tmueller@198
    44
	@echo
tmueller@0
    45
	@echo "NOTE .......... Set environment variables to complement your setup, e.g."
tmueller@0
    46
	@echo "                % LANGUAGE=de WWWUSER=wwwrun make help"
root@2
    47
	@echo "                or make settings persistent by changing them in the Makefile"
tmueller@0
    48
	@echo
tmueller@0
    49
tmueller@96
    50
tmueller@198
    51
clean install modules:
tmueller@0
    52
	$(MAKE) -C cgi-bin $@
tmueller@0
    53
tmueller@96
    54
tmueller@0
    55
setup:
tmueller@0
    56
	mkdir -p $(CONTENTDIR)
tmueller@149
    57
	-cd $(CONTENTDIR) && mkdir work_$(LANGUAGE)
tmueller@152
    58
	-cd $(CONTENTDIR) && ln -sn work_$(LANGUAGE) current_$(LANGUAGE)
tmueller@133
    59
	mkdir -p $(VARDIR)/sessions $(VARDIR)/htmlcache
tmueller@152
    60
	if test ! -f $(CONTENTDIR)/work_$(LANGUAGE)/markup; then cp README $(CONTENTDIR)/work_$(LANGUAGE)/home; fi
tmueller@152
    61
	if test ! -f $(CONTENTDIR)/work_$(LANGUAGE)/copyright; then cp COPYRIGHT $(CONTENTDIR)/work_$(LANGUAGE)/copyright; fi
tmueller@152
    62
	if test ! -f $(CONTENTDIR)/work_$(LANGUAGE)/markup; then cp MARKUP $(CONTENTDIR)/work_$(LANGUAGE)/markup; fi
tmueller@152
    63
	if test ! -f $(CONTENTDIR)/work_$(LANGUAGE)/login; then echo -e 'INCLUDE(login)' >> $(CONTENTDIR)/work_$(LANGUAGE)/login; fi
tmueller@152
    64
	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
    65
tmueller@96
    66
tmueller@0
    67
permissions:
tmueller@0
    68
	chmod -R 664 *
tmueller@0
    69
	chown -R :$(GROUP) *
tmueller@0
    70
	find . -type d | xargs chmod ugo+x
tmueller@201
    71
	chmod ugo+x $(CGIDIR)/loona.cgi $(CGIDIR)/loona_fastcgi.lua $(CGIDIR)/lua.cgi
tmueller@133
    72
	chown -R $(WWWUSER) $(VARDIR)/sessions $(VARDIR)/htmlcache
tmueller@135
    73
	chown -R $(WWWUSER) $(CONTENTDIR) $(HTDIR)
tmueller@0
    74
	find . -name CVS -type d | xargs -r chmod g+rw
tmueller@129
    75
	-chown $(WWWUSER):$(GROUP) $(ETCDIR)/passwd.lua
tmueller@129
    76
	-chmod 460 $(ETCDIR)/passwd.lua
tmueller@0
    77
tmueller@96
    78
tmueller@96
    79
all: modules setup permissions
tmueller@96
    80
tmueller@0
    81
tmueller@198
    82
distclean:
tmueller@0
    83
	-rm -Rf $(CONTENTDIR)
tmueller@0
    84
	-rm -Rf $(VARDIR)
tmueller@112
    85
	-rm cgi-bin/tek/*.o cgi-bin/tek/*.so cgi-bin/tek/web/*.o cgi-bin/tek/web/*.so
tmueller@141
    86
	-rm -f $(HTDIR)/*.html $(HTDIR)/*.html.*
tmueller@198
    87
tmueller@198
    88
tmueller@198
    89
fastcgi-run:
tmueller@198
    90
	$(MAKE) -C cgi-bin $@