Makefile
author Timm S. Mueller <tmueller@neoscientists.org>
Sun, 11 Mar 2007 20:19:10 +0100
changeset 149 8fc5dbd1eacb
parent 141 fc50232cf086
child 151 e01bdf886128
permissions -rw-r--r--
the default profile is now 'work'; further cleanup
tmueller@96
     1
root@2
     2
#
root@2
     3
#	Loona Makefile
root@2
     4
#	
tmueller@0
     5
tmueller@0
     6
WWWUSER ?= apache
tmueller@0
     7
GROUP ?= apache
tmueller@0
     8
LANGUAGE ?= en
tmueller@0
     9
root@2
    10
tmueller@0
    11
CONTENTDIR ?= content
tmueller@0
    12
VARDIR ?= var
tmueller@0
    13
CGIDIR ?= cgi-bin
tmueller@0
    14
ETCDIR ?= etc
tmueller@133
    15
HTDIR ?= htdocs
tmueller@0
    16
tmueller@96
    17
tmueller@0
    18
help:
tmueller@0
    19
	@echo
tmueller@0
    20
	@echo "Loona make targets"
tmueller@0
    21
	@echo "-------------------------------------------------------------------------------"
tmueller@0
    22
	@echo "help .......... This help"
root@2
    23
	@echo
tmueller@0
    24
	@echo "modules ....... Build modules"
tmueller@0
    25
	@echo "setup ......... Create initial site structure [LANGUAGE: $(LANGUAGE)]"
tmueller@0
    26
	@echo "permissions ... Set permissions [WWWUSER: $(WWWUSER), GROUP: $(GROUP)]"
root@2
    27
	@echo
root@2
    28
	@echo "all ........... All of the above: modules, setup, permissions"
tmueller@0
    29
	@echo
tmueller@0
    30
	@echo "NOTE .......... Set environment variables to complement your setup, e.g."
tmueller@0
    31
	@echo "                % LANGUAGE=de WWWUSER=wwwrun make help"
root@2
    32
	@echo "                or make settings persistent by changing them in the Makefile"
tmueller@0
    33
	@echo
tmueller@0
    34
tmueller@96
    35
tmueller@0
    36
clean install modules: 
tmueller@0
    37
	$(MAKE) -C cgi-bin $@
tmueller@0
    38
tmueller@96
    39
tmueller@0
    40
setup:
tmueller@0
    41
	mkdir -p $(CONTENTDIR)
tmueller@149
    42
	-cd $(CONTENTDIR) && mkdir work_$(LANGUAGE)
tmueller@149
    43
	cd $(CONTENTDIR) && ln -snf work_$(LANGUAGE) current_$(LANGUAGE)
tmueller@133
    44
	mkdir -p $(VARDIR)/sessions $(VARDIR)/htmlcache
tmueller@110
    45
	if test ! -f $(CONTENTDIR)/current_$(LANGUAGE)/markup; then cp README $(CONTENTDIR)/current_$(LANGUAGE)/home; fi
tmueller@110
    46
	if test ! -f $(CONTENTDIR)/current_$(LANGUAGE)/copyright; then cp COPYRIGHT $(CONTENTDIR)/current_$(LANGUAGE)/copyright; fi
tmueller@110
    47
	if test ! -f $(CONTENTDIR)/current_$(LANGUAGE)/markup; then cp MARKUP $(CONTENTDIR)/current_$(LANGUAGE)/markup; fi
tmueller@105
    48
	if test ! -f $(CONTENTDIR)/current_$(LANGUAGE)/login; then echo -e 'INCLUDE(login)' >> $(CONTENTDIR)/current_$(LANGUAGE)/login; fi
tmueller@129
    49
	if test ! -f $(CONTENTDIR)/current_$(LANGUAGE)/.sections; then echo -e '[1] = { name = "home" },\n[2] = { name = "copyright" },\n[3] = { name = "markup" },\n[4] = { name = "login", dynamic = { main = true } },' >> $(CONTENTDIR)/current_$(LANGUAGE)/.sections; fi
tmueller@0
    50
tmueller@96
    51
tmueller@0
    52
permissions:
tmueller@0
    53
	chmod -R 664 *
tmueller@0
    54
	chown -R :$(GROUP) *
tmueller@0
    55
	find . -type d | xargs chmod ugo+x
tmueller@93
    56
	chmod ugo+x $(CGIDIR)/loona.cgi
tmueller@133
    57
	chown -R $(WWWUSER) $(VARDIR)/sessions $(VARDIR)/htmlcache
tmueller@135
    58
	chown -R $(WWWUSER) $(CONTENTDIR) $(HTDIR)
tmueller@0
    59
	find . -name CVS -type d | xargs -r chmod g+rw
tmueller@129
    60
	-chown $(WWWUSER):$(GROUP) $(ETCDIR)/passwd.lua
tmueller@129
    61
	-chmod 460 $(ETCDIR)/passwd.lua
tmueller@0
    62
tmueller@96
    63
tmueller@96
    64
all: modules setup permissions
tmueller@96
    65
tmueller@0
    66
tmueller@0
    67
distclean: 
tmueller@0
    68
	-rm -Rf $(CONTENTDIR)
tmueller@0
    69
	-rm -Rf $(VARDIR)
tmueller@112
    70
	-rm cgi-bin/tek/*.o cgi-bin/tek/*.so cgi-bin/tek/web/*.o cgi-bin/tek/web/*.so
tmueller@141
    71
	-rm -f $(HTDIR)/*.html $(HTDIR)/*.html.*