#!/bin/bash ###################################################################### # $Id: makemake,v 1.11 2008/02/20 14:53:27 perette Exp $ # Author: Perette Barella # Purpose: This script generates a Makefile for a directory in a # Web page development hiearchy. It generates a list of # directories which are recursed into by 'build', # and a list of files which are to be compiled in the # current directory. The 'makedep.m4' macro package is # used to find dependencies with the .web files. # Options: -r - recurse into subdirectories. makemake runs itself # on all lower directories. ###################################################################### arg0=$(basename $0) if [ "$WEBBASE" = "" ] then echo "$arg0: WEBBASE undefined." exit 1 fi if [ ! -d "$WEBBASE" ] then echo "$arg0: WEBBASE does not point to a valid directory." exit 1 fi INCLUDE=${WEBBASE}/Include [ ! -s stddefs.m4 ] && $INCLUDE/makeinc dirs="" for file in * do [ -d "$file" -a \ "$file" != "RCS" -a "$file" != "SCCS" -a "$file" != "Thumbnails" -a \ ! -L "$file" -a ! -e "$file/.nomake" ] && dirs="$file $dirs" done files="$(echo *.web)" [ "$files" = "*.web" ] && files="" > Makefile [ -r Makefile.defs ] && echo "include Makefile.defs " >> Makefile echo "SUBDIRS=$dirs AUTOHTMLFILES=$(echo $files | sed 's/\.web/\.html/g') HTMLFILES=\$(AUTOHTMLFILES) \$(LOCALHTMLFILES) FILES=\${LOCALFILES} \${AUTOHTMLFILES} WEBBASE=${WEBBASE} include ${INCLUDE}/Makefile.inc" >> Makefile [ -r Makefile.local ] && echo "include Makefile.local" >> Makefile echo >> Makefile if [ "$files" != "" ] then for file in *.web do name=$(basename $file .web) depends=$(${M4:-m4} -D_DEPENDENCY=' #line 00 "$1" ' -P -s $file | grep '^#line' | cut -d'"' -f2 -s | sort -u) echo "${name}.html: " $depends >> Makefile done fi [ "$dirs" = "" ] && exit 0 if [ "$1" = "-R" -o "$1" = "-r" ] then for dir in $dirs do echo "$arg0: Building dependencies in $dir" cd $dir ${INCLUDE}/makemake -r cd .. done fi