-# $OpenBSD: Makefile,v 1.1 2017/05/29 20:59:28 markus Exp $
+# $OpenBSD: Makefile,v 1.2 2017/05/30 15:36:13 bluhm Exp $
WARNINGS=Yes
-.include <bsd.own.mk>
-.include <bsd.obj.mk>
-
-.PATH: ${.CURDIR}/../../../../sbin/iked \
- ${.CURDIR}/../../../../sbin/iked/${__objdir}
-
PROG= test_parser
-SRCS= tests.c common.c test_parser_fuzz.c ikev2_pld.c \
- imsg_util.c log.c util.c
-SRCS+= ikev2_map.c eap_map.c
+SRCS= tests.c common.c test_parser_fuzz.c
+IKEOBJS= ikev2_pld.o imsg_util.o log.o util.o \
+ ikev2_map.o eap_map.o
+CLEANFILES= ${IKEOBJS}
-LDADD= -lutil -lcrypto
+LDADD+= -lutil -lcrypto ${IKEOBJS}
DPADD+= ${LIBUTIL} ${LIBCRYPTO}
CFLAGS+= -I${.CURDIR}/../../../../sbin/iked
-CFLAGS+= -I${.CURDIR}/../../../../sbin/iked/${__objdir}
CFLAGS+= -Wno-missing-field-initializers
-CFLAGS+= -I${.CURDIR}/../test_helper
+test_parser: ${IKEOBJS}
-.if exists(${.CURDIR}/../test_helper/${__objdir})
-LDADD+=-L${.CURDIR}/../test_helper/${__objdir} -ltest_helper
-DPADD+=${.CURDIR}/../test_helper/${__objdir}/libtest_helper.a
-.else
-LDADD+=-L${.CURDIR}/../test_helper -ltest_helper
-DPADD+=${.CURDIR}/../test_helper/libtest_helper.a
-.endif
+${IKEOBJS}:
+ cd ${.CURDIR}/../../../../sbin/iked && make $@
+ ln -sf ${.OBJDIR}/../../../../sbin/iked/$@ .
-REGRESS_TARGETS=stamp-regress-${PROG}
+LDADD+= -L${.OBJDIR} -ltest_helper
+DPADD+= libtest_helper.a
+CFLAGS+= -I${.CURDIR}/../test_helper
-stamp-regress-${PROG}: ${PROG}
- ./${PROG} && touch stamp-regress-${PROG}
+libtest_helper.a:
+ cd ${.CURDIR}/../test_helper && make $@
+ ln -sf ${.OBJDIR}/../test_helper/$@ .
.include <bsd.regress.mk>