Files
lotherk e71bb99b35 mcde: tradcpp predefines the target OS (dtlogin Xservers)
tradcpp runs on the build host but preprocesses dtlogin/config/*.src for the target. config.h used the compiler's OS, so a Linux->NetBSD cross build preprocessed the __linux__ branch of Xservers.src (tested before __NetBSD__) and installed /usr/pkg/dt/config/Xservers with '/usr/bin/X :0' and Xfailsafe with XDIR=/usr/bin; dtlogin had no server to start. configure.ac now derives MCDE_TRADCPP_CPPFLAGS from host_os and tradcpp takes CONFIG_OS_IDENT for CONFIG_OS. Measured 2026-11-15 (config.log build_os=linux-gnu host_os=netbsd) and by hand: tradcpp with -DCONFIG_OS_IDENT=__NetBSD__ emits ':0   Local local@console /usr/X11R7/bin/X :0', without it '/usr/bin/X :0'.
2026-11-15 09:31:27 +00:00

30 lines
1.4 KiB
Makefile

MAINTAINERCLEANFILES = Makefile.in
noinst_PROGRAMS = tradcpp
tradcpp_SOURCES = array.c directive.c files.c macro.h output.h \
utils.c array.h directive.h files.h main.c place.c utils.h \
bool.h eval.c inlinedefs.h mode.h place.h version.h config.h \
eval.h macro.c output.c union.h
# tradcpp is a build tool: it must run on the machine that builds MCDE, so it is
# compiled by the build host's compiler, not the target's (the values come from
# AM_MAKEFLAGS in the top Makefile.am and the pkgsrc recipe). Built for the
# target it cannot execute here: "/bin/sh: ../../../../util/tradcpp/tradcpp: not
# found" (build/logs/userland-2026-11-14j.log:7715ff).
# automake has no per-target CC/CFLAGS/LDFLAGS override that replaces the
# generated values (tradcpp_CC was ignored: the binary was still linked by the
# target compiler, an ELF for NetBSD that cannot run here,
# build/logs/userland-2026-11-14k.log:7697). The whole program is a build
# tool, so replace the generated variables for this sub-make only; the top
# Makefile.am forwards them through AM_MAKEFLAGS.
# $(MCDE_TRADCPP_CPPFLAGS) comes from configure.ac: it says which OS's macro
# this build tool predefines -- the TARGET's, not the build host's (config.h
# explains what went wrong without it).
CC = $(CC_FOR_BUILD)
CPPFLAGS = $(CPPFLAGS_FOR_BUILD) $(MCDE_TRADCPP_CPPFLAGS)
CFLAGS = $(CFLAGS_FOR_BUILD)
LDFLAGS = $(LDFLAGS_FOR_BUILD)