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 Free Software 4 Foundation, Inc. 5 This file is part of GNU Make. 6 7 GNU Make is free software; you can redistribute it and/or modify it under the 8 terms of the GNU General Public License as published by the Free Software 9 Foundation; either version 2, or (at your option) any later version. 10 11 GNU Make is distributed in the hope that it will be useful, but WITHOUT ANY 12 WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR 13 A PARTICULAR PURPOSE. See the GNU General Public License for more details. 14 15 You should have received a copy of the GNU General Public License along with 16 GNU Make; see the file COPYING. If not, write to the Free Software 17 Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. */ 18 19 #include "make.h" 20 #include "filedef.h" 21 #include "variable.h" 22 #include "rule.h" 23 #include "dep.h" 24 #include "job.h" 25 #include "commands.h" 26 27 /* Define GCC_IS_NATIVE if gcc is the native development environment on 28 your system (gcc/bison/flex vs cc/yacc/lex). */ 29 #if defined(__MSDOS__) || defined(__EMX__) 30 # define GCC_IS_NATIVE 31 #endif 32 33 34 /* This is the default list of suffixes for suffix rules. 35 `.s' must come last, so that a `.o' file will be made from 36 a `.c' or `.p' or ... file rather than from a .s file. */ 37 38 static char default_suffixes[] 39 #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"; 43 #elif defined(__EMX__) 44 = ".out .a .ln .o .c .cc .C .cpp .p .f .F .r .y .l .s .S \ 45 .mod .sym .def .h .info .dvi .tex .texinfo .texi .txinfo \ 46 .w .ch .web .sh .elc .el .obj .exe .dll .lib"; 47 #else 48 = ".out .a .ln .o .c .cc .C .cpp .p .f .F .r .y .l .s .S \ 49 .mod .sym .def .h .info .dvi .tex .texinfo .texi .txinfo \ 50 .w .ch .web .sh .elc .el"; 51 #endif 52 53 static struct pspec default_pattern_rules[] = 54 { 55 { "(%)", "%", 56 "$(AR) $(ARFLAGS) $@ $<" }, 57 58 /* The X.out rules are only in BSD's default set because 59 BSD Make has no null-suffix rules, so `foo.out' and 60 `foo' are the same thing. */ 61 #ifdef VMS 62 { "%.exe", "%", 63 "copy $< $@" }, 64 #else 65 { "%.out", "%", 66 "@rm -f $@ \n cp $< $@" }, 67 #endif 68 /* Syntax is "ctangle foo.w foo.ch foo.c". */ 69 { "%.c", "%.w %.ch", 70 "$(CTANGLE) $^ $@" }, 71 { "%.tex", "%.w %.ch", 72 "$(CWEAVE) $^ $@" }, 73 74 { 0, 0, 0 } 75 }; 76 77 static struct pspec default_terminal_rules[] = 78 { 79 #ifdef VMS 80 /* RCS. */ 81 { "%", "%$$5lv", /* Multinet style */ 82 "if f$$search($@) .nes. \"\" then +$(CHECKOUT,v)" }, 83 { "%", "[.$$rcs]%$$5lv", /* Multinet style */ 84 "if f$$search($@) .nes. \"\" then +$(CHECKOUT,v)" }, 85 { "%", "%_v", /* Normal style */ 86 "if f$$search($@) .nes. \"\" then +$(CHECKOUT,v)" }, 87 { "%", "[.rcs]%_v", /* Normal style */ 88 "if f$$search($@) .nes. \"\" then +$(CHECKOUT,v)" }, 89 90 /* SCCS. */ 91 /* ain't no SCCS on vms */ 92 #else 93 /* RCS. */ 94 { "%", "%,v", 95 "$(CHECKOUT,v)" }, 96 { "%", "RCS/%,v", 97 "$(CHECKOUT,v)" }, 98 { "%", "RCS/%", 99 "$(CHECKOUT,v)" }, 100 101 /* SCCS. */ 102 { "%", "s.%", 103 "$(GET) $(GFLAGS) $(SCCS_OUTPUT_OPTION) $<" }, 104 { "%", "SCCS/s.%", 105 "$(GET) $(GFLAGS) $(SCCS_OUTPUT_OPTION) $<" }, 106 #endif /* !VMS */ 107 { 0, 0, 0 } 108 }; 109 110 static char *default_suffix_rules[] = 111 { 112 #ifdef VMS 113 ".obj.exe", 114 "$(LINK.obj) $^ $(LOADLIBES) $(LDLIBS) $(CRT0) /exe=$@", 115 ".mar.exe", 116 "$(COMPILE.mar) $^ \n $(LINK.obj) $(subst .mar,.obj,$^) $(LOADLIBES) $(LDLIBS) $(CRT0) /exe=$@", 117 ".s.exe", 118 "$(COMPILE.s) $^ \n $(LINK.obj) $(subst .s,.obj,$^) $(LOADLIBES) $(LDLIBS) $(CRT0) /exe=$@", 119 ".c.exe", 120 "$(COMPILE.c) $^ \n $(LINK.obj) $(subst .c,.obj,$^) $(LOADLIBES) $(LDLIBS) $(CRT0) /exe=$@", 121 ".cc.exe", 122 #ifdef GCC_IS_NATIVE 123 "$(COMPILE.cc) $^ \n $(LINK.obj) $(CXXSTARTUP),sys$$disk:[]$(subst .cc,.obj,$^) $(LOADLIBES) $(LXLIBS) $(LDLIBS) $(CXXRT0) /exe=$@", 124 #else 125 "$(COMPILE.cc) $^ \n $(CXXLINK.obj) $(subst .cc,.obj,$^) $(LOADLIBES) $(LXLIBS) $(LDLIBS) $(CXXRT0) /exe=$@", 126 ".cxx.exe", 127 "$(COMPILE.cxx) $^ \n $(CXXLINK.obj) $(subst .cxx,.obj,$^) $(LOADLIBES) $(LXLIBS) $(LDLIBS) $(CXXRT0) /exe=$@", 128 #endif 129 ".for.exe", 130 "$(COMPILE.for) $^ \n $(LINK.obj) $(subst .for,.obj,$^) $(LOADLIBES) $(LDLIBS) /exe=$@", 131 ".pas.exe", 132 "$(COMPILE.pas) $^ \n $(LINK.obj) $(subst .pas,.obj,$^) $(LOADLIBES) $(LDLIBS) /exe=$@", 133 134 ".com", 135 "copy $< >$@", 136 137 ".mar.obj", 138 "$(COMPILE.mar) /obj=$@ $<", 139 ".s.obj", 140 "$(COMPILE.s) /obj=$@ $<", 141 ".ss.obj", 142 "$(COMPILE.s) /obj=$@ $<", 143 ".c.i", 144 "$(COMPILE.c)/prep /list=$@ $<", 145 ".c.s", 146 "$(COMPILE.c)/noobj/machine /list=$@ $<", 147 ".i.s", 148 "$(COMPILE.c)/noprep/noobj/machine /list=$@ $<", 149 ".c.obj", 150 "$(COMPILE.c) /obj=$@ $<", 151 ".cc.ii", 152 "$(COMPILE.cc)/prep /list=$@ $<", 153 ".cc.ss", 154 "$(COMPILE.cc)/noobj/machine /list=$@ $<", 155 ".ii.ss", 156 "$(COMPILE.cc)/noprep/noobj/machine /list=$@ $<", 157 ".cc.obj", 158 "$(COMPILE.cc) /obj=$@ $<", 159 ".cxx.obj", 160 "$(COMPILE.cxx) /obj=$@ $<", 161 ".for.obj", 162 "$(COMPILE.for) /obj=$@ $<", 163 ".pas.obj", 164 "$(COMPILE.pas) /obj=$@ $<", 165 166 ".y.c", 167 "$(YACC.y) $< \n rename y_tab.c $@", 168 ".l.c", 169 "$(LEX.l) $< \n rename lexyy.c $@", 170 171 ".texinfo.info", 172 "$(MAKEINFO) $<", 173 174 ".tex.dvi", 175 "$(TEX) $<", 176 177 #else /* ! VMS */ 178 179 ".o", 180 "$(LINK.o) $^ $(LOADLIBES) $(LDLIBS) -o $@", 181 ".s", 182 "$(LINK.s) $^ $(LOADLIBES) $(LDLIBS) -o $@", 183 ".S", 184 "$(LINK.S) $^ $(LOADLIBES) $(LDLIBS) -o $@", 185 ".c", 186 "$(LINK.c) $^ $(LOADLIBES) $(LDLIBS) -o $@", 187 ".cc", 188 "$(LINK.cc) $^ $(LOADLIBES) $(LDLIBS) -o $@", 189 ".C", 190 "$(LINK.C) $^ $(LOADLIBES) $(LDLIBS) -o $@", 191 ".cpp", 192 "$(LINK.cpp) $^ $(LOADLIBES) $(LDLIBS) -o $@", 193 ".f", 194 "$(LINK.f) $^ $(LOADLIBES) $(LDLIBS) -o $@", 195 ".p", 196 "$(LINK.p) $^ $(LOADLIBES) $(LDLIBS) -o $@", 197 ".F", 198 "$(LINK.F) $^ $(LOADLIBES) $(LDLIBS) -o $@", 199 ".r", 200 "$(LINK.r) $^ $(LOADLIBES) $(LDLIBS) -o $@", 201 ".mod", 202 "$(COMPILE.mod) -o $@ -e $@ $^", 203 204 ".def.sym", 205 "$(COMPILE.def) -o $@ $<", 206 207 ".sh", 208 "cat $< >$@ \n chmod a+x $@", 209 210 ".s.o", 211 "$(COMPILE.s) -o $@ $<", 212 ".S.o", 213 "$(COMPILE.S) -o $@ $<", 214 ".c.o", 215 "$(COMPILE.c) $(OUTPUT_OPTION) $<", 216 ".cc.o", 217 "$(COMPILE.cc) $(OUTPUT_OPTION) $<", 218 ".C.o", 219 "$(COMPILE.C) $(OUTPUT_OPTION) $<", 220 ".cpp.o", 221 "$(COMPILE.cpp) $(OUTPUT_OPTION) $<", 222 ".f.o", 223 "$(COMPILE.f) $(OUTPUT_OPTION) $<", 224 ".p.o", 225 "$(COMPILE.p) $(OUTPUT_OPTION) $<", 226 ".F.o", 227 "$(COMPILE.F) $(OUTPUT_OPTION) $<", 228 ".r.o", 229 "$(COMPILE.r) $(OUTPUT_OPTION) $<", 230 ".mod.o", 231 "$(COMPILE.mod) -o $@ $<", 232 233 ".c.ln", 234 "$(LINT.c) -C$* $<", 235 ".y.ln", 236 #ifndef __MSDOS__ 237 "$(YACC.y) $< \n $(LINT.c) -C$* y.tab.c \n $(RM) y.tab.c", 238 #else 239 "$(YACC.y) $< \n $(LINT.c) -C$* y_tab.c \n $(RM) y_tab.c", 240 #endif 241 ".l.ln", 242 "@$(RM) $*.c\n $(LEX.l) $< > $*.c\n$(LINT.c) -i $*.c -o $@\n $(RM) $*.c", 243 244 ".y.c", 245 #ifndef __MSDOS__ 246 "$(YACC.y) $< \n mv -f y.tab.c $@", 247 #else 248 "$(YACC.y) $< \n mv -f y_tab.c $@", 249 #endif 250 ".l.c", 251 "@$(RM) $@ \n $(LEX.l) $< > $@", 252 253 ".F.f", 254 "$(PREPROCESS.F) $(OUTPUT_OPTION) $<", 255 ".r.f", 256 "$(PREPROCESS.r) $(OUTPUT_OPTION) $<", 257 258 /* This might actually make lex.yy.c if there's no %R% 259 directive in $*.l, but in that case why were you 260 trying to make $*.r anyway? */ 261 ".l.r", 262 "$(LEX.l) $< > $@ \n mv -f lex.yy.r $@", 263 264 ".S.s", 265 "$(PREPROCESS.S) $< > $@", 266 267 ".texinfo.info", 268 "$(MAKEINFO) $(MAKEINFO_FLAGS) $< -o $@", 269 270 ".texi.info", 271 "$(MAKEINFO) $(MAKEINFO_FLAGS) $< -o $@", 272 273 ".txinfo.info", 274 "$(MAKEINFO) $(MAKEINFO_FLAGS) $< -o $@", 275 276 ".tex.dvi", 277 "$(TEX) $<", 278 279 ".texinfo.dvi", 280 "$(TEXI2DVI) $(TEXI2DVI_FLAGS) $<", 281 282 ".texi.dvi", 283 "$(TEXI2DVI) $(TEXI2DVI_FLAGS) $<", 284 285 ".txinfo.dvi", 286 "$(TEXI2DVI) $(TEXI2DVI_FLAGS) $<", 287 288 ".w.c", 289 "$(CTANGLE) $< - $@", /* The `-' says there is no `.ch' file. */ 290 291 ".web.p", 292 "$(TANGLE) $<", 293 294 ".w.tex", 295 "$(CWEAVE) $< - $@", /* The `-' says there is no `.ch' file. */ 296 297 ".web.tex", 298 "$(WEAVE) $<", 299 300 #endif /* !VMS */ 301 302 0, 0, 303 }; 304 305 static char *default_variables[] = 306 { 307 #ifdef VMS 308 #ifdef __ALPHA 309 "ARCH", "ALPHA", 310 #endif 311 #ifdef __ia64 312 "ARCH", "IA64", 313 #endif 314 #ifdef __VAX 315 "ARCH", "VAX", 316 #endif 317 "AR", "library/obj", 318 "ARFLAGS", "/replace", 319 "AS", "macro", 320 "MACRO", "macro", 321 #ifdef GCC_IS_NATIVE 322 "CC", "gcc", 323 #else 324 "CC", "cc", 325 #endif 326 "CD", "builtin_cd", 327 "MAKE", "make", 328 "ECHO", "write sys$$output \"", 329 #ifdef GCC_IS_NATIVE 330 "C++", "gcc/plus", 331 "CXX", "gcc/plus", 332 #else 333 "C++", "cxx", 334 "CXX", "cxx", 335 "CXXLD", "cxxlink", 336 #endif 337 "CO", "co", 338 "CPP", "$(CC) /preprocess_only", 339 "FC", "fortran", 340 /* System V uses these, so explicit rules using them should work. 341 However, there is no way to make implicit rules use them and FC. */ 342 "F77", "$(FC)", 343 "F77FLAGS", "$(FFLAGS)", 344 "LD", "link", 345 "LEX", "lex", 346 "PC", "pascal", 347 "YACC", "bison/yacc", 348 "YFLAGS", "/Define/Verbose", 349 "BISON", "bison", 350 "MAKEINFO", "makeinfo", 351 "TEX", "tex", 352 "TEXINDEX", "texindex", 353 354 "RM", "delete/nolog", 355 356 "CSTARTUP", "", 357 #ifdef GCC_IS_NATIVE 358 "CRT0", ",sys$$library:vaxcrtl.olb/lib,gnu_cc_library:crt0.obj", 359 "CXXSTARTUP", "gnu_cc_library:crtbegin.obj", 360 "CXXRT0", ",sys$$library:vaxcrtl.olb/lib,gnu_cc_library:crtend.obj,gnu_cc_library:gxx_main.obj", 361 "LXLIBS", ",gnu_cc_library:libstdcxx.olb/lib,gnu_cc_library:libgccplus.olb/lib", 362 "LDLIBS", ",gnu_cc_library:libgcc.olb/lib", 363 #else 364 "CRT0", "", 365 "CXXSTARTUP", "", 366 "CXXRT0", "", 367 "LXLIBS", "", 368 "LDLIBS", "", 369 #endif 370 371 "LINK.obj", "$(LD) $(LDFLAGS)", 372 #ifndef GCC_IS_NATIVE 373 "CXXLINK.obj", "$(CXXLD) $(LDFLAGS)", 374 "COMPILE.cxx", "$(CXX) $(CXXFLAGS) $(CPPFLAGS) $(TARGET_ARCH)", 375 #endif 376 "COMPILE.c", "$(CC) $(CFLAGS) $(CPPFLAGS) $(TARGET_ARCH)", 377 "COMPILE.cc", "$(CXX) $(CXXFLAGS) $(CPPFLAGS) $(TARGET_ARCH)", 378 "YACC.y", "$(YACC) $(YFLAGS)", 379 "LEX.l", "$(LEX) $(LFLAGS)", 380 "COMPILE.for", "$(FC) $(FFLAGS) $(TARGET_ARCH)", 381 "COMPILE.pas", "$(PC) $(PFLAGS) $(CPPFLAGS) $(TARGET_ARCH)", 382 "COMPILE.mar", "$(MACRO) $(MACROFLAGS)", 383 "COMPILE.s", "$(AS) $(ASFLAGS) $(TARGET_MACH)", 384 "LINT.c", "$(LINT) $(LINTFLAGS) $(CPPFLAGS) $(TARGET_ARCH)", 385 386 "MV", "rename/new_version", 387 "CP", "copy", 388 389 #else /* !VMS */ 390 391 "AR", "ar", 392 "ARFLAGS", "rv", 393 "AS", "as", 394 #ifdef GCC_IS_NATIVE 395 "CC", "gcc", 396 # ifdef __MSDOS__ 397 "CXX", "gpp", /* g++ is an invalid name on MSDOS */ 398 # else 399 "CXX", "gcc", 400 # endif /* __MSDOS__ */ 401 #else 402 "CC", "cc", 403 "CXX", "g++", 404 #endif 405 406 /* This expands to $(CO) $(COFLAGS) $< $@ if $@ does not exist, 407 and to the empty string if $@ does exist. */ 408 "CHECKOUT,v", "+$(if $(wildcard $@),,$(CO) $(COFLAGS) $< $@)", 409 "CO", "co", 410 "COFLAGS", "", 411 412 "CPP", "$(CC) -E", 413 #ifdef CRAY 414 "CF77PPFLAGS", "-P", 415 "CF77PP", "/lib/cpp", 416 "CFT", "cft77", 417 "CF", "cf77", 418 "FC", "$(CF)", 419 #else /* Not CRAY. */ 420 #ifdef _IBMR2 421 "FC", "xlf", 422 #else 423 #ifdef __convex__ 424 "FC", "fc", 425 #else 426 "FC", "f77", 427 #endif /* __convex__ */ 428 #endif /* _IBMR2 */ 429 /* System V uses these, so explicit rules using them should work. 430 However, there is no way to make implicit rules use them and FC. */ 431 "F77", "$(FC)", 432 "F77FLAGS", "$(FFLAGS)", 433 #endif /* Cray. */ 434 "GET", SCCS_GET, 435 "LD", "ld", 436 #ifdef GCC_IS_NATIVE 437 "LEX", "flex", 438 #else 439 "LEX", "lex", 440 #endif 441 "LINT", "lint", 442 "M2C", "m2c", 443 #ifdef pyr 444 "PC", "pascal", 445 #else 446 #ifdef CRAY 447 "PC", "PASCAL", 448 "SEGLDR", "segldr", 449 #else 450 "PC", "pc", 451 #endif /* CRAY. */ 452 #endif /* pyr. */ 453 #ifdef GCC_IS_NATIVE 454 "YACC", "bison -y", 455 #else 456 "YACC", "yacc", /* Or "bison -y" */ 457 #endif 458 "MAKEINFO", "makeinfo", 459 "TEX", "tex", 460 "TEXI2DVI", "texi2dvi", 461 "WEAVE", "weave", 462 "CWEAVE", "cweave", 463 "TANGLE", "tangle", 464 "CTANGLE", "ctangle", 465 466 "RM", "rm -f", 467 468 "LINK.o", "$(CC) $(LDFLAGS) $(TARGET_ARCH)", 469 "COMPILE.c", "$(CC) $(CFLAGS) $(CPPFLAGS) $(TARGET_ARCH) -c", 470 "LINK.c", "$(CC) $(CFLAGS) $(CPPFLAGS) $(LDFLAGS) $(TARGET_ARCH)", 471 "COMPILE.cc", "$(CXX) $(CXXFLAGS) $(CPPFLAGS) $(TARGET_ARCH) -c", 472 "COMPILE.C", "$(COMPILE.cc)", 473 "COMPILE.cpp", "$(COMPILE.cc)", 474 "LINK.cc", "$(CXX) $(CXXFLAGS) $(CPPFLAGS) $(LDFLAGS) $(TARGET_ARCH)", 475 "LINK.C", "$(LINK.cc)", 476 "LINK.cpp", "$(LINK.cc)", 477 "YACC.y", "$(YACC) $(YFLAGS)", 478 "LEX.l", "$(LEX) $(LFLAGS) -t", 479 "COMPILE.f", "$(FC) $(FFLAGS) $(TARGET_ARCH) -c", 480 "LINK.f", "$(FC) $(FFLAGS) $(LDFLAGS) $(TARGET_ARCH)", 481 "COMPILE.F", "$(FC) $(FFLAGS) $(CPPFLAGS) $(TARGET_ARCH) -c", 482 "LINK.F", "$(FC) $(FFLAGS) $(CPPFLAGS) $(LDFLAGS) $(TARGET_ARCH)", 483 "COMPILE.r", "$(FC) $(FFLAGS) $(RFLAGS) $(TARGET_ARCH) -c", 484 "LINK.r", "$(FC) $(FFLAGS) $(RFLAGS) $(LDFLAGS) $(TARGET_ARCH)", 485 "COMPILE.def", "$(M2C) $(M2FLAGS) $(DEFFLAGS) $(TARGET_ARCH)", 486 "COMPILE.mod", "$(M2C) $(M2FLAGS) $(MODFLAGS) $(TARGET_ARCH)", 487 "COMPILE.p", "$(PC) $(PFLAGS) $(CPPFLAGS) $(TARGET_ARCH) -c", 488 "LINK.p", "$(PC) $(PFLAGS) $(CPPFLAGS) $(LDFLAGS) $(TARGET_ARCH)", 489 "LINK.s", "$(CC) $(ASFLAGS) $(LDFLAGS) $(TARGET_MACH)", 490 "COMPILE.s", "$(AS) $(ASFLAGS) $(TARGET_MACH)", 491 "LINK.S", "$(CC) $(ASFLAGS) $(CPPFLAGS) $(LDFLAGS) $(TARGET_MACH)", 492 "COMPILE.S", "$(CC) $(ASFLAGS) $(CPPFLAGS) $(TARGET_MACH) -c", 493 "PREPROCESS.S", "$(CC) -E $(CPPFLAGS)", 494 "PREPROCESS.F", "$(FC) $(FFLAGS) $(CPPFLAGS) $(TARGET_ARCH) -F", 495 "PREPROCESS.r", "$(FC) $(FFLAGS) $(RFLAGS) $(TARGET_ARCH) -F", 496 "LINT.c", "$(LINT) $(LINTFLAGS) $(CPPFLAGS) $(TARGET_ARCH)", 497 498 #ifndef NO_MINUS_C_MINUS_O 499 "OUTPUT_OPTION", "-o $@", 500 #endif 501 502 #ifdef SCCS_GET_MINUS_G 503 "SCCS_OUTPUT_OPTION", "-G$@", 504 #endif 505 506 #ifdef _AMIGA 507 ".LIBPATTERNS", "%.lib", 508 #else 509 #ifdef __MSDOS__ 510 ".LIBPATTERNS", "lib%.a $(DJDIR)/lib/lib%.a", 511 #else 512 ".LIBPATTERNS", "lib%.so lib%.a", 513 #endif 514 #endif 515 516 #endif /* !VMS */ 517 0, 0 518 }; 519 520 /* Set up the default .SUFFIXES list. */ 522 523 void 524 set_default_suffixes (void) 525 { 526 suffix_file = enter_file (".SUFFIXES"); 527 528 if (no_builtin_rules_flag) 529 (void) define_variable ("SUFFIXES", 8, "", o_default, 0); 530 else 531 { 532 char *p = default_suffixes; 533 suffix_file->deps = (struct dep *) 534 multi_glob (parse_file_seq (&p, '\0', sizeof (struct dep), 1), 535 sizeof (struct dep)); 536 (void) define_variable ("SUFFIXES", 8, default_suffixes, o_default, 0); 537 } 538 } 539 540 /* Enter the default suffix rules as file rules. This used to be done in 541 install_default_implicit_rules, but that loses because we want the 542 suffix rules installed before reading makefiles, and thee pattern rules 543 installed after. */ 544 545 void 546 install_default_suffix_rules (void) 547 { 548 register char **s; 549 550 if (no_builtin_rules_flag) 551 return; 552 553 for (s = default_suffix_rules; *s != 0; s += 2) 554 { 555 register struct file *f = enter_file (s[0]); 556 /* Don't clobber cmds given in a makefile if there were any. */ 557 if (f->cmds == 0) 558 { 559 f->cmds = (struct commands *) xmalloc (sizeof (struct commands)); 560 f->cmds->fileinfo.filenm = 0; 561 f->cmds->commands = s[1]; 562 f->cmds->command_lines = 0; 563 } 564 } 565 } 566 567 568 /* Install the default pattern rules. */ 569 570 void 571 install_default_implicit_rules (void) 572 { 573 register struct pspec *p; 574 575 if (no_builtin_rules_flag) 576 return; 577 578 for (p = default_pattern_rules; p->target != 0; ++p) 579 install_pattern_rule (p, 0); 580 581 for (p = default_terminal_rules; p->target != 0; ++p) 582 install_pattern_rule (p, 1); 583 } 584 585 void 586 define_default_variables (void) 587 { 588 register char **s; 589 590 if (no_builtin_variables_flag) 591 return; 592 593 for (s = default_variables; *s != 0; s += 2) 594 (void) define_variable (s[0], strlen (s[0]), s[1], o_default, 1); 595 } 596