diff --git a/Makefile.in b/Makefile.in
index 90663178..65aec6ff 100644
--- a/Makefile.in
+++ b/Makefile.in
@@ -61,8 +61,9 @@ config:
# -f path). A phase aggregate (depend, modules, libs, ...) is then just a list
# of its per-dir targets as prerequisites -- no shell `for` loops, no FORCE
# pattern-rule hack. Ordering between phases is expressed as prerequisites on the
-# per-dir targets (e.g. every module@ waits for `depend`), so the graph is correct
-# under `make -jN`, not just left-to-right in a serial build. '@' never appears
+# per-dir targets (e.g. every module@ waits for the generated header ${DATABASE_H}),
+# so the graph is correct under `make -jN`, not just left-to-right in a serial
+# build. '@' never appears
# in a real target name, so it is a safe namespace separator.
# ---------------------------------------------------------------------------
@@ -169,7 +170,7 @@ install-magic:
@${MAKE} install-real
# install@
: install one subdir's artifacts (CAD dirs, then the programs).
-INSTALL_TARGETS := $(addprefix install@,${INSTALL_CAD_DIRS} ${PROGRAMS})
+INSTALL_TARGETS := $(addprefix install@,$(sort ${INSTALL_CAD_DIRS} ${PROGRAMS}))
.PHONY: $(INSTALL_TARGETS)
$(INSTALL_TARGETS): install@%: install-dirs
@$(call submake,$*,install)
@@ -192,7 +193,7 @@ install-tcl:
@${MAKE} install-tcl-real
# install-tcl@: install one subdir's Tcl-flavoured artifacts.
-INSTALLTCL_TARGETS := $(addprefix install-tcl@,${INSTALL_CAD_DIRS} ${PROGRAMS})
+INSTALLTCL_TARGETS := $(addprefix install-tcl@,$(sort ${INSTALL_CAD_DIRS} ${PROGRAMS}))
.PHONY: $(INSTALLTCL_TARGETS)
$(INSTALLTCL_TARGETS): install-tcl@%: install-tcl-dirs
@$(call submake,$*,install-tcl)
diff --git a/graphics/Makefile.in b/graphics/Makefile.in
index a2625751..0346dbfb 100644
--- a/graphics/Makefile.in
+++ b/graphics/Makefile.in
@@ -31,24 +31,6 @@ X11HELP_PROG = XHelper7
include ${MAGICDIR}/defs.mak
SRCS = ${BASE_SRCS} ${GR_SRCS}
-DEPSRCS = ${BASE_SRCS}
-ifeq (${MAKE_X11},1)
-DEPSRCS += ${X11_SRCS} ${TK_SRCS}
-endif
-ifeq (${MAKE_GL},1)
-DEPSRCS += ${OGL_GL_SRCS} ${TOGL_GL_SRCS}
-ifeq (${MAKE_GLU},1)
-DEPSRCS += ${OGL_GLU_SRCS} ${TOGL_GLU_SRCS}
-endif
-DEPSRCS += ${THREE_D_SRCS}
-endif
-ifeq (${MAKE_X11},1)
-DEPSRCS += ${TKCOMMON_SRCS}
-DEPSRCS += ${X11HELPER_SRCS} ${X11THREAD_SRCS}
-endif
-ifeq (${MAKE_CAIRO},1)
-DEPSRCS += ${TCAIRO_SRCS}
-endif
# Note GR_SRCS is from defs.mak
OBJS = ${BASE_SRCS:.c=.o} ${GR_SRCS:.c=.o}
CFLAGS += ${GR_CFLAGS}
diff --git a/npm/build.sh b/npm/build.sh
index d9d241f6..72bcc770 100755
--- a/npm/build.sh
+++ b/npm/build.sh
@@ -90,7 +90,9 @@ ncpu() {
sed_strip_cr() {
local file=$1 tmp
tmp=$(mktemp)
- sed 's/\r//' "$file" > "$tmp" && cat "$tmp" > "$file" && rm "$tmp"
+ # Only write back when a CR was actually stripped, so a clean LF checkout is
+ # left untouched (no mtime bump that could perturb a coexisting native build).
+ sed 's/\r//' "$file" > "$tmp" && { cmp -s "$tmp" "$file" || cat "$tmp" > "$file"; } && rm "$tmp"
}
if [ $OPT_RELEASE -eq 1 ]; then
diff --git a/scripts/defs.mak.in b/scripts/defs.mak.in
index c8e8f49f..29120274 100755
--- a/scripts/defs.mak.in
+++ b/scripts/defs.mak.in
@@ -131,7 +131,8 @@ MAGIC_BUILDDATE_DEFS = @MAGIC_BUILDDATE_DEFS@
# skipping it under --disable-magic-builddate avoids the parse-time date spawn.
ifeq (${MAGIC_BUILDDATE_DEFS},)
# Honor SOURCE_DATE_EPOCH (reproducible builds -- appimage/npm tarballs) when set,
-# else the current time. UTC so the stamp does not depend on the builder's zone.
+# else the current time. The SOURCE_DATE_EPOCH branch uses UTC so a reproducible
+# stamp does not depend on the builder's zone; the plain-`date` fallback is local.
MAGIC_BUILDDATE ?= $(shell if [ -n "$$SOURCE_DATE_EPOCH" ]; then \
date -u -d "@$$SOURCE_DATE_EPOCH" 2>/dev/null \
|| date -u -r "$$SOURCE_DATE_EPOCH" 2>/dev/null; \
diff --git a/toolchains/emscripten/defs.mak b/toolchains/emscripten/defs.mak
index 60cd86f6..986b3daf 100644
--- a/toolchains/emscripten/defs.mak
+++ b/toolchains/emscripten/defs.mak
@@ -62,11 +62,12 @@ TOP_EXTRA_LIBS += \
# The ${MAGICDIR}/scmos dir embed above supplies the *generated* tech files, but a
# technology's "styles" section also needs the display styles + colour maps
-# (scmos ${FILES}: mos.*.dstyle / mos.*.cmap). Those are *source* files, so out
-# of source they are not in the build tree and the embed misses them -- init then
-# fails with "Couldn't open color map file mos.7bit.std.cmap" / "Cannot load
-# technology". Embed each from the source tree into the same VFS dir. $(wildcard)
-# matches only files that exist, so a stale/typo'd name in ${FILES} (e.g. the
-# non-existent mos.7bit.mraster_dstyle) can never break the link.
-SCMOS_DISPLAY := $(wildcard ${MAGICSRC}/scmos/mos.*.dstyle ${MAGICSRC}/scmos/mos.*.cmap)
+# (scmos ${FILES}). Those are *source* files, so out of source they are not in
+# the build tree and the embed misses them -- init then fails with "Couldn't open
+# color map file mos.7bit.std.cmap" / "Cannot load technology". Embed each from
+# the source tree into the same VFS dir. Match `mos.*dstyle` (no dot) so both the
+# `.dstyle` files and mos.7bit.mraster_dstyle (an underscore, not a dot) are
+# covered, plus the `mos.*.cmap` colour maps. $(wildcard) matches only files that
+# exist, so it never lists a name that would break the link.
+SCMOS_DISPLAY := $(wildcard ${MAGICSRC}/scmos/mos.*dstyle ${MAGICSRC}/scmos/mos.*.cmap)
TOP_EXTRA_LIBS += $(foreach f,$(SCMOS_DISPLAY),--embed-file $(f)@/magic/sys/current/$(notdir $(f)))