Admin/website/build/main.mak
author haftmann
Sat, 04 Jun 2005 10:26:08 +0200
changeset 16233 e634d33deb86
child 16274 fb68cffed61f
permissions -rw-r--r--
added new website
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
16233
e634d33deb86 added new website
haftmann
parents:
diff changeset
     1
# isaweb makefile
e634d33deb86 added new website
haftmann
parents:
diff changeset
     2
# $Id$
e634d33deb86 added new website
haftmann
parents:
diff changeset
     3
e634d33deb86 added new website
haftmann
parents:
diff changeset
     4
# force shell
e634d33deb86 added new website
haftmann
parents:
diff changeset
     5
SHELL=bash
e634d33deb86 added new website
haftmann
parents:
diff changeset
     6
e634d33deb86 added new website
haftmann
parents:
diff changeset
     7
# some global variables
e634d33deb86 added new website
haftmann
parents:
diff changeset
     8
CONF=conf/localconf.mak
e634d33deb86 added new website
haftmann
parents:
diff changeset
     9
e634d33deb86 added new website
haftmann
parents:
diff changeset
    10
# configuration switch
e634d33deb86 added new website
haftmann
parents:
diff changeset
    11
ifeq ($(phase), init)
e634d33deb86 added new website
haftmann
parents:
diff changeset
    12
e634d33deb86 added new website
haftmann
parents:
diff changeset
    13
# allocate configuration
e634d33deb86 added new website
haftmann
parents:
diff changeset
    14
init:
e634d33deb86 added new website
haftmann
parents:
diff changeset
    15
	mkdir -p conf
e634d33deb86 added new website
haftmann
parents:
diff changeset
    16
	case $$HOSTNAME in sunbroy*) ARCH=sun;; *) ARCH=at;; esac; \
e634d33deb86 added new website
haftmann
parents:
diff changeset
    17
	sed 's/# $$Id.*//g' build/localconf.$$ARCH.template.mak > $(CONF)
e634d33deb86 added new website
haftmann
parents:
diff changeset
    18
	$$EDITOR $(CONF)
e634d33deb86 added new website
haftmann
parents:
diff changeset
    19
	@false
e634d33deb86 added new website
haftmann
parents:
diff changeset
    20
.PHONY: init
e634d33deb86 added new website
haftmann
parents:
diff changeset
    21
e634d33deb86 added new website
haftmann
parents:
diff changeset
    22
else
e634d33deb86 added new website
haftmann
parents:
diff changeset
    23
e634d33deb86 added new website
haftmann
parents:
diff changeset
    24
# default target
e634d33deb86 added new website
haftmann
parents:
diff changeset
    25
default: site
e634d33deb86 added new website
haftmann
parents:
diff changeset
    26
e634d33deb86 added new website
haftmann
parents:
diff changeset
    27
# check configuration
e634d33deb86 added new website
haftmann
parents:
diff changeset
    28
include $(CONF)
e634d33deb86 added new website
haftmann
parents:
diff changeset
    29
$(CONF):
e634d33deb86 added new website
haftmann
parents:
diff changeset
    30
	@if [ ! -e $(CONF) ]; \
e634d33deb86 added new website
haftmann
parents:
diff changeset
    31
	then \
e634d33deb86 added new website
haftmann
parents:
diff changeset
    32
		echo 'Framework not configured yet; set EDITOR environment variable'; \
e634d33deb86 added new website
haftmann
parents:
diff changeset
    33
		echo 'to your favorite editor and type'; \
e634d33deb86 added new website
haftmann
parents:
diff changeset
    34
		echo; \
e634d33deb86 added new website
haftmann
parents:
diff changeset
    35
		echo '    make phase=init'; \
e634d33deb86 added new website
haftmann
parents:
diff changeset
    36
		echo; \
e634d33deb86 added new website
haftmann
parents:
diff changeset
    37
		echo 'to configure it'; \
e634d33deb86 added new website
haftmann
parents:
diff changeset
    38
		false; \
e634d33deb86 added new website
haftmann
parents:
diff changeset
    39
	else \
e634d33deb86 added new website
haftmann
parents:
diff changeset
    40
		:; \
e634d33deb86 added new website
haftmann
parents:
diff changeset
    41
	fi
e634d33deb86 added new website
haftmann
parents:
diff changeset
    42
e634d33deb86 added new website
haftmann
parents:
diff changeset
    43
# tidy handling
e634d33deb86 added new website
haftmann
parents:
diff changeset
    44
ifeq ($(DISABLE_TIDY),)
e634d33deb86 added new website
haftmann
parents:
diff changeset
    45
TIDYCMD=$(TIDY) -q -i -asxhtml --output-xhtml true \
e634d33deb86 added new website
haftmann
parents:
diff changeset
    46
                --doctype auto \
