modular strip (except android yet, ios, daisy-seed)

This commit is contained in:
Stefano D'Angelo 2025-01-04 09:50:15 +01:00
parent dce3373d9b
commit 7bdceca9dd
6 changed files with 36 additions and 15 deletions

View File

@ -78,6 +78,10 @@ DIRS := build build/obj
ALL := build/$(PROGRAM) ALL := build/$(PROGRAM)
STRIP_ALL := build/$(PROGRAM)
STRIP_PHONY :=
STRIP_PREREQS := $(STRIP_ALL) $(STRIP_PHONY)
-include $(MKINC_DIR)/vars-extra.mk -include $(MKINC_DIR)/vars-extra.mk
all: $(ALL) all: $(ALL)
@ -96,17 +100,17 @@ $(DIRS):
clean: clean:
rm -fr build rm -fr build
strip: all strip: $(STRIP_PREREQS)
strip build/$(PROGRAM) strip build/$(PROGRAM)
ifeq ($(OS), Windows_NT) ifeq ($(OS), Windows_NT)
.PHONY: all clean .PHONY: all clean strip $(STRIP_PHONY)
else else
install: all install: all
mkdir -m 0755 -p $(BINDIR) mkdir -m 0755 -p $(BINDIR)
install -m 0755 build/$(PROGRAM) $(BINDIR) install -m 0755 build/$(PROGRAM) $(BINDIR)
.PHONY: all clean strip install .PHONY: all clean strip $(STRIP_PHONY) install
endif endif
-include $(MKINC_DIR)/rules-extra.mk -include $(MKINC_DIR)/rules-extra.mk

View File

@ -92,6 +92,10 @@ DIRS := build build/$(BUNDLE_DIR) build/obj
ALL := build/$(BUNDLE_DIR)/manifest.ttl build/$(BUNDLE_DIR)/$(DLL_FILE) ALL := build/$(BUNDLE_DIR)/manifest.ttl build/$(BUNDLE_DIR)/$(DLL_FILE)
STRIP_ALL := build/$(BUNDLE_DIR)/$(DLL_FILE) build/$(BUNDLE_DIR)/manifest.ttl
STRIP_PHONY :=
STRIP_PREREQS := $(STRIP_ALL) $(STRIP_PHONY)
-include $(MKINC_DIR)/vars-extra.mk -include $(MKINC_DIR)/vars-extra.mk
all: $(ALL) all: $(ALL)
@ -113,7 +117,7 @@ $(DIRS):
clean: clean:
rm -fr build rm -fr build
strip: all strip: $(STRIP_PREREQS)
strip build/$(BUNDLE_DIR)/$(DLL_FILE) strip build/$(BUNDLE_DIR)/$(DLL_FILE)
#Reaper can't handle this #Reaper can't handle this
#rdfproc lv2_store parse build/$(BUNDLE_DIR)/manifest.ttl turtle || (rm lv2_store* && exit 1) #rdfproc lv2_store parse build/$(BUNDLE_DIR)/manifest.ttl turtle || (rm lv2_store* && exit 1)
@ -150,7 +154,7 @@ install-user: all
-include $(MKINC_DIR)/rules-extra.mk -include $(MKINC_DIR)/rules-extra.mk
.PHONY: all clean strip install install-user .PHONY: all clean strip $(STRIP_PHONY) install install-user
.SECONDEXPANSION: .SECONDEXPANSION:

View File

@ -113,11 +113,14 @@ CXX_OBJS := $(addprefix build/obj/, $(notdir $(CXX_SRCS:.cpp=.o)))
DIRS := build build/obj build/$(BUNDLE_DIR) build/$(BUNDLE_DIR)/Contents build/$(BUNDLE_DIR)/Contents/Resources build/$(BUNDLE_DIR)/$(DLL_DIR) DIRS := build build/obj build/$(BUNDLE_DIR) build/$(BUNDLE_DIR)/Contents build/$(BUNDLE_DIR)/Contents/Resources build/$(BUNDLE_DIR)/$(DLL_DIR)
ALL := build/$(BUNDLE_DIR)/$(DLL_FILE) ALL := build/$(BUNDLE_DIR)/$(DLL_FILE)
ifeq ($(UNAME_S), Darwin) ifeq ($(UNAME_S), Darwin)
ALL := $(ALL) build/$(BUNDLE_DIR)/Contents/Info.plist build/$(BUNDLE_DIR)/Contents/PkgInfo ALL := $(ALL) build/$(BUNDLE_DIR)/Contents/Info.plist build/$(BUNDLE_DIR)/Contents/PkgInfo
endif endif
STRIP_ALL := build/$(BUNDLE_DIR)/$(DLL_FILE)
STRIP_PHONY :=
STRIP_PREREQS := $(STRIP_ALL) $(STRIP_PHONY)
-include $(MKINC_DIR)/vars-extra.mk -include $(MKINC_DIR)/vars-extra.mk
all: $(ALL) all: $(ALL)
@ -144,7 +147,7 @@ $(DIRS):
clean: clean:
rm -fr build rm -fr build
strip: all strip: $(STRIP_PREREQS)
strip build/$(BUNDLE_DIR)/$(DLL_FILE) strip build/$(BUNDLE_DIR)/$(DLL_FILE)
install: all install: all
@ -177,7 +180,7 @@ install-user: all
-include $(MKINC_DIR)/rules-extra.mk -include $(MKINC_DIR)/rules-extra.mk
.PHONY: all clean strip install install-user .PHONY: all clean strip $(STRIP_PHONY) install install-user
.SECONDEXPANSION: .SECONDEXPANSION:

