Logo Search packages:      
Sourcecode: make version File versions  Download package


/* Data base of default implicit rules for GNU Make.
Copyright (C) 1988,1989,1990,1991,1992,1993,1994,1995,
1996,2003,2004 Free Software Foundation, Inc.
This file is part of GNU Make.

GNU Make is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2, or (at your option)
any later version.

GNU Make is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
GNU General Public License for more details.

You should have received a copy of the GNU General Public License
along with GNU Make; see the file COPYING.  If not, write to
the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
Boston, MA 02111-1307, USA.  */

#include "make.h"
#include "filedef.h"
#include "variable.h"
#include "rule.h"
#include "dep.h"
#include "job.h"
#include "commands.h"

/* Define GCC_IS_NATIVE if gcc is the native development environment on
   your system (gcc/bison/flex vs cc/yacc/lex).  */
#if defined(__MSDOS__) || defined(__EMX__)
# define GCC_IS_NATIVE

/* This is the default list of suffixes for suffix rules.
   `.s' must come last, so that a `.o' file will be made from
   a `.c' or `.p' or ... file rather than from a .s file.  */

static char default_suffixes[]
#ifdef VMS
  = ".exe .olb .ln .obj .c .cxx .cc .pas .p .for .f .r .y .l .mar \
.s .ss .i .ii .mod .sym .def .h .info .dvi .tex .texinfo .texi .txinfo \
.w .ch .cweb .web .com .sh .elc .el";
#elif defined(__EMX__)
  = ".out .a .ln .o .c .cc .C .cpp .p .f .F .r .y .l .s .S \
.mod .sym .def .h .info .dvi .tex .texinfo .texi .txinfo \
.w .ch .web .sh .elc .el .obj .exe .dll .lib";
  = ".out .a .ln .o .c .cc .C .cpp .p .f .F .r .y .l .s .S \
.mod .sym .def .h .info .dvi .tex .texinfo .texi .txinfo \
.w .ch .web .sh .elc .el";

static struct pspec default_pattern_rules[] =
    { "(%)", "%",
      "$(AR) $(ARFLAGS) $@ $<" },

    /* The X.out rules are only in BSD's default set because
       BSD Make has no null-suffix rules, so `foo.out' and
       `foo' are the same thing.  */
#ifdef VMS
    { "%.exe", "%",
        "copy $< $@" },
    { "%.out", "%",
      "@rm -f $@ \n cp $< $@" },
    /* Syntax is "ctangle foo.w foo.ch foo.c".  */
    { "%.c", "%.w %.ch",
      "$(CTANGLE) $^ $@" },
    { "%.tex", "%.w %.ch",
      "$(CWEAVE) $^ $@" },

    { 0, 0, 0 }

static struct pspec default_terminal_rules[] =
#ifdef VMS
    /* RCS.  */
    { "%", "%$$5lv", /* Multinet style */
        "if f$$search($@) .nes. \"\" then +$(CHECKOUT,v)" },
    { "%", "[.$$rcs]%$$5lv", /* Multinet style */
        "if f$$search($@) .nes. \"\" then +$(CHECKOUT,v)" },
    { "%", "%_v", /* Normal style */
        "if f$$search($@) .nes. \"\" then +$(CHECKOUT,v)" },
    { "%", "[.rcs]%_v", /* Normal style */
        "if f$$search($@) .nes. \"\" then +$(CHECKOUT,v)" },

    /* SCCS.  */
      /* ain't no SCCS on vms */
    /* RCS.  */
    { "%", "%,v",
      "$(CHECKOUT,v)" },
    { "%", "RCS/%,v",
      "$(CHECKOUT,v)" },
    { "%", "RCS/%",
      "$(CHECKOUT,v)" },

    /* SCCS.  */
    { "%", "s.%",
      "$(GET) $(GFLAGS) $(SCCS_OUTPUT_OPTION) $<" },
    { "%", "SCCS/s.%",
      "$(GET) $(GFLAGS) $(SCCS_OUTPUT_OPTION) $<" },
#endif /* !VMS */
    { 0, 0, 0 }

