Commit 56f4b611 authored by Rémi Denis-Courmont's avatar Rémi Denis-Courmont

Files to preprocess the website

parent badfb028
The purpose of the Makefile is to preprocess website's pages
statically through the PHP processor, so as to reduce the load on the
web server.
In each directories, you should create a Makefile.inc file that will
be included by the Makefile scripts. In that file, you can create a
SUBDIR variable to specify the list of subdirectories.
--
Remi Denis-Courmont
#!/usr/bin/make -f
#
# Makefile to build PHP-based websites statically
# by Remi Denis-Courmont
# $Id$
ifeq ($(ROOT),)
ROOT := ./
NEXTROOT := ../
else
NEXTROOT := ../$(ROOT)
endif
PHPCGI := $(ROOT)php-cgi.sh
STRIP_HEADERS := $(ROOT)strip-headers.sh
all: real-all
include Makefile.inc
ifeq ($(PHP_FILES),)
PHP_FILES := $(wildcard *.html)
endif
TARGETS := $(PHP_FILES:%.html=%.tmp)
real-all: $(TARGETS) all-recursive
clean: clean-recursive
rm -f $(TARGETS)
%-recursive:
@for d in $(SUBDIR) ; do \
$(MAKE) -f $(NEXTROOT)Makefile -C $$d ROOT=$(NEXTROOT) $* \
|| exit $$? ; \
done
$(TARGETS): %.tmp: %.html $(ROOT)Makefile
@echo "Preprocessing $@ ..."
@DOCUMENT_ROOT=$(ROOT) $(PHPCGI) $< | $(STRIP_HEADERS) > $@
.PHONY: clean all
# Subdirectories to be preprocessed
SUBDIR = doc events removed rez streaming support team vlc
# Additionnal dependencies
news.tmp: news.msg
index.tmp: news.msg
#!/bin/sh
#
# Script to call the PHP Hypertext Processor as a CGI script
# -- Courmisch 21/10/2004
#
# $Id: phpcgi.sh 1960 2004-11-01 16:52:30Z dionoea $
# It won't work if you call the PHP CLI usually in /usr/bin or /usr/local/bin
PHP=/usr/lib/cgi-bin/php4
# CGI/1.1 interface variables
export SERVER_SOFTWARE="Shell CGI/0.1"
export SERVER_NAME="localhost"
export GATEWAY_INTERFACE="CGI/1.1"
export SERVER_PROTOCOL="HTTP/1.1"
export SERVER_PORT="80"
export REQUEST_METHOD="GET"
export PATH_INFO=`echo "$1" | cut -d '?' -f1`
export PATH_TRANSLATED="${2}${PATH_INFO}"
export SCRIPT_NAME="/cgi-bin/php4"
export QUERY_STRING=`echo "$1" | cut -d '?' -f2`
export REMOTE_HOST="localhost"
export REMOTE_ADDR="127.0.0.1"
#export AUTH_TYPE
#export REMOTE_USER
#export REMOTE_IDENT
# CGI Redirect security workaround
export REDIRECT_STATUS=200
export REDIRECT_QUERY_STRING="$QUERY_STRING"
export REDIRECT_URL="$PATH_INFO"
$PHP < /dev/null
#!/bin/sh
#
# Small script to remove HTTP headers generated by CGI scripts
#
# $Id$
while read l; do
len=${#l}
if test "$len" -le 1; then
exec cat
fi
done
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment