mkmk.sh revision 0bbfda8a
1#!/bin/sh 2cd `dirname $0` 3 4echo "Generating Makefile" 5exec 4<&1 6exec 1>Makefile 7 8# Will need to be smarter if/when we add a 'combined'. 9FILES="*.adoc" 10 11 12# Heading 13cat << EOF 14## GENERATED FILE 15 16BDIR=build 17ADOC=asciidoctor -atoc -anumbered 18 19# Default target 20all: \${BDIR} 21 22\${BDIR}: 23 mkdir -p \${BDIR} 24 25clean: 26 rm -rf \${BDIR} 27 28allclean: clean 29 rm -f Makefile 30 31 32# Individual files 33 34EOF 35 36 37# Now list the files 38for i in ${FILES}; do 39 in="${i}" 40 out="\${BDIR}/`echo ${i} | sed -E -e 's/(.*)\.adoc/\1.html/'`" 41 echo "all: ${out}" 42 echo "${out}: \${BDIR} ${in}" 43 printf "\t\${ADOC} -o ${out} ${in}\n" 44 echo 45done 46 47 48 49exec 1<&4 50 51echo "Done." 52