static char *default_suffix_rules[] =
#ifdef VMS
    "$(LINK.obj) $^ $(LOADLIBES) $(LDLIBS) $(CRT0) /exe=$@",
    "$(COMPILE.mar) $^ \n $(LINK.obj) $(subst .mar,.obj,$^) $(LOADLIBES) $(LDLIBS) $(CRT0) /exe=$@",
    "$(COMPILE.s) $^ \n $(LINK.obj) $(subst .s,.obj,$^) $(LOADLIBES) $(LDLIBS) $(CRT0) /exe=$@",
    "$(COMPILE.c) $^ \n $(LINK.obj) $(subst .c,.obj,$^) $(LOADLIBES) $(LDLIBS) $(CRT0) /exe=$@",
    "$(COMPILE.cc) $^ \n $(LINK.obj) $(CXXSTARTUP),sys$$disk:[]$(subst .cc,.obj,$^) $(LOADLIBES) $(LXLIBS) $(LDLIBS) $(CXXRT0) /exe=$@",
    "$(COMPILE.cc) $^ \n $(CXXLINK.obj) $(subst .cc,.obj,$^) $(LOADLIBES) $(LXLIBS) $(LDLIBS) $(CXXRT0) /exe=$@",
    "$(COMPILE.cxx) $^ \n $(CXXLINK.obj) $(subst .cxx,.obj,$^) $(LOADLIBES) $(LXLIBS) $(LDLIBS) $(CXXRT0) /exe=$@",
    "$(COMPILE.for) $^ \n $(LINK.obj) $(subst .for,.obj,$^) $(LOADLIBES) $(LDLIBS) /exe=$@",
    "$(COMPILE.pas) $^ \n $(LINK.obj) $(subst .pas,.obj,$^) $(LOADLIBES) $(LDLIBS) /exe=$@",

    "copy $< >$@",

    "$(COMPILE.mar) /obj=$@ $<",
    "$(COMPILE.s) /obj=$@ $<",
    "$(COMPILE.s) /obj=$@ $<",
    "$(COMPILE.c)/prep /list=$@ $<",
    "$(COMPILE.c)/noobj/machine /list=$@ $<",
    "$(COMPILE.c)/noprep/noobj/machine /list=$@ $<",
    "$(COMPILE.c) /obj=$@ $<",
    "$(COMPILE.cc)/prep /list=$@ $<",
    "$(COMPILE.cc)/noobj/machine /list=$@ $<",
    "$(COMPILE.cc)/noprep/noobj/machine /list=$@ $<",
    "$(COMPILE.cc) /obj=$@ $<",
    "$(COMPILE.cxx) /obj=$@ $<",
    "$(COMPILE.for) /obj=$@ $<",
    "$(COMPILE.pas) /obj=$@ $<",

    "$(YACC.y) $< \n rename y_tab.c $@",
    "$(LEX.l) $< \n rename lexyy.c $@",

    "$(MAKEINFO) $<",

    "$(TEX) $<",

#else /* ! VMS */

    "$(LINK.o) $^ $(LOADLIBES) $(LDLIBS) -o $@",
    "$(LINK.s) $^ $(LOADLIBES) $(LDLIBS) -o $@",
    "$(LINK.S) $^ $(LOADLIBES) $(LDLIBS) -o $@",
    "$(LINK.c) $^ $(LOADLIBES) $(LDLIBS) -o $@",
    "$(LINK.cc) $^ $(LOADLIBES) $(LDLIBS) -o $@",
    "$(LINK.C) $^ $(LOADLIBES) $(LDLIBS) -o $@",
    "$(LINK.cpp) $^ $(LOADLIBES) $(LDLIBS) -o $@",
    "$(LINK.f) $^ $(LOADLIBES) $(LDLIBS) -o $@",
    "$(LINK.p) $^ $(LOADLIBES) $(LDLIBS) -o $@",
    "$(LINK.F) $^ $(LOADLIBES) $(LDLIBS) -o $@",
    "$(LINK.r) $^ $(LOADLIBES) $(LDLIBS) -o $@",
    "$(COMPILE.mod) -o $@ -e $@ $^",

    "$(COMPILE.def) -o $@ $<",

    "cat $< >$@ \n chmod a+x $@",

    "$(COMPILE.s) -o $@ $<",
    "$(COMPILE.S) -o $@ $<",
    "$(COMPILE.c) $(OUTPUT_OPTION) $<",
    "$(COMPILE.cc) $(OUTPUT_OPTION) $<",
    "$(COMPILE.cpp) $(OUTPUT_OPTION) $<",
    "$(COMPILE.f) $(OUTPUT_OPTION) $<",
    "$(COMPILE.p) $(OUTPUT_OPTION) $<",
    "$(COMPILE.r) $(OUTPUT_OPTION) $<",
    "$(COMPILE.mod) -o $@ $<",

    "$(LINT.c) -C$* $<",
#ifndef __MSDOS__
    "$(YACC.y) $< \n $(LINT.c) -C$* y.tab.c \n $(RM) y.tab.c",
    "$(YACC.y) $< \n $(LINT.c) -C$* y_tab.c \n $(RM) y_tab.c",
    "@$(RM) $*.c\n $(LEX.l) $< > $*.c\n$(LINT.c) -i $*.c -o $@\n $(RM) $*.c",

