I currently have this Makefile which :
- Finds all *.f in the directory it is run
- Looks for matching *.o in the specified subdir (as defined in Objets_dir)
- Compiles and links
Code :
# Paths
# -----
# Where to put the *.o
Objets_dir = temp\Win
# Where to check for the *.o
VPATH = $(Objets_dir)
# Where to put the resulting binary
Executable = D:\Documents\out.exe
# List of needed objects
Objets = $(patsubst %.f,%.o,$(wildcard *.f))
# Rules
# -----
F_compilo = gfortran
F_compilo_options = -O3 -ffpe-trap=invalid,zero,overflow -mfpmath=sse -fmax-errors=3
Link = x86_64-w64-mingw32-gfortran
Link_options =
# Let's go
# --------
# Compile (generation of .o)
%.o:%.f
$(F_compilo) $(F_compilo_options) -c $< -o $(Objets_dir)\$@
# Link (generation of .exe)
$(Executable): $(Objets)
$(Link) $(Link_options) -o $@ $(addprefix $(Objets_dir)\, $(Objets))
For information, I am using mingw32-make to execute this Makefile.
I would like to edit it so that I could specify a list of subfolders where it would also (in addition to the current folder) look for source files (*.f). It would then be a bit less generic but I would be very fine with this.
This makefile is something I retreived from the internet years ago and barely ever touched except to add some commentaries or edit compile flags. I suppose the line that would require editing is the one with the "wildcard" call, but I am completely (completely) ignorant regarding Make language.
Can you suggest how to edit it ?