build: do not share a file for the 64-bit time_t test

YEAR_2038 writes its test program to $(TMP_DIR)/year2038.c and deletes
it after the test. Packages that are built in parallel run the test at
the same time and use the same file, so one of them can compile a
partly written file or find no file. The test then fails, and the host
build is configured with --disable-year2038.

Pass the test program to the compiler on stdin instead.

Signed-off-by: John Crispin <john@phrozen.org>
This commit is contained in:
John Crispin committed 2026-09-22 18:18:58 +02:00
1 parent 1315d21949
commit 83b7310eb3
1 file changed
+6 -6
+6 -6
View File
@@ -438,12 +438,12 @@ endef
##
define YEAR_2038
$(shell \
mkdir -p $(TMP_DIR); \
echo '$(pound) include <time.h>' > $(TMP_DIR)/year2038.c; \
echo '$(pound) define LARGE_TIME_T ((time_t) (((time_t) 1 << 30) - 1 + 3 * ((time_t) 1 << 30)))' >> $(TMP_DIR)/year2038.c; \
echo 'int verify_time_t_range[(LARGE_TIME_T / 65537 == 65535 && LARGE_TIME_T % 65537 == 0) ? 1 : -1];' >> $(TMP_DIR)/year2038.c; \
echo 'int main (void) {return 0;}' >> $(TMP_DIR)/year2038.c; \
$(HOSTCC) $(TMP_DIR)/year2038.c -o /dev/null 2>/dev/null && echo y && rm -f $(TMP_DIR)/year2038.c || rm -f $(TMP_DIR)/year2038.c; \
{ \
echo '$(pound) include <time.h>'; \
echo '$(pound) define LARGE_TIME_T ((time_t) (((time_t) 1 << 30) - 1 + 3 * ((time_t) 1 << 30)))'; \
echo 'int verify_time_t_range[(LARGE_TIME_T / 65537 == 65535 && LARGE_TIME_T % 65537 == 0) ? 1 : -1];'; \
echo 'int main (void) {return 0;}'; \
} | $(HOSTCC) -x c - -o /dev/null 2>/dev/null && echo y; \
)
endef