From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from ffbox0-bg.ffmpeg.org (ffbox0-bg.ffmpeg.org [79.124.17.100]) by master.gitmailbox.com (Postfix) with ESMTPS id 76F484ADE6 for ; Tue, 20 May 2025 23:33:15 +0000 (UTC) Received: from [127.0.1.1] (localhost [127.0.0.1]) by ffbox0-bg.ffmpeg.org (Postfix) with ESMTP id 4555968DBDE; Wed, 21 May 2025 02:33:11 +0300 (EEST) Received: from mail-pg1-f169.google.com (mail-pg1-f169.google.com [209.85.215.169]) by ffbox0-bg.ffmpeg.org (Postfix) with ESMTPS id 8564168D734 for ; Wed, 21 May 2025 02:33:05 +0300 (EEST) Received: by mail-pg1-f169.google.com with SMTP id 41be03b00d2f7-b0db0b6a677so5302776a12.2 for ; Tue, 20 May 2025 16:33:05 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1747783983; x=1748388783; darn=ffmpeg.org; h=cc:to:mime-version:content-transfer-encoding:fcc:subject:date :references:in-reply-to:message-id:from:from:to:cc:subject:date :message-id:reply-to; bh=SMVjifSB/icxllUylJSyWzGtHXxp19IASK1rHa7Heig=; b=Z92GGFK0FNDk4ATtVHnYYYyScJE3hhKXvPkS0k/OjcWwx2kVMp+cBNbD0u8e3fGuVX k636lmEjXeDnNQDcBgyYHvVYPvJqKPz8/0bcolOslxfHmB7V/UzVPAO+zT9iT1Liqb4h 7lHhieiEUqi5/YlUcEZ2eDQYMoULrau+qW/dhsr+UEUZS3UBakgOgRyulvQiqAL2JXUN khVGVXPBnJppXMOAqo+kfFUeQqJmig0Vi1V9E3N7HLZe8XN88q6KPK1tf/qwH7Tsvqwp 8zFv/YzfVzhsFc6TpAm7kNcETChjMnxzbdG6SH8goxCn9hmZpB2DZFC7dvoakRIFHWBu yk3Q== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1747783983; x=1748388783; h=cc:to:mime-version:content-transfer-encoding:fcc:subject:date :references:in-reply-to:message-id:from:x-gm-message-state:from:to :cc:subject:date:message-id:reply-to; bh=SMVjifSB/icxllUylJSyWzGtHXxp19IASK1rHa7Heig=; b=PVOdb421b0SJ5j5QBw+xTmVyGF38o9WwRC6YfNbajkdFVGqxVHi3FDSlkSE2hFyI+E AMjtowifjTZrTRrS2cPAXnSkhRgmZc9xGeKaX6lW5aMS11hxzB5joxgdB2ngW21yEVNX ewP2o3cWklaSF3NML3gw8gdVOtYD2oZPaW0DNwlE+rojvy4OpPXIv1NecXU7Cz0ISHcI VtRE1Lq/RdrfRWfI70uKKuLSij9P4QV7n210m2w4RtgRDJ9+4YWh9fusUm3SQkqSdN74 AxPguGziS+ZqA325SbIs0hPWhljDFcK2HImTv0Za7Q8qrnt++cr4cyxbh195R9qo2pjd zqkA== X-Gm-Message-State: AOJu0Yzrw6LvdS0HCbWQoY4TvCQZCX+WXQiNetqWZNdZD0SydGbRmYPS cXB+H0b/pxX+zFZBdAtHvLcRI7pOcHpORHXMuPDPykM/RxukG93GwUhfHhxgcw== X-Gm-Gg: ASbGncu+46irTljlS4HZrJqpAQPf/lBbEo2qrmFCCzML6+mPWSxxBVq0P9KGc8zHve7 CicvXKB6oboWFOk0kRwmGsRY3AMv3p3vTxVafPOEqNX+S1xqtHy1kSqc5uJ9AUsm4EOrXq+4P5A tnXXrxZYvH2S/negZ5KX4CBFnbEGg2ejdYadbAB9Rk2XifjfcVbTmcxCOGBhM5gVTFJuOPlWVyM oYfxESG1sFJJH6sF/yr9YyPJqWYXVVWO7vrIgE1V5fPpo4am6sAW0BhD+xvHtkrCK0ujOvPJ4kT LS1NknUwEmZ8/tFrUdjwL5Ef7R/co9JcxuN1ITJjl64zOJxsW+Alb01pR9m0jz9xxnxnWQ== X-Google-Smtp-Source: AGHT+IH3lKkdERJpRlpS1i3pQnEEZH8EVFcF2yXGSv3C/TuuxNtoupzmTyR53kfmq7z3r7s6VtHgfA== X-Received: by 2002:a17:902:dacf:b0:220:c164:6ee1 with SMTP id d9443c01a7336-231d4595b02mr279647845ad.32.1747783983477; Tue, 20 May 2025 16:33:03 -0700 (PDT) Received: from [127.0.0.1] (master.gitmailbox.com. [34.83.118.50]) by smtp.gmail.com with ESMTPSA id d9443c01a7336-231d4eba368sm82192415ad.200.2025.05.20.16.33.03 (version=TLS1_2 cipher=ECDHE-ECDSA-AES128-GCM-SHA256 bits=128/128); Tue, 20 May 2025 16:33:03 -0700 (PDT) From: softworkz X-Google-Original-From: softworkz Message-Id: In-Reply-To: References: Date: Tue, 20 May 2025 23:32:57 +0000 Fcc: Sent MIME-Version: 1.0 To: ffmpeg-devel@ffmpeg.org Subject: [FFmpeg-devel] [PATCH v3] ffbuild/commonmak: Fix rebuild check with implicit rule chains X-BeenThere: ffmpeg-devel@ffmpeg.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: FFmpeg development discussions and patches List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Reply-To: FFmpeg development discussions and patches Cc: softworkz Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Errors-To: ffmpeg-devel-bounces@ffmpeg.org Sender: "ffmpeg-devel" Archived-At: List-Archive: List-Post: From: softworkz 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 --- 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".