Subject: avoiding install death
To: None <current-users@NetBSD.ORG>
From: Simon J. Gerraty <sjg@frodo.dn.itg.telecom.com.au>
List: current-users
Date: 02/01/1996 16:32:02
It would be truely wonderful the install rules in the Makefiles, made
sure that the target directory exists.

Nothing worse that having a make build die because of:

install -c -o bin -g bin -m 444 MAKEDEV.cat8 /usr/share/man/cat8/atari/MAKEDEV.0
install: /usr/share/man/cat8/atari/MAKEDEV.0: No such file or directory

rather than go edit all the Makefiles I made the following change to
bsd.man.mk 

RCS file: /prod/cvsroot/usr.src/share/mk/bsd.man.mk,v
retrieving revision 1.1.1.3
diff -c -b -r1.1.1.3 bsd.man.mk
*** /tmp/T0a09974       Thu Feb  1 16:27:27 1996
--- bsd.man.mk  Thu Feb  1 16:24:46 1996
***************
*** 23,29 ****
  MANALL=       ${MAN:S/.1$/.cat1/g:S/.2$/.cat2/g:S/.3$/.cat3/g:S/.4$/.cat4/g:S/.5$/.cat5/g:S/.6$/.cat6/g:S/.7$/.cat7/g:S/.8$/.cat8/g:S/.9$/.cat9/g}
  .endif
  
! MINSTALL=     install ${COPY} -o ${MANOWN} -g ${MANGRP} -m ${MANMODE}
  .if defined(MANZ)
  # chown and chmod are done afterward automatically
  MCOMPRESS=    gzip -cf
--- 23,31 ----
  MANALL=       ${MAN:S/.1$/.cat1/g:S/.2$/.cat2/g:S/.3$/.cat3/g:S/.4$/.cat4/g:S/.5$/.cat5/g:S/.6$/.cat6/g:S/.7$/.cat7/g:S/.8$/.cat8/g:S/.9$/.cat9/g}
  .endif
  
! INSTALL?= install
! MANDIRMODE?= 755
! MINSTALL=     ${INSTALL} ${COPY} -o ${MANOWN} -g ${MANGRP} -m ${MANMODE}
  .if defined(MANZ)
  # chown and chmod are done afterward automatically
  MCOMPRESS=    gzip -cf
***************
*** 35,40 ****
--- 37,44 ----
        @for page in ${MANALL}; do \
                dir=${DESTDIR}${MANDIR}`expr $$page : '.*\.cat\([1-9]\)'`; \
                instpage=$${dir}${MANSUBDIR}/`expr $$page : '\(.*\)\.cat[1-9]'`.0${MCOMPRESSSUFFIX}; \
+               instdir=`dirname $$instpage`; \
+               test -d $$instdir || ${INSTALL} -d -m ${MANDIRMODE} $$instdir; \
                if [ X"${MCOMPRESS}" = X ]; then \
                        echo ${MINSTALL} $$page $$instpage; \
                        ${MINSTALL} $$page $$instpage; \