Reputation: 341
Situation
Attempting to cleanup after a Makefile compilation.
Errors
These are the error(s) that I'm routinely receiving while attempting to conduct, one would believe to be, a simple cleanup operation.
Errors:
Command:
make linux
g++ Main.o CHARACTER.o ATTRIBUTES.o -o bin/release/Player.sh find *.o -type f -delete
g++: error: find: No such file or directory
g++: error: f: No such file or directory
g++: error: unrecognized command line option ‘-type’; did you mean ‘-pipe’?
Command:
make linux
g++ Main.o CHARACTER.o ATTRIBUTES.o -o bin/release/Player.sh rm -f *.o
g++: error: rm: No such file or directory
g++: error: unrecognized command line option ‘-f’
Command:
make linux
g++ Main.o CHARACTER.o ATTRIBUTES.o -o bin/release/Player.sh clean
g++: error: clean: No such file or directory
Makefile:2: recipe for target 'linux' failed
Makefile
linux: Main.o CHARACTER.o ATTRIBUTES.o
g++ Main.o CHARACTER.o ATTRIBUTES.o -o bin/release/Player.sh clean
(alternate command attempt)
g++ Main.o CHARACTER.o ATTRIBUTES.o -o bin/release/Player.sh -rm -f *.o
(alternate command attempt)
g++ Main.o CHARACTER.o ATTRIBUTES.o -o bin/release/Player.sh find *.o -type f -delete
win32: Main.o CHARACTER.o ATTRIBUTES.o
g++ Main.o CHARACTER.o ATTRIBUTES.o -o bin/release/Player.exe cleanWin
main.o: Main.cpp
g++ -c Main.cpp
CHARACTER.o: src/CHARACTER.cpp include/CHARACTER.h
g++ -c src/CHARACTER.cpp
ATTRIBUTES.o: src/ATTRIBUTES.cpp include/ATTRIBUTES.h
g++ -c src/ATTRIBUTES.cpp
clean:
rm -f *.o
cleanWin:
del *.o
Summary
Everything except the cleanup routine works apparently fine, however, once cleanup is attempted, I errors for functions that are definitely accessible throughout my OS, whether Win32 or Linux. Can't quite understand why these simple commands are routinely having issues.
Similar Posts
Albeit, my issue is similar to the following post(s), their solution(s) apparently have no effect.
make clean
Makefile targetMakefile No such file or directory
Upvotes: 1
Views: 1402
Reputation: 117168
You are adding find *.o -type f -deletefind *.o -type f -delete
and the other cleanup commands as arguments to g++
. Put ;
between commands. Example:
linux: Main.o CHARACTER.o ATTRIBUTES.o
g++ Main.o CHARACTER.o ATTRIBUTES.o -o bin/release/Player.sh ;
clean
Note that this target, linux
, doesn't actually produce a linux
file. It will produce a binary file called bin/release/Player.sh
which is a really bad name for a binary file. .sh
is usually reserved for shell scripts.
Upvotes: 3