After compiling several *.c and *.h files using make, I cleaned up the object files using make clean. However I don't know how to remove the executable.
my makefile code -->
CC=gcc CFLAGS=-I. mp1: main.o downloader.o json.o $(CC) -o mp1 main.o downloader.o json.o -I. .PHONY : clean clean : -rm *.o $(objects) 3 Answers
Your executable seems to be the file mp1. Add this file to the rm command in the clean target:
clean : -rm *.o $(objects) mp1 $ sudo make cleanThe above mentioned command will clean all the .o files
This command is useful when make is not available in your system.
$ find coding/ -type f -executable | xargs rm
This command removes all executable files in the coding directory.
The first part of the command, the find part lists all the files which are executable.
The second part of the command takes the input from 1st part and gives it to rm command.
xargs - a command that converts its standard input into arguments of another program, look the man page for more info