home *** CD-ROM | disk | FTP | other *** search
/ NetNews Usenet Archive 1993 #3 / NN_1993_3.iso / spool / gnu / utils / bug / 2492 < prev    next >
Encoding:
Text File  |  1993-01-28  |  11.3 KB  |  415 lines

  1. Path: sparky!uunet!stanford.edu!ames!saimiri.primate.wisc.edu!zaphod.mps.ohio-state.edu!pacific.mps.ohio-state.edu!cis.ohio-state.edu!glsdev.UUCP!norm
  2. From: norm@glsdev.UUCP (Norm Brake)
  3. Newsgroups: gnu.utils.bug
  4. Subject: problem with make 3.63 and sccs
  5. Date: 26 Jan 1993 22:21:11 -0500
  6. Organization: GNUs Not Usenet
  7. Lines: 401
  8. Sender: daemon@cis.ohio-state.edu
  9. Approved: bug-gnu-utils@prep.ai.mit.edu
  10. Distribution: gnu
  11. Message-ID: <9301261517.AA13649@modcomp.com>
  12. Reply-To: modcomp!glsdev!norm@uunet.uu.net
  13.  
  14.    When I specify a dependency in another directory, I usually want
  15.    it fetched from the SCCS directory under that other directory into
  16.    that other directory.
  17.  
  18.    With the code as delivered in 3.63, a dependency of '../hdr/foo.h'
  19.    will create './foo.h' from '../hdr/SCCS/s.foo.h'.  Not what I want at all.
  20.  
  21.    A dependency of '../hdr/foo.h' should create '../hdr/foo.h'
  22.    from '../hdr/SCCS/s.foo.h'.
  23.  
  24.    See #ifdef _MODCOMP in the following copy of 'default.c' for my
  25.    fix for this.  The first occurance is the fix, the rest have to
  26.    do with our compiler names for FORTRAN and PASCAL.
  27.  
  28.    There may be a better way to do this directly from the get command
  29.    but this worked so I quit fixing it.
  30.  
  31. -- 
  32. Norm Brake                                Modular Computer Systems, Inc.
  33. (norm@modcomp.com)                        P.O. Box 6099                   
  34. Software Tools Group                      Ft. Lauderdale, FL, USA 33340-6099
  35. ----------------------------------------------------------------------------
  36. /* Data base of default implicit rules for GNU Make.
  37. Copyright (C) 1988, 1989, 1990, 1991, 1992 Free Software Foundation, Inc.
  38. This file is part of GNU Make.
  39.  
  40. GNU Make is free software; you can redistribute it and/or modify
  41. it under the terms of the GNU General Public License as published by
  42. the Free Software Foundation; either version 2, or (at your option)
  43. any later version.
  44.  
  45. GNU Make is distributed in the hope that it will be useful,
  46. but WITHOUT ANY WARRANTY; without even the implied warranty of
  47. MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
  48. GNU General Public License for more details.
  49.  
  50. You should have received a copy of the GNU General Public License
  51. along with GNU Make; see the file COPYING.  If not, write to
  52. the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.  */
  53.  
  54. #include "make.h"
  55. #include "rule.h"
  56. #include "dep.h"
  57. #include "file.h"
  58. #include "commands.h"
  59. #include "variable.h"
  60.  
  61.  
  62. /* This is the default list of suffixes for suffix rules.
  63.    `.s' must come last, so that a `.o' file will be made from
  64.    a `.c' or `.p' or ... file rather than from a .s file.  */
  65.  
  66. static char default_suffixes[]
  67.   = ".out .a .ln .o .c .cc .C .p .f .F .r .y .l .s .S \
  68. .mod .sym .def .h .info .dvi .tex .texinfo .texi .cweb .web .sh .elc .el";
  69.  
  70. static struct pspec default_pattern_rules[] =
  71.   {
  72.     { "(%)", "%",
  73.     "$(AR) $(ARFLAGS) $@ $<" },
  74.  
  75.     /* The X.out rules are only in BSD's default set because
  76.        BSD Make has no null-suffix rules, so `foo.out' and
  77.        `foo' are the same thing.  */
  78.     { "%.out", "%",
  79.     "@rm -f $@ \n cp $< $@" },
  80.  
  81.     { 0, 0, 0 }
  82.   };
  83.  
  84. static struct pspec default_terminal_rules[] =
  85.   {
  86.     /* RCS.  */
  87.     { "%", "%,v",
  88.     "+$(CHECKOUT,v)" },
  89.     { "%", "RCS/%,v",
  90.     "+$(CHECKOUT,v)" },
  91.  
  92. #ifdef _MODCOMP
  93. /*
  94.    When I specify a dependency in another directory, I usually want
  95.    it fetched from the SCCS directory under that other directory into
  96.    that other directory.
  97.    Thus a dependency of '../hdr/foo.h' should create '../hdr/foo.h'
  98.    from '../hdr/SCCS/s.foo.h'.
  99.    RCS (above) may have similar problems but I don't use RCS so I don't know.
  100. */
  101.     /* SCCS.  */
  102.     { "%", "s.%",
  103.     "cd $(@D); $(GET) $(GFLAGS) $(<F)" },
  104.     { "%", "SCCS/s.%",
  105.     "cd $(@D); $(GET) $(GFLAGS) SCCS/$(<F)" },
  106. /*
  107.    With this next one, a dependency of '../hdr/foo.h' will create
  108.    './foo.h' from '../hdr/SCCS/s.foo.h'.  Not what I want at all.
  109. */
  110. #else
  111.     /* SCCS.  */
  112.     { "%", "s.%",
  113.     "$(GET) $(GFLAGS) $<" },
  114.     { "%", "SCCS/s.%",
  115.     "$(GET) $(GFLAGS) $<" },
  116. #endif
  117.  
  118.     { 0, 0, 0 }
  119.   };
  120.  
  121. static char *default_suffix_rules[] =
  122.   {
  123.     ".o",
  124.     "$(LINK.o) $^ $(LOADLIBES) $(LDLIBS) -o $@",
  125.     ".s",
  126.     "$(LINK.s) $^ $(LOADLIBES) $(LDLIBS) -o $@",
  127.     ".S",
  128.     "$(LINK.S) $^ $(LOADLIBES) $(LDLIBS) -o $@",
  129.     ".c",
  130.     "$(LINK.c) $^ $(LOADLIBES) $(LDLIBS) -o $@",
  131.     ".cc",
  132.     "$(LINK.cc) $^ $(LOADLIBES) $(LDLIBS) -o $@",
  133.     ".C",
  134.     "$(LINK.C) $^ $(LOADLIBES) $(LDLIBS) -o $@",
  135.     ".f",
  136.     "$(LINK.f) $^ $(LOADLIBES) $(LDLIBS) -o $@",
  137.     ".p",
  138.     "$(LINK.p) $^ $(LOADLIBES) $(LDLIBS) -o $@",
  139.     ".F",
  140.     "$(LINK.F) $^ $(LOADLIBES) $(LDLIBS) -o $@",
  141.     ".r",
  142.     "$(LINK.r) $^ $(LOADLIBES) $(LDLIBS) -o $@",
  143.     ".mod",
  144.     "$(COMPILE.mod) -o $@ -e $@ $^",
  145.  
  146.     ".def.sym", 
  147.     "$(COMPILE.def) -o $@ $<",
  148.  
  149.     ".sh",
  150.     "cat $< >$@ \n chmod a+x $@",
  151.  
  152.     ".s.o",
  153. #if !defined(M_XENIX) || defined(__GNUC__)
  154.     "$(COMPILE.s) -o $@ $<",
  155. #else    /* Xenix.  */
  156.     "$(COMPILE.s) -o$@ $<",
  157. #endif    /* Not Xenix.  */
  158.     ".S.o",
  159. #if !defined(M_XENIX) || defined(__GNUC__)
  160.     "$(COMPILE.S) -o $@ $<",
  161. #else    /* Xenix.  */
  162.     "$(COMPILE.S) -o$@ $<",
  163. #endif    /* Not Xenix.  */
  164.     ".c.o",
  165.     "$(COMPILE.c) $< $(OUTPUT_OPTION)",
  166.     ".cc.o",
  167.     "$(COMPILE.cc) $< $(OUTPUT_OPTION)",
  168.     ".C.o",
  169.     "$(COMPILE.C) $< $(OUTPUT_OPTION)",
  170.     ".f.o",
  171.     "$(COMPILE.f) $< $(OUTPUT_OPTION)",
  172.     ".p.o",
  173.     "$(COMPILE.p) $< $(OUTPUT_OPTION)",
  174.     ".F.o",
  175.     "$(COMPILE.F) $< $(OUTPUT_OPTION)",
  176.     ".r.o",
  177.     "$(COMPILE.r) $< $(OUTPUT_OPTION)",
  178.     ".mod.o",
  179.     "$(COMPILE.mod) -o $@ $<",
  180.  
  181.     ".c.ln",
  182.     "$(LINT.c) -C$* $<",
  183.     ".y.ln",
  184.     "$(YACC.y) $< \n $(LINT.c) -C$* y.tab.c \n $(RM) y.tab.c",
  185.     ".l.ln",
  186.     "@$(RM) $*.c\n $(LEX.l) $< > $*.c\n$(LINT.c) -i $*.c -o $@\n $(RM) $*.c",
  187.  
  188.     ".y.c",
  189.     "$(YACC.y) $< \n mv -f y.tab.c $@",
  190.     ".l.c",
  191.     "@$(RM) $@ \n $(LEX.l) $< > $@",
  192.  
  193.     ".F.f",
  194.     "$(PREPROCESS.F) $< $(OUTPUT_OPTION)",
  195.     ".r.f",
  196.     "$(PREPROCESS.r) $< $(OUTPUT_OPTION)",
  197.  
  198.     /* This might actually make lex.yy.c if there's no %R%
  199.        directive in $*.l, but in that case why were you
  200.        trying to make $*.r anyway?  */
  201.     ".l.r",
  202.     "$(LEX.l) $< > $@ \n mv -f lex.yy.r $@",
  203.  
  204.     ".S.s",
  205.     "$(PREPROCESS.S) $< > $@",
  206.  
  207.     ".texinfo.info",
  208.     "$(MAKEINFO) $<",
  209.  
  210.     ".texi.info",
  211.     "$(MAKEINFO) $<",
  212.  
  213.     ".tex.dvi",
  214.     "$(TEX) $<",
  215.  
  216.     ".texinfo.dvi",
  217.     "$(TEXI2DVI) $<",
  218.  
  219.     ".texi.dvi",
  220.     "$(TEXI2DVI) $<",
  221.  
  222.     ".cweb.c",
  223.     "$(CTANGLE) $<",
  224.  
  225.     ".web.p",
  226.     "$(TANGLE) $<",
  227.  
  228.     ".cweb.tex",
  229.     "$(CWEAVE) $<",
  230.  
  231.     ".web.tex",
  232.     "$(WEAVE) $<",
  233.  
  234.     0, 0,
  235.   };
  236.  
  237. static char *default_variables[] =
  238.   {
  239.     "AR", "ar",
  240.     "ARFLAGS", "rv",
  241.     "AS", "as",
  242.     "CC", "cc",
  243.     "CXX", "g++",
  244.  
  245.     /* This expands to $(CO) $(COFLAGS) $< $@ if $@ does not exist,
  246.        and to the empty string if $@ does exist.  */
  247.     "CHECKOUT,v",
  248.     "$(patsubst $@-noexist,$(CO) $(COFLAGS) $< $@,\
  249.         $(filter-out $@,$(firstword $(wildcard $@) $@-noexist)))",
  250.  
  251.     "CO", "co",
  252.     "CPP", "$(CC) -E",
  253. #ifdef    CRAY
  254.     "CF77PPFLAGS", "-P",
  255.     "CF77PP", "/lib/cpp",
  256.     "CFT", "cft77",
  257.     "CF", "cf77",
  258.     "FC", "$(CF)",
  259. #else    /* Not CRAY.  */
  260. #ifdef    _IBMR2
  261.     "FC", "xlf",
  262. #else
  263. #ifdef    __convex__
  264.     "FC", "fc",
  265. #else
  266. #ifdef _MODCOMP
  267.     "FC", "gf77",
  268. #else
  269.     "FC", "f77",
  270. #endif /* _MODCOMP */
  271. #endif /* __convex__ */
  272. #endif /* _IBMR2 */
  273.     /* System V uses these, so explicit rules using them should work.
  274.        However, there is no way to make implicit rules use them and FC.  */
  275.     "F77", "$(FC)",
  276.     "F77FLAGS", "$(FFLAGS)",
  277. #endif    /* Cray.  */
  278. #if    defined (USG) || defined (ultrix) || defined (_IBMR2)
  279.     "GET", "get",
  280. #else
  281.     "GET", "/usr/sccs/get",
  282. #endif
  283.     "LD", "ld",
  284.     "LEX", "lex",
  285.     "LINT", "lint",
  286.     "M2C", "m2c",
  287. #ifdef    pyr
  288.     "PC", "pascal",
  289. #else
  290. #ifdef    CRAY
  291.     "PC", "PASCAL",
  292.     "SEGLDR", "segldr",
  293. #else
  294. #ifdef _MODCOMP
  295.     "PC", "gpc",
  296. #else
  297.     "PC", "pc",
  298. #endif    /* _MODCOMP */
  299. #endif    /* CRAY.  */
  300. #endif    /* pyr.  */
  301.     "YACC", "yacc",    /* Or "bison -y"  */
  302.     "MAKEINFO", "makeinfo",
  303.     "TEX", "tex",
  304.     "TEXI2DVI", "texi2dvi",
  305.     "WEAVE", "weave",
  306.     "CWEAVE", "cweave",
  307.     "TANGLE", "tangle",
  308.     "CTANGLE", "ctangle",
  309.  
  310.     "RM", "rm -f",
  311.  
  312.     "LINK.o", "$(CC) $(LDFLAGS) $(TARGET_ARCH)",
  313.     "COMPILE.c", "$(CC) $(CFLAGS) $(CPPFLAGS) $(TARGET_ARCH) -c",
  314.     "LINK.c", "$(CC) $(CFLAGS) $(CPPFLAGS) $(LDFLAGS) $(TARGET_ARCH)",
  315.     "COMPILE.cc", "$(CXX) $(CXXFLAGS) $(CPPFLAGS) $(TARGET_ARCH) -c",
  316.     "COMPILE.C", "$(COMPILE.cc)",
  317.     "LINK.cc", "$(CXX) $(CXXFLAGS) $(CPPFLAGS) $(LDFLAGS) $(TARGET_ARCH)",
  318.     "LINK.C", "$(LINK.cc)",
  319.     "YACC.y", "$(YACC) $(YFLAGS)",
  320.     "LEX.l", "$(LEX) $(LFLAGS) -t",
  321.     "COMPILE.f", "$(FC) $(FFLAGS) $(TARGET_ARCH) -c",
  322.     "LINK.f", "$(FC) $(FFLAGS) $(LDFLAGS) $(TARGET_ARCH)",
  323.     "COMPILE.F", "$(FC) $(FFLAGS) $(CPPFLAGS) $(TARGET_ARCH) -c",
  324.     "LINK.F", "$(FC) $(FFLAGS) $(CPPFLAGS) $(LDFLAGS) $(TARGET_ARCH)",
  325.     "COMPILE.r", "$(FC) $(FFLAGS) $(RFLAGS) $(TARGET_ARCH) -c",
  326.     "LINK.r", "$(FC) $(FFLAGS) $(RFLAGS) $(LDFLAGS) $(TARGET_ARCH)",
  327.     "COMPILE.def", "$(M2C) $(M2FLAGS) $(DEFFLAGS) $(TARGET_ARCH)",
  328.     "COMPILE.mod", "$(M2C) $(M2FLAGS) $(MODFLAGS) $(TARGET_ARCH)",
  329.     "COMPILE.p", "$(PC) $(PFLAGS) $(CPPFLAGS) $(TARGET_ARCH) -c",
  330.     "LINK.p", "$(PC) $(PFLAGS) $(CPPFLAGS) $(LDFLAGS) $(TARGET_ARCH)",
  331.     "LINK.s", "$(CC) $(ASFLAGS) $(LDFLAGS) $(TARGET_MACH)",
  332.     "COMPILE.s", "$(AS) $(ASFLAGS) $(TARGET_MACH)",
  333.     "LINK.S", "$(CC) $(ASFLAGS) $(CPPFLAGS) $(LDFLAGS) $(TARGET_MACH)",
  334.     "COMPILE.S", "$(CC) $(ASFLAGS) $(CPPFLAGS) $(TARGET_MACH) -c",
  335. #if !defined(M_XENIX) || defined(__GNUC__)
  336.     "PREPROCESS.S", "$(CC) -E $(CPPFLAGS)",
  337. #else    /* Xenix.  */
  338.     "PREPROCESS.S", "$(CC) -EP $(CPPFLAGS)",
  339. #endif    /* Not Xenix.  */
  340.     "PREPROCESS.F", "$(FC) $(FFLAGS) $(CPPFLAGS) $(TARGET_ARCH) -F",
  341.     "PREPROCESS.r", "$(FC) $(FFLAGS) $(RFLAGS) $(TARGET_ARCH) -F",
  342.     "LINT.c", "$(LINT) $(LINTFLAGS) $(CPPFLAGS) $(TARGET_ARCH)",
  343.  
  344. #ifndef    NO_MINUS_C_MINUS_O
  345. #if !defined(M_XENIX) || defined(__GNUC__)
  346.     "OUTPUT_OPTION", "-o $@",
  347. #else    /* Xenix.  */
  348.     "OUTPUT_OPTION", "-Fo$@",
  349. #endif    /* Not Xenix.  */
  350. #endif
  351.  
  352.     0, 0
  353.   };
  354.  
  355. /* Set up the default .SUFFIXES list.  */
  356.  
  357. void
  358. set_default_suffixes ()
  359. {
  360.   suffix_file = enter_file (".SUFFIXES");
  361.  
  362.   if (no_builtin_rules_flag)
  363.     (void) define_variable ("SUFFIXES", 8, "", o_default, 0);
  364.   else
  365.     {
  366.       char *p = default_suffixes;
  367.       suffix_file->deps = (struct dep *)
  368.     multi_glob (parse_file_seq (&p, '\0', sizeof (struct dep)),
  369.             sizeof (struct dep));
  370.       (void) define_variable ("SUFFIXES", 8, default_suffixes, o_default, 0);
  371.     }
  372. }
  373.  
  374. /* Install the default pattern rules and enter
  375.    the default suffix rules as file rules.  */
  376.  
  377. void
  378. install_default_implicit_rules ()
  379. {
  380.   register struct pspec *p;
  381.   register char **s;
  382.   
  383.   if (no_builtin_rules_flag)
  384.     return;
  385.  
  386.   for (p = default_pattern_rules; p->target != 0; ++p)
  387.     install_pattern_rule (p, 0);
  388.  
  389.   for (p = default_terminal_rules; p->target != 0; ++p)
  390.     install_pattern_rule (p, 1);
  391.  
  392.   for (s = default_suffix_rules; *s != 0; s += 2)
  393.     {
  394.       register struct file *f = enter_file (s[0]);
  395.       /* Don't clobber cmds given in a makefile if there were any.  */
  396.       if (f->cmds == 0)
  397.     {
  398.       f->cmds = (struct commands *) xmalloc (sizeof (struct commands));
  399.       f->cmds->filename = 0;
  400.       f->cmds->commands = s[1];
  401.       f->cmds->command_lines = 0;
  402.     }
  403.     }
  404. }
  405.  
  406. void
  407. define_default_variables ()
  408. {
  409.   register char **s;
  410.  
  411.   for (s = default_variables; *s != 0; s += 2)
  412.     (void) define_variable (s[0], strlen (s[0]), s[1], o_default, 1);
  413. }
  414.  
  415.