I have a Makefile that looks like this
CXX = g++ -O2 -Wall all: code1 code2 code1: code1.cc utilities.cc $(CXX) $^ -o $@ code2: code2.cc utilities.cc
In makefile language $@ means "name of the target", so rm -f $@ translates to rm -f clean.
$@
rm -f $@
rm -f clean
You need to specify to rm what exactly you want to delete, like rm -f *.o code1 code2
rm
rm -f *.o code1 code2