How can I clean up after a build?

I need to rebuild cgx. How can I clean up the previous build? There is no clean target in the Makefile. I am at the moment using brute force “rm -f *.o cgx” in the src directory. Is this the way to go?

You can write a clean rule in the makefile https://www.gnu.org/software/make/manual/html_node/Cleanup.html

Typically, I clean up after the ccx run;

        ccx -i job
        rm -f job.log spooles.out *.12d *.cvg *.sta
        rm -f *Miss*.nam

Additionally, I have a separate rule to remove all generated files, in case the preprocessor or solver fails;

.PHONY: clean
clean: 
        rm -f *.equ *.sur *.nam *.msh *.log *.12d *.cvg *.sta *.con
        rm -f spooles.out
1 Like