mirror of
https://github.com/logicog/RTLPlayground.git
synced 2026-10-29 17:54:14 +08:00
Merge pull request #534 from DrDoof/fix/html-min-stamp
build: minify the web files only when they change
This commit is contained in:
2 files changed
+19
-6
No files matched your search
@@ -148,13 +148,23 @@ HTML := $(shell find html -name '*.js' -or -name '*.html' -or -name '*.svg' -or
|
|||||||
# The raw html/ sources stay untouched for development; the minified
|
# The raw html/ sources stay untouched for development; the minified
|
||||||
# copy is a build artifact under output/.
|
# copy is a build artifact under output/.
|
||||||
HTML_MIN := $(BUILDDIR)/html_min
|
HTML_MIN := $(BUILDDIR)/html_min
|
||||||
|
HTML_MIN_LIST := $(BUILDDIR)/html_min.list
|
||||||
|
HTML_MIN_STAMP := $(BUILDDIR)/html_min.stamp
|
||||||
.PHONY: html_min
|
.PHONY: html_min
|
||||||
html_min: $(HTML)
|
html_min: $(HTML_MIN_STAMP)
|
||||||
|
|
||||||
|
$(HTML_MIN_LIST): FORCE
|
||||||
|
@mkdir -p $(BUILDDIR)
|
||||||
|
@echo $(sort $(HTML)) > $@.tmp
|
||||||
|
@cmp -s $@.tmp $@ && rm -f $@.tmp || mv $@.tmp $@
|
||||||
|
|
||||||
|
$(HTML_MIN_STAMP): $(HTML) $(HTML_MIN_LIST) tools/minify.py $(if $(wildcard $(HTML_MIN)),,FORCE)
|
||||||
rm -rf $(HTML_MIN)
|
rm -rf $(HTML_MIN)
|
||||||
mkdir -p $(HTML_MIN)
|
mkdir -p $(HTML_MIN)
|
||||||
@for f in $(HTML); do python3 tools/minify.py $$f $(HTML_MIN)/$$(basename $$f) || exit 1; done
|
@for f in $(HTML); do python3 tools/minify.py $$f $(HTML_MIN)/$$(basename $$f) || exit 1; done
|
||||||
|
@touch $@
|
||||||
|
|
||||||
html_data.c html_data.h &: $(HTML) | tools html_min
|
html_data.c html_data.h &: $(HTML_MIN_STAMP) | tools
|
||||||
tools/$(BUILDDIR)/fileadder -a $(HTML_LOCATION) -s $(IMAGESIZE) -b BANK1 -z -d $(HTML_MIN) -p html_data
|
tools/$(BUILDDIR)/fileadder -a $(HTML_LOCATION) -s $(IMAGESIZE) -b BANK1 -z -d $(HTML_MIN) -p html_data
|
||||||
|
|
||||||
$(VERSION_HEADER): FORCE
|
$(VERSION_HEADER): FORCE
|
||||||
@@ -172,11 +182,11 @@ $(SUBDIRS):
|
|||||||
$(MAKE) -C $@ BUILDDIR=$(BUILDDIR)
|
$(MAKE) -C $@ BUILDDIR=$(BUILDDIR)
|
||||||
|
|
||||||
clean: $(SUBDIRSCLEAN)
|
clean: $(SUBDIRSCLEAN)
|
||||||
-rm -f html_data.c html_data.h $(VERSION_HEADER)
|
-rm -f html_data.c html_data.h $(VERSION_HEADER) $(HTML_MIN_LIST) $(HTML_MIN_STAMP)
|
||||||
-if [ -d $(BUILDDIR) ]; then find $(BUILDDIR) -type f ! -name "*.bin" -delete; fi
|
-if [ -d $(BUILDDIR) ]; then find $(BUILDDIR) -type f ! -name "*.bin" -delete; fi
|
||||||
|
|
||||||
distclean: $(SUBDIRSCLEAN)
|
distclean: $(SUBDIRSCLEAN)
|
||||||
-rm -f html_data.c html_data.h $(VERSION_HEADER)
|
-rm -f html_data.c html_data.h $(VERSION_HEADER) $(HTML_MIN_LIST) $(HTML_MIN_STAMP)
|
||||||
-rm -rf $(BUILDDIR)
|
-rm -rf $(BUILDDIR)
|
||||||
-rm -rf toolchain
|
-rm -rf toolchain
|
||||||
|
|
||||||
|
|||||||
@@ -79,8 +79,11 @@ JSON polling of the visible section).
|
|||||||
computation no longer depends on uninitialised buffer content.
|
computation no longer depends on uninitialised buffer content.
|
||||||
- `version.h` is now written by a single atomic `printf` (change from
|
- `version.h` is now written by a single atomic `printf` (change from
|
||||||
upstream) instead of five separate `echo`s, so a parallel build
|
upstream) instead of five separate `echo`s, so a parallel build
|
||||||
(`make -j`) can no longer read a half-written copy. It stays in
|
(`make -j`) can no longer read a half-written copy. It depends on
|
||||||
`.PHONY` so it is regenerated on every build.
|
`FORCE`, so its recipe runs on every build, but the file is only
|
||||||
|
rewritten when its content changes. The minified copy in
|
||||||
|
`output/html_min/` is redone only when a web file, the list of web
|
||||||
|
files or `tools/minify.py` changes.
|
||||||
|
|
||||||
## Verification
|
## Verification
|
||||||
|
|
||||||
|
|||||||
Reference in new issue
Block a user