#ifndef __MSDOS__
    "$(YACC.y) $< \n mv -f y.tab.c $@",
    "$(YACC.y) $< \n mv -f y_tab.c $@",
    "@$(RM) $@ \n $(LEX.l) $< > $@",


    /* This might actually make lex.yy.c if there's no %R%
       directive in $*.l, but in that case why were you
       trying to make $*.r anyway?  */
    "$(LEX.l) $< > $@ \n mv -f lex.yy.r $@",

    "$(PREPROCESS.S) $< > $@",

    "$(MAKEINFO) $(MAKEINFO_FLAGS) $< -o $@",

    "$(MAKEINFO) $(MAKEINFO_FLAGS) $< -o $@",

    "$(MAKEINFO) $(MAKEINFO_FLAGS) $< -o $@",

    "$(TEX) $<",

    "$(TEXI2DVI) $(TEXI2DVI_FLAGS) $<",

    "$(TEXI2DVI) $(TEXI2DVI_FLAGS) $<",

    "$(TEXI2DVI) $(TEXI2DVI_FLAGS) $<",

    "$(CTANGLE) $< - $@",     /* The `-' says there is no `.ch' file.  */

    "$(TANGLE) $<",

    "$(CWEAVE) $< - $@",      /* The `-' says there is no `.ch' file.  */

    "$(WEAVE) $<",

#endif /* !VMS */

    0, 0,

static char *default_variables[] =
#ifdef VMS
#ifdef __ALPHA
    "ARCH", "ALPHA",
#ifdef __ia64
    "ARCH", "IA64",
#ifdef __VAX
    "ARCH", "VAX",
    "AR", "library/obj",
    "ARFLAGS", "/replace",
    "AS", "macro",
    "MACRO", "macro",
    "CC", "gcc",
    "CC", "cc",
    "CD", "builtin_cd",
    "MAKE", "make",
    "ECHO", "write sys$$output \"",
    "C++", "gcc/plus",
    "CXX", "gcc/plus",
    "C++", "cxx",
    "CXX", "cxx",
    "CXXLD", "cxxlink",
    "CO", "co",
    "CPP", "$(CC) /preprocess_only",
    "FC", "fortran",
    /* System V uses these, so explicit rules using them should work.
       However, there is no way to make implicit rules use them and FC.  */
    "F77", "$(FC)",
    "F77FLAGS", "$(FFLAGS)",
    "LD", "link",
    "LEX", "lex",
    "PC", "pascal",
    "YACC", "bison/yacc",
    "YFLAGS", "/Define/Verbose",
    "BISON", "bison",
    "MAKEINFO", "makeinfo",
    "TEX", "tex",
    "TEXINDEX", "texindex",

    "RM", "delete/nolog",

    "CSTARTUP", "",
    "CRT0", ",sys$$library:vaxcrtl.olb/lib,gnu_cc_library:crt0.obj",
    "CXXSTARTUP", "gnu_cc_library:crtbegin.obj",
    "CXXRT0", ",sys$$library:vaxcrtl.olb/lib,gnu_cc_library:crtend.obj,gnu_cc_library:gxx_main.obj",
    "LXLIBS", ",gnu_cc_library:libstdcxx.olb/lib,gnu_cc_library:libgccplus.olb/lib",
    "LDLIBS", ",gnu_cc_library:libgcc.olb/lib",
    "CRT0", "",
    "CXXSTARTUP", "",
    "CXXRT0", "",
    "LXLIBS", "",
    "LDLIBS", "",

    "LINK.obj", "$(LD) $(LDFLAGS)",
    "CXXLINK.obj", "$(CXXLD) $(LDFLAGS)",
    "YACC.y", "$(YACC) $(YFLAGS)",
    "LEX.l", "$(LEX) $(LFLAGS)",
    "COMPILE.for", "$(FC) $(FFLAGS) $(TARGET_ARCH)",
    "COMPILE.mar", "$(MACRO) $(MACROFLAGS)",

    "MV", "rename/new_version",
    "CP", "copy",

#else /* !VMS */

    "AR", "ar",
    "ARFLAGS", "rv",
    "AS", "as",
    "CC", "gcc",
# ifdef __MSDOS__
    "CXX", "gpp", /* g++ is an invalid name on MSDOS */
# else
    "CXX", "gcc",
# endif /* __MSDOS__ */
    "CC", "cc",
    "CXX", "g++",

    /* This expands to $(CO) $(COFLAGS) $< $@ if $@ does not exist,
       and to the empty string if $@ does exist.  */
    "CHECKOUT,v", "+$(if $(wildcard $@),,$(CO) $(COFLAGS) $< $@)",
    "CO", "co",
    "COFLAGS", "",

    "CPP", "$(CC) -E",
#ifdef      CRAY
    "CF77PPFLAGS", "-P",
    "CF77PP", "/lib/cpp",
    "CFT", "cft77",
    "CF", "cf77",
    "FC", "$(CF)",
