2012-07-01 17:54:36 +02:00
|
|
|
# $MirOS: src/bin/mksh/Makefile,v 1.101 2012/07/01 15:54:36 tg Exp $
|
2009-05-16 18:59:42 +02:00
|
|
|
#-
|
2012-03-28 00:36:53 +02:00
|
|
|
# Copyright (c) 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010,
|
|
|
|
# 2011, 2012
|
2009-05-16 18:59:42 +02:00
|
|
|
# Thorsten Glaser <tg@mirbsd.org>
|
|
|
|
#
|
|
|
|
# Provided that these terms and disclaimer and all copyright notices
|
|
|
|
# are retained or reproduced in an accompanying document, permission
|
|
|
|
# is granted to deal in this work without restriction, including un-
|
|
|
|
# limited rights to use, publicly perform, distribute, sell, modify,
|
|
|
|
# merge, give away, or sublicence.
|
|
|
|
#
|
|
|
|
# This work is provided "AS IS" and WITHOUT WARRANTY of any kind, to
|
|
|
|
# the utmost extent permitted by applicable law, neither express nor
|
|
|
|
# implied; without malicious intent or gross negligence. In no event
|
|
|
|
# may a licensor, author or contributor be held liable for indirect,
|
|
|
|
# direct, other damage, loss, or other issues arising in any way out
|
|
|
|
# of dealing in the work, even if advised of the possibility of such
|
|
|
|
# damage or existence of a defect, except proven that it results out
|
|
|
|
# of said person's immediate fault when using the work as intended.
|
• remove strcasestr.c, use home-grown implementation¹, call it stricmp,
and have it return an API-correct const char *
• enhance and stylify comments
• a little KNF and simplifications
• #ifdef DEBUG: replace strchr and strstr with ucstrchr and ucstrstr
that take and return a non-const char *, and fix the violations
• new cstrchr, cstrstr (take and give const char *)
• new vstrchr, vstrstr (take const or not, give boolean value)
• new afreechk(x) = afreechv(x,x) = if (x1) afree(x2, ATEMP)
• new ksh_isdash(str) = (str != NULL) && !strcmp(str, "-")
• replace the only use of strrchr with inlined code to shrink
• minor man page fixes
• Minix 3 signames are autogenerated with gcc
• rename strlfun.c to strlcpy.c since we don't do strlcat(3) anyway,
only strlcpy(3), and shorten it
• dot.mkshrc: move MKSH=… down to the export line
to not disturb the PS1 visual impression ☺
• dot.mkshrc: Lstripcom(): optimise
• bump version
¹) side effect from creating API-correct cstrchr, cstrstr, etc.
uses goto so it must be better ☻
tested on mirbsd-current via both Makefile and Build.sh
2007-03-04 04:04:28 +01:00
|
|
|
#-
|
|
|
|
# use CPPFLAGS=-DDEBUG __CRAZY=Yes to check for certain more stuff
|
2007-02-18 17:24:13 +01:00
|
|
|
|
|
|
|
.include <bsd.own.mk>
|
2005-05-23 05:06:10 +02:00
|
|
|
|
|
|
|
PROG= mksh
|
2009-03-22 17:55:38 +01:00
|
|
|
SRCS= edit.c eval.c exec.c expr.c funcs.c histrap.c jobs.c \
|
|
|
|
lalloc.c lex.c main.c misc.c shf.c syn.c tree.c var.c
|
2007-01-18 02:24:46 +01:00
|
|
|
.if !make(test-build)
|
2011-12-08 23:19:16 +01:00
|
|
|
CPPFLAGS+= -DMKSH_ASSUME_UTF8 -DMKSH_DISABLE_DEPRECATED \
|
2009-12-12 23:27:10 +01:00
|
|
|
-DHAVE_ATTRIBUTE_BOUNDED=1 -DHAVE_ATTRIBUTE_FORMAT=1 \
|
|
|
|
-DHAVE_ATTRIBUTE_NONNULL=1 -DHAVE_ATTRIBUTE_NORETURN=1 \
|
|
|
|
-DHAVE_ATTRIBUTE_UNUSED=1 -DHAVE_ATTRIBUTE_USED=1 \
|
• more comment and int→bool cleanup, add and improve some comments
• in interactive mode, always look up {LC_{ALL,CTYPE},LANG} environment
variables if setlocale/nl_langinfo(CODESET) doesn’t suffice
• add the ability to call any builtin (some don't make sense or wouldn't
work) directly by analysing argv[0]
• for direct builtin calls, the {LC_{ALL,CTYPE},LANG} environment
variables determine utf8-mode, even if MKSH_ASSUME_UTF8 was set
• when called as builtin, echo behaves POSIXish
• add domainname as alias for true on MirBSD only, to be able to link it
• sync mksh Makefiles with Build.sh output
• adjust manpage wrt release plans
• link some things to mksh now that we have callable builtins:
bin/echo bin/kill bin/pwd bin/sleep (exact matches)
bin/test bin/[ (were scripts before)
bin/domainname=usr/bin/true usr/bin/false (move to /bin/ now)
• drop linked utilities and, except for echo and kill, their manpages
• adjust instbin and link a few more there as well
2011-02-11 02:18:23 +01:00
|
|
|
-DHAVE_SYS_BSDTYPES_H=0 -DHAVE_SYS_FILE_H=1 \
|
2011-04-09 20:47:14 +02:00
|
|
|
-DHAVE_SYS_MKDEV_H=0 -DHAVE_SYS_MMAN_H=1 -DHAVE_SYS_PARAM_H=1 \
|
|
|
|
-DHAVE_SYS_SELECT_H=1 -DHAVE_SYS_SYSMACROS_H=0 \
|
|
|
|
-DHAVE_BSTRING_H=0 -DHAVE_GRP_H=1 -DHAVE_LIBGEN_H=1 \
|
|
|
|
-DHAVE_LIBUTIL_H=0 -DHAVE_PATHS_H=1 -DHAVE_STDINT_H=1 \
|
2012-05-05 00:44:34 +02:00
|
|
|
-DHAVE_STRINGS_H=1 -DHAVE_TERMIOS_H=1 -DHAVE_ULIMIT_H=0 \
|
|
|
|
-DHAVE_VALUES_H=0 -DHAVE_CAN_INTTYPES=1 -DHAVE_CAN_UCBINTS=1 \
|
2011-04-09 20:47:14 +02:00
|
|
|
-DHAVE_CAN_INT8TYPE=1 -DHAVE_CAN_UCBINT8=1 -DHAVE_RLIM_T=1 \
|
|
|
|
-DHAVE_SIG_T=1 -DHAVE_SYS_SIGNAME=1 -DHAVE_SYS_SIGLIST=1 \
|
2012-03-28 00:36:53 +02:00
|
|
|
-DHAVE_STRSIGNAL=0 -DHAVE_FLOCK=1 -DHAVE_LOCK_FCNTL=1 \
|
2012-04-07 13:19:53 +02:00
|
|
|
-DHAVE_GETRUSAGE=1 -DHAVE_KILLPG=1 -DHAVE_MKNOD=0 \
|
2012-04-14 18:07:48 +02:00
|
|
|
-DHAVE_MMAP=1 -DHAVE_NICE=1 -DHAVE_REVOKE=1 \
|
2009-12-12 23:27:10 +01:00
|
|
|
-DHAVE_SETLOCALE_CTYPE=0 -DHAVE_LANGINFO_CODESET=0 \
|
• more comment and int→bool cleanup, add and improve some comments
• in interactive mode, always look up {LC_{ALL,CTYPE},LANG} environment
variables if setlocale/nl_langinfo(CODESET) doesn’t suffice
• add the ability to call any builtin (some don't make sense or wouldn't
work) directly by analysing argv[0]
• for direct builtin calls, the {LC_{ALL,CTYPE},LANG} environment
variables determine utf8-mode, even if MKSH_ASSUME_UTF8 was set
• when called as builtin, echo behaves POSIXish
• add domainname as alias for true on MirBSD only, to be able to link it
• sync mksh Makefiles with Build.sh output
• adjust manpage wrt release plans
• link some things to mksh now that we have callable builtins:
bin/echo bin/kill bin/pwd bin/sleep (exact matches)
bin/test bin/[ (were scripts before)
bin/domainname=usr/bin/true usr/bin/false (move to /bin/ now)
• drop linked utilities and, except for echo and kill, their manpages
• adjust instbin and link a few more there as well
2011-02-11 02:18:23 +01:00
|
|
|
-DHAVE_SELECT=1 -DHAVE_SETRESUGID=1 -DHAVE_SETGROUPS=1 \
|
2012-04-07 13:19:53 +02:00
|
|
|
-DHAVE_STRLCPY=1 -DHAVE_FLOCK_DECL=1 -DHAVE_REVOKE_DECL=1 \
|
|
|
|
-DHAVE_SYS_SIGLIST_DECL=1 -DHAVE_PERSISTENT_HISTORY=1 \
|
|
|
|
-DHAVE_SILENT_IDIVWRAPV=0 -DMKSH_BUILD_R=409
|
2012-03-27 23:23:52 +02:00
|
|
|
CPPFLAGS+= -D${${PROG:L}_tf:C/(Mir${MAN:E}{0,1}){2}/4/:S/x/mksh_BUILD/:U}
|
2012-03-28 00:36:53 +02:00
|
|
|
COPTS+= -std=c99 -Wall
|
2007-01-18 02:24:46 +01:00
|
|
|
.endif
|
2005-05-23 05:06:10 +02:00
|
|
|
|
2009-07-30 21:11:12 +02:00
|
|
|
USE_PRINTF_BUILTIN?= 0
|
|
|
|
.if ${USE_PRINTF_BUILTIN} == 1
|
|
|
|
.PATH: ${BSDSRCDIR}/usr.bin/printf
|
|
|
|
SRCS+= printf.c
|
|
|
|
CPPFLAGS+= -DMKSH_PRINTF_BUILTIN
|
|
|
|
.endif
|
|
|
|
|
2012-03-23 20:38:12 +01:00
|
|
|
DEBUGFILE?= No
|
|
|
|
.if ${DEBUGFILE:L} == "yes"
|
|
|
|
CPPFLAGS+= -DDF=mksh_debugtofile
|
|
|
|
.endif
|
|
|
|
|
• more comment and int→bool cleanup, add and improve some comments
• in interactive mode, always look up {LC_{ALL,CTYPE},LANG} environment
variables if setlocale/nl_langinfo(CODESET) doesn’t suffice
• add the ability to call any builtin (some don't make sense or wouldn't
work) directly by analysing argv[0]
• for direct builtin calls, the {LC_{ALL,CTYPE},LANG} environment
variables determine utf8-mode, even if MKSH_ASSUME_UTF8 was set
• when called as builtin, echo behaves POSIXish
• add domainname as alias for true on MirBSD only, to be able to link it
• sync mksh Makefiles with Build.sh output
• adjust manpage wrt release plans
• link some things to mksh now that we have callable builtins:
bin/echo bin/kill bin/pwd bin/sleep (exact matches)
bin/test bin/[ (were scripts before)
bin/domainname=usr/bin/true usr/bin/false (move to /bin/ now)
• drop linked utilities and, except for echo and kill, their manpages
• adjust instbin and link a few more there as well
2011-02-11 02:18:23 +01:00
|
|
|
MANLINKS= [ false pwd sh sleep test true
|
|
|
|
BINLINKS= ${MANLINKS} echo domainname kill
|
|
|
|
.for _i in ${BINLINKS}
|
|
|
|
LINKS+= ${BINDIR}/${PROG} ${BINDIR}/${_i}
|
|
|
|
.endfor
|
|
|
|
.for _i in ${MANLINKS}
|
|
|
|
MLINKS+= ${PROG}.1 ${_i}.1
|
|
|
|
.endfor
|
2006-07-23 21:10:59 +02:00
|
|
|
|
2005-05-23 05:06:10 +02:00
|
|
|
regress: ${PROG} check.pl check.t
|
2007-01-12 02:11:03 +01:00
|
|
|
-rm -rf regress-dir
|
2006-05-08 14:18:49 +02:00
|
|
|
mkdir -p regress-dir
|
|
|
|
echo export FNORD=666 >regress-dir/.mkshrc
|
2008-10-05 18:26:13 +02:00
|
|
|
HOME=$$(realpath regress-dir) perl ${.CURDIR}/check.pl \
|
2012-06-28 22:17:39 +02:00
|
|
|
-s ${.CURDIR}/check.t -v -p ./${PROG} \
|
|
|
|
-C shell:legacy-no,int:32,nodeprecated,fastbox
|
2006-05-08 14:18:49 +02:00
|
|
|
|
2007-01-18 02:24:46 +01:00
|
|
|
test-build: .PHONY
|
|
|
|
-rm -rf build-dir
|
|
|
|
mkdir -p build-dir
|
2011-10-07 21:51:17 +02:00
|
|
|
.if ${USE_PRINTF_BUILTIN} == 1
|
|
|
|
cp ${BSDSRCDIR}/usr.bin/printf/printf.c build-dir/
|
|
|
|
.endif
|
2007-01-18 02:24:46 +01:00
|
|
|
cd build-dir; env CC=${CC:Q} CFLAGS=${CFLAGS:M*:Q} \
|
|
|
|
CPPFLAGS=${CPPFLAGS:M*:Q} LDFLAGS=${LDFLAGS:M*:Q} \
|
|
|
|
LIBS= NOWARN=-Wno-error TARGET_OS= CPP= /bin/sh \
|
2012-07-01 17:54:36 +02:00
|
|
|
${.CURDIR}/Build.sh -Q -r ${_TBF} && ./test.sh -v -f
|
|
|
|
|
|
|
|
test-build-lksh: .PHONY
|
|
|
|
cd ${.CURDIR} && exec ${MAKE} test-build \
|
|
|
|
_TBF=-L USE_PRINTF_BUILTIN=0
|
2006-05-08 14:18:49 +02:00
|
|
|
|
2007-01-18 02:24:46 +01:00
|
|
|
cleandir: clean-extra
|
|
|
|
|
|
|
|
clean-extra: .PHONY
|
2009-07-30 21:18:06 +02:00
|
|
|
-rm -rf build-dir regress-dir printf.o printf.ln
|
2005-05-23 05:06:10 +02:00
|
|
|
|
2012-03-27 23:23:52 +02:00
|
|
|
mksh_tf=xMakefile${OStype:S/${MACHINE_OS}/1/1g}${OSNAME}
|
2007-04-16 20:54:37 +02:00
|
|
|
distribution:
|
2009-08-27 18:52:12 +02:00
|
|
|
sed 's!\$$I''d\([:$$]\)!$$M''irSecuCron\1!g' \
|
|
|
|
${.CURDIR}/dot.mkshrc >${DESTDIR}/etc/skel/.mkshrc
|
|
|
|
chown ${BINOWN}:${CONFGRP} ${DESTDIR}/etc/skel/.mkshrc
|
|
|
|
chmod 0644 ${DESTDIR}/etc/skel/.mkshrc
|
2007-04-16 20:54:37 +02:00
|
|
|
|
2005-05-23 05:06:10 +02:00
|
|
|
.include <bsd.prog.mk>
|