The following makefile builds a library from three source files. It can easily be adapted for general use by replacing the SRCS and TARGET macros with the pertinent source file and library names.
FC = lf95 SRCS = one.f90 two.f90 three.f90 TARGET = foo.lib $(TARGET) : $(SRCS) $(FC) $? -out $@
The FC macro names LF95 as the compiler.
The SRCS macro is a list of source files which comprise the library contents.
The TARGET macro defines the library name.
The library will only be updated if the source file is newer than the library file, it does not depend on the presence or status of object files. If the library does not exist when NMAKE is invoked, LF95 is used to create the library. If the library is already present when NMAKE is invoked, LF95 in used to update the library.