################################################################################ # A simple Makefile for GMU make. Invoke with "gmake genetic" # For documentation see: http://www.gnu.org/manual/make/html_node/make_toc.html # # based on one by C. Savage for PHYS3038 # FORTRAN = f90 FPP = -fast -fpp FLAGS = -module obj LIBRARIES = -lmpi INCLUDES = SOURCEDIR = src OBJECTDIR = obj BINARYDIR = bin SOURCE = $(SOURCEDIR)/tspglobals.f90 \ $(SOURCEDIR)/quicksort.f90 \ $(SOURCEDIR)/tsputils.f90 \ $(SOURCEDIR)/tspmc.f90 \ $(SOURCEDIR)/tspanneal.f90 \ $(SOURCEDIR)/tspevol.f90 \ $(SOURCEDIR)/tspparsa.f90 \ $(SOURCEDIR)/tsp.f90 # # Create the required directories if not present. # $@ is the name of the target # N.B. the commands finishing rules must start with a TAB. # DIRECTORIES = $(BINARYDIR) $(OBJECTDIR) $(DIRECTORIES) : if ( test ! -d $@ ) then ( mkdir $@ ) fi # # the previous line is a command for a rule, and so starts with a TAB. # # # Create the list of object files from the source files # Takes the SOURCE list and replaces .f90 with .o and SOURCEDIR with OBJECTDIR # OBJECTS = $(SOURCE:$(SOURCEDIR)/%.f90=$(OBJECTDIR)/%.o) # # Main program to build # tsp: $(BINARYDIR)/tsp # # Main dependancies # # The exceutable depends on the directories, which it will make if not present, # and on the object files. # $(BINARYDIR)/tsp: $(DIRECTORIES) $(OBJECTS) $(FORTRAN) $(FLAGS) $(LIBRARIES) $(INCLUDES) $(OBJECTS) -o $@ # # Build the object files using this pattern rule # Any OBJECTDIR/.o file is made from the corresponding SOURCEDIR/.f90 file # The -c option produces only object files # $< is the name of the first prerequisite for the invoking target, # here the .f90 file, # because we have put them first in the .o dependencies above. # $(OBJECTDIR)/%.o : $(SOURCEDIR)/%.f90 $(FORTRAN) $(INCLUDES) $(FLAGS) -c $< -o $@