mirror of
ssh://git.janware.com/srv/git/janware/proj/jw-pkg
synced 2026-01-15 03:53:32 +01:00
make, scripts: Re-add files necessary for building ytools
Re-add everthing needed for building and packaging ytools. This is a big commit, 2002 lines of code. It mostly consists of C/C++ machinery, plus some documentation-related stuff. Signed-off-by: Jan Lindemann <jan@janware.com>
This commit is contained in:
parent
0a9340af49
commit
bf16c6714b
27 changed files with 1975 additions and 0 deletions
31
make/js.mk
Normal file
31
make/js.mk
Normal file
|
|
@ -0,0 +1,31 @@
|
|||
JAVA ?= /usr/bin/java
|
||||
JS_MINIFY_FILTER_IN ?= sed 's/console\.[a-z]\+([^)]\+) *;//g'
|
||||
JS_SRC ?= $(filter-out %.min.js,$(wildcard *.js))
|
||||
JS_GENERATED ?= $(patsubst %.js,%.min.js,$(JS_SRC))
|
||||
JS_EXTRA_EXTERNS ?=
|
||||
JS_CC_BUILD_ROOT ?= $(PROJECTS_DIR)/closure-compiler/contrib/closure-compiler/install-root
|
||||
JS_EXTERNS_DIRS ?= $(firstword $(wildcard $(JS_CC_BUILD_ROOT)/$(realpath $(PROJECTS_DIR))/closure-compiler/share/externs /opt/closure-compiler/share/externs))
|
||||
JS_EXTERNS ?= $(sort $(JS_EXTRA_EXTERNS) jquery-3.3.js)
|
||||
JS_EXTERN_PATHS ?= $(wildcard $(foreach d,$(JS_EXTERNS_DIRS),$(addprefix $d/,$(JS_EXTERNS))))
|
||||
JS_MINIFY_OPTS ?= $(addprefix --externs ,$(JS_EXTERN_PATHS)) --compilation_level ADVANCED --strict_mode_input
|
||||
JS_MINIFY_EXE ?= $(JAVA) -jar $(firstword $(wildcard \
|
||||
$(JS_CC_BUILD_ROOT)/usr/share/java/closure-compiler.jar \
|
||||
/usr/share/java/closure-compiler.jar \
|
||||
) closure-compiler.jar-not-found)
|
||||
JS_MINIFY ?= $(JS_MINIFY_EXE) $(JS_MINIFY_OPTS)
|
||||
|
||||
# This is not nice. It requires install-files to be included from elsewhere,
|
||||
# which is not obvious. OTOH, if it isn't, SOURCE_FILES doesn't do any harm,
|
||||
# either.
|
||||
SOURCE_FILES += $(JS_GENERATED)
|
||||
|
||||
all: $(JS_GENERATED)
|
||||
clean: minify.clean
|
||||
|
||||
%.min.js: %.js
|
||||
cat $< | $(JS_MINIFY_FILTER_IN) > $@.filtered
|
||||
$(JS_MINIFY) $@.filtered > $@.tmp
|
||||
mv $@.tmp $@
|
||||
|
||||
minify.clean:
|
||||
rm -f $(JS_GENERATED) *.tmp *.filtered
|
||||
Loading…
Add table
Add a link
Reference in a new issue