1# Sample Makefile for compiling Fortran programs using Quad-Double library. 2# Make sure the script qd-config (installed during "make install") 3# is in your path. 4 5# Fortran compiler. Should be whatever "qd-config --fc" returns. 6FC=$(shell qd-config --fc) 7 8# C++ compiler. Used for linking. 9# Should be whatever "qd-config --cxx" returns. 10CXX=$(shell qd-config --cxx) 11 12# Fortran compiler flags. Should be whatever "qd-config --fcflags" 13# returns, but some items (like optimization levels) # can be 14# tweaked if desired. 15FCFLAGS=$(shell qd-config --fcflags) 16 17# Linker flags. Includes the Quad-Double library and any Fortran 18# libraries that needs to be linked in. Should be whatever 19# "qd-config --fclibs" returns 20FCLIBS=$(shell qd-config --fclibs) 21 22# If your main proram is written in Fortran, you need declare your 23# main program as "subroutine f_main", not "program myprog", since 24# C++ linker must find the main entry, provided by 25# "qd-config --fmainlib". 26FCMAIN=$(shell qd-config --fmainlib) 27 28fortran_test: fortran_test.o 29 $(CXX) -o $@ fortran_test.o $(FCLIBS) $(FCMAIN) 30 31%.o: %.f90 32 $(FC) -c $(FCFLAGS) $< 33 34