xref: /openbsd-src/regress/usr.bin/ctfdump/Makefile (revision 2586d8accf3b936e023a0b91791f9a3e08e4e3b6)
1#	$OpenBSD: Makefile,v 1.2 2017/08/23 14:09:39 bluhm Exp $
2
3# If you are unsure whether the output of ctfdump(1) is correct, you can
4# install ctftools from ports and set CTFDUMP=/usr/local/bin/ctfdump.
5CTFDUMP?=		/usr/bin/ctfdump
6CTFSTRIP?=		/usr/bin/ctfstrip
7
8PROG=			example
9DEBUG+=			-g
10
11REGRESS_TARGETS=	base_types_encoding
12
13# Test the proper encoding and display of base types in the C language.
14base_types_encoding: ${PROG}.ctf
15	${MAKE} -C ${.CURDIR} run-${PROG} RT=$@ RE=' (INTEGER|FLOAT) '
16
17# Run ctfdump(1) and massage the output to make it stable.  ${RT} is the
18# original test target; ${RE} reduces the output to the relevant lines.
19run-${PROG}: ${PROG}.ctf
20	${CTFDUMP} ${PROG}.ctf 2>&1 | sed 's/\[[0-9]*\]/[]/' | sort | egrep '${RE}' >${RT}.out
21.if exists(${RT}.${MACHINE})
22	diff -u ${.CURDIR}/${RT}.${MACHINE} ${RT}.out
23	@echo ok - ${RT}
24.else
25	# ${RT} for machine ${MACHINE} not found
26	@echo SKIPPED
27.endif
28
29${PROG}.ctf: ${PROG}
30	${CTFSTRIP} -o ${PROG}.ctf ${PROG}
31
32CLEANFILES+= ${PROG}.ctf *.out
33
34.include <bsd.regress.mk>
35