From: Ramiro Polla <ramiro.polla@gmail.com> To: ffmpeg-devel@ffmpeg.org Subject: [FFmpeg-devel] [PATCH 4/5] ffbuild/common.mak: clean up and move fftools/resources-specific code its Makefile Date: Tue, 27 May 2025 03:33:27 +0200 Message-ID: <20250527013328.308477-4-ramiro.polla@gmail.com> (raw) In-Reply-To: <20250527013328.308477-1-ramiro.polla@gmail.com> - Intermediate files are no longer removed; - A .res suffix has been added to resource files, so that there's no need to add new rules for each new filetype; - Superfluous comments have been removed; - Targets depending on CONFIG_RESOURCE_COMPRESSION have been deduplicated. --- ffbuild/common.mak | 45 +------------------ fftools/resources/.gitignore | 7 ++- fftools/resources/Makefile | 31 ++++++++++--- .../resources/{graph.css => graph.css.res} | 0 .../resources/{graph.html => graph.html.res} | 0 fftools/resources/resman.c | 12 ++--- 6 files changed, 36 insertions(+), 59 deletions(-) rename fftools/resources/{graph.css => graph.css.res} (100%) rename fftools/resources/{graph.html => graph.html.res} (100%) diff --git a/ffbuild/common.mak b/ffbuild/common.mak index ddf48923ea..27dd48a4e6 100644 --- a/ffbuild/common.mak +++ b/ffbuild/common.mak @@ -139,46 +139,6 @@ else $(BIN2C) $(patsubst $(SRC_PATH)/%,$(SRC_LINK)/%,$<) $@ $(subst .,_,$(basename $(notdir $@))) endif -# 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/ $$//' \ - > $@ - -ifdef CONFIG_RESOURCE_COMPRESSION - -# 2) Gzip the minified CSS -%.css.min.gz: TAG = GZIP -%.css.min.gz: %.css.min - $(M)gzip -nc9 $< > $@ - -# 3) Convert the gzipped CSS to a .c array -%.css.c: %.css.min.gz $(BIN2CEXE) - $(BIN2C) $< $@ $(subst .,_,$(basename $(notdir $@))) - -# 4) Gzip the HTML file (no minification needed) -%.html.gz: TAG = GZIP -%.html.gz: %.html - $(M)gzip -nc9 $< > $@ - -# 5) Convert the gzipped HTML to a .c array -%.html.c: %.html.gz $(BIN2CEXE) - $(BIN2C) $< $@ $(subst .,_,$(basename $(notdir $@))) - -else # NO COMPRESSION - -# 2) Convert the minified CSS to a .c array -%.css.c: %.css.min $(BIN2CEXE) - $(BIN2C) $< $@ $(subst .,_,$(basename $(notdir $@))) - -# 3) Convert the plain HTML to a .c array -%.html.c: %.html $(BIN2CEXE) - $(BIN2C) $< $@ $(subst .,_,$(basename $(notdir $@))) -endif - clean:: $(RM) $(BIN2CEXE) $(CLEANSUFFIXES:%=ffbuild/%) @@ -229,10 +189,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=.c) $(PTXOBJS:.o=.gz) $(PTXOBJS:.o=) alltools: $(TOOLS) @@ -252,7 +211,7 @@ $(TOOLOBJS): | tools OUTDIRS := $(OUTDIRS) $(dir $(OBJS) $(HOBJS) $(HOSTOBJS) $(SHLIBOBJS) $(STLIBOBJS) $(TESTOBJS)) -CLEANSUFFIXES = *.d *.gcda *.gcno *.h.c *.ho *.map *.o *.objs *.pc *.ptx *.ptx.gz *.ptx.c *.ver *.version *.html.gz *.html.c *.css.gz *.css.c *$(DEFAULT_X86ASMD).asm *~ *.ilk *.pdb +CLEANSUFFIXES = *.d *.gcda *.gcno *.h.c *.ho *.map *.o *.objs *.pc *.ptx *.ptx.gz *.ptx.c *.ver *.version *.min.res *.res.gz *.res.c *$(DEFAULT_X86ASMD).asm *~ *.ilk *.pdb LIBSUFFIXES = *.a *.lib *.so *.so.* *.dylib *.dll *.def *.dll.a define RULES diff --git a/fftools/resources/.gitignore b/fftools/resources/.gitignore index 5f496535a6..4c56856284 100644 --- a/fftools/resources/.gitignore +++ b/fftools/resources/.gitignore @@ -1,4 +1,3 @@ -*.html.c -*.css.c -*.html.gz -*.css.gz +*.res.c +*.res.gz +*.res diff --git a/fftools/resources/Makefile b/fftools/resources/Makefile index 8579a52678..a8eb111441 100644 --- a/fftools/resources/Makefile +++ b/fftools/resources/Makefile @@ -1,13 +1,32 @@ clean:: $(RM) $(CLEANSUFFIXES:%=fftools/resources/%) -vpath %.html $(SRC_PATH) -vpath %.css $(SRC_PATH) +vpath %.res $(SRC_PATH) -# Uncomment to prevent deletion during build -#.PRECIOUS: %.css.c %.css.min %.css.gz %.css.min.gz %.html.gz %.html.c +RESOURCEOBJS += fftools/resources/graph.css.min.res.o +RESOURCEOBJS += fftools/resources/graph.html.res.o OBJS-resman += \ fftools/resources/resman.o \ - fftools/resources/graph.html.o \ - fftools/resources/graph.css.o \ + $(RESOURCEOBJS) + +%.css.min.res: TAG = SED +%.css.min.res: %.css.res + $(M)sed 's!/\\*.*\\*/!!g' $< \ + | tr '\n' ' ' \ + | tr -s ' ' \ + | sed 's/^ //; s/ $$//' \ + > $@ + +ifdef CONFIG_RESOURCE_COMPRESSION +RES_GZ = .gz +endif + +%.res.gz: TAG = GZIP +%.res.gz: %.res + $(M)gzip -nc9 $< > $@ + +%.res.c: %.res$(RES_GZ) $(BIN2CEXE) + $(BIN2C) $< $@ $(subst .,_,$(basename $(notdir $@))) + +.SECONDARY: $(RESOURCEOBJS:.o=) $(RESOURCEOBJS:.o=.c) $(RESOURCEOBJS:.o=.gz) diff --git a/fftools/resources/graph.css b/fftools/resources/graph.css.res similarity index 100% rename from fftools/resources/graph.css rename to fftools/resources/graph.css.res diff --git a/fftools/resources/graph.html b/fftools/resources/graph.html.res similarity index 100% rename from fftools/resources/graph.html rename to fftools/resources/graph.html.res diff --git a/fftools/resources/resman.c b/fftools/resources/resman.c index a9e21626fa..00518efd87 100644 --- a/fftools/resources/resman.c +++ b/fftools/resources/resman.c @@ -38,15 +38,15 @@ #include "libavutil/dict.h" #include "libavutil/common.h" -extern const unsigned char ff_graph_html_data[]; -extern const unsigned int ff_graph_html_len; +extern const unsigned char ff_graph_html_res_data[]; +extern const unsigned int ff_graph_html_res_len; -extern const unsigned char ff_graph_css_data[]; -extern const unsigned ff_graph_css_len; +extern const unsigned char ff_graph_css_min_res_data[]; +extern const unsigned ff_graph_css_min_res_len; static const FFResourceDefinition resource_definitions[] = { - [FF_RESOURCE_GRAPH_CSS] = { FF_RESOURCE_GRAPH_CSS, "graph.css", &ff_graph_css_data[0], &ff_graph_css_len }, - [FF_RESOURCE_GRAPH_HTML] = { FF_RESOURCE_GRAPH_HTML, "graph.html", &ff_graph_html_data[0], &ff_graph_html_len }, + [FF_RESOURCE_GRAPH_CSS] = { FF_RESOURCE_GRAPH_CSS, "graph.css", &ff_graph_css_min_res_data[0], &ff_graph_css_min_res_len }, + [FF_RESOURCE_GRAPH_HTML] = { FF_RESOURCE_GRAPH_HTML, "graph.html", &ff_graph_html_res_data[0], &ff_graph_html_res_len }, }; -- 2.39.5 _______________________________________________ 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".
next prev parent reply other threads:[~2025-05-27 1:34 UTC|newest] Thread overview: 33+ messages / expand[flat|nested] mbox.gz Atom feed top 2025-05-27 1:33 [FFmpeg-devel] [PATCH 1/5] configure: remove build-time check for gzip support in zlib Ramiro Polla 2025-05-27 1:33 ` [FFmpeg-devel] [PATCH 2/5] configure: move embedded resource checks to dependency tracker Ramiro Polla 2025-05-27 1:33 ` [FFmpeg-devel] [PATCH 3/5] configure: improve gzip check Ramiro Polla 2025-05-27 6:54 ` Jacob Lifshay 2025-05-27 16:12 ` Ramiro Polla 2025-05-27 19:45 ` Jacob Lifshay 2025-05-27 1:33 ` Ramiro Polla [this message] 2025-05-27 1:48 ` [FFmpeg-devel] [PATCH 4/5] ffbuild/common.mak: clean up and move fftools/resources-specific code its Makefile softworkz . 2025-05-27 2:04 ` Ramiro Polla 2025-05-27 2:18 ` softworkz . 2025-05-27 1:55 ` softworkz . 2025-05-27 3:29 ` Ramiro Polla 2025-05-27 4:02 ` softworkz . 2025-05-27 12:35 ` Ramiro Polla 2025-05-27 19:20 ` softworkz . 2025-05-27 19:59 ` Ramiro Polla 2025-05-27 20:13 ` softworkz . 2025-05-30 11:00 ` Ramiro Polla 2025-05-27 1:33 ` [FFmpeg-devel] [PATCH 5/5] fftools/Makefile: clean files from fftools/{graph, textformat}/ Ramiro Polla 2025-06-01 21:30 ` Ramiro Polla 2025-06-01 21:46 ` softworkz . 2025-06-01 21:58 ` softworkz . 2025-05-27 1:43 ` [FFmpeg-devel] [PATCH 1/5] configure: remove build-time check for gzip support in zlib softworkz . 2025-05-27 1:52 ` Ramiro Polla 2025-05-27 13:18 ` Timo Rothenpieler 2025-05-27 17:55 ` Ramiro Polla 2025-05-30 11:10 ` Ramiro Polla 2025-05-30 18:18 ` Jacob Lifshay 2025-06-02 23:22 ` Ramiro Polla 2025-06-02 23:25 ` softworkz . 2025-06-02 23:31 ` softworkz . 2025-06-03 0:19 ` Ramiro Polla 2025-06-03 0:46 ` softworkz .
Reply instructions: You may reply publicly to this message via plain-text email using any one of the following methods: * Save the following mbox file, import it into your mail client, and reply-to-all from there: mbox Avoid top-posting and favor interleaved quoting: https://en.wikipedia.org/wiki/Posting_style#Interleaved_style * Reply using the --to, --cc, and --in-reply-to switches of git-send-email(1): git send-email \ --in-reply-to=20250527013328.308477-4-ramiro.polla@gmail.com \ --to=ramiro.polla@gmail.com \ --cc=ffmpeg-devel@ffmpeg.org \ /path/to/YOUR_REPLY https://kernel.org/pub/software/scm/git/docs/git-send-email.html * If your mail client supports setting the In-Reply-To header via mailto: links, try the mailto: link
Git Inbox Mirror of the ffmpeg-devel mailing list - see https://ffmpeg.org/mailman/listinfo/ffmpeg-devel This inbox may be cloned and mirrored by anyone: git clone --mirror https://master.gitmailbox.com/ffmpegdev/0 ffmpegdev/git/0.git # If you have public-inbox 1.1+ installed, you may # initialize and index your mirror using the following commands: public-inbox-init -V2 ffmpegdev ffmpegdev/ https://master.gitmailbox.com/ffmpegdev \ ffmpegdev@gitmailbox.com public-inbox-index ffmpegdev Example config snippet for mirrors. AGPL code for this site: git clone https://public-inbox.org/public-inbox.git