LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Newbie (https://www.linuxquestions.org/questions/linux-newbie-8/)
-   -   Removing source files from a public directory after compilation (https://www.linuxquestions.org/questions/linux-newbie-8/removing-source-files-from-a-public-directory-after-compilation-937482/)

vtucf 03-31-2012 08:22 PM

Removing source files from a public directory after compilation
 
Hi,

I would like to know how I can modify makefile.am / makefile.in . makefile (I am not sure which file is relevant!) to remove *.f source files everytime I compile my fortran codes. The idea is to

(a) Move the required source files in to the src directory of the project.

(b) compile to create executable using 'make', and,

(c) clean up the source files after creation of the executable.

(d) If need to recompile, run 'make clean' & repeat the procedure above.

The project directory I am working in is public but I have been directed to not share the source code for my project. Can someone please help?

Thanks so much.

Regards,
vtucf

suicidaleggroll 03-31-2012 08:43 PM

Usually it's as simple as adding a "rm -f *.f" after the compile command. Depends on how the makefile is set up though.

For one of my projects, I have the make command automatically clear out all of the .o files after compilation, so it builds from scratch every time. For that, I have this in my makefile:
Code:

target.exe: $(OBJS)
      $(FC) -o $@ $(OBJS) $(LDFLAGS) $(LIBS)
      rm *.o *.mod

Just make damn sure you don't accidentally run a "make" where you actually keep the source ;)


All times are GMT -5. The time now is 01:08 PM.