| 1715 | |
| 1716 | #if defined(OLD_MAKEDEFS_OPTIONS) |
| 1717 | void |
| 1718 | do_date(void) |
| 1719 | { |
| 1720 | #ifdef KR1ED |
| 1721 | long clocktim = 0; |
| 1722 | #else |
| 1723 | time_t clocktim = 0; |
| 1724 | #endif |
| 1725 | char githash[BUFSZ], gitbranch[BUFSZ]; |
| 1726 | char *c, cbuf[60], buf[BUFSZ]; |
| 1727 | const char *ul_sfx; |
| 1728 | #if defined(CROSSCOMPILE) && !defined(CROSSCOMPILE_TARGET) |
| 1729 | const char *xpref = "HOST_"; |
| 1730 | #else |
| 1731 | const char *xpref = (const char *) 0; |
| 1732 | #endif /* CROSSCOMPILE && !CROSSCOMPILE_TARGET */ |
| 1733 | |
| 1734 | /* before creating date.h, make sure that xxx_GRAPHICS and |
| 1735 | DEFAULT_WINDOW_SYS have been set up in a viable fashion */ |
| 1736 | windowing_sanity(); |
| 1737 | |
| 1738 | filename[0] = '\0'; |
| 1739 | #ifdef FILE_PREFIX |
| 1740 | Strcat(filename, file_prefix); |
| 1741 | #endif |
| 1742 | Sprintf(eos(filename), INCLUDE_TEMPLATE, DATE_FILE); |
| 1743 | if (!(ofp = fopen(filename, WRTMODE))) { |
| 1744 | perror(filename); |
| 1745 | makedefs_exit(EXIT_FAILURE); |
| 1746 | /*NOTREACHED*/ |
| 1747 | } |
| 1748 | /* NB: We've moved on from SCCS, but this way this line |
| 1749 | * won't get clobbered when downstream projects import |
| 1750 | * this file into something more modern. */ |
| 1751 | Fprintf(ofp, "%s", Reference_file); |
| 1752 | |
| 1753 | (void) time(&clocktim); |
| 1754 | #ifdef REPRODUCIBLE_BUILD |
| 1755 | { |
| 1756 | /* |
| 1757 | * Use date+time of latest source file revision (set up in |
| 1758 | * our environment rather than derived by scanning sources) |
| 1759 | * instead of current date+time, so that later rebuilds of |
| 1760 | * the same sources specifying the same configuration will |
| 1761 | * produce the same result. |
| 1762 | * |
| 1763 | * Changing the configuration should be done by modifying |
| 1764 | * config.h or <port>conf.h and setting SOURCE_DATE_EPOCH |
| 1765 | * based on whichever changed most recently, not by using |
| 1766 | * make CFLAGS='-Dthis -Dthat' |
| 1767 | * to make alterations on the fly. |
| 1768 | * |
| 1769 | * Limited validation is performed to prevent dates in the |
| 1770 | * future (beyond a leeway of 24 hours) or distant past. |
| 1771 | * |
| 1772 | * Assumes the value of time_t is in seconds, which is |
| 1773 | * fundamental for Unix and mandated by POSIX. For any ports |
| 1774 | * where that isn't true, leaving REPRODUCIBLE_BUILD disabled |
no test coverage detected