e634d33deb86 added new website
haftmann
parents:
diff changeset
    47
                --literal-attributes true \
e634d33deb86 added new website
haftmann
parents:
diff changeset
    48
                --wrap 0 \
e634d33deb86 added new website
haftmann
parents:
diff changeset
    49
                --indent auto --indent-spaces 2 \
e634d33deb86 added new website
haftmann
parents:
diff changeset
    50
                --input-encoding utf8 --output-encoding latin1 \
e634d33deb86 added new website
haftmann
parents:
diff changeset
    51
                --logical-emphasis yes --gnu-emacs yes --write-back yes
e634d33deb86 added new website
haftmann
parents:
diff changeset
    52
else
e634d33deb86 added new website
haftmann
parents:
diff changeset
    53
TIDYCMD=:
e634d33deb86 added new website
haftmann
parents:
diff changeset
    54
endif
e634d33deb86 added new website
haftmann
parents:
diff changeset
    55
e634d33deb86 added new website
haftmann
parents:
diff changeset
    56
# dependencies
e634d33deb86 added new website
haftmann
parents:
diff changeset
    57
DEP_FILE=conf/depends.mak
e634d33deb86 added new website
haftmann
parents:
diff changeset
    58
site: $(DEP_FILE) allsite
e634d33deb86 added new website
haftmann
parents:
diff changeset
    59
.PHONY: site
e634d33deb86 added new website
haftmann
parents:
diff changeset
    60
e634d33deb86 added new website
haftmann
parents:
diff changeset
    61
# import dependencies
e634d33deb86 added new website
haftmann
parents:
diff changeset
    62
include $(DEP_FILE)
e634d33deb86 added new website
haftmann
parents:
diff changeset
    63
endif
e634d33deb86 added new website
haftmann
parents:
diff changeset
    64
e634d33deb86 added new website
haftmann
parents:
diff changeset
    65
# pypager iso-8859-1 hack
e634d33deb86 added new website
haftmann
parents:
diff changeset
    66
ifneq ($(FORCE_ISO_8859_1),)
e634d33deb86 added new website
haftmann
parents:
diff changeset
    67
FORCE_ENC_CMD=--encodinghtml "iso-8859-1"
e634d33deb86 added new website
haftmann
parents:
diff changeset
    68
else
e634d33deb86 added new website
haftmann
parents:
diff changeset
    69
FORCE_ENC_CMD=
e634d33deb86 added new website
haftmann
parents:
diff changeset
    70
endif
e634d33deb86 added new website
haftmann
parents:
diff changeset
    71
e634d33deb86 added new website
haftmann
parents:
diff changeset
    72
# import project-specific dependencies
e634d33deb86 added new website
haftmann
parents:
diff changeset
    73
include build/project.mak
e634d33deb86 added new website
haftmann
parents:
diff changeset
    74
e634d33deb86 added new website
haftmann
parents:
diff changeset
    75
# build dependencies
e634d33deb86 added new website
haftmann
parents:
diff changeset
    76
$(DEP_FILE): $(CONF)
e634d33deb86 added new website
haftmann
parents:
diff changeset
    77
	rm -f $(DEP_FILE); \
e634d33deb86 added new website
haftmann
parents:
diff changeset
    78
	touch $(DEP_FILE); \
e634d33deb86 added new website
haftmann
parents:
diff changeset
    79
	echo '# This is a generated file; do not edit' >> $(DEP_FILE); \
e634d33deb86 added new website
haftmann
parents:
diff changeset
    80
	echo >> $(DEP_FILE); \
e634d33deb86 added new website
haftmann
parents:
diff changeset
    81
	allstatic=''; \
e634d33deb86 added new website
haftmann
parents:
diff changeset
    82
	for dir in $(STATICDIRS); \
e634d33deb86 added new website
haftmann
parents:
diff changeset
    83
	do \
e634d33deb86 added new website
haftmann
parents:
diff changeset
    84
		for file in `$(FIND) $$dir -type f -a ! -path "*/CVS/*"`; \
e634d33deb86 added new website
haftmann
parents:
diff changeset
    85
		do \
e634d33deb86 added new website
haftmann
parents:
diff changeset
    86
			outputfile=$(OUTPUTROOT)/$$file; \
e634d33deb86 added new website
haftmann
parents:
diff changeset
    87
			outputdir=`dirname $$outputfile`; \
e634d33deb86 added new website
haftmann
parents:
diff changeset
    88
			echo "$$outputfile: $$file" >> $(DEP_FILE); \
e634d33deb86 added new website
haftmann
parents:
diff changeset
    89
			echo "	mkdir -p $$outputdir" >> $(DEP_FILE); \
