####################################################################### # # # Here is a Simple Makefile for the Simple example # # # ####################################################################### # # Notes: The '#' character is the comment character, use it liberally # # # # The words 'CUSTOMIZE HERE' indicate places where you should modify # this skeleton to build a program of your own. You can fiddle with the # rest of the makefile at your leisure, but the CUSTOMIZE HERE sections # indicate the minimal number of changes necessary to use this for your # programs # # DGS 96.09.06 # --------------------------------------------------------------------- # Here are the Macros that define the basic Tools we might need. Not # All of these are actually used in this simple makefile # CPP = /usr/ccs/lib/cpp # Macro to define the Pre-Processor CC = gcc # Macro to define the C compiler FF = f77 # Macro to define the FORTRAN compiler LD = f77 # Macro to define the Linker AR = ar # Macro to define the Archiver # # Next come the macros that define the flags for the tools defined # above. A brief explanation of the flags follows: # # C Compiler Flags: -c -> Compile only ( Supress linking ) # -g -> Include symbolic information for debugging # -02 -> Optimizer level 2 # # C Pre-Processor Flags: -P -> Preprocess file only # -D... -> Define symbol # # FORTRAN (F77) Flags: -c -> Compile only ( Supress linking ) # -02 -> Optimizer level 2 # -e -> Extend Source to 132 columns # -F -> Run the preprocessor on the source file # and place the output in .f CFLAGS = -c -g -O2 # C Compiler Flags FFLAGS = -c -O2 -e # Fortran Compiler Flags LDFLAGS = -lm # Linker Flags # # Here are the macros that define the lists of modules...For this simple # example we have only a three modules, a main program, a subroutine, # and a function. Replace these filenames with your own as you write # your modules # ####################### CUSTOMIZE HERE #################### fname = fort_main.o fort_sub.o fort_fcn.o #------------------------------------------------------------------------------ # Here are the dependancy rules. # Note: The actions must begin with a so be careful when pasting with # the Mouse in Motif # # # Rule to Build the FORTRAN program f_simple. Replace the name 'f_simple' # with one of your own choosing. # ####################### CUSTOMIZE HERE #################### f_simple: $(fname) ${LD} ${LDFLAGS} $(fname) -o f_simple # # Rule to build the subroutine UNIT tester. Notice the -D option # used to define the preprocessor symbol 'UNIT_TEST'. Add your # own unit test definitions here as necessary. # ####################### CUSTOMIZE HERE #################### sub_unit: fort_sub.F ${FF} -e -DUNIT_TEST fort_sub.F -o sub_unit rm -f fort_sub.o # Remove the object file with the unit tester fcn_unit: fort_fcn.F ${FF} -e -DUNIT_TEST fort_fcn.F -o fcn_unit rm -f fort_fcn.o # Remove the object file with the unit tester #----------------------------------------------------------------- # Rule to build the FORTRAN subroutine and function. Add your new # modules down here as you create them. # ######################### CUSTOMIZE HERE ################## fort_sub.o: fort_sub.F ${FF} ${FFLAGS} $*.F -o fort_sub.o fort_fcn.o: fort_fcn.F ${FF} ${FFLAGS} $*.F -o fort_fcn.o # +++++++++++++++++++++++++++++++++++++++++++++++++ # Rule to clean up the working directory, removing # all old object files, executables and core files # +++++++++++++++++++++++++++++++++++++++++++++++++ clean: rm *.o f_simple core