X-Git-Url: https://git.saurik.com/apple/libc.git/blobdiff_plain/9385eb3d10ebe5eb398c52040ec3dbfba9b0cdcf..b5d655f7532a546b54809da387f7467d128a756b:/Makefile.fbsd_end diff --git a/Makefile.fbsd_end b/Makefile.fbsd_end index 835bd0d..6275b05 100644 --- a/Makefile.fbsd_end +++ b/Makefile.fbsd_end @@ -12,48 +12,61 @@ FBSDSECTIONS= 1 2 3 4 5 6 7 8 9 -.if !target(_FBSDPATCH) -_FBSDPATCH: .USE - @if [ -f ${.ALLSRC}.patch ]; then \ - echo cp ${.ALLSRC} ${.TARGET}; \ - cp ${.ALLSRC} ${.TARGET}; \ - echo patch ${.TARGET} ${.ALLSRC}.patch; \ - patch ${.TARGET} ${.ALLSRC}.patch; \ - else \ - echo ln -s ${.ALLSRC} ${.TARGET}; \ - ln -s ${.ALLSRC} ${.TARGET}; \ - fi -.endif -.if !target(_FBSDPATCH) -_FBSDPATCH: .USE - cp ${.ALLSRC} ${.TARGET}; \ - patch ${.TARGET} ${.ALLSRC}.patch -.endif +# This .for statement forces evaluation of ${_cwd} +.for _cwd in ${CWD} .for _src in ${FBSDSRCS} -${_src:R}-fbsd.${_src:E}: FreeBSD/${_src} _FBSDPATCH +.ifmake autopatch +${_cwd}/${_src:R}-fbsd.${_src:E}: ${_cwd}/FreeBSD/${_src} _AUTOPATCH +AUTOPATCHSRCS+= ${_cwd}/${_src:R}-fbsd.${_src:E} +.else # !autopatch SRCS+= ${_src} +.endif # autopatch .endfor .for _src in ${FBSDMDSRCS} -${_src:R}-fbsd.${_src:E}: FreeBSD/${_src} _FBSDPATCH +.ifmake autopatch +${_cwd}/${_src:R}-fbsd.${_src:E}: ${_cwd}/FreeBSD/${_src} _AUTOPATCH +AUTOPATCHSRCS+= ${_cwd}/${_src:R}-fbsd.${_src:E} +.else # !autopatch MDSRCS+= ${_src} +.endif # autopatch .endfor .for _src in ${FBSDMISRCS} -${_src:R}-fbsd.${_src:E}: FreeBSD/${_src} _FBSDPATCH +.ifmake autopatch +${_cwd}/${_src:R}-fbsd.${_src:E}: ${_cwd}/FreeBSD/${_src} _AUTOPATCH +AUTOPATCHSRCS+= ${_cwd}/${_src:R}-fbsd.${_src:E} +.else # !autopatch MISRCS+= ${_src} +.endif # autopatch .endfor -.for _src in ${FBSDORIGHDRS} -${_src}: FreeBSD/${_src} _FBSDPATCH -FBSDHDRS+= ${_src} +# FBSDPATCHSRCS are for source that need patching, but don't build +# in base variant (only in other variants) +.ifmake autopatch +.for _src in ${FBSDPATCHSRCS} +${_cwd}/${_src:R}-fbsd.${_src:E}: ${_cwd}/FreeBSD/${_src} _AUTOPATCH +AUTOPATCHSRCS+= ${_cwd}/${_src:R}-fbsd.${_src:E} .endfor +.endif # autopatch + +.ifmake autopatch +.for _src in ${FBSDHDRS} +${_cwd}/${_src}: ${_cwd}/FreeBSD/${_src} _AUTOPATCH +AUTOPATCHHDRS+= ${_cwd}/${_src} +.endfor +.endif # autopatch .for _sect in ${FBSDSECTIONS} .for _src in ${FBSDMAN${_sect}} -${_src}: FreeBSD/${_src} _FBSDPATCH +.ifmake autopatch +${_cwd}/${_src}: ${_cwd}/FreeBSD/${_src} _AUTOPATCH +AUTOPATCHMAN+= ${_cwd}/${_src} +.else # !autopatch MAN${_sect}+= ${_src} -FBSDPATCHMAN+= ${_src} +.endif # autopatch .endfor .endfor + +.endfor # _cwd