e634d33deb86 added new website
haftmann
parents:
diff changeset
    90
			echo '	cp $$< $$@' >> $(DEP_FILE); \
e634d33deb86 added new website
haftmann
parents:
diff changeset
    91
			allstatic="$$allstatic$$outputfile "; \
e634d33deb86 added new website
haftmann
parents:
diff changeset
    92
			echo >> $(DEP_FILE); \
e634d33deb86 added new website
haftmann
parents:
diff changeset
    93
		done; \
e634d33deb86 added new website
haftmann
parents:
diff changeset
    94
	done; \
e634d33deb86 added new website
haftmann
parents:
diff changeset
    95
	echo "DEP_ALLSTATIC=$$allstatic" >> $(DEP_FILE); \
e634d33deb86 added new website
haftmann
parents:
diff changeset
    96
	echo >> $(DEP_FILE); \
e634d33deb86 added new website
haftmann
parents:
diff changeset
    97
	echo 'DEP_HTML=$$(DEP_ALLSTATIC) $$(DEP_SYMLINKS) include/documentationdist.include.html $(DEP_FILE) $(CONF)' >> $(DEP_FILE); \
e634d33deb86 added new website
haftmann
parents:
diff changeset
    98
	echo >> $(DEP_FILE); \
e634d33deb86 added new website
haftmann
parents:
diff changeset
    99
	allhtml=''; \
e634d33deb86 added new website
haftmann
parents:
diff changeset
   100
	for html in `$(FIND) . -name "*.html" -a ! -name "*.include.html"`; \
e634d33deb86 added new website
haftmann
parents:
diff changeset
   101
	do \
e634d33deb86 added new website
haftmann
parents:
diff changeset
   102
		outputfile=$(OUTPUTROOT)/$$html; \
e634d33deb86 added new website
haftmann
parents:
diff changeset
   103
		outputdir=`dirname $$outputfile`; \
e634d33deb86 added new website
haftmann
parents:
diff changeset
   104
		echo "$$outputfile: $$html"' $$(DEP_HTML)' >> $(DEP_FILE); \
e634d33deb86 added new website
haftmann
parents:
diff changeset
   105
		echo "	mkdir -p $$outputdir" >> $(DEP_FILE); \
e634d33deb86 added new website
haftmann
parents:
diff changeset
   106
		echo '	$(PYTHON) build/pypager.py --dtd="dtd/" $(FORCE_ENC_CMD) --srcroot="." --dstroot="$(OUTPUTROOT)" distname="$(DISTNAME)" $$< $$@' >> $(DEP_FILE); \
e634d33deb86 added new website
haftmann
parents:
diff changeset
   107
		echo '	-$(TIDYCMD) $$@' >> $(DEP_FILE); \
e634d33deb86 added new website
haftmann
parents:
diff changeset
   108
		allhtml="$$allhtml$$outputfile "; \
e634d33deb86 added new website
haftmann
parents:
diff changeset
   109
		echo >> $(DEP_FILE); \
e634d33deb86 added new website
haftmann
parents:
diff changeset
   110
	done; \
e634d33deb86 added new website
haftmann
parents:
diff changeset
   111
	echo "DEP_ALLHTML=$$allhtml" >> $(DEP_FILE); \
e634d33deb86 added new website
haftmann
parents:
diff changeset
   112
	echo >> $(DEP_FILE); \
e634d33deb86 added new website
haftmann
parents:
diff changeset
   113
	echo 'allsite: $$(DEP_ALLHTML) $$(DEP_ALLSTATIC)' >> $(DEP_FILE); \
e634d33deb86 added new website
haftmann
parents:
diff changeset
   114
	echo ".PHONY: allsite" >> $(DEP_FILE)
e634d33deb86 added new website
haftmann
parents:
diff changeset
   115
e634d33deb86 added new website
haftmann
parents:
diff changeset
   116
# build dependencies explicitly
e634d33deb86 added new website
haftmann
parents:
diff changeset
   117
depends:
e634d33deb86 added new website
haftmann
parents:
diff changeset
   118
	rm -f $(DEP_FILE)
e634d33deb86 added new website
haftmann
parents:
diff changeset
   119
	$(MAKE) $(DEP_FILE)
e634d33deb86 added new website
haftmann
parents:
diff changeset
   120
.PHONY: depends
e634d33deb86 added new website
haftmann
parents:
diff changeset
   121
e634d33deb86 added new website
haftmann
parents:
diff changeset
   122
# clean build files
e634d33deb86 added new website
haftmann
parents:
diff changeset
   123
clean:
e634d33deb86 added new website
haftmann
parents:
diff changeset
   124
	rm -f $(DEP_FILE)
e634d33deb86 added new website
haftmann
parents:
diff changeset
   125
.PHONY: clean