#else /* Not CRAY.  */
#ifdef      _IBMR2
    "FC", "xlf",
#ifdef      __convex__
    "FC", "fc",
    "FC", "f77",
#endif /* __convex__ */
#endif /* _IBMR2 */
    /* System V uses these, so explicit rules using them should work.
       However, there is no way to make implicit rules use them and FC.  */
    "F77", "$(FC)",
    "F77FLAGS", "$(FFLAGS)",
#endif      /* Cray.  */
    "GET", SCCS_GET,
    "LD", "ld",
    "LEX", "flex",
    "LEX", "lex",
    "LINT", "lint",
    "M2C", "m2c",
#ifdef      pyr
    "PC", "pascal",
#ifdef      CRAY
    "PC", "PASCAL",
    "SEGLDR", "segldr",
    "PC", "pc",
#endif      /* CRAY.  */
#endif      /* pyr.  */
    "YACC", "bison -y",
    "YACC", "yacc",     /* Or "bison -y"  */
    "MAKEINFO", "makeinfo",
    "TEX", "tex",
    "TEXI2DVI", "texi2dvi",
    "WEAVE", "weave",
    "CWEAVE", "cweave",
    "TANGLE", "tangle",
    "CTANGLE", "ctangle",

    "RM", "rm -f",

    "LINK.o", "$(CC) $(LDFLAGS) $(TARGET_ARCH)",
    "COMPILE.C", "$(COMPILE.cc)",
    "COMPILE.cpp", "$(COMPILE.cc)",
    "LINK.C", "$(LINK.cc)",
    "LINK.cpp", "$(LINK.cc)",
    "YACC.y", "$(YACC) $(YFLAGS)",
    "LEX.l", "$(LEX) $(LFLAGS) -t",
    "COMPILE.f", "$(FC) $(FFLAGS) $(TARGET_ARCH) -c",
    "LINK.f", "$(FC) $(FFLAGS) $(LDFLAGS) $(TARGET_ARCH)",
    "COMPILE.r", "$(FC) $(FFLAGS) $(RFLAGS) $(TARGET_ARCH) -c",
    "COMPILE.def", "$(M2C) $(M2FLAGS) $(DEFFLAGS) $(TARGET_ARCH)",
    "COMPILE.mod", "$(M2C) $(M2FLAGS) $(MODFLAGS) $(TARGET_ARCH)",

#ifndef     NO_MINUS_C_MINUS_O
    "OUTPUT_OPTION", "-o $@",

#ifdef      SCCS_GET_MINUS_G

#ifdef _AMIGA
    ".LIBPATTERNS", "%.lib",
#ifdef __MSDOS__
    ".LIBPATTERNS", "lib%.a $(DJDIR)/lib/lib%.a",
    ".LIBPATTERNS", "lib%.so lib%.a",

#endif /* !VMS */
    0, 0
/* Set up the default .SUFFIXES list.  */

set_default_suffixes (void)
  suffix_file = enter_file (".SUFFIXES");

  if (no_builtin_rules_flag)
    (void) define_variable ("SUFFIXES", 8, "", o_default, 0);
      char *p = default_suffixes;
      suffix_file->deps = (struct dep *)
      multi_glob (parse_file_seq (&p, '\0', sizeof (struct dep), 1),
                sizeof (struct dep));
      (void) define_variable ("SUFFIXES", 8, default_suffixes, o_default, 0);

/* Enter the default suffix rules as file rules.  This used to be done in
   install_default_implicit_rules, but that loses because we want the
   suffix rules installed before reading makefiles, and thee pattern rules
   installed after.  */

install_default_suffix_rules (void)
  register char **s;

  if (no_builtin_rules_flag)

 for (s = default_suffix_rules; *s != 0; s += 2)
      register struct file *f = enter_file (s[0]);
      /* Don't clobber cmds given in a makefile if there were any.  */
      if (f->cmds == 0)
        f->cmds = (struct commands *) xmalloc (sizeof (struct commands));
        f->cmds->fileinfo.filenm = 0;
        f->cmds->commands = s[1];
        f->cmds->command_lines = 0;

/* Install the default pattern rules.  */

install_default_implicit_rules (void)
  register struct pspec *p;

  if (no_builtin_rules_flag)

  for (p = default_pattern_rules; p->target != 0; ++p)
    install_pattern_rule (p, 0);

  for (p = default_terminal_rules; p->target != 0; ++p)
    install_pattern_rule (p, 1);

define_default_variables (void)
  register char **s;

  if (no_builtin_variables_flag)

  for (s = default_variables; *s != 0; s += 2)
    (void) define_variable (s[0], strlen (s[0]), s[1], o_default, 1);

Generated by  Doxygen 1.6.0   Back to index