Files
mcde/programs/dtksh/Makefile.am
T
lotherk 1422052fd2 mcde/dtksh: the compiler goes into the environment, not the argument list
ksh93's bin/package takes its compiler from $CC ('case $cc in /*)') and the
absolute path passed as a bare argument did not survive the script's own parsing:
it still said 'cc: not found -- set CC=C-compiler' with the path on the command
line (build/logs/userland-2026-11-14-finish4.log:16480).  The rule now prefixes the
one command with CC=<wrapper path>, which is where the script looks first.
2026-11-14 08:06:52 +00:00

97 lines
3.3 KiB
Makefile

MAINTAINERCLEANFILES = Makefile.in
CLEANFILES = init.c DtFuncs.dtsh
SUBDIRS = examples
kshdir = ${libdir}/dtksh
dist_ksh_SCRIPTS = DtFuncs.dtsh
KSH93SRC = ./ksh93
KSH93LIBSHELL = $(KSH93SRC)/lib/libshell.a
bin_PROGRAMS = dtksh
BUILT_SOURCES = init.c
# Put all SHOPT definitions here. It is vital that dtksh and ksh93
# are built with the same options. We pass this list to both the
# dtksh components and to the ksh93 build as well. They must be
# specifically assigned a 1 or various preprocessor checks (#if SHOPT
# ...) in ksh93 will fail.
KSH93_SHOPTS = -DSHOPT_DYNAMIC=1 -DSHOPT_NAMESPACE=1 -DSHOPT_MULTIBYTE=1 \
-DSHOPT_STATS=1 -DSHOPT_BGX=1 -DSHOPT_AUDIT=1 \
-DSHOPT_KIA=1 -DSHOPT_HISTEXPAND=1 -DSHOPT_EDPREDICT=1 \
-DSHOPT_ESH=1 -DSHOPT_VSH=1 -DSHOPT_FIXEDARRAY=1 -DSHOPT_SUID_EXEC=1 \
-DSHOPT_BRACEPAT=1 -DSHOPT_ECHOPRINT=1
dtksh_CPPFLAGS = -I$(KSH93SRC)/include/ast -I$(KSH93SRC)/src/cmd/ksh93/include \
-I$(KSH93SRC)/src/cmd/ksh93 -I${srcdir}/lib/DtPrint \
-I${srcdir}/lib/DtHelp $(KSH93_SHOPTS) \
-D_PACKAGE_ast -DKSHELL \
'-DERROR_CONTEXT_T=Error_context_t' \
-D_API_ast=20100309 -DBUILD_DTKSH
dtksh_LDADD = $(DTCLIENTLIBS) ksh93/src/cmd/ksh93/pmain.o $(XTOOLLIB) \
libshell.a $(KSH93SRC)/lib/libcmd.a $(KSH93SRC)/lib/libast.a \
$(KSH93SRC)/lib/libdll.a
if SOLARIS
dtksh_LDADD += -lsecdb -lsocket -lnsl
endif
if AIX
dtksh_CPPFLAGS += -D_IBMRPC_
dtksh_LDFLAGS = -bE:dtksh.exp
endif
dtksh_SOURCES = init.c \
widget.c \
dtkcvt.c \
dtkcmds.c \
XtCvtrs.c \
xmcvt.c \
xmcmds.c \
xmwidgets.c \
extra.c \
msgs.c
# ksh93's bin/package insists on the compiler as an ABSOLUTE path
# ("case $cc in /*)", else "$CC: not found -- set CC=C-compiler"), and it only
# recognises a bare path, not CC=<path>. A cross build's compiler is a name
# (x86_64--netbsd-gcc), so the pkgsrc recipe passes KSH_CC, the compiler wrapper
# by its path; native builds leave it empty and bin/package uses $CC as before
# (build/logs/userland-2026-11-14n.log:16461).
# CWRAPPERS_CONFIG_DIR is pkgsrc's; it is exported to every make of the build and
# names the wrapper directory, whose bin/cc applies the cross flags. A plain
# build has neither KSH_CC nor CWRAPPERS_CONFIG_DIR and keeps using $CC.
# ksh93's bin/package takes the compiler from $CC and insists on an absolute
# path ("case $cc in /*)"); a bare path argument did not survive its parsing
# (build/logs/userland-2026-11-14-finish4.log:16480), so the compiler is given in
# the environment of that one command. KSH_CC wins; otherwise the wrapper is
# derived from pkgsrc's CWRAPPERS_CONFIG_DIR, which every make of the build sees.
# A plain build has neither and keeps its own $CC.
KSH_CC_ENV = $(if $(KSH_CC),CC=$(KSH_CC),$(if $(CWRAPPERS_CONFIG_DIR),CC=$(dir $(CWRAPPERS_CONFIG_DIR))bin/cc))
ksh93/bin/ksh:
$(KSH_CC_ENV) ksh93/bin/package flat make CCFLAGS='$(KSH93_SHOPTS) $(MCDE_DIALECT_CFLAGS)'
init.c: ksh93/bin/ksh
$(CP) ksh93/src/cmd/ksh93/sh/init.c ./
libshell.a: $(KSH93SLIBSHELL) dtksh-init.o
$(CP) $(KSH93LIBSHELL) libshell.a; \
$(AR) d libshell.a init.o; \
$(AR) cq libshell.a dtksh-init.o
check-local:
./dtksh -c true && ksh93/bin/shtests --posix --utf8 SHELL=.libs/dtksh
clean-local:
ksh93/bin/package clean
DtFuncs.dtsh:
$(CP) DtFuncs.sh DtFuncs.dtsh