While debugging a Makefile
so a problem with linking openssl
, I encountered the followed if expr
syntax:
all:
@ $(CALC_VERSIONS); \
INHIBIT_SYMLINKS=yes; \
SHLIB=cyg$(LIBNAME); SHLIB_SOVER=-$(LIBVERSION); SHLIB_SUFFIX=.dll; \
dll_name=$$SHLIB$$SHLIB_SOVER$$SHLIB_SUFFIX; extras=; \
base=-Wl,--enable-auto-image-base; \
if expr $(PLATFORM) : 'mingw' > /dev/null; then \
case $(LIBNAME) in \
What does if expr $(PLATFORM) : 'mingw'
do? And why output to /dev/null
expr 'string' : 'string'
returns a non-zero value and prints a zero if the strings do not match and returns a zero and prints the length of the strings if the strings do match. The output is redirected to /dev/null
because there really isn’t any benefit to the output since the return code is used in the if statement.