Changeset 3138 for vendor/gnumake/current/default.c
- Timestamp:
- Mar 12, 2018, 8:32:29 PM (7 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
vendor/gnumake/current/default.c
r2596 r3138 1 1 /* Data base of default implicit rules for GNU Make. 2 Copyright (C) 1988, 1989, 1990, 1991, 1992, 1993, 1994, 1995, 1996, 1997, 3 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 4 2010 Free Software Foundation, Inc. 2 Copyright (C) 1988-2016 Free Software Foundation, Inc. 5 3 This file is part of GNU Make. 6 4 … … 17 15 this program. If not, see <http://www.gnu.org/licenses/>. */ 18 16 19 #include "make.h" 17 #include "makeint.h" 18 19 #include <assert.h> 20 20 21 #include "filedef.h" 21 22 #include "variable.h" … … 33 34 34 35 /* This is the default list of suffixes for suffix rules. 35 `.s' must come last, so that a `.o' file will be made from36 a `.c' or `.p' or ... file rather than from a .s file. */36 '.s' must come last, so that a '.o' file will be made from 37 a '.c' or '.p' or ... file rather than from a .s file. */ 37 38 38 39 static char default_suffixes[] 39 40 #ifdef VMS 40 = ".exe .olb .ln .obj .c .cxx .cc .pas .p .for .f .r .y .l .mar \ 41 .s .ss .i .ii .mod .sym .def .h .info .dvi .tex .texinfo .texi .txinfo \ 42 .w .ch .cweb .web .com .sh .elc .el"; 41 /* VMS should include all UNIX/POSIX + some VMS extensions */ 42 = ".out .exe .a .olb .hlb .tlb .mlb .ln .o .obj .c .cxx .cc .cpp .pas .p \ 43 .for .f .r .y .l .ym .yl .mar .s .ss .i .ii .mod .sym .def .h .info .dvi \ 44 .tex .texinfo .texi .txinfo .mem .hlp .brn .rnh .rno .rnt .rnx .w .ch .cweb \ 45 .web .com .sh .elc .el"; 43 46 #elif defined(__EMX__) 44 47 = ".out .a .ln .o .c .cc .C .cpp .p .f .F .m .r .y .l .ym .yl .s .S \ … … 53 56 static struct pspec default_pattern_rules[] = 54 57 { 58 #ifdef VMS 55 59 { "(%)", "%", 56 "$(AR) $(ARFLAGS) $@ $<" }, 57 60 "@if f$$search(\"$@\") .eqs. \"\" then $(LIBRARY)/CREATE/" 61 "$(or " 62 "$(patsubst %,TEXT,$(filter %.tlb %.TLB,$@))," 63 "$(patsubst %,HELP,$(filter %.hlb %.HLB,$@))," 64 "$(patsubst %,MACRO,$(filter %.mlb %.MLB,$@))," 65 "$(and " 66 "$(patsubst %,SHARE,$(filter %.olb %.OLB,$@))," 67 "$(patsubst %,SHARE,$(filter %.exe %.EXE,$<)))," 68 "OBJECT)" 69 " $@\n" 70 "$(AR) $(ARFLAGS) $@ $<" }, 71 72 #else 73 { "(%)", "%", 74 "$(AR) $(ARFLAGS) $@ $<" }, 75 #endif 58 76 /* The X.out rules are only in BSD's default set because 59 BSD Make has no null-suffix rules, so `foo.out' and60 `foo' are the same thing. */77 BSD Make has no null-suffix rules, so 'foo.out' and 78 'foo' are the same thing. */ 61 79 #ifdef VMS 62 80 { "%.exe", "%", 63 "copy $< $@" }, 64 #else 81 "$(CP) $< $@" }, 82 83 #endif 65 84 { "%.out", "%", 66 67 #endif 85 "@rm -f $@ \n cp $< $@" }, 86 68 87 /* Syntax is "ctangle foo.w foo.ch foo.c". */ 69 88 { "%.c", "%.w %.ch", 70 89 "$(CTANGLE) $^ $@" }, 71 90 { "%.tex", "%.w %.ch", 72 91 "$(CWEAVE) $^ $@" }, 73 92 74 93 { 0, 0, 0 } … … 78 97 { 79 98 #ifdef VMS 99 80 100 /* RCS. */ 81 101 { "%", "%$$5lv", /* Multinet style */ 82 "if f$$search( $@) .nes. \"\" then +$(CHECKOUT,v)" },102 "if f$$search(\"$@\") .nes. \"\" then +$(CHECKOUT,v)" }, 83 103 { "%", "[.$$rcs]%$$5lv", /* Multinet style */ 84 "if f$$search( $@) .nes. \"\" then +$(CHECKOUT,v)" },104 "if f$$search(\"$@\") .nes. \"\" then +$(CHECKOUT,v)" }, 85 105 { "%", "%_v", /* Normal style */ 86 "if f$$search( $@) .nes. \"\" then +$(CHECKOUT,v)" },106 "if f$$search(\"$@\") .nes. \"\" then +$(CHECKOUT,v)" }, 87 107 { "%", "[.rcs]%_v", /* Normal style */ 88 "if f$$search( $@) .nes. \"\" then +$(CHECKOUT,v)" },108 "if f$$search(\"$@\") .nes. \"\" then +$(CHECKOUT,v)" }, 89 109 90 110 /* SCCS. */ 91 /* ain't no SCCS on vms */ 111 /* ain't no SCCS on vms */ 112 92 113 #else 93 114 /* RCS. */ 94 115 { "%", "%,v", 95 116 "$(CHECKOUT,v)" }, 96 117 { "%", "RCS/%,v", 97 118 "$(CHECKOUT,v)" }, 98 119 { "%", "RCS/%", 99 120 "$(CHECKOUT,v)" }, 100 121 101 122 /* SCCS. */ 102 123 { "%", "s.%", 103 124 "$(GET) $(GFLAGS) $(SCCS_OUTPUT_OPTION) $<" }, 104 125 { "%", "SCCS/s.%", 105 126 "$(GET) $(GFLAGS) $(SCCS_OUTPUT_OPTION) $<" }, 106 127 #endif /* !VMS */ 107 128 { 0, 0, 0 } 108 129 }; 109 130 110 static c har *default_suffix_rules[] =131 static const char *default_suffix_rules[] = 111 132 { 112 133 #ifdef VMS 134 ".o", 135 "$(LINK.obj) $^ $(LOADLIBES) $(LDLIBS) -o $@", 136 ".obj", 137 "$(LINK.obj) $^ $(LOADLIBES) $(LDLIBS) -o $@", 138 ".s", 139 "$(LINK.s) $^ $(LOADLIBES) $(LDLIBS) -o $@", 140 ".S", 141 "$(LINK.S) $^ $(LOADLIBES) $(LDLIBS) -o $@", 142 ".c", 143 "$(LINK.c) $^ $(LOADLIBES) $(LDLIBS) -o $@", 144 ".cc", 145 "$(LINK.cc) $^ $(LOADLIBES) $(LDLIBS) -o $@", 146 ".C", 147 "$(LINK.C) $^ $(LOADLIBES) $(LDLIBS) -o $@", 148 ".cpp", 149 "$(LINK.cpp) $^ $(LOADLIBES) $(LDLIBS) -o $@", 150 ".f", 151 "$(LINK.f) $^ $(LOADLIBES) $(LDLIBS) -o $@", 152 ".m", 153 "$(LINK.m) $^ $(LOADLIBES) $(LDLIBS) -o $@", 154 ".p", 155 "$(LINK.p) $^ $(LOADLIBES) $(LDLIBS) -o $@", 156 ".F", 157 "$(LINK.F) $^ $(LOADLIBES) $(LDLIBS) -o $@", 158 ".r", 159 "$(LINK.r) $^ $(LOADLIBES) $(LDLIBS) -o $@", 160 ".mod", 161 "$(COMPILE.mod) -o $@ -e $@ $^", 162 163 ".def.sym", 164 "$(COMPILE.def) -o $@ $<", 165 166 ".sh", 167 "copy $< >$@", 168 113 169 ".obj.exe", 114 170 "$(LINK.obj) $^ $(LOADLIBES) $(LDLIBS) $(CRT0) /exe=$@", 115 171 ".mar.exe", 116 172 "$(COMPILE.mar) $^ \n $(LINK.obj) $(subst .mar,.obj,$^) $(LOADLIBES) $(LDLIBS) $(CRT0) /exe=$@", 173 ".s.o", 174 "$(COMPILE.s) -o $@ $<", 117 175 ".s.exe", 118 176 "$(COMPILE.s) $^ \n $(LINK.obj) $(subst .s,.obj,$^) $(LOADLIBES) $(LDLIBS) $(CRT0) /exe=$@", … … 149 207 ".c.obj", 150 208 "$(COMPILE.c) /obj=$@ $<", 209 ".c.o", 210 "$(COMPILE.c) /obj=$@ $<", 151 211 ".cc.ii", 152 212 "$(COMPILE.cc)/prep /list=$@ $<", … … 157 217 ".cc.obj", 158 218 "$(COMPILE.cc) /obj=$@ $<", 219 ".cc.o", 220 "$(COMPILE.cc) /obj=$@ $<", 159 221 ".cxx.obj", 222 "$(COMPILE.cxx) /obj=$@ $<", 223 ".cxx.o", 160 224 "$(COMPILE.cxx) /obj=$@ $<", 161 225 ".for.obj", 162 226 "$(COMPILE.for) /obj=$@ $<", 227 ".for.o", 228 "$(COMPILE.for) /obj=$@ $<", 163 229 ".pas.obj", 230 "$(COMPILE.pas) /obj=$@ $<", 231 ".pas.o", 164 232 "$(COMPILE.pas) /obj=$@ $<", 165 233 … … 174 242 ".tex.dvi", 175 243 "$(TEX) $<", 244 245 ".cpp.o", 246 "$(COMPILE.cpp) $(OUTPUT_OPTION) $<", 247 ".f.o", 248 "$(COMPILE.f) $(OUTPUT_OPTION) $<", 249 ".m.o", 250 "$(COMPILE.m) $(OUTPUT_OPTION) $<", 251 ".p.o", 252 "$(COMPILE.p) $(OUTPUT_OPTION) $<", 253 ".r.o", 254 "$(COMPILE.r) $(OUTPUT_OPTION) $<", 255 ".mod.o", 256 "$(COMPILE.mod) -o $@ $<", 257 258 ".c.ln", 259 "$(LINT.c) -C$* $<", 260 ".y.ln", 261 "$(YACC.y) $< \n rename y_tab.c $@", 262 263 ".l.ln", 264 "@$(RM) $*.c\n $(LEX.l) $< > $*.c\n$(LINT.c) -i $*.c -o $@\n $(RM) $*.c", 176 265 177 266 #else /* ! VMS */ … … 294 383 295 384 ".w.c", 296 "$(CTANGLE) $< - $@", /* The `-' says there is no `.ch' file. */385 "$(CTANGLE) $< - $@", /* The '-' says there is no '.ch' file. */ 297 386 298 387 ".web.p", … … 300 389 301 390 ".w.tex", 302 "$(CWEAVE) $< - $@", /* The `-' says there is no `.ch' file. */391 "$(CWEAVE) $< - $@", /* The '-' says there is no '.ch' file. */ 303 392 304 393 ".web.tex", … … 322 411 "ARCH", "VAX", 323 412 #endif 324 "AR", "library/obj", 413 "AR", "library", 414 "LIBRARY", "library", 325 415 "ARFLAGS", "/replace", 326 416 "AS", "macro", … … 332 422 #endif 333 423 "CD", "builtin_cd", 334 "MAKE", "make", 335 "ECHO", "write sys$$output \"", 424 "ECHO", "builtin_echo", 336 425 #ifdef GCC_IS_NATIVE 337 426 "C++", "gcc/plus", … … 340 429 "C++", "cxx", 341 430 "CXX", "cxx", 431 #ifndef __ia64 342 432 "CXXLD", "cxxlink", 433 "CXXLINK", "cxxlink", 434 #else 435 /* CXXLINK is not used on VMS/IA64 */ 436 "CXXLD", "link", 437 "CXXLINK", "link", 438 #endif 343 439 #endif 344 440 "CO", "co", … … 376 472 #endif 377 473 474 "LINK.o", "$(LD) $(LDFLAGS)", 378 475 "LINK.obj", "$(LD) $(LDFLAGS)", 379 476 #ifndef GCC_IS_NATIVE … … 382 479 #endif 383 480 "COMPILE.c", "$(CC) $(CFLAGS) $(CPPFLAGS) $(TARGET_ARCH)", 481 "LINK.c", "$(CC) $(CFLAGS) $(CPPFLAGS) $(TARGET_ARCH)", 482 "COMPILE.m", "$(OBJC) $(OBJCFLAGS) $(CPPFLAGS) $(TARGET_ARCH) -c", 483 "LINK.m", "$(OBJC) $(OBJCFLAGS) $(CPPFLAGS) $(LDFLAGS) $(TARGET_ARCH)", 384 484 "COMPILE.cc", "$(CXX) $(CXXFLAGS) $(CPPFLAGS) $(TARGET_ARCH)", 485 "COMPILE.C", "$(COMPILE.cc)", 486 "COMPILE.cpp", "$(COMPILE.cc)", 487 "LINK.C", "$(LINK.cc)", 488 "LINK.cpp", "$(LINK.cc)", 385 489 "YACC.y", "$(YACC) $(YFLAGS)", 386 490 "LEX.l", "$(LEX) $(LFLAGS)", 491 "YACC.m", "$(YACC) $(YFLAGS)", 492 "LEX.m", "$(LEX) $(LFLAGS) -t", 387 493 "COMPILE.for", "$(FC) $(FFLAGS) $(TARGET_ARCH)", 494 "COMPILE.f", "$(FC) $(FFLAGS) $(TARGET_ARCH) -c", 495 "LINK.f", "$(FC) $(FFLAGS) $(LDFLAGS) $(TARGET_ARCH)", 496 "COMPILE.F", "$(FC) $(FFLAGS) $(CPPFLAGS) $(TARGET_ARCH) -c", 497 "LINK.F", "$(FC) $(FFLAGS) $(CPPFLAGS) $(LDFLAGS) $(TARGET_ARCH)", 498 "COMPILE.r", "$(FC) $(FFLAGS) $(RFLAGS) $(TARGET_ARCH) -c", 499 "LINK.r", "$(FC) $(FFLAGS) $(RFLAGS) $(LDFLAGS) $(TARGET_ARCH)", 388 500 "COMPILE.pas", "$(PC) $(PFLAGS) $(CPPFLAGS) $(TARGET_ARCH)", 501 "COMPILE.def", "$(M2C) $(M2FLAGS) $(DEFFLAGS) $(TARGET_ARCH)", 502 "COMPILE.mod", "$(M2C) $(M2FLAGS) $(MODFLAGS) $(TARGET_ARCH)", 503 "COMPILE.p", "$(PC) $(PFLAGS) $(CPPFLAGS) $(TARGET_ARCH) -c", 504 "LINK.p", "$(PC) $(PFLAGS) $(CPPFLAGS) $(LDFLAGS) $(TARGET_ARCH)", 389 505 "COMPILE.mar", "$(MACRO) $(MACROFLAGS)", 390 506 "COMPILE.s", "$(AS) $(ASFLAGS) $(TARGET_MACH)", 507 "LINK.S", "$(CC) $(ASFLAGS) $(CPPFLAGS) $(LDFLAGS) $(TARGET_MACH)", 508 "COMPILE.S", "$(CC) $(ASFLAGS) $(CPPFLAGS) $(TARGET_MACH) -c", 509 "PREPROCESS.S", "$(CC) -E $(CPPFLAGS)", 510 "PREPROCESS.F", "$(FC) $(FFLAGS) $(CPPFLAGS) $(TARGET_ARCH) -F", 511 "PREPROCESS.r", "$(FC) $(FFLAGS) $(RFLAGS) $(TARGET_ARCH) -F", 391 512 "LINT.c", "$(LINT) $(LINTFLAGS) $(CPPFLAGS) $(TARGET_ARCH)", 392 513 393 514 "MV", "rename/new_version", 394 515 "CP", "copy", 516 ".LIBPATTERNS", "%.olb lib%.a", 395 517 396 518 #else /* !VMS */ … … 402 524 "CC", "gcc", 403 525 # ifdef __MSDOS__ 404 "CXX", "gpp", 526 "CXX", "gpp", /* g++ is an invalid name on MSDOS */ 405 527 # else 406 528 "CXX", "gcc", … … 420 542 421 543 "CPP", "$(CC) -E", 422 #ifdef 544 #ifdef CRAY 423 545 "CF77PPFLAGS", "-P", 424 546 "CF77PP", "/lib/cpp", … … 426 548 "CF", "cf77", 427 549 "FC", "$(CF)", 428 #else 429 #ifdef 550 #else /* Not CRAY. */ 551 #ifdef _IBMR2 430 552 "FC", "xlf", 431 553 #else 432 #ifdef 554 #ifdef __convex__ 433 555 "FC", "fc", 434 556 #else … … 440 562 "F77", "$(FC)", 441 563 "F77FLAGS", "$(FFLAGS)", 442 #endif 564 #endif /* Cray. */ 443 565 "GET", SCCS_GET, 444 566 "LD", "ld", … … 450 572 "LINT", "lint", 451 573 "M2C", "m2c", 452 #ifdef 574 #ifdef pyr 453 575 "PC", "pascal", 454 576 #else 455 #ifdef 577 #ifdef CRAY 456 578 "PC", "PASCAL", 457 579 "SEGLDR", "segldr", 458 580 #else 459 581 "PC", "pc", 460 #endif 461 #endif 582 #endif /* CRAY. */ 583 #endif /* pyr. */ 462 584 #ifdef GCC_IS_NATIVE 463 585 "YACC", "bison -y", 464 586 #else 465 "YACC", "yacc", 587 "YACC", "yacc", /* Or "bison -y" */ 466 588 #endif 467 589 "MAKEINFO", "makeinfo", … … 481 603 "LINK.m", "$(OBJC) $(OBJCFLAGS) $(CPPFLAGS) $(LDFLAGS) $(TARGET_ARCH)", 482 604 "COMPILE.cc", "$(CXX) $(CXXFLAGS) $(CPPFLAGS) $(TARGET_ARCH) -c", 605 #ifndef HAVE_CASE_INSENSITIVE_FS 606 /* On case-insensitive filesystems, treat *.C files as *.c files, 607 to avoid erroneously compiling C sources as C++, which will 608 probably fail. */ 483 609 "COMPILE.C", "$(COMPILE.cc)", 610 #else 611 "COMPILE.C", "$(COMPILE.c)", 612 #endif 484 613 "COMPILE.cpp", "$(COMPILE.cc)", 485 614 "LINK.cc", "$(CXX) $(CXXFLAGS) $(CPPFLAGS) $(LDFLAGS) $(TARGET_ARCH)", 615 #ifndef HAVE_CASE_INSENSITIVE_FS 486 616 "LINK.C", "$(LINK.cc)", 617 #else 618 "LINK.C", "$(LINK.c)", 619 #endif 487 620 "LINK.cpp", "$(LINK.cc)", 488 621 "YACC.y", "$(YACC) $(YFLAGS)", … … 509 642 "LINT.c", "$(LINT) $(LINTFLAGS) $(CPPFLAGS) $(TARGET_ARCH)", 510 643 511 #ifndef 644 #ifndef NO_MINUS_C_MINUS_O 512 645 "OUTPUT_OPTION", "-o $@", 513 646 #endif 514 647 515 #ifdef 648 #ifdef SCCS_GET_MINUS_G 516 649 "SCCS_OUTPUT_OPTION", "-G$@", 517 650 #endif 518 651 519 #if def _AMIGA652 #if defined(_AMIGA) 520 653 ".LIBPATTERNS", "%.lib", 521 #else 522 #ifdef __MSDOS__ 654 #elif defined(__MSDOS__) 523 655 ".LIBPATTERNS", "lib%.a $(DJDIR)/lib/lib%.a", 656 #elif defined(__APPLE__) 657 ".LIBPATTERNS", "lib%.dylib lib%.a", 658 #elif defined(__CYGWIN__) || defined(WINDOWS32) 659 ".LIBPATTERNS", "lib%.dll.a %.dll.a lib%.a %.lib lib%.dll %.dll", 524 660 #else 525 661 ".LIBPATTERNS", "lib%.so lib%.a", 526 662 #endif 527 #endif528 663 529 664 #endif /* !VMS */ 665 /* Make this assignment to avoid undefined variable warnings. */ 666 "GNUMAKEFLAGS", "", 530 667 0, 0 531 668 }; … … 538 675 { 539 676 suffix_file = enter_file (strcache_add (".SUFFIXES")); 677 suffix_file->builtin = 1; 540 678 541 679 if (no_builtin_rules_flag) … … 543 681 else 544 682 { 545 char *p = default_suffixes; 546 suffix_file->deps = enter_prereqs(PARSE_FILE_SEQ (&p, struct dep, '\0', 547 NULL, 0), 548 NULL); 683 struct dep *d; 684 const char *p = default_suffixes; 685 suffix_file->deps = enter_prereqs (PARSE_SIMPLE_SEQ ((char **)&p, struct dep), 686 NULL); 687 for (d = suffix_file->deps; d; d = d->next) 688 d->file->builtin = 1; 689 549 690 define_variable_cname ("SUFFIXES", default_suffixes, o_default, 0); 550 691 } … … 559 700 install_default_suffix_rules (void) 560 701 { 561 c har **s;702 const char **s; 562 703 563 704 if (no_builtin_rules_flag) … … 567 708 { 568 709 struct file *f = enter_file (strcache_add (s[0])); 569 /* Don't clobber cmds given in a makefile if there were any. */570 if (f->cmds == 0)571 { 572 f->cmds = xmalloc (sizeof (struct commands));573 f->cmds->fileinfo.filenm = 0;574 f->cmds->commands = s[1];575 f->cmds->command_lines = 0;576 } 710 /* This function should run before any makefile is parsed. */ 711 assert (f->cmds == 0); 712 f->cmds = xmalloc (sizeof (struct commands)); 713 f->cmds->fileinfo.filenm = 0; 714 f->cmds->commands = xstrdup (s[1]); 715 f->cmds->command_lines = 0; 716 f->cmds->recipe_prefix = RECIPEPREFIX_DEFAULT; 717 f->builtin = 1; 577 718 } 578 719 } … … 607 748 define_variable (s[0], strlen (s[0]), s[1], o_default, 1); 608 749 } 750 751 void 752 undefine_default_variables (void) 753 { 754 const char **s; 755 756 for (s = default_variables; *s != 0; s += 2) 757 undefine_variable_global (s[0], strlen (s[0]), o_default); 758 }
Note:
See TracChangeset
for help on using the changeset viewer.