Euchre web-app for the socially distant family
git clone git://
Log | Files | Refs | README | LICENSE

commit 14480732a8194c8e1fe54ef83e67c3838be276bd (patch)
parent 97b41cd38bf92fd09d3da6cf4c4fbab852fc4a25
Author: Alex Karle <>
Date:   Wed, 13 May 2020 00:17:33 -0400

make: Add proper dependency logic to build/release

As mentioned in the top comment, building webpack take both over a
minute on my development laptop and gets my fans spinning real good.

So for cutting a release where no public content has changed, it's
reallllly painful to have to sit through that! (ok, I exaggerate, but my
hobby time is precious!)

Thankfully, this is exactly what make was built for -- only building
that which has changed. Throw in a couple `find`'s and some dependency
magic with timestamp files and boom, we don't have to rebuild webpack

M.gitignore | 1+
MMakefile | 23++++++++++++++++++++--- | 9---------
3 files changed, 21 insertions(+), 12 deletions(-)

diff --git a/.gitignore b/.gitignore @@ -3,3 +3,4 @@ public/asset tags /build/ /build.*/ +.public.ts diff --git a/Makefile b/Makefile @@ -1,3 +1,8 @@ +# Rebuilding the webpack for a server-only release is a painful +# few minutes on my poor old thinkpad. We can do better +PUBLIC_FILES := $(shell find public -type f) +LIB_FILES := $(shell find lib -type f) + .PHONY: all all: test tags @@ -10,12 +15,24 @@ test: perl -c perl t/Rules.t -.PHONY: release -release: test +# If no public files have changed, don't rebuild the webpack! +# We make this timestamp file the dependency for build to +# ensure we don't do it too often... +.public.ts: $(PUBLIC_FILES) ./ + touch .public.ts + +# Only rebuild if any of public/ or the Perl stuff has changed +build: .public.ts $(LIB_FILES) + mkdir -p build + cp -a public lib build + @echo ">>> Build Success! <<<" + +.PHONY: release +release: build test scp -r build/* ssh sh /var/www/ .PHONY: clean clean: - rm -rf build build.1* + rm -rf build diff --git a/ b/ @@ -15,12 +15,3 @@ export MOJO_WEBPACK_BUILD=1 # Run an effectively no-op (non daemonizing) command to kick it off ./ routes - -# Make the build directory -[ -d "build" ] && mv build build.`date +%s` -mkdir build -cp -a public lib build - -echo "---------------------------------------------------------------" -echo " Build Success!" -echo "---------------------------------------------------------------"