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 4DF4E4D425 for ; Sun, 18 May 2025 06:30:49 +0000 (UTC) Received: from [127.0.1.1] (localhost [127.0.0.1]) by ffbox0-bg.ffmpeg.org (Postfix) with ESMTP id 5C38268D30A; Sun, 18 May 2025 09:30:45 +0300 (EEST) Received: from mail-pf1-f181.google.com (mail-pf1-f181.google.com [209.85.210.181]) by ffbox0-bg.ffmpeg.org (Postfix) with ESMTPS id BA59D68CFBB for ; Sun, 18 May 2025 09:30:38 +0300 (EEST) Received: by mail-pf1-f181.google.com with SMTP id d2e1a72fcca58-736c277331eso3963806b3a.1 for ; Sat, 17 May 2025 23:30:38 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1747549837; x=1748154637; 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=HCk1YdHI640wnKRbriHT3h8RwdLNRPC3mdf3zP3DDM0=; b=Yg+cqvJeo/o1K13vxVHzCGPzSwrqvoYSOlko39wxGDlQF67nNglFHrGzFVlnlUtKer t7u8uNGyTLFbZFk7AbbEPUJ9hnW3RFNWQUBpWBJ2sEhOGwgM/inqqQ1mAAvYBKZ+vXay P5f/a3SPmae61fPjLQmbLPUNR9qHp7xByYoyADnywYqiYU0JuXug8AtLxmzz/Ai1WN6J 1zAMckTuRe8mHB4RqLkCcH6yCBy1UCtnzM4mbbOTbGiI64urf2yEcj585cNZMi7LKhcJ BhMzLDysh5780H65mH0gdoh6C0QNVhlfVwVcQuZpsAG9qRTmBApRCVqvWUC/QiX1AQol bVsQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1747549837; x=1748154637; 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=HCk1YdHI640wnKRbriHT3h8RwdLNRPC3mdf3zP3DDM0=; b=dIS+AoUY68feAYpOVtquRZTeaXdFY8pSQvVmDbEBD1Mm7+79zu4WxDi9O1m5IAEEKH FW4eDzH6sMJsexrhU8jDHtBNWpUy+bG/ue4vY5cVMht7/01etT+rVzgtanP0G63BdlwI 5VW3iRlr9NI7cS2dSBD2SJbmpOH+zSuq3LQtv2szrJeSAS2wW8jIKB+Mn39DxBg9ZO73 lGqe6nrho0PXBCluQnrPZF4DvHXAO6gcOTWgEbM0sjVRyeI7cQtMlK+oA73K5dY0CB2N 2y7JJznJ4Rw97W9/Ndlq8Kn51jzNqXDI8hlSHSwCo+BTiCa1nTIE5RbyaN6Z6kHsLNbG Fhiw== X-Gm-Message-State: AOJu0Yx9Bvi6txY+kYMWj+4lxavzRe31cfPT9FxvT+uNhmTnNHuQl0bC 2sL7OerJP6PqmriKSTL3wkHe9ZSrGJVUiJfKV8SIbetePAXTRex8ksbcMtziqw== X-Gm-Gg: ASbGncuIdMi63ya8XTaJ4nWSFL+Zqj0f2hS1tDYB/Oz80DXdInvdAWWJA00uyxG4dIU gOruSKR8fkOCKEjjOPlSbSUAAyT5bLuY4YR8D0sGe/Jh+ceC0gnILPWeZllDPQ1XWgGauW+wFjg vXaOkxH9Ss2ksnu7F3HGciPLmUe8J+fVHMMupv96YwMe/8ei7DALM//Y3txcxtlRMG8zxeirySK JjmaLVLLOLwVbmcqCgsBHJI7e8pTCWp0CU+g8aiF+HtJhcAWXrEXvvVVj6Sq76EGUMa0p8egirM L7ZMdeVGuEz16+m0fzPkAsMZP1A+jFzIsgg523FG5qZeN4hln2mmTo1tDIo/iex27PsKBQ== X-Google-Smtp-Source: AGHT+IHc5xQkt9NOY54BCPwS7BUTEpFSO4TGuYwIDZj41MFulnAQWxgc3HwFOBmPA4+cd1KN58I6Ag== X-Received: by 2002:a05:6a21:9614:b0:218:23bd:6927 with SMTP id adf61e73a8af0-21823bd81c6mr3250114637.6.1747549836556; Sat, 17 May 2025 23:30:36 -0700 (PDT) Received: from [127.0.0.1] (master.gitmailbox.com. [34.83.118.50]) by smtp.gmail.com with ESMTPSA id 98e67ed59e1d1-30e7b4dda42sm4412641a91.35.2025.05.17.23.30.36 (version=TLS1_2 cipher=ECDHE-ECDSA-AES128-GCM-SHA256 bits=128/128); Sat, 17 May 2025 23:30:36 -0700 (PDT) From: softworkz X-Google-Original-From: softworkz Message-Id: In-Reply-To: References: Date: Sun, 18 May 2025 06:30:30 +0000 Fcc: Sent MIME-Version: 1.0 To: ffmpeg-devel@ffmpeg.org Subject: [FFmpeg-devel] [PATCH v2] 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) 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".