1#	$NetBSD: Makefile.hooks,v 1.4 2023/08/01 05:57:53 mrg Exp $
2
3#
4# Makefile fragment to build genhooks and *target-hooks*.h
5#
6
7.for f in hooks
8gen${f}.lo: ${HH} gen${f}.cc ${G_D_TARGET_DEF}
9gen${f}: gen${f}.lo ${GENPROG_ERROR_DEPENDS} 
10	${_MKTARGET_LINK}
11	${HOST_LINK.cc} -o ${.TARGET} ${.ALLSRC} ${NBCOMPATLIB} ${HOSTLIBIBERTY} ${LDFLAGS.${.TARGET}}
12CLEANFILES+=	genhooks gen${f}.lo
13.endfor
14CLEANFILES+=	${GENPROG_ERROR_DEPENDS} 
15
16# and now the outputs of genhooks
17target-hooks-def.h: genhooks
18	./genhooks "Target Hook" >${.TARGET}
19c-family/c-target-hooks-def.h: genhooks
20	mkdir -p c-family
21	./genhooks "C Target Hook" >${.TARGET}
22common/common-target-hooks-def.h: genhooks
23	mkdir -p common
24	./genhooks "Common Target Hook" >${.TARGET}
25
26CLEANFILES+=	target-hooks-def.h \
27		c-family/c-target-hooks-def.h \
28		common/common-target-hooks-def.h
29