1#ident "@(#)Mdashalike	1.2 20/07/08  Copyright (c) 2006-2018 J. Schilling"
2###########################################################################
3SRCROOT=	..
4RULESDIR=	RULES
5include		$(SRCROOT)/$(RULESDIR)/rules.top
6###########################################################################
7
8INSDIR=		bin
9					# Shell
10TARGET=		pbosh
11#SYMLINKS=	pfsh			# Profile Bourne Shell
12#SYMLINKS +=	bosh			# Bourne Shell
13#SYMLINKS +=	jsh			# Job control Bourne Shell
14#HARDLINKS +=	../xpg4/bin/sh		# POSIX Bourne Shell
15
16##CPPOPTS +=	-DNO_USER_MALLOC	# Do not use our own malloc()
17
18CPPOPTS +=	-DVSHNAME='"pbosh"'	# Shell name variant (bosh/osh/pbosh)
19
20CPPOPTS +=	-DSCHILY_INCLUDES	# Tell the code to use schily include files
21CPPOPTS +=	-DBOURNE_SHELL		# Tell the code that we compile for sh
22CPPOPTS +=	-DUSE_LARGEFILES	# Allow Large Files (> 2 GB)
23CPPOPTS +=	-DUSE_NLS		# Enable NLS support in include/schily/*.h
24CPPOPTS +=	-DUSE_JS_BOOL		# Allow to use schily/dbgmalloc.h
25#CPPOPTS +=	-DNO_LOCALE		# Don't use setlocale()
26#CPPOPTS +=	-DNO_WCHAR		# Don't use wide chars
27#CPPOPTS +=	-DNO_VFORK		# Don't use vfork()
28#CPPOPTS +=	-DNO_WAITID		# Don't use waitid()
29
30CPPOPTS +=	-D_iBCS2 				# SCO echo compat
31CPPOPTS +=	-DTEXT_DOMAIN='"SUNW_OST_OSCMD"'	# gettext()
32CPPOPTS +=	-D_TS_ERRNO 				# Enable multi-threaded errno
33CPPOPTS +=	-DACCT					# Shell Accounting
34#CPPOPTS +=	RES			# "Research" include "login", disable others
35
36CPPOPTS +=	-DDO_SHRCFILES		# Enable rcfiles "/etc/sh.shrc" "$HOME/.shrc"
37#CPPOPTS +=	-DDO_HASHCMDS		# Include hash cmds (line starts with #)
38#CPPOPTS +=	-DDO_HOSTPROMPT		# Set PS1 to "hostname uname> "
39CPPOPTS +=	-DDO_SYSALIAS		# Include alias/unalias builtin
40#CPPOPTS +=	-DDO_GLOBALALIASES	# Include persistent aliases in ~/.globals
41#CPPOPTS +=	-DDO_LOCALALIASES	# Include persistent aliases in .locals
42#CPPOPTS +=	-DDO_SYSALLOC		# Include the "alloc" debug builtin
43#CPPOPTS +=	-DDO_SYSREPEAT		# Include the "repeat" builtin
44#CPPOPTS +=	-DDO_SYSDOSH		# Include the "dosh" builtin
45#CPPOPTS +=	-DDO_SYSPUSHD		# Include pushd / popd / dirs builtin && cd -
46CPPOPTS +=	-DDO_SYSTRUE		# Include true / false builtin
47CPPOPTS +=	-DDO_ECHO_A		# Include support for echo \a
48#CPPOPTS +=	-DDO_EXEC_AC		# Include support for exec -c -a
49CPPOPTS +=	-DDO_READ_R		# Include support for read -r
50CPPOPTS +=	-DDO_SET_O		# Include support for set -o
51CPPOPTS +=	-DDO_MULTI_OPT		# Include support for sh -v -x / set -v -x
52CPPOPTS +=	-DDO_UMASK_S		# Include support for umask -S
53#CPPOPTS +=	-DDO_GETOPT_LONGONLY	# Include support for getopts "?900?(lo)"
54CPPOPTS +=	-DDO_GETOPT_POSIX	# Fail: $OPTARG has optopt for optstr[0] = ':'
55CPPOPTS +=	-DDO_GETOPT_UTILS	# Include support for -- in all builtins
56CPPOPTS +=	-DDO_POSIX_FOR		# Support for i; do .... with semicolon
57CPPOPTS +=	-DDO_POSIX_CASE		# Support for POSIX case with _(_ pat )
58CPPOPTS +=	-DDO_POSIX_GMATCH	# Support for POSIX [:alpha:] ...
59#CPPOPTS +=	-DGMATCH_CLERR_NORM	# Handle glob class error as normal char
60CPPOPTS +=	-DDO_POSIX_TYPE		# Report keywords as well
61CPPOPTS +=	-DDO_PIPE_SEMI_SYNTAX_E	# Report a syntax error for "echo foo |;"
62CPPOPTS +=	-DDO_PIPE_SYNTAX_E	# Report a syntax error for "echo foo |"
63CPPOPTS +=	-DDO_EMPTY_SEMI		# Permit ";" and ";echo" as valid commands
64CPPOPTS +=	-DDO_PIPE_PARENT	# Optimized pipes: Shell always parent
65CPPOPTS +=	-DDO_SETIO_NOFORK	# Avoid to fork w. redir. IO in compound cmd
66CPPOPTS +=	-DDO_ALLEXPORT		# Bugfix for set -a; read VAR / getopts
67CPPOPTS +=	-DDO_O_APPEND		# Support O_APPEND instead of lseek() for >>
68CPPOPTS +=	-DDO_EXPAND_DIRSLASH	# Expand dir*/ to dir/
69CPPOPTS +=	-DDO_SIGNED_EXIT	# Allow negative exit(1) parameters
70CPPOPTS +=	-DDO_DOT_SH_PARAMS	# Include support for ${.sh.xxx} parameters
71CPPOPTS +=	-DDO_U_DOLAT_NOFAIL	# set -u; echo "$@" does not fail
72CPPOPTS +=	-DDO_DUP_FAIL		# call failed() when dup() fails
73CPPOPTS +=	-DDO_SUBSTRING		# Include support for substring operations
74CPPOPTS +=	-DDO_POSIX_SPEC_BLTIN	# Only special builtins keep var assignment
75CPPOPTS +=	-DDO_POSIX_FAILURE	# Only special builtins exit() on errors
76CPPOPTS +=	-DDO_POSIX_CD		# cd/pwd/... implement POSIX -L/-P
77#CPPOPTS +=	-DDO_CHDIR_LONG		# chdir() and pwd() support more than PATH_MAX
78#CPPOPTS +=	-DDO_EXPAND_LONG	# expand() support more than PATH_MAX
79CPPOPTS +=	-DDO_POSIX_RETURN	# Allow "return" inside "dot" scripts
80CPPOPTS +=	-DDO_POSIX_EXIT		# Use POSIX exit codes 126/127
81CPPOPTS +=	-DDO_POSIX_E		# Use POSIX rules for set -e, e.g. cmd subst
82CPPOPTS +=	-DDO_POSIX_EXPORT	# Support export/readonly -p name=value
83					# and export prefix vars to "exec"
84CPPOPTS +=	-DDO_POSIX_EXPORT_ENV	# Autoexport imported environ w. -o posix
85CPPOPTS +=	-DDO_EXPORT_ENV		# Always autoexport imported environ
86CPPOPTS +=	-DDO_POSIX_UNSET	# Support unset -f / -v
87CPPOPTS +=	-DDO_POSIX_SET		# Let set -- clear the arguments
88CPPOPTS +=	-DDO_POSIX_M		# Imply "set -m" for interactive shells
89CPPOPTS +=	-DDO_POSIX_TEST		# Implement POSIX test -e & text -S
90CPPOPTS +=	-DDO_POSIX_TRAP		# Implement POSIX trap -- for output
91CPPOPTS +=	-DDO_TRAP_EXIT		# Fork for (trap cmd EXIT; /usr/bin/true)
92CPPOPTS +=	-DDO_POSIX_READ		# Implement POSIX read, mult. IFS -> ""
93CPPOPTS +=	-DDO_POSIX_PARAM	# Implement support for ${10}
94CPPOPTS +=	-DDO_POSIX_HERE		# Clear "quote" before expanding here document
95CPPOPTS +=	-DDO_ALWAYS_POSIX_SH	# set -o posix by default
96#CPPOPTS +=	-DDO_POSIX_SH		# set -o posix if basename(argv[0]) == "sh"
97					# This has precedence before DO_POSIX_PATH
98					# Define DO_POSIX_SH if you like to use
99					# bosh as /bin/sh on Linux.
100CPPOPTS +=	-DDO_POSIX_PATH		# Implement set -o posix from PATH
101					# call smake 'CPPOPTX=-DPOSIX_BOSH_PATH=\"/bin/sh\"'
102					# or add CPPOPTS += -DPOSIX_BOSH_PATH=\"/bin/sh\"
103					# to make a PATH auto set -o posix
104CPPOPTS +=	-DDO_POSIX_REDIRECT	# Redirect all error messages
105CPPOPTS +=	-DDO_POSIX_FIELD_SPLIT	# IFS=: var=a::b echo $var -> a '' b
106
107CPPOPTS +=	-DDO_NOTSYM		# Implement POSIX NOT symbol (!)
108#CPPOPTS +=	-DDO_SELECT		# Implement ksh "select" feature
109CPPOPTS +=	-DDO_IFS_HACK		# Implement an IFS hack similar to ksh88
110CPPOPTS +=	-DDO_DOL_PAREN		# Implement POSIX $(...) command subst
111#CPPOPTS +=	-DDO_EXT_TEST		# Implement extended test features
112CPPOPTS +=	-DDO_TILDE		# Include support for tilde expansion
113CPPOPTS +=	-DDO_BGNICE		# Include support for set -o bgnice
114#CPPOPTS +=	-DDO_TIME		# Include support for set -o time
115#CPPOPTS +=	-DDO_FULLEXCODE		# Include support for set -o fullexitcode
116#					# The next feature is currently not POSIX
117#CPPOPTX +=	-DDO_EXIT_MODFIX	# Prevent $? == 0 whith exitcode & 0xFF
118CPPOPTS +=	-DDO_CONT_BRK_FIX	# Fix the SYS III (1981) continue/break bug
119CPPOPTS +=	-DDO_CONT_BRK_POSIX	# Exit 1 with break 0 / continue 0
120CPPOPTS +=	-DDO_IOSTRIP_FIX	# Fix the SYS III (1981) cat 0<<-EOF bug
121CPPOPTS +=	-DDO_NOCLOBBER		# Include support for set -o noclobber
122CPPOPTS +=	-DDO_NOTIFY		# Include support for set -o notify
123#CPPOPTS +=	-DDO_FDPIPE		# Include support for 2| for stderr pipe
124CPPOPTS +=	-DDO_KILL_L_SIG		# Include support for kill -l signo
125CPPOPTS +=	-DDO_IFS_SEP		# First char in IFS is "$*" separator
126CPPOPTS +=	-DDO_PS34		# Include support for PS3 and PS4
127CPPOPTS +=	-DDO_PPID		# Include support for POSIX PPID
128CPPOPTS +=	-DDO_LINENO		# Include support for POSIX LINENO
129CPPOPTS +=	-DDO_ULIMIT_OPTS	# Add options to the ulimit(1) output
130CPPOPTS +=	-DDO_STOI_PICKY		# Be more picky when parsing numbers
131#CPPOPTS +=	-DDO_SYSBUILTIN		# Include the "builtin" builtin
132CPPOPTS +=	-DDO_SYSCOMMAND		# Include the "command" builtin
133#CPPOPTS +=	-DDO_SYSATEXPR		# Include the "@" builtin
134CPPOPTS +=	-DDO_SYSSYNC		# Include the "sync" builtin
135#CPPOPTS +=	-DDO_SYSPGRP		# Include the "pgrp" builtin
136#CPPOPTS +=	-DDO_SYSKILLPG		# Include the "killpg" builtin
137#CPPOPTS +=	-DDO_SYSERRSTR		# Include the "errstr" builtin
138#CPPOPTS +=	-DDO_SYSFIND		# Include the "find" builtin
139CPPOPTS +=	-DDO_SYSPRINTF		# Include the "printf" builtin
140#CPPOPTS +=	-DDO_SYSPRINTF_FLOAT	# Include float support in "printf" builtin
141CPPOPTS +=	-DDO_SYSLOCAL		# Include the "local" builtin
142#CPPOPTS +=	-DDO_SYSFC		# Include the "fc" builtin
143#CPPOPTS +=	-DDO_SYSLIMIT		# Include the "limit" builtin
144CPPOPTS +=	-DDO_QS_CONVERT		# Convert quoted "\a\b\c" to "'abc'"
145#LIB_FIND +=	-lfind			# Add libfind
146
147#CPPOPTS +=	-DPARSE_DEBUG		# Include debug code/messages for parser
148#CPPOPTS +=	-DSTAK_DEBUG		# Include debug code for stak.c
149CPPOPTS +=	-DTOSSGROWING_MACRO	# Make stak.c::tossgrowing() a macro
150#CPPOPTS +=	-DTOSSCHECK		# Debug / verify magic in tossgrowing()
151#CPPOPTS +=	-DARGS_RIGHT_TO_LEFT	# Evaluate var2=val2 var1=val1 left to right
152#CPPOPTS +=	-DMY_GMATCH		# Enforce to use our local gmatch()
153					# instead if the gmatch() from -lgen
154
155#CPPOPTS +=	-DSUN_EXPORT_BUG	# Export local readoly vars to scripts
156
157#CPPOPTS +=	-DINTERACTIVE		# Include command line history editor
158CPPOPTS +=	-DINT_DOLMINUS		# Auto set -i for interactive shell
159
160#CPPOPTS +=	-DNO_SIGSEGV		# Do not install a SIGSEGV handler for debug
161
162CFILES=		abbrev.c args.c bltin.c cmd.c ctype.c defs.c echo.c error.c \
163		expand.c fault.c func.c hash.c hashserv.c io.c jobs.c macro.c \
164		main.c msg.c name.c print.c pwd.c service.c \
165		sh_policy.c stak.c string.c strexpr.c test.c \
166		ulimit.c word.c xec.c \
167		signames.c gmatch.c umask.c alias.c \
168		optget.c printf.c
169
170HFILES=		abbrev.h bosh.h ctype.h defs.h dup.h hash.h jobs.h \
171		mac.h mode.h name.h \
172		sh_policy.h stak.h sym.h timeout.h version.h
173
174# -lgen		fuer gmatch()
175# -lsecdb	fuer getexecuser() free_execattr()
176# $(LIB_ACL_TEST) fuer libfind
177#
178# $(LIB_GEN)	is no longer used since we use -DDO_POSIX_GMATCH and
179#		thus compile in our own gmatch()
180#
181LIBS=		$(LIB_SECDB) -lshedit -lxtermcap -lgetopt \
182		-lschily \
183		$(LIB_INTL) $(LIB_DL)
184#LIBS=		-lgen -lsecdb
185#XMK_FILE=	Makefile.man bosh.mk1 jsh.mk1 pfsh.mk1
186XMK_FILE=	Makefile.man
187
188signames.c abbrev.c abbrev.h:
189	@echo "	==> MAKING SYMLINKS in ."; sh ./MKLINKS
190$(ALLTARGETS): signames.c abbrev.c abbrev.h
191$(SRCROOT)/$(RULESDIR)/rules.cmd: signames.c
192
193###########################################################################
194include		$(SRCROOT)/$(RULESDIR)/rules.cmd
195include		$(SRCROOT)/$(RULESDIR)/rules.tst
196###########################################################################
197count: $(HFILES) $(CFILES)
198	count $r1
199
200
201#IFDEF=	-UEVALVERS -USECURITY -USEC_ENV -DEXTVERS -UCLONE_WRITE -USAO_RAW
202IFDEF=	-UJOS -UJOS_ALLOC -UXADEBUG -UDXADEBUG -UOLD -UNEED_STDERR -UFOOBAR
203
204XRELFILES=	Makefile MKLINKS Makefile.man pbosh.1 README
205
206###########################################################################
207include		$(SRCROOT)/$(RULESDIR)/rules.rel
208###########################################################################
209REL_SRC_MATCH= match -hv 'XDBG!CWDBG'
210
211MAKE_LICENSE=MKCDDL
212