Makefile.fbsd_end   [plain text]


# For the FreeBSD auto patching mechanism and compatibility environment
# setup, original FreeBSD sources a put into a FreeBSD subdirectory.
# If a file with the same name, but suffix ".patch" is in that directory,
# that patch will be applied before use.
#
# The FBSDMDSRCS, FBSDMISRCS, FBSDORIGHDRS and FBSDSRCS variables must be set,
# and bracketed by .include of Makefile.fbsd_begin and Makefile.fbsd_end
#
# Set up dependencies between the FreeBSD source (in a FreeBSD subdirectory)
# and a file with a -fbsd.x suffix (where x is 'c' or 's').  The suffix
# rules will then compile the file with the simulate FreeBSD environment.

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

.for _src in ${FBSDSRCS}
${_src:R}-fbsd.${_src:E}: FreeBSD/${_src} _FBSDPATCH
SRCS+= ${_src}
.endfor

.for _src in ${FBSDMDSRCS}
${_src:R}-fbsd.${_src:E}: FreeBSD/${_src} _FBSDPATCH
MDSRCS+= ${_src}
.endfor

.for _src in ${FBSDMISRCS}
${_src:R}-fbsd.${_src:E}: FreeBSD/${_src} _FBSDPATCH
MISRCS+= ${_src}
.endfor

.for _src in ${FBSDORIGHDRS}
${_src}: FreeBSD/${_src} _FBSDPATCH
FBSDHDRS+= ${_src}
.endfor

.for _sect in ${FBSDSECTIONS}
.for _src in ${FBSDMAN${_sect}}
${_src}: FreeBSD/${_src} _FBSDPATCH
MAN${_sect}+= ${_src}
FBSDPATCHMAN+= ${_src}
.endfor
.endfor