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