Changeset View
Changeset View
Standalone View
Standalone View
Mk/Uses/dos2unix.mk
Show All 9 Lines | |||||
.if !defined(_INCLUDE_USES_DOS2UNIX_MK) | .if !defined(_INCLUDE_USES_DOS2UNIX_MK) | ||||
_INCLUDE_USES_DOS2UNIX_MK= yes | _INCLUDE_USES_DOS2UNIX_MK= yes | ||||
.if !defined(DOS2UNIX_FILES) && !defined(DOS2UNIX_REGEX) && !defined(DOS2UNIX_GLOB) | .if !defined(DOS2UNIX_FILES) && !defined(DOS2UNIX_REGEX) && !defined(DOS2UNIX_GLOB) | ||||
_DOS2UNIX_ALL= yes | _DOS2UNIX_ALL= yes | ||||
.endif | .endif | ||||
DOS2UNIX_WRKSRC?= ${WRKSRC} | |||||
_USES_patch+= 200:dos2unix | _USES_patch+= 200:dos2unix | ||||
dos2unix: | dos2unix: | ||||
@${ECHO_MSG} "===> Converting DOS text files to UNIX text files" | @${ECHO_MSG} "===> Converting DOS text files to UNIX text files" | ||||
.if defined(_DOS2UNIX_ALL) | .if defined(_DOS2UNIX_ALL) | ||||
@${FIND} ${WRKSRC} -type f -print0 | \ | @${FIND} ${DOS2UNIX_WRKSRC} -type f -print0 | \ | ||||
${XARGS} -0 ${SED} -i '' -e 's/ $$//' | ${XARGS} -0 ${SED} -i '' -e 's/ $$//' | ||||
.else | .else | ||||
.if defined(DOS2UNIX_FILES) | .if defined(DOS2UNIX_FILES) | ||||
@(cd ${WRKSRC}; \ | @(cd ${DOS2UNIX_WRKSRC}; \ | ||||
${ECHO_CMD} ${DOS2UNIX_FILES} | ${XARGS} ${SED} -i '' -e 's/ $$//' ) | ${ECHO_CMD} ${DOS2UNIX_FILES} | ${XARGS} ${SED} -i '' -e 's/ $$//' ) | ||||
.elif defined(DOS2UNIX_REGEX) | .elif defined(DOS2UNIX_REGEX) | ||||
@${FIND} -E ${WRKSRC} -type f -iregex '${DOS2UNIX_REGEX}' -print0 | \ | @${FIND} -E ${DOS2UNIX_WRKSRC} -type f -iregex '${DOS2UNIX_REGEX}' -print0 | \ | ||||
${XARGS} -0 ${SED} -i '' -e 's/ $$//' | ${XARGS} -0 ${SED} -i '' -e 's/ $$//' | ||||
.else | .else | ||||
.for f in ${DOS2UNIX_GLOB} | .for f in ${DOS2UNIX_GLOB} | ||||
@${FIND} ${WRKSRC} -type f -name '${f}' -print0 | \ | @${FIND} ${DOS2UNIX_WRKSRC} -type f -name '${f}' -print0 | \ | ||||
${XARGS} -0 ${SED} -i '' -e 's/ $$//' | ${XARGS} -0 ${SED} -i '' -e 's/ $$//' | ||||
.endfor | .endfor | ||||
.endif | .endif | ||||
.endif | .endif | ||||
.endif | .endif |