summaryrefslogtreecommitdiff
path: root/regress/buildlink-libtool/Makefile
blob: 05d007623552da2c5a3b8837006ecfc4527b188b (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
# $NetBSD: Makefile,v 1.5 2010/03/21 16:29:43 wiz Exp $

DISTNAME=	regress-buildlink-libtool-0.0
CATEGORIES=	regress
MASTER_SITES=	# empty
DISTFILES=	# empty

MAINTAINER=	pkgsrc-users@NetBSD.org
COMMENT=	test buildlink libtool

USE_LIBTOOL=	yes
NO_CONFIGURE=	yes
NO_INSTALL=	yes

# Remove GCC optimization options.
BUILDLINK_TRANSFORM+=	rm:-O[0-9]*

# Convert "-lreadline" into "-ledit -ltermcap -lm".
BUILDLINK_TRANSFORM+=	l:readline:edit:termcap:m

do-extract:
	${CP} -R ${FILESDIR} ${WRKSRC}

.PHONY: regress do-regress

regress: build do-regress

FAILED_TESTS=	${WRKDIR}/failed
PASSED_TESTS=	${WRKDIR}/passed

do-regress:
	@if [ -f ${FAILED_TESTS} ]; then				\
		${ECHO} "FAILED:";					\
		${CAT} ${FAILED_TESTS} | while read test; do		\
			${ECHO} "	$$test";			\
		done;							\
		exit 1;							\
	else								\
		${DO_NADA};						\
	fi

report-failed:
	@if [ -f "${FAILED_TESTS}" ]; then				\
		${ECHO} `${CAT} ${FAILED_TESTS} | ${WC} -l`;		\
	else								\
		${ECHO} "0";						\
	fi

report-passed:
	@if [ -f "${PASSED_TESTS}" ]; then				\
		ECHO} `${CAT} ${PASSED_TESTS} | ${WC} -l`;		\
	else								\
		${ECHO} "0";						\
	fi

TEST_RESULT=	${ECHO} "(${.TARGET}) got:      $$test";		\
		${ECHO} "(${.TARGET}) expected: $$expected";		\
		case $$test in						\
		$$expected)						\
			${ECHO} "(${.TARGET}) result:   PASS";		\
			${ECHO} "${.TARGET}" >> ${PASSED_TESTS};	\
			;;						\
		*)							\
			${ECHO} "(${.TARGET}) result:   FAIL";		\
			${ECHO} "${.TARGET}" >> ${FAILED_TESTS};	\
			;;						\
		esac

# Check that the dependency_libs line of libregress1.lai is empty.
do-regress: test1
test1:
	@cd ${WRKSRC};							\
	. .libs/libregress1.lai;					\
	test="$$dependency_libs";					\
	expected="";							\
	${TEST_RESULT}

# Check that the dependency_libs line of libregress2.lai is empty.
do-regress: test2
test2:
	@cd ${WRKSRC};							\
	. .libs/libregress2.lai;					\
	test="$$dependency_libs";					\
	expected="-L${PREFIX}/lib -lregress1";				\
	${TEST_RESULT}

.include "../../mk/bsd.pkg.mk"