ena.4: Add a missing space.
[dragonfly.git] / initrd / Makefile
blobdbf3cdacb4806a5131b41a1241100bf3625f1b5d
1 INITRD_MAKE= LC_ALL=C \
2 make -m ${.CURDIR}/../share/mk
4 # Target directory to install the rescue tools
5 RESCUE_DIR?= /rescue
7 # Temporary directory to stage the initrd files (e.g., /etc)
8 # NOTE: Ignore ${DESTDIR} when staging files into this directory
9 INITRD_STAGEDIR!= mktemp -d -t initrd-stage
11 .END:
12 @rm -rf ${INITRD_STAGEDIR}
14 _build_rescue:
15 @echo ">>> Building rescue tools ..."
16 .for _dir in oinit rescue rescue.libcrypto
17 (cd ${.CURDIR}/${_dir} && \
18 ${INITRD_MAKE} obj && \
19 ${INITRD_MAKE} depend all)
20 .endfor
22 _install_rescue:
23 @echo ">>> Installing rescue tools ..."
24 .for _dir in oinit rescue rescue.libcrypto
25 (cd ${.CURDIR}/${_dir} && \
26 ${INITRD_MAKE} BINDIR=${RESCUE_DIR} install)
27 .endfor
29 _stage_initrd:
30 @echo ">>> Staging initrd contents ..."
31 (cd ${.CURDIR}/etc && \
32 mkdir ${INITRD_STAGEDIR}/etc && \
33 ${INITRD_MAKE} obj && \
34 ${INITRD_MAKE} depend all && \
35 ${INITRD_MAKE} BINDIR=${INITRD_STAGEDIR}/etc DESTDIR="" install)
37 _make_initrd:
38 @echo ">>> Creating initrd.img.gz ..."
39 sh ${.CURDIR}/mkinitrd.sh \
40 -b ${DESTDIR}/boot \
41 -r ${DESTDIR}${RESCUE_DIR} \
42 -c ${INITRD_STAGEDIR}
44 _clean_rescue:
45 @echo ">>> Cleaning rescue ..."
46 .for _dir in oinit rescue rescue.libcrypto
47 (cd ${.CURDIR}/${_dir} && ${INITRD_MAKE} clean cleandepend)
48 .endfor
50 _clean_initrd:
51 @echo ">>> Cleaning initrd ..."
52 (cd ${.CURDIR}/etc && ${INITRD_MAKE} clean cleandepend)
54 clean: _clean_rescue _clean_initrd
56 quickrescue: _build_rescue _install_rescue
57 rescue: _clean_rescue quickrescue .PHONY
58 .ORDER: _clean_rescue _build_rescue _install_rescue
60 _quickinitrd: _stage_initrd _make_initrd
61 _initrd: _clean_initrd _quickinitrd
62 .ORDER: _clean_initrd _stage_initrd _make_initrd
64 quickinitrd: quickrescue _quickinitrd
65 initrd: rescue _initrd
66 .ORDER: quickrescue _quickinitrd
67 .ORDER: rescue _initrd