#	$NetBSD: Makefile,v 1.10 2008/08/29 00:02:24 gmcgarry Exp $

#.include <bsd.own.mk>

#DIST=	${NETBSDSRCDIR}/dist
#.PATH:	${DIST}/nawk

PROG=	awk
SRCS=	awkgram.y b.c lex.c lib.c main.c parse.c proctab.c run.c tran.c
#CPPFLAGS+=	-I. -DHAS_ISBLANK
CPPFLAGS+=	-I. -DHAS_ISBLANK -g
LDFLAGS+= -g
YFLAGS+= -p awklib_
LDADD+=	-lm
DPADD+=	${LIBM}
YHEADER=	yes
.if (defined(HAVE_GCC) && ${HAVE_GCC} == 4) || defined(HAVE_PCC)
COPTS=	-Wno-pointer-sign
.endif
WARNS=2

# info file originally from GNU awk 3.1.3, adjusted for nawk slightly
#.PATH:	${NETBSDSRCDIR}/gnu/dist/gawk
#TEXINFO=        awk.info

show-var:
	@echo "${${VARNAME}}"

#.include <bsd.info.mk>
.include <bsd.prog.mk>

.include <bsd.warns.mk>

test: ${PROG}
	@echo "No news is good news"
	@echo "1. Testing FS, print and next"
	./${PROG} -F: '/^#/ { next } { print $$1 }' /etc/passwd
	@echo "2. Testing FS, non-first field, print and next"
	./${PROG} -F: '/^#/ { next } { print $$5 }' /etc/passwd
	@echo "3. Another dynamic loading test"
	@./dl2.sh
	@echo "4. Dynamic loading test 1 from libc::write(2)"
	@./dl3.sh
	@echo "5. Dynamic loading test 2 from libc::printf(3)"
	@./dl4.sh
	@echo "6. Dynamic loading test 3 from libc::printf(3) with immediate prototype"
	@./dl5.sh
	@echo "7. Dynamic loading test 4 - storage allocation and use"
	@./dl6.sh
	@echo "8. Dynamic loading test 5 - structure field test"
	@./dl7.sh
	@echo "All tests complete"
