1/* 2 * NAME 3 * f77 - the Fortran compiler cookbook 4 * 5 * DESCRIPTION 6 * This cookbook describes how to work with C files. 7 * Include file dependencies are automatically determined. 8 * 9 * RECIPES 10 * %.o: %.f77 make object files form C source files 11 * 12 * VARIABLES 13 * f77 The Fortran compiler command 14 * Not altered if already defined. 15 * f77_flags options to pass to the Fortran compiler command 16 * Not altered if already defined. 17 * The default is empty. 18 * ld_flags Options passed to the compiler when linking, 19 * these are typically library search paths and libraries. 20 * Not altered if already defined. 21 * The default is empty. 22 * f77_src Fortran source files in the current directory. 23 * dot_src Source files constructable in the current directory 24 * (unioned with existing setting, if necessary). 25 * dot_obj Object files constructable in the current directory 26 * (unioned with existing setting, if necessary). 27 * dot_clean Files which may be removed from the current directory 28 * in a clean target. 29 * 30 * SEE ALSO 31 * program The program cookbook: 32 * ld The linker program 33 * ld_flags The linker options, NOT libraries. 34 * ld_libraries The linker options (-L, -l) for libraries. 35 * Copyright (C) 1997-2007 Peter Miller 36 */ 37 38#pragma once 39 40if [not [defined c_incl]] then 41 c_incl = [find_command c_incl]; 42if [not [defined f77]] then 43 f77 = f77; 44if [not [defined f77_flags]] then 45 f77_flags = ; 46f77_src = [glob "*.f77" ]; 47if [not [defined dot_src]] then 48 dot_src = ; 49dot_src = [stringset [dot_src] [f77_src] - [fromto %.f77 %.s [f77_src]]]; 50if [not [defined dot_obj]] then 51 dot_obj = ; 52dot_obj = [stringset [dot_obj] [fromto %.f77 %.o [f77_src]]]; 53if [not [defined dot_clean]] then 54 dot_clean = ; 55dot_clean = 56 [stringset 57 [dot_clean] 58 [fromto %.f77 %.o [f77_src]] 59 [fromto %.f77 %.s [f77_src]] 60 ]; 61 62%.o: %.f77 63{ 64 [f77] [f77_flags] 65 [addprefix "-I" [search_list]] 66 -c [resolve %.f77]; 67} 68 69/* 70 * if the c_incl command is available, then check dependencies 71 */ 72#if [c_incl] 73 74%.f77.d: %.f77 75{ 76 [c_incl] -nc -ns -nrec 77 --language\=optimistic 78 [cc_include_flags] 79 [resolve %.f77] 80 [addprefix "-I" [search_list]] 81 -prefix "'cascade %.f77 ='" 82 -suffix "';'" 83 > [target]; 84} 85 86%.inc.d: %.inc 87{ 88 [c_incl] -nc -ns -nrec 89 [cc_include_flags] 90 [resolve %.inc] 91 [addprefix "-I" [search_list]] 92 -prefix "'cascade %.inc ='" 93 -suffix "';'" 94 > [target]; 95} 96 97f77_dep_files = [addsuffix ".d" [f77_src] [glob "*.inc"]]; 98#include-cooked [f77_dep_files] 99#endif 100