# This example shows the most common most confusing aspect -- new shells # are created for each command line. Operations that work on the environment # don't work as you might expect. # The leading '@' means "don't print this command". # Note: You can invoke make with the -s switch (for "silent running"), or # you can use the .SILENT: pseudo-target (deprecated), or you can # use '@'. bug0: @export MYVAR="Setting MYVAR" echo MYVAR is \'$$MYVAR\' bug1: @pwd @cd subdir @pwd unbug0: export MYVAR="Setting MYVAR"; echo $$MYVAR unbug1: pwd; cd subdir; pwd # I want the recursive invocation that follows to work, no matter # what this file is called. THISFILE=$(word $(words ${MAKEFILE_LIST}),${MAKEFILE_LIST}) bugless0: export MYVAR="Invoked make recursively"; ${MAKE} -f ${THISFILE} bug0 clean: rm -f *~ *.o *.exe