Makefile
author root@roadshow
Mon, 12 Feb 2007 12:23:16 +0100
changeset 2 1cc19e4dfa82
parent 0 d4b36cfa50e8
child 93 f8e0c44094fc
permissions -rw-r--r--
Improved defaults and commentary in config and Makefiles
root@2
     1
#
root@2
     2
#	Loona Makefile
root@2
     3
#	
tmueller@0
     4
tmueller@0
     5
WWWUSER ?= apache
tmueller@0
     6
GROUP ?= apache
tmueller@0
     7
LANGUAGE ?= en
tmueller@0
     8
root@2
     9
tmueller@0
    10
CONTENTDIR ?= content
tmueller@0
    11
VARDIR ?= var
tmueller@0
    12
SESSIONDIR ?= $(VARDIR)/sessions
tmueller@0
    13
CGIDIR ?= cgi-bin
tmueller@0
    14
ETCDIR ?= etc
tmueller@0
    15
tmueller@0
    16
help:
tmueller@0
    17
	@echo
tmueller@0
    18
	@echo "Loona make targets"
tmueller@0
    19
	@echo "-------------------------------------------------------------------------------"
tmueller@0
    20
	@echo "help .......... This help"
root@2
    21
	@echo
tmueller@0
    22
	@echo "modules ....... Build modules"
tmueller@0
    23
	@echo "setup ......... Create initial site structure [LANGUAGE: $(LANGUAGE)]"
tmueller@0
    24
	@echo "permissions ... Set permissions [WWWUSER: $(WWWUSER), GROUP: $(GROUP)]"
root@2
    25
	@echo
root@2
    26
	@echo "all ........... All of the above: modules, setup, permissions"
tmueller@0
    27
	@echo
tmueller@0
    28
	@echo "NOTE .......... Set environment variables to complement your setup, e.g."
tmueller@0
    29
	@echo "                % LANGUAGE=de WWWUSER=wwwrun make help"
root@2
    30
	@echo "                or make settings persistent by changing them in the Makefile"
tmueller@0
    31
	@echo
tmueller@0
    32
tmueller@0
    33
clean install modules: 
tmueller@0
    34
	$(MAKE) -C cgi-bin $@
tmueller@0
    35
tmueller@0
    36
setup:
tmueller@0
    37
	mkdir -p $(CONTENTDIR)
tmueller@0
    38
	-cd $(CONTENTDIR) && mkdir default_$(LANGUAGE)
tmueller@0
    39
	cd $(CONTENTDIR) && ln -snf default_$(LANGUAGE) current_$(LANGUAGE)
tmueller@0
    40
	mkdir -p $(SESSIONDIR)
tmueller@0
    41
	if test ! -f $(CONTENTDIR)/current_$(LANGUAGE)/.sections; then echo '[1] = { name = "login" }' >> $(CONTENTDIR)/current_$(LANGUAGE)/.sections; fi
tmueller@0
    42
	if test ! -f $(CONTENTDIR)/current_$(LANGUAGE)/login; then echo 'INCLUDE(login)' >> $(CONTENTDIR)/current_$(LANGUAGE)/login; fi
tmueller@0
    43
tmueller@0
    44
permissions:
tmueller@0
    45
	chmod -R 664 *
tmueller@0
    46
	chown -R :$(GROUP) *
tmueller@0
    47
	find . -type d | xargs chmod ugo+x
tmueller@0
    48
	chmod ugo+x $(CGIDIR)/weblua.cgi
tmueller@0
    49
	chown -R $(WWWUSER) $(SESSIONDIR)
tmueller@0
    50
	chown -R $(WWWUSER) $(CONTENTDIR)
tmueller@0
    51
	find . -name CVS -type d | xargs -r chmod g+rw
tmueller@0
    52
	chown $(WWWUSER):$(GROUP) $(ETCDIR)/passwd.lua
tmueller@0
    53
	chmod 460 $(ETCDIR)/passwd.lua
tmueller@0
    54
tmueller@0
    55
all:	modules setup permissions
tmueller@0
    56
tmueller@0
    57
distclean: 
tmueller@0
    58
	-rm -Rf $(CONTENTDIR)
tmueller@0
    59
	-rm -Rf $(VARDIR)