]> git.cworth.org Git - lmno.games/commitdiff
Makefile: Fix downloading of React javascript files
authorCarl Worth <cworth@cworth.org>
Fri, 5 Jun 2020 17:09:52 +0000 (10:09 -0700)
committerCarl Worth <cworth@cworth.org>
Fri, 5 Jun 2020 17:09:52 +0000 (10:09 -0700)
This has not worke since commit b5bcbc45f19ee068478edb73b48bc7194e582da8

There were two things broken in that commit:

  1. It was inserting a "deps/" into the URL for downloading, (which
     doesn't exist---we only have "deps/" in the local filesystem.

  2. It wasn't distinguishing "react-dom@16" from "react@16" in the
     URL, (half of the files we download need one, and half the
     other).

This commit fixes both. The first by using a "substitution reference"
with the $@ variable to remove the "deps/" from its value when
constructing the URL. And the second by splitting the existing rule
into two rules.

Whle here, we also replace the use of the patsubt function in the
SHA512 recipe with the simpler substitution reference exactly as we
are now using it in the line before.

Makefile

index cf1e1d7008e05a1d7ee18e81103c11b4e3a7b722..4132e9652cea38de0140aa220721beea3ad5a035 100644 (file)
--- a/Makefile
+++ b/Makefile
@@ -75,9 +75,13 @@ deps: $(REACT_DOWNLOADS)
        $(call quiet,SHA512) deps/*.sha512
 
 DOWNLOAD=wget $(WGET_VERBOSE_FLAGS) -nc -P deps
-deps/%.js:
-       $(call quiet,DOWNLOAD) https://unpkg.com/react@16/umd/$@
-       $(call quiet,SHA512) $(patsubst %,%.sha512,$@)
+deps/react.%.js:
+       $(call quiet,DOWNLOAD) https://unpkg.com/react@16/umd/$(@:deps/%=%)
+       $(call quiet,SHA512) $(@:%=%.sha512)
+
+deps/react-dom.%.js:
+       $(call quiet,DOWNLOAD) https://unpkg.com/react-dom@16/umd/$(@:deps/%=%)
+       $(call quiet,SHA512) $(@:%=%.sha512)
 
 deploy:
        rm -rf .deploy-source