Git Inbox Mirror of the ffmpeg-devel mailing list - see https://ffmpeg.org/mailman/listinfo/ffmpeg-devel
 help / color / mirror / Atom feed
From: softworkz <ffmpegagent@gmail.com>
To: ffmpeg-devel@ffmpeg.org
Cc: softworkz <softworkz@hotmail.com>
Subject: [FFmpeg-devel] [PATCH v5 2/2] ffbuild/commonmak: Consolidate pattern rules for compression
Date: Tue, 27 May 2025 21:41:27 +0000
Message-ID: <9ff1856142f8dd069f1b034c5466a10f50a4b9b5.1748382088.git.ffmpegagent@gmail.com> (raw)
In-Reply-To: <pull.80.v5.ffstaging.FFmpeg.1748382088.ffmpegagent@gmail.com>

From: softworkz <softworkz@hotmail.com>

This commit simplifies and consolidates all the rules around
ptx and resource file compression.

Signed-off-by: softworkz <softworkz@hotmail.com>
---
 ffbuild/common.mak | 41 +++++++++++++++++------------------------
 1 file changed, 17 insertions(+), 24 deletions(-)

diff --git a/ffbuild/common.mak b/ffbuild/common.mak
index f03b9ca051..f446a12b92 100644
--- a/ffbuild/common.mak
+++ b/ffbuild/common.mak
@@ -115,6 +115,12 @@ COMPILE_LASX = $(call COMPILE,CC,LASXFLAGS)
 $(BIN2CEXE): ffbuild/bin2c_host.o
 	$(HOSTLD) $(HOSTLDFLAGS) $(HOSTLD_O) $^ $(HOSTEXTRALIBS)
 
+RUN_BIN2C = $(BIN2C) $(patsubst $(SRC_PATH)/%,$(SRC_LINK)/%,$<) $@ $(subst .,_,$(basename $(notdir $@)))
+RUN_GZIP  = $(M)gzip -nc9 $(patsubst $(SRC_PATH)/%,$(SRC_LINK)/%,$<) >$@
+RUN_MINIFY = $(M)sed 's!/\\*.*\\*/!!g' $< | tr '\n' ' ' | tr -s ' ' | sed 's/^ //; s/ $$//' > $@
+%.gz: TAG = GZIP
+%.min: TAG = MINIFY
+
 %.metal.air: %.metal
 	$(METALCC) $< -o $@
 
@@ -122,63 +128,50 @@ $(BIN2CEXE): ffbuild/bin2c_host.o
 	$(METALLIB) --split-module-without-linking $< -o $@
 
 %.metallib.c: %.metallib $(BIN2CEXE)
-	$(BIN2C) $< $@ $(subst .,_,$(basename $(notdir $@)))
+	$(RUN_BIN2C)
 
 %.ptx: %.cu $(SRC_PATH)/compat/cuda/cuda_runtime.h
 	$(COMPILE_NVCC)
 
 ifdef CONFIG_PTX_COMPRESSION
-%.ptx.gz: TAG = GZIP
 %.ptx.gz: %.ptx
-	$(M)gzip -nc9 $(patsubst $(SRC_PATH)/%,$(SRC_LINK)/%,$<) >$@
+	$(RUN_GZIP)
 
 %.ptx.c: %.ptx.gz $(BIN2CEXE)
-	$(BIN2C) $(patsubst $(SRC_PATH)/%,$(SRC_LINK)/%,$<) $@ $(subst .,_,$(basename $(notdir $@)))
+	$(RUN_BIN2C)
 else
 %.ptx.c: %.ptx $(BIN2CEXE)
-	$(BIN2C) $(patsubst $(SRC_PATH)/%,$(SRC_LINK)/%,$<) $@ $(subst .,_,$(basename $(notdir $@)))
+	$(RUN_BIN2C)
 endif
 
 %.ptx.o: CCDEP       =
 %.ptx.o: CC_DEPFLAGS =
 
 
-# 1) Preprocess CSS to a minified version
 %.css.min: %.css
-	# Must start with a tab in the real Makefile
-	sed 's!/\\*.*\\*/!!g' $< \
-	| tr '\n' ' ' \
-	| tr -s ' ' \
-	| sed 's/^ //; s/ $$//' \
-	> $@
+	$(RUN_MINIFY)
 
 ifdef CONFIG_RESOURCE_COMPRESSION
 
