1#	$OpenBSD: Makefile,v 1.15 2020/04/02 06:06:22 otto Exp $
2#	$NetBSD: Makefile,v 1.1 2000/08/20 14:58:45 mrg Exp $
3
4CURDIR=	${.CURDIR}
5S=	${CURDIR}/../../../..
6
7#
8# Override normal settings
9#
10
11CLEANFILES=	machine ffs.fth.h \
12		bootblk bootblk.text bootblk.text.tmp -.d
13
14NOMAN=
15STRIPFLAG=
16BINMODE=644
17
18INCLUDES=	-I. -I$S/arch -I$S -nostdinc
19CPPFLAGS=	${INCLUDES} ${IDENT} ${PARAM}
20
21.if !make(clean) && !make(cleandir) && !make(includes) && !make(libdep) && \
22    !make(sadep) && !make(salibdir) && !make(obj)
23.BEGIN:
24	@([ -h machine ] || ln -s ${.CURDIR}/../../include machine)
25.endif
26
27all: bootblk.text bootblk
28
29ffs.fth.h: ${.CURDIR}/genassym.sh genfth.cf
30	sh ${.CURDIR}/genassym.sh -f ${CC} ${CFLAGS} ${CPPFLAGS} ${PROF} \
31		< ${.CURDIR}/genfth.cf >ffs.fth.h.tmp && \
32		mv -f ffs.fth.h.tmp ffs.fth.h
33
34bootblk.text: bootblk.fth ffs.fth.h
35	awk '/fload/ { print "#include \"" $$2 "\"" }; !/fload/' \
36	    ${.CURDIR}/bootblk.fth | /usr/bin/cpp -P > bootblk.text.tmp && \
37	    mv -f bootblk.text.tmp bootblk.text
38
39bootblk: bootblk.fth ffs.fth.h
40	fgen -o bootblk ${.CURDIR}/bootblk.fth
41
42beforeinstall:
43	${INSTALL} ${INSTALL_COPY} -o ${BINOWN} -g ${BINGRP} -m ${BINMODE} \
44	    bootblk ${DESTDIR}/usr/mdec
45
46#
47# The following are if you grab the fakeboot program from the Sun website
48#
49
50fake: bootblk bootblk.text
51	../fakeboot/fakeboot -elf32 <bootblk >/bootblk
52	../fakeboot/fakeboot -elf32 <bootblk.text >/bootblk.text
53
54.include <bsd.prog.mk>
55