# or otherwise start in a clean source tree (such as a
# after a fresh "git clone" or use "git clean -f -x -d).
#
+CP=cp
+BABEL=babeljs
ifeq ($(LMNO_BUILD),production)
react.js: deps/react.production.min.js
- cp $^ $@
+ $(call quiet,CP) $^ $@
react-dom.js: deps/react-dom.production.min.js
- cp $^ $@
+ $(call quiet,CP) $^ $@
+export BABEL_ENV=production
%.js: %.jsx
- BABEL_ENV=production babeljs $^ --out-file $@
+ $(call quiet,BABEL) $^ --out-file $@
else
react.js: deps/react.development.js
- cp $^ $@
+ $(call quiet,CP) $^ $@
react-dom.js: deps/react-dom.development.js
- cp $^ $@
+ $(call quiet,CP) $^ $@
+export BABEL_ENV=development
%.js: %.jsx
- BABEL_ENV=development babeljs $^ --out-file $@
+ $(call quiet,BABEL) $^ --out-file $@
endif
-checksums: $(REACT_DOWNLOADS)
- sha512sum --strict -c checksums.sha512
-
-deps/react.development.js:
- wget -nv -nc -P deps https://unpkg.com/react@16/umd/react.development.js
+# The user has not set any verbosity, default to quiet mode and inform the
+# user how to enable verbose compiles.
+ifeq ($(V),)
+quiet_DOC := "Use \"$(MAKE) V=1\" to see the verbose compile lines.\n"
+quiet = @printf $(quiet_DOC)$(eval quiet_DOC:=)"$(1) $(or $(2),$@)\n"; $($(word 1, $(1)))
+WGET_VERBOSE_FLAGS=--quiet
+endif
+# The user has explicitly enabled quiet compilation.
+ifeq ($(V),0)
+quiet = @printf "$(1) $(or $(2),$@)\n"; $($(word 1, $(1)))
+WGET_VERBOSE_FLAGS=--quiet
+endif
+# Otherwise, print the full command line.
+quiet ?= $($(word 1, $(1)))
+WGET_VERBOSE_FLAGS ?= --no-verbose
-deps/react-dom.development.js:
- wget -nv -nc -P deps https://unpkg.com/react-dom@16/umd/react-dom.development.js
+SHA512=sha512sum --strict -c
+.PHONY: deps
+deps: $(REACT_DOWNLOADS)
+ $(call quiet,SHA512) deps/*.sha512
-deps/react.production.min.js:
- wget -nv -nc -P deps https://unpkg.com/react@16/umd/react.production.min.js
+DOWNLOAD=wget $(WGET_VERBOSE_FLAGS) -nc -P deps
+deps/react.%.js:
+ $(call quiet,DOWNLOAD) https://unpkg.com/react@16/umd/$(@:deps/%=%)
+ $(call quiet,SHA512) $(@:%=%.sha512)
-deps/react-dom.production.min.js:
- wget -nv -nc -P deps https://unpkg.com/react-dom@16/umd/react-dom.production.min.js
+deps/react-dom.%.js:
+ $(call quiet,DOWNLOAD) https://unpkg.com/react-dom@16/umd/$(@:deps/%=%)
+ $(call quiet,SHA512) $(@:%=%.sha512)
deploy:
rm -rf .deploy-source
git clone . .deploy-source
+ cp deps/*.js .deploy-source/deps
+ make -C .deploy-source deps
make -C .deploy-source LMNO_BUILD=production
rm -rf .deploy-source/.git
(cd .deploy-source; rsync -avz \
clean:
rm -f $(JS_TARGETS)
rm -f $(REACT_DEPS)
- rm -f $(REACT_DOWNLOADS)
+ rm -f deps/*.js