-# 2) Gzip the minified CSS
 %.css.min.gz: %.css.min
-	$(M)gzip -nc9 $< > $@
+	$(RUN_GZIP)
 
-# 3) Convert the gzipped CSS to a .c array
 %.css.c: %.css.min.gz $(BIN2CEXE)
-	$(BIN2C) $< $@ $(subst .,_,$(basename $(notdir $@)))
+	$(RUN_BIN2C)
 
-# 4) Gzip the HTML file (no minification needed)
 %.html.gz: %.html
-	$(M)gzip -nc9 $< > $@
+	$(RUN_GZIP)
 
-# 5) Convert the gzipped HTML to a .c array
 %.html.c: %.html.gz $(BIN2CEXE)
-	$(BIN2C) $< $@ $(subst .,_,$(basename $(notdir $@)))
+	$(RUN_BIN2C)
 
 else   # NO COMPRESSION
 
-# 2) Convert the minified CSS to a .c array
 %.css.c: %.css.min $(BIN2CEXE)
-	$(BIN2C) $< $@ $(subst .,_,$(basename $(notdir $@)))
+	$(RUN_BIN2C)
 
-# 3) Convert the plain HTML to a .c array
 %.html.c: %.html $(BIN2CEXE)
-	$(BIN2C) $< $@ $(subst .,_,$(basename $(notdir $@)))
+	$(RUN_BIN2C)
 endif
 
 %.html.o %.css.o: CCDEP       =
-- 
ffmpeg-codebot
_______________________________________________
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
https://ffmpeg.org/mailman/listinfo/ffmpeg-devel

To unsubscribe, visit link above, or email
ffmpeg-devel-request@ffmpeg.org with subject "unsubscribe".

  parent reply	other threads:[~2025-05-27 21:42 UTC|newest]

Thread overview: 17+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-05-18  2:14 [FFmpeg-devel] [PATCH] ffbuild/commonmak: Fix rebuild check with implicit rule chains softworkz
2025-05-18  6:30 ` [FFmpeg-devel] [PATCH v2] " softworkz
2025-05-20 19:09   ` softworkz .
2025-05-20 19:36   ` Ramiro Polla
2025-05-20 19:46     ` softworkz .
2025-05-20 20:28       ` Ramiro Polla
2025-05-20 21:13         ` softworkz .
2025-05-20 21:51           ` softworkz .
2025-05-20 23:32   ` [FFmpeg-devel] [PATCH v3] " softworkz
2025-05-23 22:05     ` [FFmpeg-devel] [PATCH v4] " softworkz
2025-05-27 21:41       ` [FFmpeg-devel] [PATCH v5 0/2] " ffmpegagent
2025-05-27 21:41         ` [FFmpeg-devel] [PATCH v5 1/2] " softworkz
2025-05-27 21:41         ` softworkz [this message]
2025-06-17 16:01         ` [FFmpeg-devel] [PATCH v6 0/2] " ffmpegagent
2025-06-17 16:01           ` [FFmpeg-devel] [PATCH v6 1/2] " softworkz
2025-06-17 16:01           ` [FFmpeg-devel] [PATCH v6 2/2] ffbuild/commonmak: Consolidate pattern rules for compression softworkz
2025-06-17 16:41           ` [FFmpeg-devel] [PATCH v6 0/2] ffbuild/commonmak: Fix rebuild check with implicit rule chains softworkz .

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=9ff1856142f8dd069f1b034c5466a10f50a4b9b5.1748382088.git.ffmpegagent@gmail.com \
    --to=ffmpegagent@gmail.com \
    --cc=ffmpeg-devel@ffmpeg.org \
    --cc=softworkz@hotmail.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link

Git Inbox Mirror of the ffmpeg-devel mailing list - see https://ffmpeg.org/mailman/listinfo/ffmpeg-devel

This inbox may be cloned and mirrored by anyone:

	git clone --mirror https://master.gitmailbox.com/ffmpegdev/0 ffmpegdev/git/0.git

	# If you have public-inbox 1.1+ installed, you may
	# initialize and index your mirror using the following commands:
	public-inbox-init -V2 ffmpegdev ffmpegdev/ https://master.gitmailbox.com/ffmpegdev \
		ffmpegdev@gitmailbox.com
	public-inbox-index ffmpegdev

Example config snippet for mirrors.


AGPL code for this site: git clone https://public-inbox.org/public-inbox.git