Files
mcde/programs/dtksh/Makefile.am
T
lotherk da98eef08e mcde/dtksh: the wrapper path is derived where the rule runs
KSH_CC from the recipe reached the top-level make (bmake show-var BUILD_MAKE_CMD
carries it) but not the sub-make that runs the rule -- AM_MAKEFLAGS of
programs/dtksh is automake's own and empty, and the value did not travel down
(build/logs/userland-2026-11-14-finish3.log:16459 runs without an argument).  The
rule now derives it from CWRAPPERS_CONFIG_DIR, which pkgsrc exports into every
make in the tree: the wrapper is one level beside it.  KSH_CC still wins when it
is set; a plain build keeps $CC.
2026-11-14 07:54:54 +00:00

91 lines
2.9 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.
KSH_CC_ARG = $(if $(KSH_CC),$(KSH_CC),$(if $(CWRAPPERS_CONFIG_DIR),$(dir $(CWRAPPERS_CONFIG_DIR))bin/cc))
ksh93/bin/ksh:
ksh93/bin/package flat make CCFLAGS='$(KSH93_SHOPTS) $(MCDE_DIALECT_CFLAGS)' $(KSH_CC_ARG)
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