summaryrefslogtreecommitdiff
path: root/default.c
diff options
context:
space:
mode:
authorKévin THIERRY <kevin.thierry@open.eurogiciel.org>2014-11-05 08:27:15 +0100
committerKévin THIERRY <kevin.thierry@open.eurogiciel.org>2014-11-05 08:27:15 +0100
commite15597c3e85dedc015ff923a88febd46a1551f71 (patch)
tree467fdb092d1fa76bcb63d4db653e8176dae24e62 /default.c
parent9789b4dba120180760ec948089fc98ebab6eb28b (diff)
downloadmake-e15597c3e85dedc015ff923a88febd46a1551f71.tar.gz
make-e15597c3e85dedc015ff923a88febd46a1551f71.tar.bz2
make-e15597c3e85dedc015ff923a88febd46a1551f71.zip
Imported Upstream version 4.0upstream/4.0sandbox/kevinthierry/upstream
Diffstat (limited to 'default.c')
-rw-r--r--default.c112
1 files changed, 64 insertions, 48 deletions
diff --git a/default.c b/default.c
index 4d6d984..47b7dd3 100644
--- a/default.c
+++ b/default.c
@@ -1,7 +1,5 @@
/* Data base of default implicit rules for GNU Make.
-Copyright (C) 1988, 1989, 1990, 1991, 1992, 1993, 1994, 1995, 1996, 1997,
-1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009,
-2010 Free Software Foundation, Inc.
+Copyright (C) 1988-2013 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
@@ -16,7 +14,10 @@ A PARTICULAR PURPOSE. See the GNU General Public License for more details.
You should have received a copy of the GNU General Public License along with
this program. If not, see <http://www.gnu.org/licenses/>. */
-#include "make.h"
+#include "makeint.h"
+
+#include <assert.h>
+
#include "filedef.h"
#include "variable.h"
#include "rule.h"
@@ -32,8 +33,8 @@ this program. If not, see <http://www.gnu.org/licenses/>. */
/* 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. */
+ '.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
@@ -53,23 +54,23 @@ static char default_suffixes[]
static struct pspec default_pattern_rules[] =
{
{ "(%)", "%",
- "$(AR) $(ARFLAGS) $@ $<" },
+ "$(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. */
+ BSD Make has no null-suffix rules, so 'foo.out' and
+ 'foo' are the same thing. */
#ifdef VMS
{ "%.exe", "%",
"copy $< $@" },
#else
{ "%.out", "%",
- "@rm -f $@ \n cp $< $@" },
+ "@rm -f $@ \n cp $< $@" },
#endif
/* Syntax is "ctangle foo.w foo.ch foo.c". */
{ "%.c", "%.w %.ch",
- "$(CTANGLE) $^ $@" },
+ "$(CTANGLE) $^ $@" },
{ "%.tex", "%.w %.ch",
- "$(CWEAVE) $^ $@" },
+ "$(CWEAVE) $^ $@" },
{ 0, 0, 0 }
};
@@ -88,21 +89,21 @@ static struct pspec default_terminal_rules[] =
"if f$$search($@) .nes. \"\" then +$(CHECKOUT,v)" },
/* SCCS. */
- /* ain't no SCCS on vms */
+ /* ain't no SCCS on vms */
#else
/* RCS. */
{ "%", "%,v",
- "$(CHECKOUT,v)" },
+ "$(CHECKOUT,v)" },
{ "%", "RCS/%,v",
- "$(CHECKOUT,v)" },
+ "$(CHECKOUT,v)" },
{ "%", "RCS/%",
- "$(CHECKOUT,v)" },
+ "$(CHECKOUT,v)" },
/* SCCS. */
{ "%", "s.%",
- "$(GET) $(GFLAGS) $(SCCS_OUTPUT_OPTION) $<" },
+ "$(GET) $(GFLAGS) $(SCCS_OUTPUT_OPTION) $<" },
{ "%", "SCCS/s.%",
- "$(GET) $(GFLAGS) $(SCCS_OUTPUT_OPTION) $<" },
+ "$(GET) $(GFLAGS) $(SCCS_OUTPUT_OPTION) $<" },
#endif /* !VMS */
{ 0, 0, 0 }
};
@@ -293,13 +294,13 @@ static char *default_suffix_rules[] =
"$(TEXI2DVI) $(TEXI2DVI_FLAGS) $<",
".w.c",
- "$(CTANGLE) $< - $@", /* The `-' says there is no `.ch' file. */
+ "$(CTANGLE) $< - $@", /* The '-' says there is no '.ch' file. */
".web.p",
"$(TANGLE) $<",
".w.tex",
- "$(CWEAVE) $< - $@", /* The `-' says there is no `.ch' file. */
+ "$(CWEAVE) $< - $@", /* The '-' says there is no '.ch' file. */
".web.tex",
"$(WEAVE) $<",
@@ -401,7 +402,7 @@ static const char *default_variables[] =
#ifdef GCC_IS_NATIVE
"CC", "gcc",
# ifdef __MSDOS__
- "CXX", "gpp", /* g++ is an invalid name on MSDOS */
+ "CXX", "gpp", /* g++ is an invalid name on MSDOS */
# else
"CXX", "gcc",
# endif /* __MSDOS__ */
@@ -419,17 +420,17 @@ static const char *default_variables[] =
"COFLAGS", "",
"CPP", "$(CC) -E",
-#ifdef CRAY
+#ifdef CRAY
"CF77PPFLAGS", "-P",
"CF77PP", "/lib/cpp",
"CFT", "cft77",
"CF", "cf77",
"FC", "$(CF)",
-#else /* Not CRAY. */
-#ifdef _IBMR2
+#else /* Not CRAY. */
+#ifdef _IBMR2
"FC", "xlf",
#else
-#ifdef __convex__
+#ifdef __convex__
"FC", "fc",
#else
"FC", "f77",
@@ -439,7 +440,7 @@ static const char *default_variables[] =
However, there is no way to make implicit rules use them and FC. */
"F77", "$(FC)",
"F77FLAGS", "$(FFLAGS)",
-#endif /* Cray. */
+#endif /* Cray. */
"GET", SCCS_GET,
"LD", "ld",
#ifdef GCC_IS_NATIVE
@@ -449,20 +450,20 @@ static const char *default_variables[] =
#endif
"LINT", "lint",
"M2C", "m2c",
-#ifdef pyr
+#ifdef pyr
"PC", "pascal",
#else
-#ifdef CRAY
+#ifdef CRAY
"PC", "PASCAL",
"SEGLDR", "segldr",
#else
"PC", "pc",
-#endif /* CRAY. */
-#endif /* pyr. */
+#endif /* CRAY. */
+#endif /* pyr. */
#ifdef GCC_IS_NATIVE
"YACC", "bison -y",
#else
- "YACC", "yacc", /* Or "bison -y" */
+ "YACC", "yacc", /* Or "bison -y" */
#endif
"MAKEINFO", "makeinfo",
"TEX", "tex",
@@ -508,25 +509,27 @@ static const char *default_variables[] =
"PREPROCESS.r", "$(FC) $(FFLAGS) $(RFLAGS) $(TARGET_ARCH) -F",
"LINT.c", "$(LINT) $(LINTFLAGS) $(CPPFLAGS) $(TARGET_ARCH)",
-#ifndef NO_MINUS_C_MINUS_O
+#ifndef NO_MINUS_C_MINUS_O
"OUTPUT_OPTION", "-o $@",
#endif
-#ifdef SCCS_GET_MINUS_G
+#ifdef SCCS_GET_MINUS_G
"SCCS_OUTPUT_OPTION", "-G$@",
#endif
-#ifdef _AMIGA
+#if defined(_AMIGA)
".LIBPATTERNS", "%.lib",
-#else
-#ifdef __MSDOS__
+#elif defined(__MSDOS__)
".LIBPATTERNS", "lib%.a $(DJDIR)/lib/lib%.a",
+#elif defined(__APPLE__)
+ ".LIBPATTERNS", "lib%.dylib lib%.a",
#else
".LIBPATTERNS", "lib%.so lib%.a",
#endif
-#endif
#endif /* !VMS */
+ /* Make this assignment to avoid undefined variable warnings. */
+ "GNUMAKEFLAGS", "",
0, 0
};
@@ -536,15 +539,19 @@ void
set_default_suffixes (void)
{
suffix_file = enter_file (strcache_add (".SUFFIXES"));
+ suffix_file->builtin = 1;
if (no_builtin_rules_flag)
define_variable_cname ("SUFFIXES", "", o_default, 0);
else
{
+ struct dep *d;
char *p = default_suffixes;
- suffix_file->deps = enter_prereqs(PARSE_FILE_SEQ (&p, struct dep, '\0',
- NULL, 0),
- NULL);
+ suffix_file->deps = enter_prereqs (PARSE_SIMPLE_SEQ (&p, struct dep),
+ NULL);
+ for (d = suffix_file->deps; d; d = d->next)
+ d->file->builtin = 1;
+
define_variable_cname ("SUFFIXES", default_suffixes, o_default, 0);
}
}
@@ -565,14 +572,14 @@ install_default_suffix_rules (void)
for (s = default_suffix_rules; *s != 0; s += 2)
{
struct file *f = enter_file (strcache_add (s[0]));
- /* Don't clobber cmds given in a makefile if there were any. */
- if (f->cmds == 0)
- {
- f->cmds = xmalloc (sizeof (struct commands));
- f->cmds->fileinfo.filenm = 0;
- f->cmds->commands = s[1];
- f->cmds->command_lines = 0;
- }
+ /* This function should run before any makefile is parsed. */
+ assert (f->cmds == 0);
+ f->cmds = xmalloc (sizeof (struct commands));
+ f->cmds->fileinfo.filenm = 0;
+ f->cmds->commands = s[1];
+ f->cmds->command_lines = 0;
+ f->cmds->recipe_prefix = RECIPEPREFIX_DEFAULT;
+ f->builtin = 1;
}
}
@@ -605,3 +612,12 @@ define_default_variables (void)
for (s = default_variables; *s != 0; s += 2)
define_variable (s[0], strlen (s[0]), s[1], o_default, 1);
}
+
+void
+undefine_default_variables (void)
+{
+ const char **s;
+
+ for (s = default_variables; *s != 0; s += 2)
+ undefine_variable_global (s[0], strlen (s[0]), o_default);
+}