Annotation of 43BSDTahoe/new/help/src/f77/make, revision 1.1

1.1     ! root        1: .TI F77/MAKE "Sep. 4, 1985"
        !             2: Make - A System for Program Development and Maintenance
        !             3: 
        !             4: The UNIX utility 'make' is a program development tool that greatly
        !             5: enhances the construction and maintenance of moderate to large programs
        !             6: in any language.
        !             7: 
        !             8: \&'Make' is used to find out which object files that a program depends on
        !             9: are out of date, and to have them automatically recompiled.
        !            10: To use 'make', you must describe the dependencies within the program in
        !            11: a file called 'makefile' or 'Makefile'.  Here is a simple 'Makefile'
        !            12: for a program 'prog' which is made from the source in 'main.f',
        !            13: \&'sub1.f' and 'sub2.f':
        !            14: 
        !            15: .nf
        !            16:        prog:   main.o sub1.o sub2.o
        !            17:                f77 main.o sub1.o sub2.o -o prog
        !            18: .fi
        !            19: 
        !            20: The first line describes the target, 'prog', and gives the name of
        !            21: the three object files it depends on.  The second line tells how to
        !            22: create the target file once the files it depends on are up to date.
        !            23: 
        !            24: \&'Make' requires that the target file name MUST start in column one and
        !            25: the next line MUST start with a tab (control-I), not with blanks.
        !            26: 
        !            27: To use this makefile, type: 'make'.  Then 'make' will check that the
        !            28: three object files exist and are more recent than the corresponding
        !            29: source files; e.g. if 'main.f' was last changed on April 20, 5:02 and
        !            30: \&'main.o' was last changed on April 20, 4:58, then 'make' will recompile
        !            31: \&'main.f' to generate an up to date 'main.o'.  If however, 'main.o' is
        !            32: more recent than 'main.f', it will not be recompiled.
        !            33: 
        !            34: Once the three files named on the first line are up to date, 'make'
        !            35: checks whether any of them are newer than 'prog'.  If so, it
        !            36: executes the next line to generate a new version of 'prog';
        !            37: otherwise, it stops and reports 'prog' is up to date.
        !            38: 
        !            39: For this example, typing 'make' when the object files do not exist
        !            40: results in:
        !            41: 
        !            42: .nf
        !            43:        f77    -c main.f
        !            44:        main.f:
        !            45:           MAIN:
        !            46:        f77    -c sub1.f
        !            47:        sub1.f:
        !            48:           sub1:
        !            49:        f77    -c sub2.f
        !            50:        sub2.f:
        !            51:           sub2:
        !            52:        f77 main.o sub1.o sub2.o  -o doit
        !            53:        Loading prog ...
        !            54: .fi
        !            55: 
        !            56: If you type 'make' again:
        !            57: 
        !            58:        `prog' is up to date.
        !            59: 
        !            60: If you now edit 'main.f' and then type 'make':
        !            61: 
        !            62: .nf
        !            63:        f77    -c main.f
        !            64:        main.f:
        !            65:           MAIN:
        !            66:        f77 main.o sub1.o sub2.o  -o doit
        !            67:        Loading prog ...
        !            68: .fi
        !            69: 
        !            70: \&'Make' only performs those steps that are needed to keep 'prog' up to date.
        !            71: To see what 'make' would do without actually doing it, type 'make -n'.
        !            72: 
        !            73: Here is a more advanced 'Makefile'.  FFLAGS is a special string known
        !            74: to 'make' in which you can specify f77 compilation flags; here '-g' is
        !            75: specified to save the symbol table for use with the symbolic debugger.
        !            76: OBJECTS and SOURCES are defined as lists of file names.
        !            77: 
        !            78: .nf
        !            79:        FFLAGS = -g
        !            80:        OBJECTS = main.o sub1.o sub2.o sub3.o sub4.o sub5.o
        !            81:        SOURCES = main.f sub1.f sub2.f sub3.f sub4.f sub5.f
        !            82: 
        !            83:        prog:   $(OBJECTS)
        !            84:                f77 -g $(OBJECTS) -o prog  -lf77plot -l4014
        !            85: 
        !            86:        main.o sub1.o:          block1.h
        !            87:        sub2.o sub3.o sub4.o:   block2.h
        !            88: 
        !            89:        #       to print all the source on the line printer
        !            90:        print: ; pr block1.h block2.h $(SOURCES) | lpr
        !            91: 
        !            92:        #       to remove all the object files and core dumps
        !            93:        remove: ; rm -f $(OBJECTS) core
        !            94: .fi
        !            95: 
        !            96: The linking line specifies the '-g' flag because FFLAGS is used automatically
        !            97: only for compilations.
        !            98: This makefile is for a graphics program which runs on a Tektronics 4014
        !            99: terminal; thus the linking line
        !           100: specifies \%'-lf77plot' for the f77 graphics interface
        !           101: library (see "man 3f plot") and \%'-l4014' for the Tektronics 4014
        !           102: plot library (see "man 3 plot").
        !           103: 
        !           104: The next two lines specify additional
        !           105: dependencies; both 'main.o' and 'sub1.o' depend on the file 'block1.h'
        !           106: and three object files depend on 'block2.h'.  These two files define
        !           107: common blocks and are included via the 'include' statement (see "help
        !           108: f77 style").  Now if 'block1.h' is changed, 'make' will
        !           109: automatically recompile 'main.o' and 'sub1.o', and if 'block2.h' is
        !           110: changed, the three object files depending on it will be recompiled.
        !           111: 
        !           112: The last lines define two new targets, 'print' and 'remove'.  A name is
        !           113: designated as a target by appearing on a line starting in
        !           114: column one.  The default when you type 'make' is to make the first
        !           115: target.
        !           116: Thus typing 'make' is equivalent to typing 'make prog'.
        !           117: You can also type 'make print' which will cause all
        !           118: the source files to be printed or 'make remove' to remove disk files
        !           119: to save space.
        !           120: 
        !           121: For more on-line information on 'make', see "man make".  For more
        !           122: extensive written documentation, see "A Guide for VAX UNIX Fortran
        !           123: Users" and "Make -
        !           124: A Program for Maintaining Computer Programs".

unix.superglobalmegacorp.com

This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.