Home | History | Annotate | Download | only in src
      1 # $MirOS: src/bin/mksh/Makefile,v 1.88 2011/10/07 19:51:17 tg Exp $
      2 #-
      3 # Copyright (c) 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011
      4 #	Thorsten Glaser <tg (at] mirbsd.org>
      5 #
      6 # Provided that these terms and disclaimer and all copyright notices
      7 # are retained or reproduced in an accompanying document, permission
      8 # is granted to deal in this work without restriction, including un-
      9 # limited rights to use, publicly perform, distribute, sell, modify,
     10 # merge, give away, or sublicence.
     11 #
     12 # This work is provided "AS IS" and WITHOUT WARRANTY of any kind, to
     13 # the utmost extent permitted by applicable law, neither express nor
     14 # implied; without malicious intent or gross negligence. In no event
     15 # may a licensor, author or contributor be held liable for indirect,
     16 # direct, other damage, loss, or other issues arising in any way out
     17 # of dealing in the work, even if advised of the possibility of such
     18 # damage or existence of a defect, except proven that it results out
     19 # of said person's immediate fault when using the work as intended.
     20 #-
     21 # use CPPFLAGS=-DDEBUG __CRAZY=Yes to check for certain more stuff
     22 
     23 .include <bsd.own.mk>
     24 
     25 PROG=		mksh
     26 SRCS=		edit.c eval.c exec.c expr.c funcs.c histrap.c jobs.c \
     27 		lalloc.c lex.c main.c misc.c shf.c syn.c tree.c var.c
     28 .if !make(test-build)
     29 CPPFLAGS+=	-DMKSH_ASSUME_UTF8 \
     30 		-DHAVE_ATTRIBUTE_BOUNDED=1 -DHAVE_ATTRIBUTE_FORMAT=1 \
     31 		-DHAVE_ATTRIBUTE_NONNULL=1 -DHAVE_ATTRIBUTE_NORETURN=1 \
     32 		-DHAVE_ATTRIBUTE_UNUSED=1 -DHAVE_ATTRIBUTE_USED=1 \
     33 		-DHAVE_SYS_BSDTYPES_H=0 -DHAVE_SYS_FILE_H=1 \
     34 		-DHAVE_SYS_MKDEV_H=0 -DHAVE_SYS_MMAN_H=1 -DHAVE_SYS_PARAM_H=1 \
     35 		-DHAVE_SYS_SELECT_H=1 -DHAVE_SYS_SYSMACROS_H=0 \
     36 		-DHAVE_BSTRING_H=0 -DHAVE_GRP_H=1 -DHAVE_LIBGEN_H=1 \
     37 		-DHAVE_LIBUTIL_H=0 -DHAVE_PATHS_H=1 -DHAVE_STDINT_H=1 \
     38 		-DHAVE_STRINGS_H=1 -DHAVE_ULIMIT_H=0 -DHAVE_VALUES_H=0 \
     39 		-DHAVE_CAN_INTTYPES=1 -DHAVE_CAN_UCBINTS=1 \
     40 		-DHAVE_CAN_INT8TYPE=1 -DHAVE_CAN_UCBINT8=1 -DHAVE_RLIM_T=1 \
     41 		-DHAVE_SIG_T=1 -DHAVE_SYS_SIGNAME=1 -DHAVE_SYS_SIGLIST=1 \
     42 		-DHAVE_STRSIGNAL=0 -DHAVE_GETRUSAGE=1 -DHAVE_KILLPG=1 \
     43 		-DHAVE_MKNOD=0 -DHAVE_MKSTEMP=1 -DHAVE_NICE=1 -DHAVE_REVOKE=1 \
     44 		-DHAVE_SETLOCALE_CTYPE=0 -DHAVE_LANGINFO_CODESET=0 \
     45 		-DHAVE_SELECT=1 -DHAVE_SETRESUGID=1 -DHAVE_SETGROUPS=1 \
     46 		-DHAVE_STRCASESTR=1 -DHAVE_STRLCPY=1 -DHAVE_FLOCK_DECL=1 \
     47 		-DHAVE_REVOKE_DECL=1 -DHAVE_SYS_SIGLIST_DECL=1 \
     48 		-DHAVE_PERSISTENT_HISTORY=1
     49 COPTS+=		-std=gnu99 -Wall
     50 .endif
     51 
     52 USE_PRINTF_BUILTIN?=	0
     53 .if ${USE_PRINTF_BUILTIN} == 1
     54 .PATH: ${BSDSRCDIR}/usr.bin/printf
     55 SRCS+=		printf.c
     56 CPPFLAGS+=	-DMKSH_PRINTF_BUILTIN
     57 .endif
     58 
     59 MANLINKS=	[ false pwd sh sleep test true
     60 BINLINKS=	${MANLINKS} echo domainname kill
     61 .for _i in ${BINLINKS}
     62 LINKS+=		${BINDIR}/${PROG} ${BINDIR}/${_i}
     63 .endfor
     64 .for _i in ${MANLINKS}
     65 MLINKS+=	${PROG}.1 ${_i}.1
     66 .endfor
     67 
     68 regress: ${PROG} check.pl check.t
     69 	-rm -rf regress-dir
     70 	mkdir -p regress-dir
     71 	echo export FNORD=666 >regress-dir/.mkshrc
     72 	HOME=$$(realpath regress-dir) perl ${.CURDIR}/check.pl \
     73 	    -s ${.CURDIR}/check.t -v -p ./${PROG}
     74 
     75 test-build: .PHONY
     76 	-rm -rf build-dir
     77 	mkdir -p build-dir
     78 .if ${USE_PRINTF_BUILTIN} == 1
     79 	cp ${BSDSRCDIR}/usr.bin/printf/printf.c build-dir/
     80 .endif
     81 	cd build-dir; env CC=${CC:Q} CFLAGS=${CFLAGS:M*:Q} \
     82 	    CPPFLAGS=${CPPFLAGS:M*:Q} LDFLAGS=${LDFLAGS:M*:Q} \
     83 	    LIBS= NOWARN=-Wno-error TARGET_OS= CPP= /bin/sh \
     84 	    ${.CURDIR}/Build.sh -Q -r && ./test.sh -v
     85 
     86 cleandir: clean-extra
     87 
     88 clean-extra: .PHONY
     89 	-rm -rf build-dir regress-dir printf.o printf.ln
     90 
     91 distribution:
     92 	sed 's!\$$I''d\([:$$]\)!$$M''irSecuCron\1!g' \
     93 	    ${.CURDIR}/dot.mkshrc >${DESTDIR}/etc/skel/.mkshrc
     94 	chown ${BINOWN}:${CONFGRP} ${DESTDIR}/etc/skel/.mkshrc
     95 	chmod 0644 ${DESTDIR}/etc/skel/.mkshrc
     96 
     97 .include <bsd.prog.mk>
     98