Skip to content

Commit

Permalink
Remove 'del' line noise
Browse files Browse the repository at this point in the history
The del command produced output that was too verbose for what
its used for, so pipe it to nul and put the command in a new
variable, 'RM'.
  • Loading branch information
VexedUXR committed Mar 2, 2024
1 parent cf19c17 commit df6ee27
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 9 deletions.
4 changes: 4 additions & 0 deletions mk/init.mk
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,10 @@ $V += ${$V.$Q:U} ${$V.$Q.${COMPILER_TYPE}:U}
.endfor
.endfor

# del is unnecessarily verbose for
# what we need.
RM?= del /q > nul 2>&1

.if ${COMPILER_TYPE} == "msvc"
# cl.exe wants us to pass some arguments
# to the linker instead of to it.
Expand Down
14 changes: 7 additions & 7 deletions mk/lib.mk
Original file line number Diff line number Diff line change
Expand Up @@ -74,28 +74,28 @@ OBJS+= ${SRCS:T:N*.h:R:S/$/.obj/g}

${LIB}.lib: ${OBJS}
@${META_NOECHO} building standard ${LIB} library
@del /q ${.TARGET} 2> nul
@${RM} ${.TARGET}
lib /nologo /OUT:${.TARGET} ${OBJS}

# cl uses the /link argument to pass arguments to the linker
# *everything* after it is passed to the linker.
_ := ${${COMPILER_TYPE} == "msvc":?/link:}
${LIB}.dll: ${LIB}.lib ${DPADD}
@${META_NOECHO} building shared ${LIB} library (version ${SHLIB_FULLVERSION})
@del /q ${.TARGET} 2> nul
@${RM} ${.TARGET}
${SHLIB_LD} ${OBJS} ${LDADD} ${SHLIB_LDADD} \
$_ ${LDFLAGS:N$_} ${LD_shared} ${CC_OUT:N$_}
.if !empty(SHLIB_LINKS)
del /q ${SHLIB_LINKS} & ${SHLIB_LINKS:O:u:@x@mklink $x ${.TARGET}&@}
${RM} ${SHLIB_LINKS} & ${SHLIB_LINKS:O:u:@x@mklink $x ${.TARGET}&@}
.endif

.if !target(clean)
cleanlib: .PHONY
-del /q ${CLEANFILES}
-del /q ${LIB}.lib ${OBJS}
-del /q ${LIB}.dll
-${RM} ${CLEANFILES}
${RM} ${LIB}.lib ${OBJS}
${RM} ${LIB}.dll
.if !empty(SHLIB_LINKS)
-del /q ${SHLIB_LINKS}
${RM} ${SHLIB_LINKS}
.endif

clean: cleanlib
Expand Down
3 changes: 1 addition & 2 deletions mk/prog.mk
Original file line number Diff line number Diff line change
Expand Up @@ -59,8 +59,7 @@ realbuild: ${PROG}.exe

.if !target(clean)
cleanprog:
del /q \
${PROG}.exe ${OBJS} ${CLEANFILES}
${RM} ${PROG}.exe ${OBJS} ${CLEANFILES}

clean: cleanprog
cleandir: cleanprog
Expand Down

0 comments on commit df6ee27

Please sign in to comment.