From 5490f1fd18fcc445f0c48a1ed830678e0f69ac0f Mon Sep 17 00:00:00 2001 From: Vincent Douillet Date: Thu, 26 May 2022 18:49:59 +0200 Subject: switch to perl script to make the site --- Makefile | 46 ++++++++-------------------------------------- 1 file changed, 8 insertions(+), 38 deletions(-) (limited to 'Makefile') diff --git a/Makefile b/Makefile index 3e4c1e3..c87940d 100644 --- a/Makefile +++ b/Makefile @@ -26,51 +26,21 @@ # ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE # POSSIBILITY OF SUCH DAMAGE. -MD=Markdown.pl -.SUFFIXES: .md .html -articles!=ls *.md -articles_html = ${articles:.md=.html} +PERL5LIB=/home/vincent/perl5/lib/perl5 -site : index about $(articles_html) +site : + @PERL5LIB=$(PERL5LIB) ./makesite.pl @echo "Copying static resources" @cp static/favicon.ico output/ @mkdir -p output/static @cp static/passthrough/* output/static @echo "done" -index : - @echo "Building $@" - @cat template/header.html > output/$@.html - @sed -i "s/\$$title/blog\.vdouillet\.fr/g" output/$@.html - @echo '' >> output/$@.html - @cat template/index.html >> output/$@.html - @echo '' >> output/$@.html - @cat template/footer.html >> output/$@.html - @gzip -k output/$@.html - -about : - @echo "Building $@" - @cat template/header.html > output/$@.html - @sed -i "s/\$$title/About/g" output/$@.html - @echo '' >> output/$@.html - @$(MD) static/$@.md >> output/$@.html - @echo '' >> output/$@.html - @cat template/footer.html >> output/$@.html - @gzip -k output/$@.html - -# compile each article -.md.html: - @echo "Processing $<" - @cat template/header.html > tmp.html - @ARTICLE_TITLE=`head -n1 $< | cut -d'#' -f2` ; \ - sed -i "s/\$$title/$$ARTICLE_TITLE/g" tmp.html - @echo '
' >> tmp.html - @$(MD) $< >> tmp.html - @cat template/back.html >> tmp.html - @cat template/footer.html >> tmp.html - @echo '
' >> tmp.html - @mv tmp.html output/`echo $@ | cut -d'-' -f2- -` - @gzip -k output/`echo $@ | cut -d'-' -f2- -` +setup : + mkdir -p output + PERL5LIB=$(PERL5LIB) perl -MCPAN -e"install File::Cat" + PERL5LIB=$(PERL5LIB) perl -MCPAN -e"install File::Slurp" + PERL5LIB=$(PERL5LIB) perl -MCPAN -e"install Text::Markdown" clean : rm -rf output/* -- cgit v1.2.3