View File

@ -25,3 +25,9 @@ build/web/key.pem: build/web/cert.pem
build/web/cert.pem: | build build/web/cert.pem: | build
yes "" | openssl req -x509 -newkey rsa:2048 -keyout build/web/key.pem -out build/web/cert.pem -days 365 -nodes 2>/dev/null yes "" | openssl req -x509 -newkey rsa:2048 -keyout build/web/key.pem -out build/web/cert.pem -days 365 -nodes 2>/dev/null
strip-web-demo: build/web/index.html
$(eval TMP := $(shell mktemp /tmp/index.XXXXXX))
html-minifier --collapse-whitespace --remove-comments --remove-redundant-attributes --remove-script-type-attributes --minify-css true --minify-js true build/web/index.html > $(TMP) || (rm $(TMP) && exit 1)
cp $(TMP) build/web/index.html || (rm $(TMP) && exit 1)
rm $(TMP)

View File

@ -19,3 +19,7 @@
# #
ALL := $(ALL) build/web/index.html build/web/cert.pem build/web/key.pem ALL := $(ALL) build/web/index.html build/web/cert.pem build/web/key.pem
STRIP_ALL := $(STRIP_ALL) build/web/index.html
STRIP_PHONY := strip-web-demo
STRIP_PREREQS := $(STRIP_ALL) $(STRIP_PHONY)

View File

@ -85,6 +85,10 @@ DIRS := build build/obj build/web build/web/$(BUNDLE_NAME)
ALL := build/web/$(BUNDLE_NAME)/module.wasm build/web/$(BUNDLE_NAME)/processor.js build/web/$(BUNDLE_NAME)/module.js ALL := build/web/$(BUNDLE_NAME)/module.wasm build/web/$(BUNDLE_NAME)/processor.js build/web/$(BUNDLE_NAME)/module.js
STRIP_ALL := build/web/$(BUNDLE_NAME)/module.wasm build/web/$(BUNDLE_NAME)/processor.js build/web/$(BUNDLE_NAME)/module.js
STRIP_PHONY :=
STRIP_PREREQS := $(STRIP_ALL) $(STRIP_PHONY)
-include $(MKINC_DIR)/vars-extra.mk -include $(MKINC_DIR)/vars-extra.mk
all: $(ALL) all: $(ALL)
@ -109,19 +113,15 @@ $(DIRS):
clean: clean:
rm -fr build rm -fr build
strip: strip: $(STRIP_PREREQS)
#already stripped #already stripped
#wasm-strip build/web/$(BUNDLE_NAME)/module.wasm #wasm-strip build/web/$(BUNDLE_NAME)/module.wasm
uglifyjs -c pure_funcs -m reserved build/web/$(BUNDLE_NAME)/module.js -o build/web/$(BUNDLE_NAME)/module.js uglifyjs -c pure_funcs -m reserved build/web/$(BUNDLE_NAME)/module.js -o build/web/$(BUNDLE_NAME)/module.js
uglifyjs -c pure_funcs -m reserved build/web/$(BUNDLE_NAME)/processor.js -o build/web/$(BUNDLE_NAME)/processor.js uglifyjs -c pure_funcs -m reserved build/web/$(BUNDLE_NAME)/processor.js -o build/web/$(BUNDLE_NAME)/processor.js
$(eval TMP := $(shell mktemp /tmp/index.XXXXXX))
html-minifier --collapse-whitespace --remove-comments --remove-redundant-attributes --remove-script-type-attributes --minify-css true --minify-js true build/web/index.html > $(TMP) || (rm $(TMP) && exit 1)
cp $(TMP) build/web/index.html || (rm $(TMP) && exit 1)
rm $(TMP)
-include $(MKINC_DIR)/rules-extra.mk -include $(MKINC_DIR)/rules-extra.mk
.PHONY: all clean strip .PHONY: all clean strip $(STRIP_PHONY)
.SECONDEXPANSION: .SECONDEXPANSION: