10bbfda8aSnia#!/bin/sh 20bbfda8aSniacd `dirname $0` 30bbfda8aSnia 40bbfda8aSniaecho "Generating Makefile" 50bbfda8aSniaexec 4<&1 60bbfda8aSniaexec 1>Makefile 70bbfda8aSnia 80bbfda8aSnia# Will need to be smarter if/when we add a 'combined'. 90bbfda8aSniaFILES="*.adoc" 100bbfda8aSnia 110bbfda8aSnia 120bbfda8aSnia# Heading 130bbfda8aSniacat << EOF 140bbfda8aSnia## GENERATED FILE 150bbfda8aSnia 160bbfda8aSniaBDIR=build 170bbfda8aSniaADOC=asciidoctor -atoc -anumbered 180bbfda8aSnia 190bbfda8aSnia# Default target 200bbfda8aSniaall: \${BDIR} 210bbfda8aSnia 220bbfda8aSnia\${BDIR}: 230bbfda8aSnia mkdir -p \${BDIR} 24b18c2d1eSnia (cd \${BDIR} && ln -s ../static .) 250bbfda8aSnia 260bbfda8aSniaclean: 270bbfda8aSnia rm -rf \${BDIR} 280bbfda8aSnia 290bbfda8aSniaallclean: clean 300bbfda8aSnia rm -f Makefile 310bbfda8aSnia 320bbfda8aSnia 330bbfda8aSnia# Individual files 340bbfda8aSnia 350bbfda8aSniaEOF 360bbfda8aSnia 370bbfda8aSnia 380bbfda8aSnia# Now list the files 390bbfda8aSniafor i in ${FILES}; do 400bbfda8aSnia in="${i}" 410bbfda8aSnia out="\${BDIR}/`echo ${i} | sed -E -e 's/(.*)\.adoc/\1.html/'`" 420bbfda8aSnia echo "all: ${out}" 430bbfda8aSnia echo "${out}: \${BDIR} ${in}" 440bbfda8aSnia printf "\t\${ADOC} -o ${out} ${in}\n" 450bbfda8aSnia echo 460bbfda8aSniadone 470bbfda8aSnia 480bbfda8aSnia 490bbfda8aSnia 500bbfda8aSniaexec 1<&4 510bbfda8aSnia 520bbfda8aSniaecho "Done." 53