sources | +---applications | | | +---loveandpeace | | | | | +---unix | | | | | +---win32 | | | +---worlddomination | | | +---unix | | | +---win32 | +---tools--- ... #### .SUFFIXES: .cxx .cpp .c .o # APPNAME is the parent directory of the current one APPNAME = ${shell perl -MCwd -e 'print +(split/\//,cwd)[-2]'} EXE = ${APPNAME} ... (the usual stuff follows) ...