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 0A4E44F21E for ; Sun, 18 May 2025 02:14:46 +0000 (UTC) Received: from [127.0.1.1] (localhost [127.0.0.1]) by ffbox0-bg.ffmpeg.org (Postfix) with ESMTP id 6E5AD68D239; Sun, 18 May 2025 05:14:43 +0300 (EEST) Received: from mail-pl1-f174.google.com (mail-pl1-f174.google.com [209.85.214.174]) by ffbox0-bg.ffmpeg.org (Postfix) with ESMTPS id 23F8568D239 for ; Sun, 18 May 2025 05:14:36 +0300 (EEST) Received: by mail-pl1-f174.google.com with SMTP id d9443c01a7336-231f325366eso14101585ad.1 for ; Sat, 17 May 2025 19:14:36 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1747534474; x=1748139274; darn=ffmpeg.org; h=cc:to:mime-version:content-transfer-encoding:fcc:subject:date :message-id:from:from:to:cc:subject:date:message-id:reply-to; bh=00z5fjtJbKI9w61M1zr2VY8uo112XEGLESjBbFea2H4=; b=j6kc0I50aeRxpJckZn7JDP0lkZ+1tn2NeA3s58ilgw7XPtDObSSTdqzSknmdLJjEXl LiIR34P9H2//2LCRmadj2mOfI1DuBpdCOCHRfwaSkmoeao+adNNwD5ANeDOZ5i9LuW6D 3njS/PAOpnMgkr9IzojIcFu51qbYdQo6GEjpK5hPw6Zluxu7ibAX3RSlMB5ADEg/f+fV +z1SYvimqfgusKnAHmhlnatF18MDxAwosNgsLOjQeiGrxh0kfdoHz7o6VMke/CsE1nZh eTwJ1os/ix+i5WWxJWvoalG8ANV5fMKbnWaScwy9HrWzALEJuN3Zp/xdumQncA3K9QJk bvIA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1747534474; x=1748139274; h=cc:to:mime-version:content-transfer-encoding:fcc:subject:date :message-id:from:x-gm-message-state:from:to:cc:subject:date :message-id:reply-to; bh=00z5fjtJbKI9w61M1zr2VY8uo112XEGLESjBbFea2H4=; b=Ow581LQ0Z+tzjCQyf+NQVC2RVdbGemjWiRusYZoQDwsr5yEveMCQliRb2qYqEjjBlh DwUew0bupSLHnK/yNui/1Zs4p7hVRwAcCj19ecrHOQNNBBJQSLmArTbOUXiSnSmVvi8x Ul0aKje9wGroECDukUQyV+XKBKoxxlF07B5fI/jCMi5QRoy0ROZ3B/Gmu8wg+lufVkyZ QVZ6rFtvFvM2or5JwnpYo5aTVnPe3Osx7atwhbhKVLpA4kysY116XxXPJb5Kzy3GjwBG 2EJchSfwQ+g92ZD2utPyCgANrK7yV6jSa4KRSg4GBvrGMgyVBzdSZragQcmqzK0Gnx4O B2Aw== X-Gm-Message-State: AOJu0Yx5AkqwOX5UmVkz2co3S9c7ome+o5MWK37Fsau39JPlx4cSOJWx UBIwG36/Up/CRmD5E8LZQCYuZ1Mo9nwunqblwgCKPmLSMv2871zcNtpnUMqZsg== X-Gm-Gg: ASbGncsCBEJTu7fqy7DH//1G/xtNQr7GnODv4hfvZ3nTjpqb2cq/rqeYjRiXhF3Ra7n m59omnIfCYFtbC1pjaQQPrEnkPGcfA+Ql7LIbd2Fn4Cbba3v8FbbsMwhxk30JgIOI9/ji3jr8NE QN8+5EEkb4Kv2uYT/sOthHKTbJitMMsdS7KZ1Na3aDT5FcrASFPhAExU3XRlNsk1yuZ11md0L2n ELx3mqvyrz4XKbfBe5Qd5SgqNWT15+fLsCQBuQoOROR0+Jk4+zZ1TinieDEfFtlXvnSz+t1evwa mK2q0MHfoleY1eyWcX1rIEtSa4egWIrmsG0OQTgyJV7dr0WlT66D16HOyuti0cuzq3G8SA== X-Google-Smtp-Source: AGHT+IFFAt9WjxNaZ+eBEtzjlmLKQBCYnNKB2tfJP8qe54PwyjakMHoePCyh3mEmMuC50zXTklZwKw== X-Received: by 2002:a17:903:451:b0:231:fc67:f8e3 with SMTP id d9443c01a7336-231fc680227mr50821815ad.51.1747534474164; Sat, 17 May 2025 19:14:34 -0700 (PDT) Received: from [127.0.0.1] (master.gitmailbox.com. [34.83.118.50]) by smtp.gmail.com with ESMTPSA id d9443c01a7336-231d4e9828esm36590995ad.114.2025.05.17.19.14.33 (version=TLS1_2 cipher=ECDHE-ECDSA-AES128-GCM-SHA256 bits=128/128); Sat, 17 May 2025 19:14:33 -0700 (PDT) From: softworkz X-Google-Original-From: softworkz Message-Id: Date: Sun, 18 May 2025 02:14:28 +0000 Fcc: Sent MIME-Version: 1.0 To: ffmpeg-devel@ffmpeg.org Subject: [FFmpeg-devel] [PATCH] 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 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".