* [FFmpeg-devel] [PATCH] ffbuild/commonmak: Fix rebuild check with implicit rule chains
@ 2025-05-18 2:14 softworkz
2025-05-18 6:30 ` [FFmpeg-devel] [PATCH v2] " softworkz
0 siblings, 1 reply; 17+ messages in thread
From: softworkz @ 2025-05-18 2:14 UTC (permalink / raw)
To: ffmpeg-devel; +Cc: softworkz
From: softworkz <softworkz@hotmail.com>
When there's a chain of implicit rules, make treats files generated
inside that chain as intermediate files. Those intermediate files are
removed after completion of make. When make is run again, it normally
determines the need for a rebuild by comparing the timestamps of the
original source file and the final output of the chain and if still
up-to-date, it doesn't rebuild, even when the intermediate files are
not present. That makes sense of course - why would it delete them
otherwise, it would end up in builds being never up-to-date.
But this original by-the-book logic appeared to be broken and has been
worked around by adding all intermediate files to the .SECONDARY
special target, which required extra logic and issues with make clean.
What broke the up-to-date checking is the dependency file generation.
For the .c files generated by BIN2C the compile target created a .d
file which indicated that the .ptx.o file has a dependency on the
ptx.c file. And that dependency broke the normal make behavior with
intermediate files.
This patch compiles the BIN2C generated .c files without generating
.d files. In turn the files do not longer need to be added to the
.SECONDARY target in common.mak.
When interested in those files for debugging, a line can be added to
the corresponding Makefile like
.SECONDARY: %.ptx.c %.ptx.gz
Signed-off-by: softworkz <softworkz@hotmail.com>
---
ffbuild/commonmak: Fix rebuild check with implicit rule chains
When there's a chain of implicit rules, make treats files generated
inside that chain as intermediate files. Those intermediate files are
removed after completion of make. When make is run again, it normally
determines the need for a rebuild by comparing the timestamps of the
original source file and the final output of the chain and if still
up-to-date, it doesn't rebuild, even when the intermediate files are not
present. That makes sense of course - why would it delete them
otherwise, it would end up in builds being never up-to-date. But this
original by-the-book logic appeared to be broken and has been worked
around by adding all intermediate files to the .SECONDARY special
target, which required extra logic and issues with make clean.
What broke the up-to-date checking is the dependency file generation.
For the .c files generated by BIN2C the compile target created a .d file
which indicated that the .ptx.o file has a dependency on the ptx.c file.
And that dependency broke the normal make behavior with intermediate
files.
This patch compiles the BIN2C generated .c files without generating .d
files. In turn the files do not longer need to be added to the
.SECONDARY target in common.mak.
When interested in those files for debugging, a line can be added to the
corresponding Makefile like
.SECONDARY: %.ptx.c %.ptx.gz
Signed-off-by: softworkz softworkz@hotmail.com
Published-As: https://github.com/ffstaging/FFmpeg/releases/tag/pr-ffstaging-80%2Fsoftworkz%2Fsubmit_commonmak-v1
Fetch-It-Via: git fetch https://github.com/ffstaging/FFmpeg pr-ffstaging-80/softworkz/submit_commonmak-v1
Pull-Request: https://github.com/ffstaging/FFmpeg/pull/80
ffbuild/common.mak | 15 ++++++++++++---
1 file changed, 12 insertions(+), 3 deletions(-)
diff --git a/ffbuild/common.mak b/ffbuild/common.mak
index 0e1eb1f62b..6231bc472e 100644
--- a/ffbuild/common.mak
+++ b/ffbuild/common.mak
@@ -139,6 +139,10 @@ else
$(BIN2C) $(patsubst $(SRC_PATH)/%,$(SRC_LINK)/%,$<) $@ $(subst .,_,$(basename $(notdir $@)))
endif
+%.ptx.o: %.ptx.c
+ $(CC) $(CCFLAGS) -x c -c -o $@ $<
+
+
# 1) Preprocess CSS to a minified version
%.css.min: %.css
# Must start with a tab in the real Makefile
@@ -177,6 +181,13 @@ else # NO COMPRESSION
$(BIN2C) $< $@ $(subst .,_,$(basename $(notdir $@)))
endif
+%.html.o: %.html.c
+ $(CC) $(CCFLAGS) -x c -c -o $@ $<
+
+%.css.o: %.css.c
+ $(CC) $(CCFLAGS) -x c -c -o $@ $<
+
+
clean::
$(RM) $(BIN2CEXE) $(CLEANSUFFIXES:%=ffbuild/%)
@@ -228,11 +239,9 @@ ALLHEADERS := $(subst $(SRC_DIR)/,$(SUBDIR),$(wildcard $(SRC_DIR)/*.h $(SRC_DIR)
SKIPHEADERS += $(ARCH_HEADERS:%=$(ARCH)/%) $(SKIPHEADERS-)
SKIPHEADERS := $(SKIPHEADERS:%=$(SUBDIR)%)
HOBJS = $(filter-out $(SKIPHEADERS:.h=.h.o),$(ALLHEADERS:.h=.h.o))
-PTXOBJS = $(filter %.ptx.o,$(OBJS))
-RESOURCEOBJS = $(filter %.css.o %.html.o,$(OBJS))
$(HOBJS): CCFLAGS += $(CFLAGS_HEADERS)
checkheaders: $(HOBJS)
-.SECONDARY: $(HOBJS:.o=.c) $(PTXOBJS:.o=.c) $(PTXOBJS:.o=.gz) $(PTXOBJS:.o=) $(RESOURCEOBJS:.o=.c) $(RESOURCEOBJS:%.css.o=%.css.min) $(RESOURCEOBJS:%.css.o=%.css.min.gz) $(RESOURCEOBJS:%.html.o=%.html.gz) $(RESOURCEOBJS:.o=)
+.SECONDARY: $(HOBJS:.o=.c)
alltools: $(TOOLS)
base-commit: eb6dc952cbd479bf43673af9ca0bc83f37f8f329
--
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".
^ permalink raw reply [flat|nested] 17+ messages in thread
* [FFmpeg-devel] [PATCH v2] ffbuild/commonmak: Fix rebuild check with implicit rule chains
2025-05-18 2:14 [FFmpeg-devel] [PATCH] ffbuild/commonmak: Fix rebuild check with implicit rule chains softworkz
@ 2025-05-18 6:30 ` softworkz
2025-05-20 19:09 ` softworkz .
` (2 more replies)
0 siblings, 3 replies; 17+ messages in thread
From: softworkz @ 2025-05-18 6:30 UTC (permalink / raw)
To: ffmpeg-devel; +Cc: softworkz
From: softworkz <softworkz@hotmail.com>
When there's a chain of implicit rules, make treats files generated
inside that chain as intermediate files. Those intermediate files are
removed after completion of make. When make is run again, it normally
determines the need for a rebuild by comparing the timestamps of the
original source file and the final output of the chain and if still
up-to-date, it doesn't rebuild, even when the intermediate files are
not present. That makes sense of course - why would it delete them
otherwise, it would end up in builds being never up-to-date.
But this original by-the-book logic appeared to be broken and has been
worked around by adding all intermediate files to the .SECONDARY
special target, which required extra logic and issues with make clean.
What broke the up-to-date checking is the dependency file generation.
For the .c files generated by BIN2C the compile target created a .d
file which indicated that the .ptx.o file has a dependency on the
ptx.c file. And that dependency broke the normal make behavior with
intermediate files.
This patch compiles the BIN2C generated .c files without generating
.d files. In turn the files do not longer need to be added to the
.SECONDARY target in common.mak.
When interested in those files for debugging, a line can be added to
the corresponding Makefile like
.SECONDARY: %.ptx.c %.ptx.gz
Signed-off-by: softworkz <softworkz@hotmail.com>
---
ffbuild/commonmak: Fix rebuild check with implicit rule chains
When there's a chain of implicit rules, make treats files generated
inside that chain as intermediate files. Those intermediate files are
removed after completion of make. When make is run again, it normally
determines the need for a rebuild by comparing the timestamps of the
original source file and the final output of the chain and if still
up-to-date, it doesn't rebuild, even when the intermediate files are not
present. That makes sense of course - why would it delete them
otherwise, it would end up in builds being never up-to-date. But this
original by-the-book logic appeared to be broken and has been worked
around by adding all intermediate files to the .SECONDARY special
target, which required extra logic and issues with make clean.
What broke the up-to-date checking is the dependency file generation.
For the .c files generated by BIN2C the compile target created a .d file
which indicated that the .ptx.o file has a dependency on the ptx.c file.
And that dependency broke the normal make behavior with intermediate
files.
This patch compiles the BIN2C generated .c files without generating .d
files. In turn the files do not longer need to be added to the
.SECONDARY target in common.mak.
When interested in those files for debugging, a line can be added to the
corresponding Makefile like
.SECONDARY: %.ptx.c %.ptx.gz
V2
==
* Fix MSVC build
(use the universal command pattern)
Published-As: https://github.com/ffstaging/FFmpeg/releases/tag/pr-ffstaging-80%2Fsoftworkz%2Fsubmit_commonmak-v2
Fetch-It-Via: git fetch https://github.com/ffstaging/FFmpeg pr-ffstaging-80/softworkz/submit_commonmak-v2
Pull-Request: https://github.com/ffstaging/FFmpeg/pull/80
Range-diff vs v1:
1: e276f54ffc ! 1: f468ea2431 ffbuild/commonmak: Fix rebuild check with implicit rule chains
@@ ffbuild/common.mak: else
endif
+%.ptx.o: %.ptx.c
-+ $(CC) $(CCFLAGS) -x c -c -o $@ $<
++ $(CC) $(CCFLAGS) $(CC_C) $(CC_O) $(patsubst $(SRC_PATH)/%,$(SRC_LINK)/%,$<)
+
+
# 1) Preprocess CSS to a minified version
@@ ffbuild/common.mak: else # NO COMPRESSION
endif
+%.html.o: %.html.c
-+ $(CC) $(CCFLAGS) -x c -c -o $@ $<
++ $(CC) $(CCFLAGS) $(CC_C) $(CC_O) $(patsubst $(SRC_PATH)/%,$(SRC_LINK)/%,$<)
+
+%.css.o: %.css.c
-+ $(CC) $(CCFLAGS) -x c -c -o $@ $<
++ $(CC) $(CCFLAGS) $(CC_C) $(CC_O) $(patsubst $(SRC_PATH)/%,$(SRC_LINK)/%,$<)
+
+
clean::
ffbuild/common.mak | 15 ++++++++++++---
1 file changed, 12 insertions(+), 3 deletions(-)
diff --git a/ffbuild/common.mak b/ffbuild/common.mak
index 0e1eb1f62b..d9462271d5 100644
--- a/ffbuild/common.mak
+++ b/ffbuild/common.mak
@@ -139,6 +139,10 @@ else
$(BIN2C) $(patsubst $(SRC_PATH)/%,$(SRC_LINK)/%,$<) $@ $(subst .,_,$(basename $(notdir $@)))
endif
+%.ptx.o: %.ptx.c
+ $(CC) $(CCFLAGS) $(CC_C) $(CC_O) $(patsubst $(SRC_PATH)/%,$(SRC_LINK)/%,$<)
+
+
# 1) Preprocess CSS to a minified version
%.css.min: %.css
# Must start with a tab in the real Makefile
@@ -177,6 +181,13 @@ else # NO COMPRESSION
$(BIN2C) $< $@ $(subst .,_,$(basename $(notdir $@)))
endif
+%.html.o: %.html.c
+ $(CC) $(CCFLAGS) $(CC_C) $(CC_O) $(patsubst $(SRC_PATH)/%,$(SRC_LINK)/%,$<)
+
+%.css.o: %.css.c
+ $(CC) $(CCFLAGS) $(CC_C) $(CC_O) $(patsubst $(SRC_PATH)/%,$(SRC_LINK)/%,$<)
+
+
clean::
$(RM) $(BIN2CEXE) $(CLEANSUFFIXES:%=ffbuild/%)
@@ -228,11 +239,9 @@ ALLHEADERS := $(subst $(SRC_DIR)/,$(SUBDIR),$(wildcard $(SRC_DIR)/*.h $(SRC_DIR)
SKIPHEADERS += $(ARCH_HEADERS:%=$(ARCH)/%) $(SKIPHEADERS-)
SKIPHEADERS := $(SKIPHEADERS:%=$(SUBDIR)%)
HOBJS = $(filter-out $(SKIPHEADERS:.h=.h.o),$(ALLHEADERS:.h=.h.o))
-PTXOBJS = $(filter %.ptx.o,$(OBJS))
-RESOURCEOBJS = $(filter %.css.o %.html.o,$(OBJS))
$(HOBJS): CCFLAGS += $(CFLAGS_HEADERS)
checkheaders: $(HOBJS)
-.SECONDARY: $(HOBJS:.o=.c) $(PTXOBJS:.o=.c) $(PTXOBJS:.o=.gz) $(PTXOBJS:.o=) $(RESOURCEOBJS:.o=.c) $(RESOURCEOBJS:%.css.o=%.css.min) $(RESOURCEOBJS:%.css.o=%.css.min.gz) $(RESOURCEOBJS:%.html.o=%.html.gz) $(RESOURCEOBJS:.o=)
+.SECONDARY: $(HOBJS:.o=.c)
alltools: $(TOOLS)
base-commit: eb6dc952cbd479bf43673af9ca0bc83f37f8f329
--
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".
^ permalink raw reply [flat|nested] 17+ messages in thread
* Re: [FFmpeg-devel] [PATCH v2] ffbuild/commonmak: Fix rebuild check with implicit rule chains
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 23:32 ` [FFmpeg-devel] [PATCH v3] " softworkz
2 siblings, 0 replies; 17+ messages in thread
From: softworkz . @ 2025-05-20 19:09 UTC (permalink / raw)
To: softworkz, ffmpeg-devel
> -----Original Message-----
> From: softworkz <ffmpegagent@gmail.com>
> Sent: Sonntag, 18. Mai 2025 08:31
> To: ffmpeg-devel@ffmpeg.org
> Cc: softworkz <softworkz@hotmail.com>; softworkz <softworkz@hotmail.com>
> Subject: [PATCH v2] ffbuild/commonmak: Fix rebuild check with implicit rule
> chains
>
> From: softworkz <softworkz@hotmail.com>
>
> When there's a chain of implicit rules, make treats files generated
> inside that chain as intermediate files. Those intermediate files are
> removed after completion of make. When make is run again, it normally
> determines the need for a rebuild by comparing the timestamps of the
> original source file and the final output of the chain and if still
> up-to-date, it doesn't rebuild, even when the intermediate files are
> not present. That makes sense of course - why would it delete them
> otherwise, it would end up in builds being never up-to-date.
> But this original by-the-book logic appeared to be broken and has been
> worked around by adding all intermediate files to the .SECONDARY
> special target, which required extra logic and issues with make clean.
>
> What broke the up-to-date checking is the dependency file generation.
> For the .c files generated by BIN2C the compile target created a .d
> file which indicated that the .ptx.o file has a dependency on the
> ptx.c file. And that dependency broke the normal make behavior with
> intermediate files.
>
> This patch compiles the BIN2C generated .c files without generating
> .d files. In turn the files do not longer need to be added to the
> .SECONDARY target in common.mak.
>
> When interested in those files for debugging, a line can be added to
> the corresponding Makefile like
>
> .SECONDARY: %.ptx.c %.ptx.gz
>
> Signed-off-by: softworkz <softworkz@hotmail.com>
> ---
> ffbuild/commonmak: Fix rebuild check with implicit rule chains
>
> When there's a chain of implicit rules, make treats files generated
> inside that chain as intermediate files. Those intermediate files are
> removed after completion of make. When make is run again, it normally
> determines the need for a rebuild by comparing the timestamps of the
> original source file and the final output of the chain and if still
> up-to-date, it doesn't rebuild, even when the intermediate files are not
> present. That makes sense of course - why would it delete them
> otherwise, it would end up in builds being never up-to-date. But this
> original by-the-book logic appeared to be broken and has been worked
> around by adding all intermediate files to the .SECONDARY special
> target, which required extra logic and issues with make clean.
>
> What broke the up-to-date checking is the dependency file generation.
> For the .c files generated by BIN2C the compile target created a .d file
> which indicated that the .ptx.o file has a dependency on the ptx.c file.
> And that dependency broke the normal make behavior with intermediate
> files.
>
> This patch compiles the BIN2C generated .c files without generating .d
> files. In turn the files do not longer need to be added to the
> .SECONDARY target in common.mak.
>
> When interested in those files for debugging, a line can be added to the
> corresponding Makefile like
>
> .SECONDARY: %.ptx.c %.ptx.gz
>
>
> V2
> ==
>
> * Fix MSVC build
> (use the universal command pattern)
>
> Published-As: https://github.com/ffstaging/FFmpeg/releases/tag/pr-ffstaging-
> 80%2Fsoftworkz%2Fsubmit_commonmak-v2
> Fetch-It-Via: git fetch https://github.com/ffstaging/FFmpeg pr-ffstaging-
> 80/softworkz/submit_commonmak-v2
> Pull-Request: https://github.com/ffstaging/FFmpeg/pull/80
>
> Range-diff vs v1:
>
> 1: e276f54ffc ! 1: f468ea2431 ffbuild/commonmak: Fix rebuild check with
> implicit rule chains
> @@ ffbuild/common.mak: else
> endif
>
> +%.ptx.o: %.ptx.c
> -+ $(CC) $(CCFLAGS) -x c -c -o $@ $<
> ++ $(CC) $(CCFLAGS) $(CC_C) $(CC_O) $(patsubst
> $(SRC_PATH)/%,$(SRC_LINK)/%,$<)
> +
> +
> # 1) Preprocess CSS to a minified version
> @@ ffbuild/common.mak: else # NO COMPRESSION
> endif
>
> +%.html.o: %.html.c
> -+ $(CC) $(CCFLAGS) -x c -c -o $@ $<
> ++ $(CC) $(CCFLAGS) $(CC_C) $(CC_O) $(patsubst
> $(SRC_PATH)/%,$(SRC_LINK)/%,$<)
> +
> +%.css.o: %.css.c
> -+ $(CC) $(CCFLAGS) -x c -c -o $@ $<
> ++ $(CC) $(CCFLAGS) $(CC_C) $(CC_O) $(patsubst
> $(SRC_PATH)/%,$(SRC_LINK)/%,$<)
> +
> +
> clean::
>
>
> ffbuild/common.mak | 15 ++++++++++++---
> 1 file changed, 12 insertions(+), 3 deletions(-)
>
> diff --git a/ffbuild/common.mak b/ffbuild/common.mak
> index 0e1eb1f62b..d9462271d5 100644
> --- a/ffbuild/common.mak
> +++ b/ffbuild/common.mak
> @@ -139,6 +139,10 @@ else
> $(BIN2C) $(patsubst $(SRC_PATH)/%,$(SRC_LINK)/%,$<) $@ $(subst
> .,_,$(basename $(notdir $@)))
> endif
>
> +%.ptx.o: %.ptx.c
> + $(CC) $(CCFLAGS) $(CC_C) $(CC_O) $(patsubst
> $(SRC_PATH)/%,$(SRC_LINK)/%,$<)
> +
> +
> # 1) Preprocess CSS to a minified version
> %.css.min: %.css
> # Must start with a tab in the real Makefile
> @@ -177,6 +181,13 @@ else # NO COMPRESSION
> $(BIN2C) $< $@ $(subst .,_,$(basename $(notdir $@)))
> endif
>
> +%.html.o: %.html.c
> + $(CC) $(CCFLAGS) $(CC_C) $(CC_O) $(patsubst
> $(SRC_PATH)/%,$(SRC_LINK)/%,$<)
> +
> +%.css.o: %.css.c
> + $(CC) $(CCFLAGS) $(CC_C) $(CC_O) $(patsubst
> $(SRC_PATH)/%,$(SRC_LINK)/%,$<)
> +
> +
> clean::
> $(RM) $(BIN2CEXE) $(CLEANSUFFIXES:%=ffbuild/%)
>
> @@ -228,11 +239,9 @@ ALLHEADERS := $(subst $(SRC_DIR)/,$(SUBDIR),$(wildcard
> $(SRC_DIR)/*.h $(SRC_DIR)
> SKIPHEADERS += $(ARCH_HEADERS:%=$(ARCH)/%) $(SKIPHEADERS-)
> SKIPHEADERS := $(SKIPHEADERS:%=$(SUBDIR)%)
> HOBJS = $(filter-out $(SKIPHEADERS:.h=.h.o),$(ALLHEADERS:.h=.h.o))
> -PTXOBJS = $(filter %.ptx.o,$(OBJS))
> -RESOURCEOBJS = $(filter %.css.o %.html.o,$(OBJS))
> $(HOBJS): CCFLAGS += $(CFLAGS_HEADERS)
> checkheaders: $(HOBJS)
> -.SECONDARY: $(HOBJS:.o=.c) $(PTXOBJS:.o=.c) $(PTXOBJS:.o=.gz)
> $(PTXOBJS:.o=) $(RESOURCEOBJS:.o=.c) $(RESOURCEOBJS:%.css.o=%.css.min)
> $(RESOURCEOBJS:%.css.o=%.css.min.gz) $(RESOURCEOBJS:%.html.o=%.html.gz)
> $(RESOURCEOBJS:.o=)
> +.SECONDARY: $(HOBJS:.o=.c)
>
> alltools: $(TOOLS)
>
>
> base-commit: eb6dc952cbd479bf43673af9ca0bc83f37f8f329
> --
I just realized that I forgot to mention the specific problem that this
is addressing: Andreas and James had discovered that the up-to-date check
doesn't work properly - in a way that when you run make after make again,
it wants to rebuild the .o files from the BIN2C-generated .c files.
This patch fixes this by making it work in the way it is intended by make.
(https://www.gnu.org/software/make/manual/html_node/Chained-Rules.html)
sw
_______________________________________________
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".
^ permalink raw reply [flat|nested] 17+ messages in thread
* Re: [FFmpeg-devel] [PATCH v2] ffbuild/commonmak: Fix rebuild check with implicit rule chains
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 23:32 ` [FFmpeg-devel] [PATCH v3] " softworkz
2 siblings, 1 reply; 17+ messages in thread
From: Ramiro Polla @ 2025-05-20 19:36 UTC (permalink / raw)
To: FFmpeg development discussions and patches
Hi,
On Sun, May 18, 2025 at 8:30 AM softworkz <ffmpegagent@gmail.com> wrote:
>
> From: softworkz <softworkz@hotmail.com>
>
> When there's a chain of implicit rules, make treats files generated
> inside that chain as intermediate files. Those intermediate files are
> removed after completion of make. When make is run again, it normally
> determines the need for a rebuild by comparing the timestamps of the
> original source file and the final output of the chain and if still
> up-to-date, it doesn't rebuild, even when the intermediate files are
> not present. That makes sense of course - why would it delete them
> otherwise, it would end up in builds being never up-to-date.
> But this original by-the-book logic appeared to be broken and has been
> worked around by adding all intermediate files to the .SECONDARY
> special target, which required extra logic and issues with make clean.
>
> What broke the up-to-date checking is the dependency file generation.
> For the .c files generated by BIN2C the compile target created a .d
> file which indicated that the .ptx.o file has a dependency on the
> ptx.c file. And that dependency broke the normal make behavior with
> intermediate files.
>
> This patch compiles the BIN2C generated .c files without generating
> .d files. In turn the files do not longer need to be added to the
> .SECONDARY target in common.mak.
>
> When interested in those files for debugging, a line can be added to
> the corresponding Makefile like
>
> .SECONDARY: %.ptx.c %.ptx.gz
>
> Signed-off-by: softworkz <softworkz@hotmail.com>
> ---
> ffbuild/commonmak: Fix rebuild check with implicit rule chains
>
> When there's a chain of implicit rules, make treats files generated
> inside that chain as intermediate files. Those intermediate files are
> removed after completion of make. When make is run again, it normally
> determines the need for a rebuild by comparing the timestamps of the
> original source file and the final output of the chain and if still
> up-to-date, it doesn't rebuild, even when the intermediate files are not
> present. That makes sense of course - why would it delete them
> otherwise, it would end up in builds being never up-to-date. But this
> original by-the-book logic appeared to be broken and has been worked
> around by adding all intermediate files to the .SECONDARY special
> target, which required extra logic and issues with make clean.
>
> What broke the up-to-date checking is the dependency file generation.
> For the .c files generated by BIN2C the compile target created a .d file
> which indicated that the .ptx.o file has a dependency on the ptx.c file.
> And that dependency broke the normal make behavior with intermediate
> files.
>
> This patch compiles the BIN2C generated .c files without generating .d
> files. In turn the files do not longer need to be added to the
> .SECONDARY target in common.mak.
>
> When interested in those files for debugging, a line can be added to the
> corresponding Makefile like
>
> .SECONDARY: %.ptx.c %.ptx.gz
>
>
> V2
> ==
>
> * Fix MSVC build
> (use the universal command pattern)
>
> Published-As: https://github.com/ffstaging/FFmpeg/releases/tag/pr-ffstaging-80%2Fsoftworkz%2Fsubmit_commonmak-v2
> Fetch-It-Via: git fetch https://github.com/ffstaging/FFmpeg pr-ffstaging-80/softworkz/submit_commonmak-v2
> Pull-Request: https://github.com/ffstaging/FFmpeg/pull/80
>
> Range-diff vs v1:
>
> 1: e276f54ffc ! 1: f468ea2431 ffbuild/commonmak: Fix rebuild check with implicit rule chains
> @@ ffbuild/common.mak: else
> endif
>
> +%.ptx.o: %.ptx.c
> -+ $(CC) $(CCFLAGS) -x c -c -o $@ $<
> ++ $(CC) $(CCFLAGS) $(CC_C) $(CC_O) $(patsubst $(SRC_PATH)/%,$(SRC_LINK)/%,$<)
> +
> +
> # 1) Preprocess CSS to a minified version
> @@ ffbuild/common.mak: else # NO COMPRESSION
> endif
>
> +%.html.o: %.html.c
> -+ $(CC) $(CCFLAGS) -x c -c -o $@ $<
> ++ $(CC) $(CCFLAGS) $(CC_C) $(CC_O) $(patsubst $(SRC_PATH)/%,$(SRC_LINK)/%,$<)
> +
> +%.css.o: %.css.c
> -+ $(CC) $(CCFLAGS) -x c -c -o $@ $<
> ++ $(CC) $(CCFLAGS) $(CC_C) $(CC_O) $(patsubst $(SRC_PATH)/%,$(SRC_LINK)/%,$<)
> +
> +
> clean::
>
>
> ffbuild/common.mak | 15 ++++++++++++---
> 1 file changed, 12 insertions(+), 3 deletions(-)
>
> diff --git a/ffbuild/common.mak b/ffbuild/common.mak
> index 0e1eb1f62b..d9462271d5 100644
> --- a/ffbuild/common.mak
> +++ b/ffbuild/common.mak
> @@ -139,6 +139,10 @@ else
> $(BIN2C) $(patsubst $(SRC_PATH)/%,$(SRC_LINK)/%,$<) $@ $(subst .,_,$(basename $(notdir $@)))
> endif
>
> +%.ptx.o: %.ptx.c
> + $(CC) $(CCFLAGS) $(CC_C) $(CC_O) $(patsubst $(SRC_PATH)/%,$(SRC_LINK)/%,$<)
> +
> +
> # 1) Preprocess CSS to a minified version
> %.css.min: %.css
> # Must start with a tab in the real Makefile
> @@ -177,6 +181,13 @@ else # NO COMPRESSION
> $(BIN2C) $< $@ $(subst .,_,$(basename $(notdir $@)))
> endif
>
> +%.html.o: %.html.c
> + $(CC) $(CCFLAGS) $(CC_C) $(CC_O) $(patsubst $(SRC_PATH)/%,$(SRC_LINK)/%,$<)
> +
> +%.css.o: %.css.c
> + $(CC) $(CCFLAGS) $(CC_C) $(CC_O) $(patsubst $(SRC_PATH)/%,$(SRC_LINK)/%,$<)
> +
I'm not a big fan of adding new targets with a stripped-down version
of the original rule. It seems like unnecessary duplication, and
increases the chance of divergence over time.
Instead, I think it's cleaner to use target-specific variables to
disable a part of the original rule. For example, in this case, you
would disable the dependency generation for just those targets, and
end up with something like this:
%.html.o: CC_DEPFLAGS =
%.css.o: CC_DEPFLAGS =
Ramiro
_______________________________________________
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".
^ permalink raw reply [flat|nested] 17+ messages in thread
* Re: [FFmpeg-devel] [PATCH v2] ffbuild/commonmak: Fix rebuild check with implicit rule chains
2025-05-20 19:36 ` Ramiro Polla
@ 2025-05-20 19:46 ` softworkz .
2025-05-20 20:28 ` Ramiro Polla
0 siblings, 1 reply; 17+ messages in thread
From: softworkz . @ 2025-05-20 19:46 UTC (permalink / raw)
To: FFmpeg development discussions and patches
> -----Original Message-----
> From: ffmpeg-devel <ffmpeg-devel-bounces@ffmpeg.org> On Behalf Of Ramiro Polla
> Sent: Dienstag, 20. Mai 2025 21:36
> To: FFmpeg development discussions and patches <ffmpeg-devel@ffmpeg.org>
> Subject: Re: [FFmpeg-devel] [PATCH v2] ffbuild/commonmak: Fix rebuild check
> with implicit rule chains
>
> Hi,
>
> On Sun, May 18, 2025 at 8:30 AM softworkz <ffmpegagent@gmail.com> wrote:
> >
> > From: softworkz <softworkz@hotmail.com>
> >
> > When there's a chain of implicit rules, make treats files generated
> > inside that chain as intermediate files. Those intermediate files are
> > removed after completion of make. When make is run again, it normally
> > determines the need for a rebuild by comparing the timestamps of the
> > original source file and the final output of the chain and if still
> > up-to-date, it doesn't rebuild, even when the intermediate files are
> > not present. That makes sense of course - why would it delete them
> > otherwise, it would end up in builds being never up-to-date.
> > But this original by-the-book logic appeared to be broken and has been
> > worked around by adding all intermediate files to the .SECONDARY
> > special target, which required extra logic and issues with make clean.
> >
> > What broke the up-to-date checking is the dependency file generation.
> > For the .c files generated by BIN2C the compile target created a .d
> > file which indicated that the .ptx.o file has a dependency on the
> > ptx.c file. And that dependency broke the normal make behavior with
> > intermediate files.
> >
> > This patch compiles the BIN2C generated .c files without generating
> > .d files. In turn the files do not longer need to be added to the
> > .SECONDARY target in common.mak.
> >
> > When interested in those files for debugging, a line can be added to
> > the corresponding Makefile like
> >
> > .SECONDARY: %.ptx.c %.ptx.gz
> >
> > Signed-off-by: softworkz <softworkz@hotmail.com>
> > ---
> > ffbuild/commonmak: Fix rebuild check with implicit rule chains
> >
> > When there's a chain of implicit rules, make treats files generated
> > inside that chain as intermediate files. Those intermediate files are
> > removed after completion of make. When make is run again, it normally
> > determines the need for a rebuild by comparing the timestamps of the
> > original source file and the final output of the chain and if still
> > up-to-date, it doesn't rebuild, even when the intermediate files are not
> > present. That makes sense of course - why would it delete them
> > otherwise, it would end up in builds being never up-to-date. But this
> > original by-the-book logic appeared to be broken and has been worked
> > around by adding all intermediate files to the .SECONDARY special
> > target, which required extra logic and issues with make clean.
> >
> > What broke the up-to-date checking is the dependency file generation.
> > For the .c files generated by BIN2C the compile target created a .d file
> > which indicated that the .ptx.o file has a dependency on the ptx.c file.
> > And that dependency broke the normal make behavior with intermediate
> > files.
> >
> > This patch compiles the BIN2C generated .c files without generating .d
> > files. In turn the files do not longer need to be added to the
> > .SECONDARY target in common.mak.
> >
> > When interested in those files for debugging, a line can be added to the
> > corresponding Makefile like
> >
> > .SECONDARY: %.ptx.c %.ptx.gz
> >
> >
> > V2
> > ==
> >
> > * Fix MSVC build
> > (use the universal command pattern)
> >
> > Published-As: https://github.com/ffstaging/FFmpeg/releases/tag/pr-ffstaging-
> 80%2Fsoftworkz%2Fsubmit_commonmak-v2
> > Fetch-It-Via: git fetch https://github.com/ffstaging/FFmpeg pr-ffstaging-
> 80/softworkz/submit_commonmak-v2
> > Pull-Request: https://github.com/ffstaging/FFmpeg/pull/80
> >
> > Range-diff vs v1:
> >
> > 1: e276f54ffc ! 1: f468ea2431 ffbuild/commonmak: Fix rebuild check with
> implicit rule chains
> > @@ ffbuild/common.mak: else
> > endif
> >
> > +%.ptx.o: %.ptx.c
> > -+ $(CC) $(CCFLAGS) -x c -c -o $@ $<
> > ++ $(CC) $(CCFLAGS) $(CC_C) $(CC_O) $(patsubst
> $(SRC_PATH)/%,$(SRC_LINK)/%,$<)
> > +
> > +
> > # 1) Preprocess CSS to a minified version
> > @@ ffbuild/common.mak: else # NO COMPRESSION
> > endif
> >
> > +%.html.o: %.html.c
> > -+ $(CC) $(CCFLAGS) -x c -c -o $@ $<
> > ++ $(CC) $(CCFLAGS) $(CC_C) $(CC_O) $(patsubst
> $(SRC_PATH)/%,$(SRC_LINK)/%,$<)
> > +
> > +%.css.o: %.css.c
> > -+ $(CC) $(CCFLAGS) -x c -c -o $@ $<
> > ++ $(CC) $(CCFLAGS) $(CC_C) $(CC_O) $(patsubst
> $(SRC_PATH)/%,$(SRC_LINK)/%,$<)
> > +
> > +
> > clean::
> >
> >
> > ffbuild/common.mak | 15 ++++++++++++---
> > 1 file changed, 12 insertions(+), 3 deletions(-)
> >
> > diff --git a/ffbuild/common.mak b/ffbuild/common.mak
> > index 0e1eb1f62b..d9462271d5 100644
> > --- a/ffbuild/common.mak
> > +++ b/ffbuild/common.mak
> > @@ -139,6 +139,10 @@ else
> > $(BIN2C) $(patsubst $(SRC_PATH)/%,$(SRC_LINK)/%,$<) $@ $(subst
> .,_,$(basename $(notdir $@)))
> > endif
> >
> > +%.ptx.o: %.ptx.c
> > + $(CC) $(CCFLAGS) $(CC_C) $(CC_O) $(patsubst
> $(SRC_PATH)/%,$(SRC_LINK)/%,$<)
> > +
> > +
> > # 1) Preprocess CSS to a minified version
> > %.css.min: %.css
> > # Must start with a tab in the real Makefile
> > @@ -177,6 +181,13 @@ else # NO COMPRESSION
> > $(BIN2C) $< $@ $(subst .,_,$(basename $(notdir $@)))
> > endif
> >
> > +%.html.o: %.html.c
> > + $(CC) $(CCFLAGS) $(CC_C) $(CC_O) $(patsubst
> $(SRC_PATH)/%,$(SRC_LINK)/%,$<)
> > +
> > +%.css.o: %.css.c
> > + $(CC) $(CCFLAGS) $(CC_C) $(CC_O) $(patsubst
> $(SRC_PATH)/%,$(SRC_LINK)/%,$<)
> > +
>
> I'm not a big fan of adding new targets with a stripped-down version
> of the original rule. It seems like unnecessary duplication, and
> increases the chance of divergence over time.
>
> Instead, I think it's cleaner to use target-specific variables to
> disable a part of the original rule. For example, in this case, you
> would disable the dependency generation for just those targets, and
> end up with something like this:
> %.html.o: CC_DEPFLAGS =
> %.css.o: CC_DEPFLAGS =
Hi Ramiro,
I didn't know that one can do that. That's clearly a better way, then.
What about the first line in the COMPILE macro:
define COMPILE
$(call $(1)DEP,$(1))
$($(1)) $($(1)FLAGS) $($(2)) $($(1)_DEPFLAGS) $($(1)_C) $($(1)_O) $(patsubst $(SRC_PATH)/%,$(SRC_LINK)/%,$<)
endef
I haven't traced back what it actually does - is it harmless when
it's executed in those cases where no dependency file is desired?
If that's fine, I'd send an updated patch with your suggestion.
Thank you
sw
_______________________________________________
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".
^ permalink raw reply [flat|nested] 17+ messages in thread
* Re: [FFmpeg-devel] [PATCH v2] ffbuild/commonmak: Fix rebuild check with implicit rule chains
2025-05-20 19:46 ` softworkz .
@ 2025-05-20 20:28 ` Ramiro Polla
2025-05-20 21:13 ` softworkz .
0 siblings, 1 reply; 17+ messages in thread
From: Ramiro Polla @ 2025-05-20 20:28 UTC (permalink / raw)
To: FFmpeg development discussions and patches
On Tue, May 20, 2025 at 9:46 PM softworkz .
<softworkz-at-hotmail.com@ffmpeg.org> wrote:
> > -----Original Message-----
> > From: ffmpeg-devel <ffmpeg-devel-bounces@ffmpeg.org> On Behalf Of Ramiro Polla
> > Sent: Dienstag, 20. Mai 2025 21:36
> > To: FFmpeg development discussions and patches <ffmpeg-devel@ffmpeg.org>
> > Subject: Re: [FFmpeg-devel] [PATCH v2] ffbuild/commonmak: Fix rebuild check
> > with implicit rule chains
> > On Sun, May 18, 2025 at 8:30 AM softworkz <ffmpegagent@gmail.com> wrote:
> > > From: softworkz <softworkz@hotmail.com>
> > > When there's a chain of implicit rules, make treats files generated
> > > inside that chain as intermediate files. Those intermediate files are
> > > removed after completion of make. When make is run again, it normally
> > > determines the need for a rebuild by comparing the timestamps of the
> > > original source file and the final output of the chain and if still
> > > up-to-date, it doesn't rebuild, even when the intermediate files are
> > > not present. That makes sense of course - why would it delete them
> > > otherwise, it would end up in builds being never up-to-date.
> > > But this original by-the-book logic appeared to be broken and has been
> > > worked around by adding all intermediate files to the .SECONDARY
> > > special target, which required extra logic and issues with make clean.
> > >
> > > What broke the up-to-date checking is the dependency file generation.
> > > For the .c files generated by BIN2C the compile target created a .d
> > > file which indicated that the .ptx.o file has a dependency on the
> > > ptx.c file. And that dependency broke the normal make behavior with
> > > intermediate files.
> > >
> > > This patch compiles the BIN2C generated .c files without generating
> > > .d files. In turn the files do not longer need to be added to the
> > > .SECONDARY target in common.mak.
> > >
> > > When interested in those files for debugging, a line can be added to
> > > the corresponding Makefile like
> > >
> > > .SECONDARY: %.ptx.c %.ptx.gz
> > >
> > > Signed-off-by: softworkz <softworkz@hotmail.com>
> > > ---
> > > ffbuild/commonmak: Fix rebuild check with implicit rule chains
> > >
> > > When there's a chain of implicit rules, make treats files generated
> > > inside that chain as intermediate files. Those intermediate files are
> > > removed after completion of make. When make is run again, it normally
> > > determines the need for a rebuild by comparing the timestamps of the
> > > original source file and the final output of the chain and if still
> > > up-to-date, it doesn't rebuild, even when the intermediate files are not
> > > present. That makes sense of course - why would it delete them
> > > otherwise, it would end up in builds being never up-to-date. But this
> > > original by-the-book logic appeared to be broken and has been worked
> > > around by adding all intermediate files to the .SECONDARY special
> > > target, which required extra logic and issues with make clean.
> > >
> > > What broke the up-to-date checking is the dependency file generation.
> > > For the .c files generated by BIN2C the compile target created a .d file
> > > which indicated that the .ptx.o file has a dependency on the ptx.c file.
> > > And that dependency broke the normal make behavior with intermediate
> > > files.
> > >
> > > This patch compiles the BIN2C generated .c files without generating .d
> > > files. In turn the files do not longer need to be added to the
> > > .SECONDARY target in common.mak.
> > >
> > > When interested in those files for debugging, a line can be added to the
> > > corresponding Makefile like
> > >
> > > .SECONDARY: %.ptx.c %.ptx.gz
> > >
> > >
> > > V2
> > > ==
> > >
> > > * Fix MSVC build
> > > (use the universal command pattern)
> > >
> > > Published-As: https://github.com/ffstaging/FFmpeg/releases/tag/pr-ffstaging-
> > 80%2Fsoftworkz%2Fsubmit_commonmak-v2
> > > Fetch-It-Via: git fetch https://github.com/ffstaging/FFmpeg pr-ffstaging-
> > 80/softworkz/submit_commonmak-v2
> > > Pull-Request: https://github.com/ffstaging/FFmpeg/pull/80
> > >
> > > Range-diff vs v1:
> > >
> > > 1: e276f54ffc ! 1: f468ea2431 ffbuild/commonmak: Fix rebuild check with
> > implicit rule chains
> > > @@ ffbuild/common.mak: else
> > > endif
> > >
> > > +%.ptx.o: %.ptx.c
> > > -+ $(CC) $(CCFLAGS) -x c -c -o $@ $<
> > > ++ $(CC) $(CCFLAGS) $(CC_C) $(CC_O) $(patsubst
> > $(SRC_PATH)/%,$(SRC_LINK)/%,$<)
> > > +
> > > +
> > > # 1) Preprocess CSS to a minified version
> > > @@ ffbuild/common.mak: else # NO COMPRESSION
> > > endif
> > >
> > > +%.html.o: %.html.c
> > > -+ $(CC) $(CCFLAGS) -x c -c -o $@ $<
> > > ++ $(CC) $(CCFLAGS) $(CC_C) $(CC_O) $(patsubst
> > $(SRC_PATH)/%,$(SRC_LINK)/%,$<)
> > > +
> > > +%.css.o: %.css.c
> > > -+ $(CC) $(CCFLAGS) -x c -c -o $@ $<
> > > ++ $(CC) $(CCFLAGS) $(CC_C) $(CC_O) $(patsubst
> > $(SRC_PATH)/%,$(SRC_LINK)/%,$<)
> > > +
> > > +
> > > clean::
> > >
> > >
> > > ffbuild/common.mak | 15 ++++++++++++---
> > > 1 file changed, 12 insertions(+), 3 deletions(-)
> > >
> > > diff --git a/ffbuild/common.mak b/ffbuild/common.mak
> > > index 0e1eb1f62b..d9462271d5 100644
> > > --- a/ffbuild/common.mak
> > > +++ b/ffbuild/common.mak
> > > @@ -139,6 +139,10 @@ else
> > > $(BIN2C) $(patsubst $(SRC_PATH)/%,$(SRC_LINK)/%,$<) $@ $(subst
> > .,_,$(basename $(notdir $@)))
> > > endif
> > >
> > > +%.ptx.o: %.ptx.c
> > > + $(CC) $(CCFLAGS) $(CC_C) $(CC_O) $(patsubst
> > $(SRC_PATH)/%,$(SRC_LINK)/%,$<)
> > > +
> > > +
> > > # 1) Preprocess CSS to a minified version
> > > %.css.min: %.css
> > > # Must start with a tab in the real Makefile
> > > @@ -177,6 +181,13 @@ else # NO COMPRESSION
> > > $(BIN2C) $< $@ $(subst .,_,$(basename $(notdir $@)))
> > > endif
> > >
> > > +%.html.o: %.html.c
> > > + $(CC) $(CCFLAGS) $(CC_C) $(CC_O) $(patsubst
> > $(SRC_PATH)/%,$(SRC_LINK)/%,$<)
> > > +
> > > +%.css.o: %.css.c
> > > + $(CC) $(CCFLAGS) $(CC_C) $(CC_O) $(patsubst
> > $(SRC_PATH)/%,$(SRC_LINK)/%,$<)
> > > +
> >
> > I'm not a big fan of adding new targets with a stripped-down version
> > of the original rule. It seems like unnecessary duplication, and
> > increases the chance of divergence over time.
> >
> > Instead, I think it's cleaner to use target-specific variables to
> > disable a part of the original rule. For example, in this case, you
> > would disable the dependency generation for just those targets, and
> > end up with something like this:
> > %.html.o: CC_DEPFLAGS =
> > %.css.o: CC_DEPFLAGS =
>
> Hi Ramiro,
>
> I didn't know that one can do that. That's clearly a better way, then.
>
> What about the first line in the COMPILE macro:
>
> define COMPILE
> $(call $(1)DEP,$(1))
> $($(1)) $($(1)FLAGS) $($(2)) $($(1)_DEPFLAGS) $($(1)_C) $($(1)_O) $(patsubst $(SRC_PATH)/%,$(SRC_LINK)/%,$<)
> endef
>
> I haven't traced back what it actually does - is it harmless when
> it's executed in those cases where no dependency file is desired?
>
> If that's fine, I'd send an updated patch with your suggestion.
I had forgotten about that part. It's not triggered with gcc/clang,
but it seems to be triggered when using msvc. I don't have an msvc
setup ready, but I believe you do, right? You can then check with
"make V=1".
Ramiro
_______________________________________________
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".
^ permalink raw reply [flat|nested] 17+ messages in thread
* Re: [FFmpeg-devel] [PATCH v2] ffbuild/commonmak: Fix rebuild check with implicit rule chains
2025-05-20 20:28 ` Ramiro Polla
@ 2025-05-20 21:13 ` softworkz .
2025-05-20 21:51 ` softworkz .
0 siblings, 1 reply; 17+ messages in thread
From: softworkz . @ 2025-05-20 21:13 UTC (permalink / raw)
To: FFmpeg development discussions and patches
> -----Original Message-----
> From: ffmpeg-devel <ffmpeg-devel-bounces@ffmpeg.org> On Behalf Of Ramiro Polla
> Sent: Dienstag, 20. Mai 2025 22:29
> To: FFmpeg development discussions and patches <ffmpeg-devel@ffmpeg.org>
> Subject: Re: [FFmpeg-devel] [PATCH v2] ffbuild/commonmak: Fix rebuild check
> with implicit rule chains
>
> On Tue, May 20, 2025 at 9:46 PM softworkz .
> <softworkz-at-hotmail.com@ffmpeg.org> wrote:
> > > -----Original Message-----
> > > From: ffmpeg-devel <ffmpeg-devel-bounces@ffmpeg.org> On Behalf Of Ramiro
> Polla
> > > Sent: Dienstag, 20. Mai 2025 21:36
> > > To: FFmpeg development discussions and patches <ffmpeg-devel@ffmpeg.org>
> > > Subject: Re: [FFmpeg-devel] [PATCH v2] ffbuild/commonmak: Fix rebuild
> check
> > > with implicit rule chains
> > > On Sun, May 18, 2025 at 8:30 AM softworkz <ffmpegagent@gmail.com> wrote:
> > > > From: softworkz <softworkz@hotmail.com>
> > > > When there's a chain of implicit rules, make treats files generated
> > > > inside that chain as intermediate files. Those intermediate files are
> > > > removed after completion of make. When make is run again, it normally
> > > > determines the need for a rebuild by comparing the timestamps of the
> > > > original source file and the final output of the chain and if still
> > > > up-to-date, it doesn't rebuild, even when the intermediate files are
> > > > not present. That makes sense of course - why would it delete them
> > > > otherwise, it would end up in builds being never up-to-date.
> > > > But this original by-the-book logic appeared to be broken and has been
> > > > worked around by adding all intermediate files to the .SECONDARY
> > > > special target, which required extra logic and issues with make clean.
> > > >
> > > > What broke the up-to-date checking is the dependency file generation.
> > > > For the .c files generated by BIN2C the compile target created a .d
> > > > file which indicated that the .ptx.o file has a dependency on the
> > > > ptx.c file. And that dependency broke the normal make behavior with
> > > > intermediate files.
> > > >
> > > > This patch compiles the BIN2C generated .c files without generating
> > > > .d files. In turn the files do not longer need to be added to the
> > > > .SECONDARY target in common.mak.
> > > >
> > > > When interested in those files for debugging, a line can be added to
> > > > the corresponding Makefile like
> > > >
> > > > .SECONDARY: %.ptx.c %.ptx.gz
> > > >
> > > > Signed-off-by: softworkz <softworkz@hotmail.com>
> > > > ---
> > > > ffbuild/commonmak: Fix rebuild check with implicit rule chains
> > > >
> > > > When there's a chain of implicit rules, make treats files generated
> > > > inside that chain as intermediate files. Those intermediate files
> are
> > > > removed after completion of make. When make is run again, it
> normally
> > > > determines the need for a rebuild by comparing the timestamps of the
> > > > original source file and the final output of the chain and if still
> > > > up-to-date, it doesn't rebuild, even when the intermediate files are
> not
> > > > present. That makes sense of course - why would it delete them
> > > > otherwise, it would end up in builds being never up-to-date. But
> this
> > > > original by-the-book logic appeared to be broken and has been worked
> > > > around by adding all intermediate files to the .SECONDARY special
> > > > target, which required extra logic and issues with make clean.
> > > >
> > > > What broke the up-to-date checking is the dependency file
> generation.
> > > > For the .c files generated by BIN2C the compile target created a .d
> file
> > > > which indicated that the .ptx.o file has a dependency on the ptx.c
> file.
> > > > And that dependency broke the normal make behavior with intermediate
> > > > files.
> > > >
> > > > This patch compiles the BIN2C generated .c files without generating
> .d
> > > > files. In turn the files do not longer need to be added to the
> > > > .SECONDARY target in common.mak.
> > > >
> > > > When interested in those files for debugging, a line can be added to
> the
> > > > corresponding Makefile like
> > > >
> > > > .SECONDARY: %.ptx.c %.ptx.gz
> > > >
> > > >
> > > > V2
> > > > ==
> > > >
> > > > * Fix MSVC build
> > > > (use the universal command pattern)
> > > >
> > > > Published-As: https://github.com/ffstaging/FFmpeg/releases/tag/pr-
> ffstaging-
> > > 80%2Fsoftworkz%2Fsubmit_commonmak-v2
> > > > Fetch-It-Via: git fetch https://github.com/ffstaging/FFmpeg pr-
> ffstaging-
> > > 80/softworkz/submit_commonmak-v2
> > > > Pull-Request: https://github.com/ffstaging/FFmpeg/pull/80
> > > >
> > > > Range-diff vs v1:
> > > >
> > > > 1: e276f54ffc ! 1: f468ea2431 ffbuild/commonmak: Fix rebuild check
> with
> > > implicit rule chains
> > > > @@ ffbuild/common.mak: else
> > > > endif
> > > >
> > > > +%.ptx.o: %.ptx.c
> > > > -+ $(CC) $(CCFLAGS) -x c -c -o $@ $<
> > > > ++ $(CC) $(CCFLAGS) $(CC_C) $(CC_O) $(patsubst
> > > $(SRC_PATH)/%,$(SRC_LINK)/%,$<)
> > > > +
> > > > +
> > > > # 1) Preprocess CSS to a minified version
> > > > @@ ffbuild/common.mak: else # NO COMPRESSION
> > > > endif
> > > >
> > > > +%.html.o: %.html.c
> > > > -+ $(CC) $(CCFLAGS) -x c -c -o $@ $<
> > > > ++ $(CC) $(CCFLAGS) $(CC_C) $(CC_O) $(patsubst
> > > $(SRC_PATH)/%,$(SRC_LINK)/%,$<)
> > > > +
> > > > +%.css.o: %.css.c
> > > > -+ $(CC) $(CCFLAGS) -x c -c -o $@ $<
> > > > ++ $(CC) $(CCFLAGS) $(CC_C) $(CC_O) $(patsubst
> > > $(SRC_PATH)/%,$(SRC_LINK)/%,$<)
> > > > +
> > > > +
> > > > clean::
> > > >
> > > >
> > > > ffbuild/common.mak | 15 ++++++++++++---
> > > > 1 file changed, 12 insertions(+), 3 deletions(-)
> > > >
> > > > diff --git a/ffbuild/common.mak b/ffbuild/common.mak
> > > > index 0e1eb1f62b..d9462271d5 100644
> > > > --- a/ffbuild/common.mak
> > > > +++ b/ffbuild/common.mak
> > > > @@ -139,6 +139,10 @@ else
> > > > $(BIN2C) $(patsubst $(SRC_PATH)/%,$(SRC_LINK)/%,$<) $@ $(subst
> > > .,_,$(basename $(notdir $@)))
> > > > endif
> > > >
> > > > +%.ptx.o: %.ptx.c
> > > > + $(CC) $(CCFLAGS) $(CC_C) $(CC_O) $(patsubst
> > > $(SRC_PATH)/%,$(SRC_LINK)/%,$<)
> > > > +
> > > > +
> > > > # 1) Preprocess CSS to a minified version
> > > > %.css.min: %.css
> > > > # Must start with a tab in the real Makefile
> > > > @@ -177,6 +181,13 @@ else # NO COMPRESSION
> > > > $(BIN2C) $< $@ $(subst .,_,$(basename $(notdir $@)))
> > > > endif
> > > >
> > > > +%.html.o: %.html.c
> > > > + $(CC) $(CCFLAGS) $(CC_C) $(CC_O) $(patsubst
> > > $(SRC_PATH)/%,$(SRC_LINK)/%,$<)
> > > > +
> > > > +%.css.o: %.css.c
> > > > + $(CC) $(CCFLAGS) $(CC_C) $(CC_O) $(patsubst
> > > $(SRC_PATH)/%,$(SRC_LINK)/%,$<)
> > > > +
> > >
> > > I'm not a big fan of adding new targets with a stripped-down version
> > > of the original rule. It seems like unnecessary duplication, and
> > > increases the chance of divergence over time.
> > >
> > > Instead, I think it's cleaner to use target-specific variables to
> > > disable a part of the original rule. For example, in this case, you
> > > would disable the dependency generation for just those targets, and
> > > end up with something like this:
> > > %.html.o: CC_DEPFLAGS =
> > > %.css.o: CC_DEPFLAGS =
> >
> > Hi Ramiro,
> >
> > I didn't know that one can do that. That's clearly a better way, then.
> >
> > What about the first line in the COMPILE macro:
> >
> > define COMPILE
> > $(call $(1)DEP,$(1))
> > $($(1)) $($(1)FLAGS) $($(2)) $($(1)_DEPFLAGS) $($(1)_C) $($(1)_O)
> $(patsubst $(SRC_PATH)/%,$(SRC_LINK)/%,$<)
> > endef
> >
> > I haven't traced back what it actually does - is it harmless when
> > it's executed in those cases where no dependency file is desired?
> >
> > If that's fine, I'd send an updated patch with your suggestion.
>
> I had forgotten about that part. It's not triggered with gcc/clang,
> but it seems to be triggered when using msvc. I don't have an msvc
> setup ready, but I believe you do, right?
My local MSVC setup is using vcxproj projects, it's not makefile driven,
but I have the other ways as well. Though, I love to have it off the table
and running elsewhere. I made the V=1 change and also added a second
make after make to check:
https://dev.azure.com/githubsync/ffmpeg/_build/results?buildId=89332&view=logs
BTW, it's public, just create a PR on https://github.com/ffstaging/FFmpeg
and you get 6 CI builds which are the same like on Patchwork.
(nobody needs to use that submission thing, just close the PR right after)
Best,
sw
_______________________________________________
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".
^ permalink raw reply [flat|nested] 17+ messages in thread
* Re: [FFmpeg-devel] [PATCH v2] ffbuild/commonmak: Fix rebuild check with implicit rule chains
2025-05-20 21:13 ` softworkz .
@ 2025-05-20 21:51 ` softworkz .
0 siblings, 0 replies; 17+ messages in thread
From: softworkz . @ 2025-05-20 21:51 UTC (permalink / raw)
To: FFmpeg development discussions and patches
[-- Attachment #1: Type: text/plain, Size: 10571 bytes --]
> -----Original Message-----
> From: ffmpeg-devel <ffmpeg-devel-bounces@ffmpeg.org> On Behalf Of softworkz .
> Sent: Dienstag, 20. Mai 2025 23:13
> To: FFmpeg development discussions and patches <ffmpeg-devel@ffmpeg.org>
> Subject: Re: [FFmpeg-devel] [PATCH v2] ffbuild/commonmak: Fix rebuild check
> with implicit rule chains
>
>
>
> > -----Original Message-----
> > From: ffmpeg-devel <ffmpeg-devel-bounces@ffmpeg.org> On Behalf Of Ramiro
> Polla
> > Sent: Dienstag, 20. Mai 2025 22:29
> > To: FFmpeg development discussions and patches <ffmpeg-devel@ffmpeg.org>
> > Subject: Re: [FFmpeg-devel] [PATCH v2] ffbuild/commonmak: Fix rebuild check
> > with implicit rule chains
> >
> > On Tue, May 20, 2025 at 9:46 PM softworkz .
> > <softworkz-at-hotmail.com@ffmpeg.org> wrote:
> > > > -----Original Message-----
> > > > From: ffmpeg-devel <ffmpeg-devel-bounces@ffmpeg.org> On Behalf Of Ramiro
> > Polla
> > > > Sent: Dienstag, 20. Mai 2025 21:36
> > > > To: FFmpeg development discussions and patches <ffmpeg-devel@ffmpeg.org>
> > > > Subject: Re: [FFmpeg-devel] [PATCH v2] ffbuild/commonmak: Fix rebuild
> > check
> > > > with implicit rule chains
> > > > On Sun, May 18, 2025 at 8:30 AM softworkz <ffmpegagent@gmail.com> wrote:
> > > > > From: softworkz <softworkz@hotmail.com>
> > > > > When there's a chain of implicit rules, make treats files generated
> > > > > inside that chain as intermediate files. Those intermediate files are
> > > > > removed after completion of make. When make is run again, it normally
> > > > > determines the need for a rebuild by comparing the timestamps of the
> > > > > original source file and the final output of the chain and if still
> > > > > up-to-date, it doesn't rebuild, even when the intermediate files are
> > > > > not present. That makes sense of course - why would it delete them
> > > > > otherwise, it would end up in builds being never up-to-date.
> > > > > But this original by-the-book logic appeared to be broken and has been
> > > > > worked around by adding all intermediate files to the .SECONDARY
> > > > > special target, which required extra logic and issues with make clean.
> > > > >
> > > > > What broke the up-to-date checking is the dependency file generation.
> > > > > For the .c files generated by BIN2C the compile target created a .d
> > > > > file which indicated that the .ptx.o file has a dependency on the
> > > > > ptx.c file. And that dependency broke the normal make behavior with
> > > > > intermediate files.
> > > > >
> > > > > This patch compiles the BIN2C generated .c files without generating
> > > > > .d files. In turn the files do not longer need to be added to the
> > > > > .SECONDARY target in common.mak.
> > > > >
> > > > > When interested in those files for debugging, a line can be added to
> > > > > the corresponding Makefile like
> > > > >
> > > > > .SECONDARY: %.ptx.c %.ptx.gz
> > > > >
> > > > > Signed-off-by: softworkz <softworkz@hotmail.com>
> > > > > ---
> > > > > ffbuild/commonmak: Fix rebuild check with implicit rule chains
> > > > >
> > > > > When there's a chain of implicit rules, make treats files
> generated
> > > > > inside that chain as intermediate files. Those intermediate files
> > are
> > > > > removed after completion of make. When make is run again, it
> > normally
> > > > > determines the need for a rebuild by comparing the timestamps of
> the
> > > > > original source file and the final output of the chain and if
> still
> > > > > up-to-date, it doesn't rebuild, even when the intermediate files
> are
> > not
> > > > > present. That makes sense of course - why would it delete them
> > > > > otherwise, it would end up in builds being never up-to-date. But
> > this
> > > > > original by-the-book logic appeared to be broken and has been
> worked
> > > > > around by adding all intermediate files to the .SECONDARY special
> > > > > target, which required extra logic and issues with make clean.
> > > > >
> > > > > What broke the up-to-date checking is the dependency file
> > generation.
> > > > > For the .c files generated by BIN2C the compile target created a
> .d
> > file
> > > > > which indicated that the .ptx.o file has a dependency on the ptx.c
> > file.
> > > > > And that dependency broke the normal make behavior with
> intermediate
> > > > > files.
> > > > >
> > > > > This patch compiles the BIN2C generated .c files without
> generating
> > .d
> > > > > files. In turn the files do not longer need to be added to the
> > > > > .SECONDARY target in common.mak.
> > > > >
> > > > > When interested in those files for debugging, a line can be added
> to
> > the
> > > > > corresponding Makefile like
> > > > >
> > > > > .SECONDARY: %.ptx.c %.ptx.gz
> > > > >
> > > > >
> > > > > V2
> > > > > ==
> > > > >
> > > > > * Fix MSVC build
> > > > > (use the universal command pattern)
> > > > >
> > > > > Published-As: https://github.com/ffstaging/FFmpeg/releases/tag/pr-
> > ffstaging-
> > > > 80%2Fsoftworkz%2Fsubmit_commonmak-v2
> > > > > Fetch-It-Via: git fetch https://github.com/ffstaging/FFmpeg pr-
> > ffstaging-
> > > > 80/softworkz/submit_commonmak-v2
> > > > > Pull-Request: https://github.com/ffstaging/FFmpeg/pull/80
> > > > >
> > > > > Range-diff vs v1:
> > > > >
> > > > > 1: e276f54ffc ! 1: f468ea2431 ffbuild/commonmak: Fix rebuild check
> > with
> > > > implicit rule chains
> > > > > @@ ffbuild/common.mak: else
> > > > > endif
> > > > >
> > > > > +%.ptx.o: %.ptx.c
> > > > > -+ $(CC) $(CCFLAGS) -x c -c -o $@ $<
> > > > > ++ $(CC) $(CCFLAGS) $(CC_C) $(CC_O) $(patsubst
> > > > $(SRC_PATH)/%,$(SRC_LINK)/%,$<)
> > > > > +
> > > > > +
> > > > > # 1) Preprocess CSS to a minified version
> > > > > @@ ffbuild/common.mak: else # NO COMPRESSION
> > > > > endif
> > > > >
> > > > > +%.html.o: %.html.c
> > > > > -+ $(CC) $(CCFLAGS) -x c -c -o $@ $<
> > > > > ++ $(CC) $(CCFLAGS) $(CC_C) $(CC_O) $(patsubst
> > > > $(SRC_PATH)/%,$(SRC_LINK)/%,$<)
> > > > > +
> > > > > +%.css.o: %.css.c
> > > > > -+ $(CC) $(CCFLAGS) -x c -c -o $@ $<
> > > > > ++ $(CC) $(CCFLAGS) $(CC_C) $(CC_O) $(patsubst
> > > > $(SRC_PATH)/%,$(SRC_LINK)/%,$<)
> > > > > +
> > > > > +
> > > > > clean::
> > > > >
> > > > >
> > > > > ffbuild/common.mak | 15 ++++++++++++---
> > > > > 1 file changed, 12 insertions(+), 3 deletions(-)
> > > > >
> > > > > diff --git a/ffbuild/common.mak b/ffbuild/common.mak
> > > > > index 0e1eb1f62b..d9462271d5 100644
> > > > > --- a/ffbuild/common.mak
> > > > > +++ b/ffbuild/common.mak
> > > > > @@ -139,6 +139,10 @@ else
> > > > > $(BIN2C) $(patsubst $(SRC_PATH)/%,$(SRC_LINK)/%,$<) $@ $(subst
> > > > .,_,$(basename $(notdir $@)))
> > > > > endif
> > > > >
> > > > > +%.ptx.o: %.ptx.c
> > > > > + $(CC) $(CCFLAGS) $(CC_C) $(CC_O) $(patsubst
> > > > $(SRC_PATH)/%,$(SRC_LINK)/%,$<)
> > > > > +
> > > > > +
> > > > > # 1) Preprocess CSS to a minified version
> > > > > %.css.min: %.css
> > > > > # Must start with a tab in the real Makefile
> > > > > @@ -177,6 +181,13 @@ else # NO COMPRESSION
> > > > > $(BIN2C) $< $@ $(subst .,_,$(basename $(notdir $@)))
> > > > > endif
> > > > >
> > > > > +%.html.o: %.html.c
> > > > > + $(CC) $(CCFLAGS) $(CC_C) $(CC_O) $(patsubst
> > > > $(SRC_PATH)/%,$(SRC_LINK)/%,$<)
> > > > > +
> > > > > +%.css.o: %.css.c
> > > > > + $(CC) $(CCFLAGS) $(CC_C) $(CC_O) $(patsubst
> > > > $(SRC_PATH)/%,$(SRC_LINK)/%,$<)
> > > > > +
> > > >
> > > > I'm not a big fan of adding new targets with a stripped-down version
> > > > of the original rule. It seems like unnecessary duplication, and
> > > > increases the chance of divergence over time.
> > > >
> > > > Instead, I think it's cleaner to use target-specific variables to
> > > > disable a part of the original rule. For example, in this case, you
> > > > would disable the dependency generation for just those targets, and
> > > > end up with something like this:
> > > > %.html.o: CC_DEPFLAGS =
> > > > %.css.o: CC_DEPFLAGS =
> > >
> > > Hi Ramiro,
> > >
> > > I didn't know that one can do that. That's clearly a better way, then.
> > >
> > > What about the first line in the COMPILE macro:
> > >
> > > define COMPILE
> > > $(call $(1)DEP,$(1))
> > > $($(1)) $($(1)FLAGS) $($(2)) $($(1)_DEPFLAGS) $($(1)_C) $($(1)_O)
> > $(patsubst $(SRC_PATH)/%,$(SRC_LINK)/%,$<)
> > > endef
> > >
> > > I haven't traced back what it actually does - is it harmless when
> > > it's executed in those cases where no dependency file is desired?
> > >
> > > If that's fine, I'd send an updated patch with your suggestion.
> >
> > I had forgotten about that part. It's not triggered with gcc/clang,
> > but it seems to be triggered when using msvc. I don't have an msvc
> > setup ready, but I believe you do, right?
>
> My local MSVC setup is using vcxproj projects, it's not makefile driven,
> but I have the other ways as well. Though, I love to have it off the table
> and running elsewhere. I made the V=1 change and also added a second
> make after make to check:
>
> https://dev.azure.com/githubsync/ffmpeg/_build/results?buildId=89332&view=logs
>
>
> BTW, it's public, just create a PR on https://github.com/ffstaging/FFmpeg
> and you get 6 CI builds which are the same like on Patchwork.
> (nobody needs to use that submission thing, just close the PR right after)
>
>
> Best,
> sw
> _______________________________________________
Ah, it seems to have created the .d files but doesn't take them into account
when rebuilding. So the first line creates the .d files in case of MSVC.
I'm not quite sure how this first line could be eliminated. When clearing
CCDEP, there would still be the "call" remaining?
Here are the last few lines. I've attached a larger snippet because some
of the lines are > 800 chars long.
sw
-----
rm -f ffmpeg.exe
cp -p ffprobe_g.exe ffprobe.exe
cp -p ffmpeg_g.exe ffmpeg.exe
echo skipping strip ffprobe.exe
echo skipping strip ffmpeg.exe
skipping strip ffprobe.exe
skipping strip ffmpeg.exe
rm fftools/resources/graph.css.c fftools/resources/graph.css.min fftools/resources/graph.html.c
make: Nothing to be done for 'all'.
Finishing: Make
[-- Attachment #2: msvc_log.txt --]
[-- Type: text/plain, Size: 11727 bytes --]
[..]
2025-05-20T21:20:38.4599405Z lib.exe -nologo -out:libavfilter/libavfilter.a @libavfilter/libavfilter.a.objs
2025-05-20T21:20:38.5152560Z rm -f libavdevice/libavdevice.a.objs
2025-05-20T21:20:38.6629746Z : libavformat/libavformat.a
2025-05-20T21:20:38.7192982Z rm -f libswresample/libswresample.a
2025-05-20T21:20:38.7642137Z : libavfilter/libavfilter.a
2025-05-20T21:20:38.8011900Z lib.exe -nologo -out:libavcodec/libavcodec.a @libavcodec/libavcodec.a.objs
2025-05-20T21:20:38.8546500Z echo libswresample/audioconvert.o libswresample/dither.o libswresample/options.o libswresample/rematrix.o libswresample/resample.o libswresample/resample_dsp.o libswresample/swresample.o libswresample/swresample_frame.o libswresample/version.o libswresample/x86/audio_convert.o libswresample/x86/audio_convert_init.o libswresample/x86/rematrix.o libswresample/x86/rematrix_init.o libswresample/x86/resample.o libswresample/x86/resample_init.o > libswresample/libswresample.a.objs
2025-05-20T21:20:39.1670545Z rm -f libavformat/libavformat.a.objs
2025-05-20T21:20:39.2286081Z rm -f libswscale/libswscale.a
2025-05-20T21:20:39.2833343Z : libavcodec/libavcodec.a
2025-05-20T21:20:39.3153743Z echo libswscale/alphablend.o libswscale/cms.o libswscale/csputils.o libswscale/format.o libswscale/gamma.o libswscale/graph.o libswscale/hscale.o libswscale/hscale_fast_bilinear.o libswscale/input.o libswscale/lut3d.o libswscale/options.o libswscale/output.o libswscale/rgb2rgb.o libswscale/slice.o libswscale/swscale.o libswscale/swscale_unscaled.o libswscale/utils.o libswscale/version.o libswscale/vscale.o libswscale/x86/hscale_fast_bilinear_simd.o libswscale/x86/input.o libswscale/x86/output.o libswscale/x86/range_convert.o libswscale/x86/rgb2rgb.o libswscale/x86/rgb_2_rgb.o libswscale/x86/scale.o libswscale/x86/scale_avx2.o libswscale/x86/swscale.o libswscale/x86/yuv2rgb.o libswscale/x86/yuv2yuvX.o libswscale/x86/yuv_2_rgb.o libswscale/yuv2rgb.o > libswscale/libswscale.a.objs
2025-05-20T21:20:39.3535087Z rm -f libavfilter/libavfilter.a.objs
2025-05-20T21:20:39.3935315Z lib.exe -nologo -out:libswresample/libswresample.a @libswresample/libswresample.a.objs
2025-05-20T21:20:39.4718489Z cl.exe -nologo -Feffbuild/bin2c.exe ffbuild/bin2c_host.o -lm
2025-05-20T21:20:39.5150028Z : libswresample/libswresample.a
2025-05-20T21:20:39.5463806Z cl : Command line warning D9002 : ignoring unknown option '-lm'
2025-05-20T21:20:39.5485627Z cl : Command line warning D9024 : unrecognized source file type 'ffbuild/bin2c_host.o', object file assumed
2025-05-20T21:20:39.5559639Z rm -f libavcodec/libavcodec.a.objs
2025-05-20T21:20:39.5973481Z lib.exe -nologo -out:libswscale/libswscale.a @libswscale/libswscale.a.objs
2025-05-20T21:20:39.6972267Z rm -f libswresample/libswresample.a.objs
2025-05-20T21:20:39.7309076Z : libswscale/libswscale.a
2025-05-20T21:20:39.8032765Z rm -f libswscale/libswscale.a.objs
2025-05-20T21:20:39.8730179Z ffbuild/bin2c.exe fftools/resources/graph.html fftools/resources/graph.html.c graph_html
2025-05-20T21:20:39.8967022Z ffbuild/bin2c.exe fftools/resources/graph.css.min fftools/resources/graph.css.c graph_css
2025-05-20T21:20:39.9504879Z cl.exe -nologo -I. -I./ -D_ISOC11_SOURCE -D_FILE_OFFSET_BITS=64 -D_LARGEFILE_SOURCE -DWIN32_LEAN_AND_MEAN -D_USE_MATH_DEFINES -D_CRT_SECURE_NO_WARNINGS -D_CRT_NONSTDC_NO_WARNINGS -D_WIN32_WINNT=0x0600 -I./compat/atomics/win32 -I./compat/stdbit -I. -I./ -D_ISOC11_SOURCE -D_FILE_OFFSET_BITS=64 -D_LARGEFILE_SOURCE -DWIN32_LEAN_AND_MEAN -D_USE_MATH_DEFINES -D_CRT_SECURE_NO_WARNINGS -D_CRT_NONSTDC_NO_WARNINGS -D_WIN32_WINNT=0x0600 -I./compat/atomics/win32 -I./compat/stdbit -nologo /std:c17 -W3 -wd4018 -wd4146 -wd4244 -wd4305 -wd4554 -O1 -utf-8 -showIncludes -Zs fftools/resources/graph.html.c 2>&1 | awk '/including/ { sub(/^.*file: */, ""); gsub(/\\/, "/"); if (!match($0, / /)) print "fftools/resources/graph.html.o:", $0 }' > fftools/resources/graph.html.d
2025-05-20T21:20:39.9942449Z cl.exe -nologo -I. -I./ -D_ISOC11_SOURCE -D_FILE_OFFSET_BITS=64 -D_LARGEFILE_SOURCE -DWIN32_LEAN_AND_MEAN -D_USE_MATH_DEFINES -D_CRT_SECURE_NO_WARNINGS -D_CRT_NONSTDC_NO_WARNINGS -D_WIN32_WINNT=0x0600 -I./compat/atomics/win32 -I./compat/stdbit -I. -I./ -D_ISOC11_SOURCE -D_FILE_OFFSET_BITS=64 -D_LARGEFILE_SOURCE -DWIN32_LEAN_AND_MEAN -D_USE_MATH_DEFINES -D_CRT_SECURE_NO_WARNINGS -D_CRT_NONSTDC_NO_WARNINGS -D_WIN32_WINNT=0x0600 -I./compat/atomics/win32 -I./compat/stdbit -nologo /std:c17 -W3 -wd4018 -wd4146 -wd4244 -wd4305 -wd4554 -O1 -utf-8 -showIncludes -Zs fftools/resources/graph.css.c 2>&1 | awk '/including/ { sub(/^.*file: */, ""); gsub(/\\/, "/"); if (!match($0, / /)) print "fftools/resources/graph.css.o:", $0 }' > fftools/resources/graph.css.d
2025-05-20T21:20:40.2041968Z cl.exe -I. -I./ -D_ISOC11_SOURCE -D_FILE_OFFSET_BITS=64 -D_LARGEFILE_SOURCE -DWIN32_LEAN_AND_MEAN -D_USE_MATH_DEFINES -D_CRT_SECURE_NO_WARNINGS -D_CRT_NONSTDC_NO_WARNINGS -D_WIN32_WINNT=0x0600 -I./compat/atomics/win32 -I./compat/stdbit -nologo /std:c17 -W3 -wd4018 -wd4146 -wd4244 -wd4305 -wd4554 -O1 -utf-8 -c -Fofftools/resources/graph.html.o fftools/resources/graph.html.c
2025-05-20T21:20:40.2296686Z cl.exe -I. -I./ -D_ISOC11_SOURCE -D_FILE_OFFSET_BITS=64 -D_LARGEFILE_SOURCE -DWIN32_LEAN_AND_MEAN -D_USE_MATH_DEFINES -D_CRT_SECURE_NO_WARNINGS -D_CRT_NONSTDC_NO_WARNINGS -D_WIN32_WINNT=0x0600 -I./compat/atomics/win32 -I./compat/stdbit -nologo /std:c17 -W3 -wd4018 -wd4146 -wd4244 -wd4305 -wd4554 -O1 -utf-8 -c -Fofftools/resources/graph.css.o fftools/resources/graph.css.c
2025-05-20T21:20:40.3005701Z graph.html.c
2025-05-20T21:20:40.3404140Z graph.css.c
2025-05-20T21:20:49.4456247Z echo skipping strip -x libavutil/x86/tx_float.o
2025-05-20T21:20:49.4739197Z skipping strip -x libavutil/x86/tx_float.o
2025-05-20T21:20:49.4773030Z rm -f libavutil/libavutil.a
2025-05-20T21:20:49.5085761Z echo libavutil/adler32.o libavutil/aes.o libavutil/aes_ctr.o libavutil/ambient_viewing_environment.o libavutil/audio_fifo.o libavutil/avsscanf.o libavutil/avstring.o libavutil/base64.o libavutil/blowfish.o libavutil/bprint.o libavutil/buffer.o libavutil/camellia.o libavutil/cast5.o libavutil/channel_layout.o libavutil/container_fifo.o libavutil/cpu.o libavutil/crc.o libavutil/csp.o libavutil/des.o libavutil/detection_bbox.o libavutil/dict.o libavutil/display.o libavutil/dovi_meta.o libavutil/downmix_info.o libavutil/encryption_info.o libavutil/error.o libavutil/eval.o libavutil/executor.o libavutil/fifo.o libavutil/file.o libavutil/file_open.o libavutil/film_grain_params.o libavutil/fixed_dsp.o libavutil/float_dsp.o libavutil/float_scalarproduct.o libavutil/frame.o libavutil/hash.o libavutil/hdr_dynamic_metadata.o libavutil/hdr_dynamic_vivid_metadata.o libavutil/hmac.o libavutil/hwcontext.o libavutil/hwcontext_d3d11va.o libavutil/hwcontext_d3d12va.o libavutil/hwcontext_dxva2.o libavutil/hwcontext_stub.o libavutil/iamf.o libavutil/imgutils.o libavutil/integer.o libavutil/intmath.o libavutil/lfg.o libavutil/lls.o libavutil/log.o libavutil/log2_tab.o libavutil/lzo.o libavutil/mastering_display_metadata.o libavutil/mathematics.o libavutil/md5.o libavutil/mem.o libavutil/murmur3.o libavutil/opt.o libavutil/parseutils.o libavutil/pixdesc.o libavutil/pixelutils.o libavutil/random_seed.o libavutil/rational.o libavutil/rc4.o libavutil/refstruct.o libavutil/reverse.o libavutil/ripemd.o libavutil/samplefmt.o libavutil/sha.o libavutil/sha512.o libavutil/side_data.o libavutil/slicethread.o libavutil/spherical.o libavutil/stereo3d.o libavutil/tea.o libavutil/threadmessage.o libavutil/time.o libavutil/timecode.o libavutil/timecode_internal.o libavutil/timestamp.o libavutil/tree.o libavutil/twofish.o libavutil/tx.o libavutil/tx_double.o libavutil/tx_float.o libavutil/tx_int32.o libavutil/utils.o libavutil/uuid.o libavutil/version.o libavutil/video_enc_params.o libavutil/video_hint.o libavutil/x86/aes.o libavutil/x86/aes_init.o libavutil/x86/cpu.o libavutil/x86/cpuid.o libavutil/x86/emms.o libavutil/x86/fixed_dsp.o libavutil/x86/fixed_dsp_init.o libavutil/x86/float_dsp.o libavutil/x86/float_dsp_init.o libavutil/x86/imgutils.o libavutil/x86/imgutils_init.o libavutil/x86/lls.o libavutil/x86/lls_init.o libavutil/x86/pixelutils.o libavutil/x86/pixelutils_init.o libavutil/x86/tx_float.o libavutil/x86/tx_float_init.o libavutil/xga_font_data.o libavutil/xtea.o libavutil/float2half.o libavutil/half2float.o > libavutil/libavutil.a.objs
2025-05-20T21:20:49.5487414Z lib.exe -nologo -out:libavutil/libavutil.a @libavutil/libavutil.a.objs
2025-05-20T21:20:49.6331012Z : libavutil/libavutil.a
2025-05-20T21:20:49.6714811Z rm -f libavutil/libavutil.a.objs
2025-05-20T21:20:49.7005843Z ./compat/windows/mslink -libpath:libavcodec -libpath:libavdevice -libpath:libavfilter -libpath:libavformat -libpath:libavutil -libpath:libswscale -libpath:libswresample -nologo -out:ffmpeg_g.exe fftools/ffmpeg_dec.o fftools/ffmpeg_demux.o fftools/ffmpeg_enc.o fftools/ffmpeg_filter.o fftools/ffmpeg_hw.o fftools/ffmpeg_mux.o fftools/ffmpeg_mux_init.o fftools/ffmpeg_opt.o fftools/ffmpeg_sched.o fftools/graph/graphprint.o fftools/sync_queue.o fftools/thread_queue.o fftools/textformat/avtextformat.o fftools/textformat/tf_compact.o fftools/textformat/tf_default.o fftools/textformat/tf_flat.o fftools/textformat/tf_ini.o fftools/textformat/tf_json.o fftools/textformat/tf_mermaid.o fftools/textformat/tf_xml.o fftools/textformat/tw_avio.o fftools/textformat/tw_buffer.o fftools/textformat/tw_stdout.o fftools/resources/resman.o fftools/resources/graph.html.o fftools/resources/graph.css.o fftools/cmdutils.o fftools/opt_common.o fftools/ffmpeg.o fftools/fftoolsres.o libavdevice.a libavfilter.a libavformat.a libavcodec.a libswresample.a libswscale.a libavutil.a psapi.lib ole32.lib strmiids.lib uuid.lib oleaut32.lib shlwapi.lib gdi32.lib vfw32.lib secur32.lib ws2_32.lib mfuuid.lib ole32.lib strmiids.lib ole32.lib user32.lib user32.lib bcrypt.lib ole32.lib psapi.lib shell32.lib
2025-05-20T21:20:49.7282614Z ./compat/windows/mslink -libpath:libavcodec -libpath:libavdevice -libpath:libavfilter -libpath:libavformat -libpath:libavutil -libpath:libswscale -libpath:libswresample -nologo -out:ffprobe_g.exe fftools/textformat/avtextformat.o fftools/textformat/tf_compact.o fftools/textformat/tf_default.o fftools/textformat/tf_flat.o fftools/textformat/tf_ini.o fftools/textformat/tf_json.o fftools/textformat/tf_mermaid.o fftools/textformat/tf_xml.o fftools/textformat/tw_avio.o fftools/textformat/tw_buffer.o fftools/textformat/tw_stdout.o fftools/resources/resman.o fftools/resources/graph.html.o fftools/resources/graph.css.o fftools/cmdutils.o fftools/opt_common.o fftools/ffprobe.o fftools/fftoolsres.o libavdevice.a libavfilter.a libavformat.a libavcodec.a libswresample.a libswscale.a libavutil.a psapi.lib ole32.lib strmiids.lib uuid.lib oleaut32.lib shlwapi.lib gdi32.lib vfw32.lib secur32.lib ws2_32.lib mfuuid.lib ole32.lib strmiids.lib ole32.lib user32.lib user32.lib bcrypt.lib shell32.lib
2025-05-20T21:20:53.8449963Z rm -f ffprobe.exe
2025-05-20T21:20:53.8720344Z rm -f ffmpeg.exe
2025-05-20T21:20:53.9027412Z cp -p ffprobe_g.exe ffprobe.exe
2025-05-20T21:20:53.9332589Z cp -p ffmpeg_g.exe ffmpeg.exe
2025-05-20T21:20:53.9508609Z echo skipping strip ffprobe.exe
2025-05-20T21:20:53.9796163Z echo skipping strip ffmpeg.exe
2025-05-20T21:20:53.9816341Z skipping strip ffprobe.exe
2025-05-20T21:20:54.0064650Z skipping strip ffmpeg.exe
2025-05-20T21:20:54.0091057Z rm fftools/resources/graph.css.c fftools/resources/graph.css.min fftools/resources/graph.html.c
2025-05-20T21:20:56.9962656Z make: Nothing to be done for 'all'.
2025-05-20T21:20:57.0392162Z ##[section]Finishing: Make
[-- Attachment #3: Type: text/plain, Size: 251 bytes --]
_______________________________________________
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".
^ permalink raw reply [flat|nested] 17+ messages in thread
* [FFmpeg-devel] [PATCH v3] ffbuild/commonmak: Fix rebuild check with implicit rule chains
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 23:32 ` softworkz
2025-05-23 22:05 ` [FFmpeg-devel] [PATCH v4] " softworkz
2 siblings, 1 reply; 17+ messages in thread
From: softworkz @ 2025-05-20 23:32 UTC (permalink / raw)
To: ffmpeg-devel; +Cc: softworkz
From: softworkz <softworkz@hotmail.com>
When there's a chain of implicit rules, make treats files generated
inside that chain as intermediate files. Those intermediate files are
removed after completion of make. When make is run again, it normally
determines the need for a rebuild by comparing the timestamps of the
original source file and the final output of the chain and if still
up-to-date, it doesn't rebuild, even when the intermediate files are
not present. That makes sense of course - why would it delete them
otherwise, it would end up in builds being never up-to-date.
But this original by-the-book logic appeared to be broken and has been
worked around by adding all intermediate files to the .SECONDARY
special target, which required extra logic and issues with make clean.
What broke the up-to-date checking is the dependency file generation.
For the .c files generated by BIN2C the compile target created a .d
file which indicated that the .ptx.o file has a dependency on the
ptx.c file. And that dependency broke the normal make behavior with
intermediate files.
This patch compiles the BIN2C generated .c files without generating
.d files. In turn the files do not longer need to be added to the
.SECONDARY target in common.mak.
When interested in those files for debugging, a line can be added to
the corresponding Makefile like
.SECONDARY: %.ptx.c %.ptx.gz
Signed-off-by: softworkz <softworkz@hotmail.com>
---
ffbuild/commonmak: Fix rebuild check with implicit rule chains
When there's a chain of implicit rules, make treats files generated
inside that chain as intermediate files. Those intermediate files are
removed after completion of make. When make is run again, it normally
determines the need for a rebuild by comparing the timestamps of the
original source file and the final output of the chain and if still
up-to-date, it doesn't rebuild, even when the intermediate files are not
present. That makes sense of course - why would it delete them
otherwise, it would end up in builds being never up-to-date. But this
original by-the-book logic appeared to be broken and has been worked
around by adding all intermediate files to the .SECONDARY special
target, which required extra logic and issues with make clean.
What broke the up-to-date checking is the dependency file generation.
For the .c files generated by BIN2C the compile target created a .d file
which indicated that the .ptx.o file has a dependency on the ptx.c file.
And that dependency broke the normal make behavior with intermediate
files.
This patch compiles the BIN2C generated .c files without generating .d
files. In turn the files do not longer need to be added to the
.SECONDARY target in common.mak.
When interested in those files for debugging, a line can be added to the
corresponding Makefile like
.SECONDARY: %.ptx.c %.ptx.gz
V2
==
* Fix MSVC build
(use the universal command pattern)
V3
==
* Skip dependency generation by clearing CC_DEPS instead
(as suggested by Ramiro - thanks!)
.
Published-As: https://github.com/ffstaging/FFmpeg/releases/tag/pr-ffstaging-80%2Fsoftworkz%2Fsubmit_commonmak-v3
Fetch-It-Via: git fetch https://github.com/ffstaging/FFmpeg pr-ffstaging-80/softworkz/submit_commonmak-v3
Pull-Request: https://github.com/ffstaging/FFmpeg/pull/80
Range-diff vs v2:
1: f468ea2431 ! 1: 981329e5d9 ffbuild/commonmak: Fix rebuild check with implicit rule chains
@@ ffbuild/common.mak: else
$(BIN2C) $(patsubst $(SRC_PATH)/%,$(SRC_LINK)/%,$<) $@ $(subst .,_,$(basename $(notdir $@)))
endif
-+%.ptx.o: %.ptx.c
-+ $(CC) $(CCFLAGS) $(CC_C) $(CC_O) $(patsubst $(SRC_PATH)/%,$(SRC_LINK)/%,$<)
++%.ptx.o: CCDEP =
++%.ptx.o: CC_DEPFLAGS =
+
+
# 1) Preprocess CSS to a minified version
@@ ffbuild/common.mak: else # NO COMPRESSION
$(BIN2C) $< $@ $(subst .,_,$(basename $(notdir $@)))
endif
-+%.html.o: %.html.c
-+ $(CC) $(CCFLAGS) $(CC_C) $(CC_O) $(patsubst $(SRC_PATH)/%,$(SRC_LINK)/%,$<)
-+
-+%.css.o: %.css.c
-+ $(CC) $(CCFLAGS) $(CC_C) $(CC_O) $(patsubst $(SRC_PATH)/%,$(SRC_LINK)/%,$<)
++%.html.o %.css.o: CCDEP =
++%.html.o %.css.o: CC_DEPFLAGS =
+
+
clean::
ffbuild/common.mak | 12 +++++++++---
1 file changed, 9 insertions(+), 3 deletions(-)
diff --git a/ffbuild/common.mak b/ffbuild/common.mak
index 0e1eb1f62b..c503dce6b0 100644
--- a/ffbuild/common.mak
+++ b/ffbuild/common.mak
@@ -139,6 +139,10 @@ else
$(BIN2C) $(patsubst $(SRC_PATH)/%,$(SRC_LINK)/%,$<) $@ $(subst .,_,$(basename $(notdir $@)))
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
@@ -177,6 +181,10 @@ else # NO COMPRESSION
$(BIN2C) $< $@ $(subst .,_,$(basename $(notdir $@)))
endif
+%.html.o %.css.o: CCDEP =
+%.html.o %.css.o: CC_DEPFLAGS =
+
+
clean::
$(RM) $(BIN2CEXE) $(CLEANSUFFIXES:%=ffbuild/%)
@@ -228,11 +236,9 @@ ALLHEADERS := $(subst $(SRC_DIR)/,$(SUBDIR),$(wildcard $(SRC_DIR)/*.h $(SRC_DIR)
SKIPHEADERS += $(ARCH_HEADERS:%=$(ARCH)/%) $(SKIPHEADERS-)
SKIPHEADERS := $(SKIPHEADERS:%=$(SUBDIR)%)
HOBJS = $(filter-out $(SKIPHEADERS:.h=.h.o),$(ALLHEADERS:.h=.h.o))
-PTXOBJS = $(filter %.ptx.o,$(OBJS))
-RESOURCEOBJS = $(filter %.css.o %.html.o,$(OBJS))
$(HOBJS): CCFLAGS += $(CFLAGS_HEADERS)
checkheaders: $(HOBJS)
-.SECONDARY: $(HOBJS:.o=.c) $(PTXOBJS:.o=.c) $(PTXOBJS:.o=.gz) $(PTXOBJS:.o=) $(RESOURCEOBJS:.o=.c) $(RESOURCEOBJS:%.css.o=%.css.min) $(RESOURCEOBJS:%.css.o=%.css.min.gz) $(RESOURCEOBJS:%.html.o=%.html.gz) $(RESOURCEOBJS:.o=)
+.SECONDARY: $(HOBJS:.o=.c)
alltools: $(TOOLS)
base-commit: fd18ae88ae736b5aabff34e17394fcd103f9e5ad
--
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".
^ permalink raw reply [flat|nested] 17+ messages in thread
* [FFmpeg-devel] [PATCH v4] ffbuild/commonmak: Fix rebuild check with implicit rule chains
2025-05-20 23:32 ` [FFmpeg-devel] [PATCH v3] " softworkz
@ 2025-05-23 22:05 ` softworkz
2025-05-27 21:41 ` [FFmpeg-devel] [PATCH v5 0/2] " ffmpegagent
0 siblings, 1 reply; 17+ messages in thread
From: softworkz @ 2025-05-23 22:05 UTC (permalink / raw)
To: ffmpeg-devel; +Cc: softworkz
From: softworkz <softworkz@hotmail.com>
When there's a chain of implicit rules, make treats files generated
inside that chain as intermediate files. Those intermediate files are
removed after completion of make. When make is run again, it normally
determines the need for a rebuild by comparing the timestamps of the
original source file and the final output of the chain and if still
up-to-date, it doesn't rebuild, even when the intermediate files are
not present. That makes sense of course - why would it delete them
otherwise, it would end up in builds being never up-to-date.
But this original by-the-book logic appeared to be broken and has been
worked around by adding all intermediate files to the .SECONDARY
special target, which required extra logic and issues with make clean.
What broke the up-to-date checking is the dependency file generation.
For the .c files generated by BIN2C the compile target created a .d
file which indicated that the .ptx.o file has a dependency on the
ptx.c file. And that dependency broke the normal make behavior with
intermediate files.
This patch compiles the BIN2C generated .c files without generating
.d files. In turn the files do not longer need to be added to the
.SECONDARY target in common.mak.
When interested in those files for debugging, a line can be added to
the corresponding Makefile like
.SECONDARY: %.ptx.c %.ptx.gz
Signed-off-by: softworkz <softworkz@hotmail.com>
---
ffbuild/commonmak: Fix rebuild check with implicit rule chains
V2
==
* Fix MSVC build
(use the universal command pattern)
V3
==
* Skip dependency generation by clearing CC_DEPS instead
(as suggested by Ramiro - thanks!)
V4
==
* Always keep .ptx files (as suggested by Timo - thanks) Tested all
scenarios:
* .ptx.c and .ptx.gz still get deleted (as intermediates)
* repeated make shows "up-to-date"
* removing a .ptx file does not cause a rebuild (it's still an
intermediate, but an "intermediate to keep")
* but changing a .ptx does (in case of dev/debugging)
* changed .cu files always rebuild of course
.
Published-As: https://github.com/ffstaging/FFmpeg/releases/tag/pr-ffstaging-80%2Fsoftworkz%2Fsubmit_commonmak-v4
Fetch-It-Via: git fetch https://github.com/ffstaging/FFmpeg pr-ffstaging-80/softworkz/submit_commonmak-v4
Pull-Request: https://github.com/ffstaging/FFmpeg/pull/80
Range-diff vs v3:
1: 981329e5d9 ! 1: 20c2fb65ed ffbuild/commonmak: Fix rebuild check with implicit rule chains
@@ ffbuild/common.mak: else # NO COMPRESSION
clean::
$(RM) $(BIN2CEXE) $(CLEANSUFFIXES:%=ffbuild/%)
-@@ ffbuild/common.mak: ALLHEADERS := $(subst $(SRC_DIR)/,$(SUBDIR),$(wildcard $(SRC_DIR)/*.h $(SRC_DIR)
- SKIPHEADERS += $(ARCH_HEADERS:%=$(ARCH)/%) $(SKIPHEADERS-)
+@@ ffbuild/common.mak: SKIPHEADERS += $(ARCH_HEADERS:%=$(ARCH)/%) $(SKIPHEADERS-)
SKIPHEADERS := $(SKIPHEADERS:%=$(SUBDIR)%)
HOBJS = $(filter-out $(SKIPHEADERS:.h=.h.o),$(ALLHEADERS:.h=.h.o))
--PTXOBJS = $(filter %.ptx.o,$(OBJS))
+ PTXOBJS = $(filter %.ptx.o,$(OBJS))
-RESOURCEOBJS = $(filter %.css.o %.html.o,$(OBJS))
$(HOBJS): CCFLAGS += $(CFLAGS_HEADERS)
checkheaders: $(HOBJS)
-.SECONDARY: $(HOBJS:.o=.c) $(PTXOBJS:.o=.c) $(PTXOBJS:.o=.gz) $(PTXOBJS:.o=) $(RESOURCEOBJS:.o=.c) $(RESOURCEOBJS:%.css.o=%.css.min) $(RESOURCEOBJS:%.css.o=%.css.min.gz) $(RESOURCEOBJS:%.html.o=%.html.gz) $(RESOURCEOBJS:.o=)
-+.SECONDARY: $(HOBJS:.o=.c)
++.SECONDARY: $(HOBJS:.o=.c) $(PTXOBJS:.o=)
alltools: $(TOOLS)
ffbuild/common.mak | 11 +++++++++--
1 file changed, 9 insertions(+), 2 deletions(-)
diff --git a/ffbuild/common.mak b/ffbuild/common.mak
index 0e1eb1f62b..f03b9ca051 100644
--- a/ffbuild/common.mak
+++ b/ffbuild/common.mak
@@ -139,6 +139,10 @@ else
$(BIN2C) $(patsubst $(SRC_PATH)/%,$(SRC_LINK)/%,$<) $@ $(subst .,_,$(basename $(notdir $@)))
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
@@ -177,6 +181,10 @@ else # NO COMPRESSION
$(BIN2C) $< $@ $(subst .,_,$(basename $(notdir $@)))
endif
+%.html.o %.css.o: CCDEP =
+%.html.o %.css.o: CC_DEPFLAGS =
+
+
clean::
$(RM) $(BIN2CEXE) $(CLEANSUFFIXES:%=ffbuild/%)
@@ -229,10 +237,9 @@ SKIPHEADERS += $(ARCH_HEADERS:%=$(ARCH)/%) $(SKIPHEADERS-)
SKIPHEADERS := $(SKIPHEADERS:%=$(SUBDIR)%)
HOBJS = $(filter-out $(SKIPHEADERS:.h=.h.o),$(ALLHEADERS:.h=.h.o))
PTXOBJS = $(filter %.ptx.o,$(OBJS))
-RESOURCEOBJS = $(filter %.css.o %.html.o,$(OBJS))
$(HOBJS): CCFLAGS += $(CFLAGS_HEADERS)
checkheaders: $(HOBJS)
-.SECONDARY: $(HOBJS:.o=.c) $(PTXOBJS:.o=.c) $(PTXOBJS:.o=.gz) $(PTXOBJS:.o=) $(RESOURCEOBJS:.o=.c) $(RESOURCEOBJS:%.css.o=%.css.min) $(RESOURCEOBJS:%.css.o=%.css.min.gz) $(RESOURCEOBJS:%.html.o=%.html.gz) $(RESOURCEOBJS:.o=)
+.SECONDARY: $(HOBJS:.o=.c) $(PTXOBJS:.o=)
alltools: $(TOOLS)
base-commit: 4099d53759ce5d9190a339c02b6bb486e2880f66
--
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".
^ permalink raw reply [flat|nested] 17+ messages in thread
* [FFmpeg-devel] [PATCH v5 0/2] ffbuild/commonmak: Fix rebuild check with implicit rule chains
2025-05-23 22:05 ` [FFmpeg-devel] [PATCH v4] " softworkz
@ 2025-05-27 21:41 ` ffmpegagent
2025-05-27 21:41 ` [FFmpeg-devel] [PATCH v5 1/2] " softworkz
` (2 more replies)
0 siblings, 3 replies; 17+ messages in thread
From: ffmpegagent @ 2025-05-27 21:41 UTC (permalink / raw)
To: ffmpeg-devel; +Cc: softworkz
V2
==
* Fix MSVC build
(use the universal command pattern)
V3
==
* Skip dependency generation by clearing CC_DEPS instead
(as suggested by Ramiro - thanks!)
V4
==
* Always keep .ptx files (as suggested by Timo - thanks) Tested all
scenarios:
* .ptx.c and .ptx.gz still get deleted (as intermediates)
* repeated make shows "up-to-date"
* removing a .ptx file does not cause a rebuild (it's still an
intermediate, but an "intermediate to keep")
* but changing a .ptx does (in case of dev/debugging)
* changed .cu files always rebuild of course
V5
==
* First patch remains unchanged
* Added second patch to clean up and consolidate the rules around
compression
.
softworkz (2):
ffbuild/commonmak: Fix rebuild check with implicit rule chains
ffbuild/commonmak: Consolidate pattern rules for compression
ffbuild/common.mak | 52 +++++++++++++++++++++++-----------------------
1 file changed, 26 insertions(+), 26 deletions(-)
base-commit: 4099d53759ce5d9190a339c02b6bb486e2880f66
Published-As: https://github.com/ffstaging/FFmpeg/releases/tag/pr-ffstaging-80%2Fsoftworkz%2Fsubmit_commonmak-v5
Fetch-It-Via: git fetch https://github.com/ffstaging/FFmpeg pr-ffstaging-80/softworkz/submit_commonmak-v5
Pull-Request: https://github.com/ffstaging/FFmpeg/pull/80
Range-diff vs v4:
1: 20c2fb65ed = 1: 20c2fb65ed ffbuild/commonmak: Fix rebuild check with implicit rule chains
-: ---------- > 2: 9ff1856142 ffbuild/commonmak: Consolidate pattern rules for compression
--
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".
^ permalink raw reply [flat|nested] 17+ messages in thread
* [FFmpeg-devel] [PATCH v5 1/2] ffbuild/commonmak: Fix rebuild check with implicit rule chains
2025-05-27 21:41 ` [FFmpeg-devel] [PATCH v5 0/2] " ffmpegagent
@ 2025-05-27 21:41 ` softworkz
2025-05-27 21:41 ` [FFmpeg-devel] [PATCH v5 2/2] ffbuild/commonmak: Consolidate pattern rules for compression softworkz
2025-06-17 16:01 ` [FFmpeg-devel] [PATCH v6 0/2] ffbuild/commonmak: Fix rebuild check with implicit rule chains ffmpegagent
2 siblings, 0 replies; 17+ messages in thread
From: softworkz @ 2025-05-27 21:41 UTC (permalink / raw)
To: ffmpeg-devel; +Cc: softworkz
From: softworkz <softworkz@hotmail.com>
When there's a chain of implicit rules, make treats files generated
inside that chain as intermediate files. Those intermediate files are
removed after completion of make. When make is run again, it normally
determines the need for a rebuild by comparing the timestamps of the
original source file and the final output of the chain and if still
up-to-date, it doesn't rebuild, even when the intermediate files are
not present. That makes sense of course - why would it delete them
otherwise, it would end up in builds being never up-to-date.
But this original by-the-book logic appeared to be broken and has been
worked around by adding all intermediate files to the .SECONDARY
special target, which required extra logic and issues with make clean.
What broke the up-to-date checking is the dependency file generation.
For the .c files generated by BIN2C the compile target created a .d
file which indicated that the .ptx.o file has a dependency on the
ptx.c file. And that dependency broke the normal make behavior with
intermediate files.
This patch compiles the BIN2C generated .c files without generating
.d files. In turn the files do not longer need to be added to the
.SECONDARY target in common.mak.
When interested in those files for debugging, a line can be added to
the corresponding Makefile like
.SECONDARY: %.ptx.c %.ptx.gz
Signed-off-by: softworkz <softworkz@hotmail.com>
---
ffbuild/common.mak | 11 +++++++++--
1 file changed, 9 insertions(+), 2 deletions(-)
diff --git a/ffbuild/common.mak b/ffbuild/common.mak
index 0e1eb1f62b..f03b9ca051 100644
--- a/ffbuild/common.mak
+++ b/ffbuild/common.mak
@@ -139,6 +139,10 @@ else
$(BIN2C) $(patsubst $(SRC_PATH)/%,$(SRC_LINK)/%,$<) $@ $(subst .,_,$(basename $(notdir $@)))
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
@@ -177,6 +181,10 @@ else # NO COMPRESSION
$(BIN2C) $< $@ $(subst .,_,$(basename $(notdir $@)))
endif
+%.html.o %.css.o: CCDEP =
+%.html.o %.css.o: CC_DEPFLAGS =
+
+
clean::
$(RM) $(BIN2CEXE) $(CLEANSUFFIXES:%=ffbuild/%)
@@ -229,10 +237,9 @@ SKIPHEADERS += $(ARCH_HEADERS:%=$(ARCH)/%) $(SKIPHEADERS-)
SKIPHEADERS := $(SKIPHEADERS:%=$(SUBDIR)%)
HOBJS = $(filter-out $(SKIPHEADERS:.h=.h.o),$(ALLHEADERS:.h=.h.o))
PTXOBJS = $(filter %.ptx.o,$(OBJS))
-RESOURCEOBJS = $(filter %.css.o %.html.o,$(OBJS))
$(HOBJS): CCFLAGS += $(CFLAGS_HEADERS)
checkheaders: $(HOBJS)
-.SECONDARY: $(HOBJS:.o=.c) $(PTXOBJS:.o=.c) $(PTXOBJS:.o=.gz) $(PTXOBJS:.o=) $(RESOURCEOBJS:.o=.c) $(RESOURCEOBJS:%.css.o=%.css.min) $(RESOURCEOBJS:%.css.o=%.css.min.gz) $(RESOURCEOBJS:%.html.o=%.html.gz) $(RESOURCEOBJS:.o=)
+.SECONDARY: $(HOBJS:.o=.c) $(PTXOBJS:.o=)
alltools: $(TOOLS)
--
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".
^ permalink raw reply [flat|nested] 17+ messages in thread
* [FFmpeg-devel] [PATCH v5 2/2] ffbuild/commonmak: Consolidate pattern rules for compression
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
2025-06-17 16:01 ` [FFmpeg-devel] [PATCH v6 0/2] ffbuild/commonmak: Fix rebuild check with implicit rule chains ffmpegagent
2 siblings, 0 replies; 17+ messages in thread
From: softworkz @ 2025-05-27 21:41 UTC (permalink / raw)
To: ffmpeg-devel; +Cc: softworkz
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".
^ permalink raw reply [flat|nested] 17+ messages in thread
* [FFmpeg-devel] [PATCH v6 0/2] ffbuild/commonmak: Fix rebuild check with implicit rule chains
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 ` [FFmpeg-devel] [PATCH v5 2/2] ffbuild/commonmak: Consolidate pattern rules for compression softworkz
@ 2025-06-17 16:01 ` ffmpegagent
2025-06-17 16:01 ` [FFmpeg-devel] [PATCH v6 1/2] " softworkz
` (2 more replies)
2 siblings, 3 replies; 17+ messages in thread
From: ffmpegagent @ 2025-06-17 16:01 UTC (permalink / raw)
To: ffmpeg-devel; +Cc: softworkz
V2
==
* Fix MSVC build
(use the universal command pattern)
V3
==
* Skip dependency generation by clearing CC_DEPS instead
(as suggested by Ramiro - thanks!)
V4
==
* Always keep .ptx files (as suggested by Timo - thanks) Tested all
scenarios:
* .ptx.c and .ptx.gz still get deleted (as intermediates)
* repeated make shows "up-to-date"
* removing a .ptx file does not cause a rebuild (it's still an
intermediate, but an "intermediate to keep")
* but changing a .ptx does (in case of dev/debugging)
* changed .cu files always rebuild of course
V5
==
* First patch remains unchanged
* Added second patch to clean up and consolidate the rules around
compression
V6
==
* Rebased
* Confirmed that it also resolves MSVC-CLang compilation
(as reported by Kasper Michalow - thanks!)
.
softworkz (2):
ffbuild/commonmak: Fix rebuild check with implicit rule chains
ffbuild/commonmak: Consolidate pattern rules for compression
ffbuild/common.mak | 54 ++++++++++++++++++++++------------------------
1 file changed, 26 insertions(+), 28 deletions(-)
base-commit: 93987c03ec6c14adc71e483a94dd229f7f75b7ba
Published-As: https://github.com/ffstaging/FFmpeg/releases/tag/pr-ffstaging-80%2Fsoftworkz%2Fsubmit_commonmak-v6
Fetch-It-Via: git fetch https://github.com/ffstaging/FFmpeg pr-ffstaging-80/softworkz/submit_commonmak-v6
Pull-Request: https://github.com/ffstaging/FFmpeg/pull/80
Range-diff vs v5:
1: 20c2fb65ed ! 1: a8da0e9d17 ffbuild/commonmak: Fix rebuild check with implicit rule chains
@@ ffbuild/common.mak: else
+
+
# 1) Preprocess CSS to a minified version
+ %.css.min: TAG = SED
%.css.min: %.css
- # Must start with a tab in the real Makefile
@@ ffbuild/common.mak: else # NO COMPRESSION
$(BIN2C) $< $@ $(subst .,_,$(basename $(notdir $@)))
endif
2: 9ff1856142 ! 2: 1781c5fc16 ffbuild/commonmak: Consolidate pattern rules for compression
@@ ffbuild/common.mak: $(BIN2CEXE): ffbuild/bin2c_host.o
-# 1) Preprocess CSS to a minified version
+-%.css.min: TAG = SED
%.css.min: %.css
-- # Must start with a tab in the real Makefile
-- sed 's!/\\*.*\\*/!!g' $< \
+- $(M)sed 's!/\\*.*\\*/!!g' $< \
- | tr '\n' ' ' \
- | tr -s ' ' \
- | sed 's/^ //; s/ $$//' \
@@ ffbuild/common.mak: $(BIN2CEXE): ffbuild/bin2c_host.o
ifdef CONFIG_RESOURCE_COMPRESSION
-# 2) Gzip the minified CSS
+-%.css.min.gz: TAG = GZIP
%.css.min.gz: %.css.min
- $(M)gzip -nc9 $< > $@
+ $(RUN_GZIP)
@@ ffbuild/common.mak: $(BIN2CEXE): ffbuild/bin2c_host.o
+ $(RUN_BIN2C)
-# 4) Gzip the HTML file (no minification needed)
+-%.html.gz: TAG = GZIP
%.html.gz: %.html
- $(M)gzip -nc9 $< > $@
+ $(RUN_GZIP)
--
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".
^ permalink raw reply [flat|nested] 17+ messages in thread
* [FFmpeg-devel] [PATCH v6 1/2] ffbuild/commonmak: Fix rebuild check with implicit rule chains
2025-06-17 16:01 ` [FFmpeg-devel] [PATCH v6 0/2] ffbuild/commonmak: Fix rebuild check with implicit rule chains ffmpegagent
@ 2025-06-17 16:01 ` 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 .
2 siblings, 0 replies; 17+ messages in thread
From: softworkz @ 2025-06-17 16:01 UTC (permalink / raw)
To: ffmpeg-devel; +Cc: softworkz
From: softworkz <softworkz@hotmail.com>
When there's a chain of implicit rules, make treats files generated
inside that chain as intermediate files. Those intermediate files are
removed after completion of make. When make is run again, it normally
determines the need for a rebuild by comparing the timestamps of the
original source file and the final output of the chain and if still
up-to-date, it doesn't rebuild, even when the intermediate files are
not present. That makes sense of course - why would it delete them
otherwise, it would end up in builds being never up-to-date.
But this original by-the-book logic appeared to be broken and has been
worked around by adding all intermediate files to the .SECONDARY
special target, which required extra logic and issues with make clean.
What broke the up-to-date checking is the dependency file generation.
For the .c files generated by BIN2C the compile target created a .d
file which indicated that the .ptx.o file has a dependency on the
ptx.c file. And that dependency broke the normal make behavior with
intermediate files.
This patch compiles the BIN2C generated .c files without generating
.d files. In turn the files do not longer need to be added to the
.SECONDARY target in common.mak.
When interested in those files for debugging, a line can be added to
the corresponding Makefile like
.SECONDARY: %.ptx.c %.ptx.gz
Signed-off-by: softworkz <softworkz@hotmail.com>
---
ffbuild/common.mak | 11 +++++++++--
1 file changed, 9 insertions(+), 2 deletions(-)
diff --git a/ffbuild/common.mak b/ffbuild/common.mak
index ddf48923ea..8304a9e9cb 100644
--- a/ffbuild/common.mak
+++ b/ffbuild/common.mak
@@ -139,6 +139,10 @@ else
$(BIN2C) $(patsubst $(SRC_PATH)/%,$(SRC_LINK)/%,$<) $@ $(subst .,_,$(basename $(notdir $@)))
endif
+%.ptx.o: CCDEP =
+%.ptx.o: CC_DEPFLAGS =
+
+
# 1) Preprocess CSS to a minified version
%.css.min: TAG = SED
%.css.min: %.css
@@ -179,6 +183,10 @@ else # NO COMPRESSION
$(BIN2C) $< $@ $(subst .,_,$(basename $(notdir $@)))
endif
+%.html.o %.css.o: CCDEP =
+%.html.o %.css.o: CC_DEPFLAGS =
+
+
clean::
$(RM) $(BIN2CEXE) $(CLEANSUFFIXES:%=ffbuild/%)
@@ -229,10 +237,9 @@ SKIPHEADERS += $(ARCH_HEADERS:%=$(ARCH)/%) $(SKIPHEADERS-)
SKIPHEADERS := $(SKIPHEADERS:%=$(SUBDIR)%)
HOBJS = $(filter-out $(SKIPHEADERS:.h=.h.o),$(ALLHEADERS:.h=.h.o))
PTXOBJS = $(filter %.ptx.o,$(OBJS))
-RESOURCEOBJS = $(filter %.css.o %.html.o,$(OBJS))
$(HOBJS): CCFLAGS += $(CFLAGS_HEADERS)
checkheaders: $(HOBJS)
-.SECONDARY: $(HOBJS:.o=.c) $(PTXOBJS:.o=.c) $(PTXOBJS:.o=.gz) $(PTXOBJS:.o=) $(RESOURCEOBJS:.o=.c) $(RESOURCEOBJS:%.css.o=%.css.min) $(RESOURCEOBJS:%.css.o=%.css.min.gz) $(RESOURCEOBJS:%.html.o=%.html.gz) $(RESOURCEOBJS:.o=)
+.SECONDARY: $(HOBJS:.o=.c) $(PTXOBJS:.o=)
alltools: $(TOOLS)
--
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".
^ permalink raw reply [flat|nested] 17+ messages in thread
* [FFmpeg-devel] [PATCH v6 2/2] ffbuild/commonmak: Consolidate pattern rules for compression
2025-06-17 16:01 ` [FFmpeg-devel] [PATCH v6 0/2] ffbuild/commonmak: Fix rebuild check with implicit rule chains ffmpegagent
2025-06-17 16:01 ` [FFmpeg-devel] [PATCH v6 1/2] " softworkz
@ 2025-06-17 16:01 ` softworkz
2025-06-17 16:41 ` [FFmpeg-devel] [PATCH v6 0/2] ffbuild/commonmak: Fix rebuild check with implicit rule chains softworkz .
2 siblings, 0 replies; 17+ messages in thread
From: softworkz @ 2025-06-17 16:01 UTC (permalink / raw)
To: ffmpeg-devel; +Cc: softworkz
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 | 43 +++++++++++++++++--------------------------
1 file changed, 17 insertions(+), 26 deletions(-)
diff --git a/ffbuild/common.mak b/ffbuild/common.mak
index 8304a9e9cb..c6726b2afc 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,65 +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: TAG = SED
%.css.min: %.css
- $(M)sed 's!/\\*.*\\*/!!g' $< \
- | tr '\n' ' ' \
- | tr -s ' ' \
- | sed 's/^ //; s/ $$//' \
- > $@
+ $(RUN_MINIFY)
ifdef CONFIG_RESOURCE_COMPRESSION
-# 2) Gzip the minified CSS
-%.css.min.gz: TAG = GZIP
%.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: TAG = GZIP
%.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".
^ permalink raw reply [flat|nested] 17+ messages in thread
* Re: [FFmpeg-devel] [PATCH v6 0/2] ffbuild/commonmak: Fix rebuild check with implicit rule chains
2025-06-17 16:01 ` [FFmpeg-devel] [PATCH v6 0/2] ffbuild/commonmak: Fix rebuild check with implicit rule chains 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 ` softworkz .
2 siblings, 0 replies; 17+ messages in thread
From: softworkz . @ 2025-06-17 16:41 UTC (permalink / raw)
To: ffmpegagent, ffmpeg-devel
> -----Original Message-----
> From: ffmpegagent <ffmpegagent@gmail.com>
> Sent: Tuesday, June 17, 2025 6:02 PM
> To: ffmpeg-devel@ffmpeg.org
> Cc: softworkz <softworkz@hotmail.com>
> Subject: [PATCH v6 0/2] ffbuild/commonmak: Fix rebuild check with implicit
> rule chains
[..]
> V4
> ==
>
> * Always keep .ptx files (as suggested by Timo - thanks) Tested all
> scenarios:
> * .ptx.c and .ptx.gz still get deleted (as intermediates)
> * repeated make shows "up-to-date"
> * removing a .ptx file does not cause a rebuild (it's still an
> intermediate, but an "intermediate to keep")
> * but changing a .ptx does (in case of dev/debugging)
> * changed .cu files always rebuild of course
>
>
> V5
> ==
>
> * First patch remains unchanged
> * Added second patch to clean up and consolidate the rules around
> compression
>
>
> V6
> ==
>
> * Rebased
> * Confirmed that it also resolves MSVC-CLang compilation
> (as reported by Kasper Michalow - thanks!)
@Andreas - this slightly conflicts with your WIP patchset. Do you think it makes
sense to get this one merged first?
It would also need a review, I'm not going to push this without, even though I
believe it's the most suitable and straightforward way to get all the issues
fixed that it covers (up-to-date check wrt. double-make, log-spam, log prefixes,
common.mak sanity and MSVC-CLang build).
Thanks,
sw
_______________________________________________
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".
^ permalink raw reply [flat|nested] 17+ messages in thread
end of thread, other threads:[~2025-06-17 16:41 UTC | newest]
Thread overview: 17+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
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 ` [FFmpeg-devel] [PATCH v5 2/2] ffbuild/commonmak: Consolidate pattern rules for compression softworkz
2025-06-17 16:01 ` [FFmpeg-devel] [PATCH v6 0/2] ffbuild/commonmak: Fix rebuild check with implicit rule chains 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 .
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