d70b175d5479 lisp

Build the generator into a binary for speed
[view raw] [browse files]
author Steve Losh <steve@stevelosh.com>
date Wed, 08 Jan 2020 22:10:26 -0800
parents 53b4573ab42b
children b98008bc3c58
branches/tags lisp
files Makefile build.sh generate.lisp

Changes

--- a/Makefile	Wed Jan 08 22:10:12 2020 -0800
+++ b/Makefile	Wed Jan 08 22:10:26 2020 -0800
@@ -1,8 +1,15 @@
+.PHONY: all thumbnails
+
 photos := $(shell ffind 'static/media/images/photography/photos/.*/.*.jpg' --entire)
 thumbs := $(subst photos,thumbnails,$(photos))
 
 THUMBNAIL_CMD = convert $< -resize "200^>" -gravity center -crop 200x200+0+0 -strip $@
 
+all: generate thumbnails
+
+generate: generate.lisp
+	sbcl --load generate.lisp --eval '(stevelosh.com:build)'
+
 thumbnails: $(thumbs)
 
 static/media/images/photography/thumbnails/plants/%.jpg: static/media/images/photography/photos/plants/%.jpg
--- a/build.sh	Wed Jan 08 22:10:12 2020 -0800
+++ b/build.sh	Wed Jan 08 22:10:26 2020 -0800
@@ -2,8 +2,8 @@
 
 set -euo pipefail
 
-make thumbnails
 mkdir -p build
-sbcl --non-interactive --load generate.lisp --eval '(stevelosh.com:toplevel)'
+make
+./generate
 rsync -avd static/ build/static
 heading smslant 'done'
--- a/generate.lisp	Wed Jan 08 22:10:12 2020 -0800
+++ b/generate.lisp	Wed Jan 08 22:10:26 2020 -0800
@@ -8,7 +8,7 @@
   (:use :cl :iterate :losh)
   (:import-from :cl-who
     :with-html-output :htm :str :fmt)
-  (:export :toplevel))
+  (:export :toplevel :build))
 
 (in-package :stevelosh.com)
 
@@ -465,10 +465,9 @@
     (page/simple resume)
     (page/rss blog-entries)))
 
+(defun build ()
+  (sb-ext:save-lisp-and-die "generate" :executable t :toplevel 'toplevel))
+
 
 #; Scratch --------------------------------------------------------------------
 
-(defparameter *blog-entries*
-  (walk "content/blog"))
-
-(plump:parse *x*)