Changeset 2596
- Timestamp:
- Jun 20, 2012, 12:44:52 AM (13 years ago)
- Location:
- vendor/gnumake/current
- Files:
-
- 211 edited
- 9 copied
Legend:
- Unmodified
- Added
- Removed
-
vendor/gnumake/current
- Property svn:ignore deleted
-
vendor/gnumake/current/.cvsignore
r900 r2596 8 8 9 9 .*gdbinit 10 .gdb_history 10 11 11 12 *.dep *.dvi *.toc *.aux *.log -
vendor/gnumake/current/AUTHORS
r1989 r2596 67 67 68 68 ------------------------------------------------------------------------------- 69 Copyright (C) 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007 70 Free Software Foundation, Inc.69 Copyright (C) 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007, 70 2008, 2009, 2010 Free Software Foundation, Inc. 71 71 This file is part of GNU Make. 72 72 -
vendor/gnumake/current/ChangeLog
r1989 r2596 1 2010-07-28 Paul Smith <psmith@gnu.org> 2 3 Version 3.82 released. 4 5 * configure.in: Change release version. 6 * NEWS: Change the date. 7 8 * read.c (parse_file_seq): Remove GLOB_NOSORT for 9 backward-compatibility. We'll add it back in next release. 10 * NEWS: Note it. 11 12 2010-07-24 Eli Zaretskii <eliz@gnu.org> 13 14 * job.c (pid2str) [WINDOWS32]: Fix CPP conditionals for using %Id 15 format. 16 17 2010-07-18 Paul Smith <psmith@gnu.org> 18 19 * configure.in: Switch bsd_signal to AC_CHECK_DECLS() to make sure 20 we have a declaration. Fixes Savannah bug #25713 (maybe?) 21 * doc/make.texi (Complex Makefile): Cleanup variable assignments. 22 (One Shell): New subsection for the .ONESHELL special target. 23 24 Patches by Ozkan Sezer <sezeroz@gmail.com>: 25 26 * misc.c (strncasecmp): Local implementation for systems without. 27 * config.h.W32.template (HAVE_STRNICMP): Define on Windows. 28 * configure.in: Check for strncasecmp/strncmpi/strnicmp. 29 * job.c [WINDOWS32]: Don't define dup2 on Windows. 30 (pid2str): Use "%Id" even with MSVC 31 (exec_command): Cast to pid_t when calling pid2str(). 32 * w32/subproc/sub_proc.c [WINDOWS32]: Include config.h first. 33 Use stddef.h on MSVC to get intptr_t. 34 * w32/subproc/misc.c [WINDOWS32]: Include config.h first. 35 * w32/compat/dirent.c [WINDOWS32]: Include config.h first. 36 (readdir): Cast -1 to correct type for d_ino. 37 * w32/pathstuff.c [WINDOWS32]: Ensure make.h is included first. 38 * make.h [WINDOWS32]: Don't prototype alloca() on Windows. 39 Add configuration for strncasecmp(). 40 * main.c (ADD_SIG) [WINDOWS32]: Avoid warnings in MSVC. 41 * config.h.W32.template [WINDOWS32]: Don't warn on unsafe 42 functions or variables. 43 * NMakefile.template [WINDOWS32]: Remove /MACHINE:I386. 44 * main.c (clean_jobserver): Cast due to MSVC brokenness. 45 (decode_switches): Ditto. 46 * vpath.c (construct_vpath_list): Ditto. 47 * rule.c (freerule): Ditto. 48 * ar.c (ar_glob): Ditto. 49 50 2010-07-16 Boris Kolpackov <boris@codesynthesis.com> 51 52 * misc.c (concat): Fix buffer overrun. 53 54 2010-07-12 Paul Smith <psmith@gnu.org> 55 56 Update copyrights to add 2010. 57 58 * build_w32.bat: Support for MSVC Windows x86_64 builds. 59 * job.c: Don't define execve() on MSVC/64bit. 60 Patch by Viktor Szakats. Fixes Savannah bug #27590. 61 62 2010-07-12 Eli Zaretskii <eliz@gnu.org> 63 64 * make.h (alloca) [!__GNUC__]: Don't define prototype. 65 (int w32_kill): Use pid_t for process ID argument. 66 Fixes Savannah bug #27809. 67 68 2010-07-12 Paul Smith <psmith@gnu.org> 69 70 Integrated new .ONESHELL feature. 71 Patch by David Boyce <dsb@boyski.com>. Modified by me. 72 73 * NEWS: Add a note about the new feature. 74 * job.c (is_bourne_compatible_shell): Determine whether we're 75 using a standard POSIX shell or not. 76 (start_job_command): Accept '-ec' as POSIX shell flags. 77 (construct_command_argv_internal): If one_shell is set and we are 78 using a POSIX shell, remove "interior" prefix characters such as 79 "@", "+", "-". Also treat "\n" as a special character when 80 choosing the slow path, if ONESHELL is set. 81 * job.h (is_bourne_compatible_argv): Define the new function. 82 83 * make.h (one_shell): New global variable to remember setting. 84 * main.c: Declare it. 85 * read.c (record_files): Set it. 86 * commands.c (chop_commands): If one_shell is set, don't chop 87 commands into multiple lines; just keep one line. 88 89 2010-07-09 Eli Zaretskii <eliz@gnu.org> 90 91 * w32/subproc/sub_proc.c: Include stdint.h. 92 (sub_process_t): Use intptr_t for file handles and pid_t for 93 process ID. 94 (process_pipes, process_init_fd, process_begin): Use intptr_t for 95 file handles and pid_t for process ID. Fixes Savannah bug #27809. 96 Patch by Ozkan Sezer <sezeroz@gmail.com> 97 98 * function.c (abspath): Support absolute file names in UNC format. 99 Fixes Savannah bug #30312. 100 101 * job.c (pid2str) [WINDOWS32]: Don't use %Id with GCC < 4.x. 102 (exec_command) [WINDOWS32]: Use pid2str instead of non-portable 103 %Id. 104 105 * main.c (handle_runtime_exceptions): Use %p to print addresses, 106 to DTRT on both 32-bit and 64-bit hosts. Savannah bug #27809. 107 108 * job.c (w32_kill, start_job_command, create_batch_file): Use 109 pid_t for process IDs and intptr_t for the 1st arg of 110 _open_osfhandle. 111 * function.c (windows32_openpipe): Use pid_t for process IDs and 112 intptr_t for the 1st arg of _open_osfhandle. 113 (func_shell): Use pid_t for process IDs. 114 * main.c (main) [WINDOWS32]: Pacify the compiler. 115 * config.h.W32.template (pid_t): Add a definition for 64-bit 116 Windows builds that don't use GCC. Fixes Savannah bug #27809. 117 Patch by Ozkan Sezer <sezeroz@gmail.com> 118 119 2010-07-07 Paul Smith <psmith@gnu.org> 120 121 * configure.in: Bump to a new prerelease version 3.81.91. 122 123 2010-07-06 Paul Smith <psmith@gnu.org> 124 125 * main.c (main): Set a default value of "-c" for .SHELLFLAGS. 126 * NEWS: Mention the new behavior of .POSIX and the new .SHELLFLAGS 127 variable. 128 * job.c (construct_command_argv): Retrieve the .SHELLFLAGS value 129 and pass it to construct_command_argv_internal(). 130 (construct_command_argv_internal): If .SHELLFLAGS is non-standard 131 use the slow path. Use that value instead of hard-coded "-c". 132 133 2010-07-05 Paul Smith <psmith@gnu.org> 134 135 * implicit.c (pattern_search): lastslash can be const. 136 * dir.c (downcase): Remove unused variable. 137 * hash.c (hash_init): Cast sizeof for error message. 138 * arscan.c (ar_scan): Cast to char* for WINDOWS32. 139 (ar_member_touch): Ditto. 140 * ar.c (glob_pattern_p): Avoid symbol collision: open -> opened 141 * signame.c (strsignal): Ditto: signal -> sig 142 * job.c (create_batch_file): Ditto: error -> error_string 143 (pid2str): Portably convert a pid_t into a string 144 (reap_children): Use it. 145 (start_waiting_job): Use it. 146 Savannah bug #27809. Patch by Ozkan Sezer <sezeroz@gmail.com> 147 148 2010-07-03 Paul Smith <psmith@gnu.org> 149 150 * read.c (parse_file_seq): All archive groups must end with ')' as 151 the LAST character in a word. If there is no word ending in ')' 152 then it's not an archive group. Fixes Savannah bug #28525. 153 154 2010-07-01 Paul Smith <psmith@gnu.org> 155 156 * main.c (main): Append optional features using separate calls. 157 Not as efficient but not all compilers allow conditionals inside 158 macro calls. Fixes Savannah bug #29244. 159 160 2010-01-10 Paul Smith <psmith@gnu.org> 161 162 * make.h (patheq): Rename strieq() to patheq() for clarity. 163 * dir.c (dir_contents_file_exists_p): Use it. 164 165 * dir.c (file_impossible): Convert xmalloc/memset to xcalloc. 166 * file.c (enter_file): Ditto. 167 * job.c (new_job): Ditto. 168 169 2009-12-11 Eli Zaretskii <eliz@gnu.org> 170 171 * job.c (construct_command_argv_internal) <sh_cmds_dos> 172 [WINDOWS32]: Add "echo." and a few more commands that are built 173 into cmd.exe. Fixes Savannah bug #28126. 174 175 * file.c (lookup_file) [HAVE_DOS_PATHS]: Treat '\\' like we do 176 with '/'. 177 178 2009-11-15 Paul Smith <psmith@gnu.org> 179 180 Patches for VMS provided by Hartmut Becker <Hartmut.Becker@hp.com> 181 182 * vmsjobs.c (ctrlYPressed) [VMS]: Deal with CTRL-Y. 183 (vmsHandleChildTerm) [VMS]: Ditto. 184 (astYHandler) [VMS]: Ditto. 185 (tryToSetupYAst) [VMS]: Ditto. 186 (child_execute_job) [VMS]: Ditto. 187 188 * vmsify.c (trnlog) [VMS]: Fix const errors. 189 (vmsify) [VMS]: Ditto. 190 191 * readme.vms [VMS]: Update with notes for 3.82. 192 193 * job.h (comname) [VMS]: Remember the temporary command filename 194 195 * dir.c (vmsify) [VMS]: Fix const errors. 196 (vms_hash) [VMS]: Ditto. 197 (vmsstat_dir) [VMS]: Ditto. 198 (find_directory) [VMS]: Fix case-insensitive option for VMS 199 (dir_contents_file_exists_p) [VMS]: Ditto. 200 (file_impossible) [VMS]: Ditto. 201 202 * config.h-vms.template (HAVE_FDOPEN) [VMS]: Have it. 203 (HAVE_STRCASECMP) [VMS]: Ditto. 204 205 * arscan.c (VMS_get_member_info) [VMS]: Fix timezone computation. 206 (ar_scan) [VMS]: Fix const error. 207 208 2009-11-12 Boris Kolpackov <boris@codesynthesis.com> 209 210 * vpath.c (vpath_search, selective_vpath_search): Add index arguments 211 which allows the caller to get the index of the matching directory. 212 213 * make.h (vpath_search): Update prototype. 214 215 * remake.c (library_search): Implement linker-compatible library 216 search. Use the new VPATH_SEARCH index functionality to keep track 217 of the directory index for each match. Select the match with the 218 lowest directory index. 219 220 * implicit.c (pattern_search): Pass NULL for the index arguments in 221 the VPATH_SEARCH call. 222 223 * doc/make.texi (Directory Search for Link Libraries): Describe the 224 new search behavior. 225 226 * NEWS: Add a note about the new behavior. 227 228 2009-10-25 Paul Smith <psmith@gnu.org> 229 230 * AUTHORS, et.al.: Update copyright years. 231 232 * implicit.c (stemlen_compare): Fix qsort() compare bug that 233 caused implicit rules with equal stem lengths to be sorted 234 indeterminately. 235 236 2009-10-24 Paul Smith <psmith@gnu.org> 237 238 * main.c (usage): Add --eval to the usage string. 239 (switches): Add the --eval switch. 240 (main): If --eval is given, add them to the simply-expanded variable 241 -*-eval-flags-*- (necessary to allow recursion to work properly). 242 (define_makeflags): Add -*-eval-flags-*- to MAKEFLAGS. 243 244 * NEWS: Describe the new --eval command line argument. 245 * doc/make.texi (Options Summary): Document --eval. 246 247 * dep.h: eval_buffer() returns void. 248 * read.c (eval_buffer): Ditto. 249 (eval): Ditto. 250 251 * variable.h (define_variable_cname): New macro for constant 252 variable names. 253 * default.c (set_default_suffixes): Use it. 254 * main.c (main): Ditto. 255 (handle_non_switch_argument): Ditto. 256 (define_makeflags): Ditto. 257 * read.c (read_all_makefiles): Ditto. 258 * variable.c (define_automatic_variables): Ditto. 259 260 * commands.c (dep_hash_cmp): Avoid casts. 261 (dep_hash_1): Ditto. 262 (dep_hash_2): Ditto. 263 264 2009-10-22 Boris Kolpackov <boris@codesynthesis.com> 265 266 * read.c (read_all_makefiles): Mark the default makefile dependency 267 dontcare. 268 269 2009-10-07 Boris Kolpackov <boris@codesynthesis.com> 270 271 * read.c (do_undefine): Free the expanded variable name. 272 273 * commands.c (dep_hash_cmp, set_file_variables): Move the order-only 274 to normal upgrade logic from dep_hash_cmp to set_file_variables. 275 276 2009-10-06 Boris Kolpackov <boris@codesynthesis.com> 277 278 * dep.h (uniquize_deps): Remove. 279 280 * read.c (uniquize_deps): Merge into set_file_variables in 281 commands.c. 282 (dep_hash_1, dep_hash_2, dep_hash_cmp): Move to commands.c. 283 284 * commands.c (set_file_variables): Avoid modifying the dep 285 chain to achieve uniqueness. Fixes savannah bug 25780. 286 287 * implicit.c (pattern_search): Instead of re-setting all automatic 288 variables for each rule we try, just update $*. 289 290 2009-10-06 Boris Kolpackov <boris@codesynthesis.com> 291 292 * variable.h (undefine_variable_in_set): New function declaration. 293 (undefine_variable_global): New macro. 294 295 * variable.c (undefine_variable_in_set): New function implementation. 296 297 * read.c (vmodifiers): Add undefine_v modifier. 298 (parse_var_assignment): Parse undefine. 299 (do_undefine): Handle the undefine directive. 300 (eval): Call do_undefine if undefine_v is set. 301 302 * main.c (.FEATURES): Add a keyword to indicate the new feature. 303 304 * doc/make.texi (Undefine Directive): Describe the new directive. 305 306 * NEWS: Add a note about the new directive. 307 308 2009-10-05 Boris Kolpackov <boris@codesynthesis.com> 309 310 * implicit.c (pattern_search): Initialize file variables only 311 if we need to parse a rule that requires the second expansion. 312 313 2009-10-03 Paul Smith <psmith@gnu.org> 314 315 * make.h: Include <alloca.h> even on systems where __GNUC__ is 316 defined. Not sure why it was done the other way. 317 Requested by David Boyce <dsb@boyski.com>. 318 319 2009-09-30 Boris Kolpackov <boris@codesynthesis.com> 320 321 * dep.h (dep): Add the DONTCARE bitfield. 322 323 * filedef.h (file):Add the NO_DIAG bitfield. 324 325 * read.c (eval_makefile): Set the DONTCARE flag in struct dep, 326 not struct file (a file can be a dependency of many targets, 327 some don't care, some do). 328 329 * remake.c (update_goal_chain): Propagate DONTCARE from struct 330 dep to struct file before updating the goal and restore it 331 afterwards. 332 (update_file): Don't prune the dependency graph if this target 333 has failed but the diagnostics hasn't been issued. 334 (complain): Scan the file's dependency graph to find the file 335 that caused the failure. 336 (update_file_1): Use NO_DIAG instead of DONTCARE to decide 337 whether to print diagnostics. 338 339 Fixes Savannah bugs #15110, #25493, #12686, and #17740. 340 341 2009-09-28 Paul Smith <psmith@gnu.org> 342 343 * doc/make.texi (Pattern Intro): Move the match algorithm 344 discussion into the "Pattern Match" node. 345 (Pattern Match): Expand on the pattern rule matching algorithm. 346 347 2009-09-28 Andreas Buening <andreas.buening@nexgo.de> 348 349 * job.c (construct_command_argv_internal) [OS2]: Don't eat too 350 much of the command line on a single pass. 351 352 2009-09-28 Boris Kolpackov <boris@codesynthesis.com> 353 354 * varible.c (create_pattern_var): Insert variables into the 355 PATTERN_VARS list in the shortest patterns first order. 356 357 * implicit.c (tryrule): Add STEMLEN and ORDER members. These are 358 used to sort the rules. 359 (stemlen_compare): Compare two tryrule elements. 360 (pattern_search): Sort the rules so that they are in the shortest 361 stem first order. 362 363 * main.c (.FEATURES): Add a keyword to indicate the new behavior. 364 365 * doc/make.texi (Pattern-specific Variable Values): Describe the 366 new pattern-specific variables application order. 367 (Introduction to Pattern Rules): Describe the new pattern rules 368 search order. 369 370 * NEWS: Add a note about the new behavior. 371 372 2009-09-27 Paul Smith <psmith@gnu.org> 373 374 * doc/make.texi (Double-Colon): Mention that pattern rules with 375 double-colons have a different meaning. Savannah bug #27497. 376 377 2009-09-27 Juan Manuel Guerrero <juan.guerrero@gmx.de> 378 379 * configh.dos.template: Remove unconditional definition of 380 SYS_SIGLIST_DECLARED. 381 Include <sys/version.h> because ports of GCC 4.3.0 and later no 382 longer include it, so macros like __DJGPP_MINOR__ are no longer 383 defined automatically. 384 385 * Makefile.DOS.template (INCLUDES): Use $(prefix) and the 386 corresponding variables to define LIBDIR, INCLUDEDIR and LOCALEDIR 387 instead of using the hardcoded ones. 388 (SUBDIRS): doc subdir added. 389 (INFO_DEPS, DVIS): Values changed to 'make.info' and 'make.dvi'. 390 (TEXI2HTML, TEXI2HTML_FLAGS): Removed. Use makeinfo --html to 391 create html formated docs. texi2html may not be ported to DOS. 392 (make.info, make.dvi, make.ps, make.html): Make targets depend on 393 'make.texi'. 394 (.texi.info, .texi, .texi.dvi): Now invoked recursively. Change 395 -I switch to look in ./ instead of ./doc. 396 (html): Target depend on html-recursive instead of make_1.html. 397 (make_1.html): Removed. 398 (mostlyclean-aminfo): Use $(srcdir)/doc instead of ./ as prefix. 399 (all-recursive): Allow for more than one subdir in the build 400 process. 401 (mostlyclean-recursive, clean-recursive, distclean-recursive) 402 (maintainer-clean-recursive, check-recursive): Enter in doc/ too. 403 (tags-recursive): Allow for more than one subdir in the build 404 process. 405 (info-recursive, dvi-recursive, ps-recursive, html-recursive): New 406 targets. Enter into doc/ to produce the targets. 407 (all-am): $(INFO_DEPS) replaced by info. 408 409 2009-09-26 Paul Smith <psmith@gnu.org> 410 411 * read.c (record_files): Use free_ns() to free struct nameseq. 412 (eval): Ditto. 413 414 * rule.c (freerule): Use free_dep_chain(). 415 416 * read.c (record_files): Free FILENAMES chain for implicit rules. 417 (eval): Static pattern targets go into the string cache. 418 419 * function.c (string_glob): Free NAME in the nameseq chain. 420 421 2009-09-25 Boris Kolpackov <boris@codesynthesis.com> 422 423 * implicit.c (pattern_search): Terminate early if we haven't 424 found any rules to try (performance improvement). 425 426 2009-09-25 Boris Kolpackov <boris@codesynthesis.com> 427 428 * implicit.c (pattern_search): Merge three parallel arrays, 429 TRYRULES, MATCHES, and CHECKED_LASTSLASH, into one array 430 of struct TRYRULE. In the old version the latter two arrays 431 had insufficient length. 432 433 2009-09-24 Paul Smith <psmith@gnu.org> 434 435 * implicit.c (pattern_search): Add back support for order-only 436 prerequisites for secondary expansion implicit rules, that were 437 accidentally dropped. If we find a "|", enable order-only mode 438 and set IGNORE_MTIME on all deps that are seen afterward. 439 (pattern_search): Fix memory leaks: for intermediate files where 440 we've already set the file variable and pattern variable sets, be 441 sure to either save or free them as appropriate. 442 443 2009-09-23 Paul Smith <psmith@gnu.org> 444 445 Rework the way secondary expansion is stored, for efficiency. 446 This changes secondary expansion so that ONLY WHEN we know we have 447 a possibility of needing secondary expansion, do we defer the 448 secondary expansion. This means more parsing the deps but we use 449 a lot less memory (due to the strcache). Also, this fixes 450 Savannah bug #18622. 451 452 * read.c (eval): Don't parse the dep string here anymore. 453 (record_files): Take the dep argument as an unparsed string. If 454 secondary expansion is enabled AND the prereq string has a '$' in 455 it, then set NEED_2ND_EXPANSION and keep the entire string. 456 Otherwise, parse the dep string here to construct the dep list 457 with the names in the strcache. 458 459 * misc.c (copy_dep_chain): For NEED_2ND_EXPANSION, we need to 460 duplicate the name string (others are in the strcache). 461 462 * implicit.c: Remove struct idep and free_idep_chain(): unused. 463 (struct patdeps): New structure to store prereq information. 464 (pattern_search): Use the NEED_2ND_EXPANSION flag to determine 465 which prerequisites need expansion, and expand only those. 466 467 * file.c (split_prereqs): Break parse_prereqs() into two parts: this 468 and enter_prereqs(). split_prereqs() takes a fully-expanded string 469 and splits it into a DEP list, handling order-only prereqs. 470 (enter_prereqs): This function enters a list of DEPs into the file 471 database. If there's a stem defined, expand any pattern chars. 472 (expand_deps): Only try to expand DEPs which have NEED_2ND_EXPANSION 473 set. Use the above functions. 474 (snap_deps): Only perform second expansion on prereqs that need it, 475 as defined by the NEED_2ND_EXPANSION flag. 476 (print_prereqs): New function to print the prereqs 477 (print_file): Call print_prereqs() rather than print inline. 478 479 * hash.h (STRING_COMPARE): Take advantage of strcache() by 480 comparing pointers. 481 (STRING_N_COMPARE): Ditto. 482 (ISTRING_COMPARE): Ditto. 483 484 * dep.h (PARSE_FILE_SEQ): New macro to reduce casts. 485 (parse_file_seq): Return void* 486 * read.c (parse_file_seq): Return void*. 487 (eval): Invoke macroized version of parse_file_seq() 488 * default.c (set_default_suffixes): Ditto. 489 * file.c (split_prereqs): Ditto. 490 * function.c (string_glob): Ditto. 491 * main.c (main): Ditto. 492 * rule.c (install_pattern_rule): Ditto. 493 494 * filedef.h: Add split_prereqs(), enter_prereqs(), etc. 495 496 2009-09-16 Paul Smith <psmith@gnu.org> 497 498 * misc.c (alloc_dep, free_dep): Now that we have xcalloc(), 499 convert to macros. 500 * dep.h: Create alloc_dep() / free_dep() macros. 501 502 * implicit.c (pattern_search): Take advantage of the new 503 parse_file_seq() to add the directory prefix to each prereq. 504 505 * dep.h: Remove multi_glob() and enhance parse_file_seq() to do it 506 all. Avoid reversing chains. Support adding prefixes. 507 * read.c (parse_file_seq): Rewrite to support globbing. Allow for 508 cached/non-cached results. 509 (eval): Remove multi_glob() & invoke new parse_file_seq(). 510 * rule.c (install_pattern_rule): Ditto. 511 * main.c (main): Ditto. 512 * implicit.c (pattern_search): Ditto. 513 * function.c (string_glob): Ditto. 514 * file.c (parse_prereqs): Ditto. 515 * default.c (set_default_suffixes): Ditto. 516 517 * variable.c (parse_variable_definition): Don't run off the end of 518 the string if it ends in whitespace (found with valgrind). 519 520 * commands.c (set_file_variables): Keep space for all targets in 521 $? if -B is given (found with valgrind). 522 523 2009-09-15 Paul Smith <psmith@gnu.org> 524 525 * misc.c (concat): Make concat() variadic so it takes >3 arguments. 526 (xcalloc): Add new function. 527 * make.h: New declarations. 528 529 * ar.c (ar_glob_match): New calling method for concat(). 530 * main.c (main): Ditto. 531 (decode_env_switches): Ditto. 532 * read.c (eval_makefile): Ditto. 533 (tilde_expand): Ditto. 534 (parse_file_seq): Ditto. 535 * variable.c (target_environment): Ditto. 536 (sync_Path_environment): Ditto. 537 538 * ar.c (ar_glob_match): Use xcalloc(). 539 * dir.c (file_impossible): Ditto. 540 * file.c (enter_file): Ditto. 541 * job.c (new_job): Ditto. 542 * read.c (parse_file_seq): Ditto. 543 * vmsfunctions.c (opendir): Ditto. 544 545 2009-09-14 Rafi Einstein <rafi.einstein@gmail.com> (tiny patch) 546 547 * w32/subproc/sub_proc.c (process_begin): Check *ep non-NULL 548 inside the loop that looks up environment for PATH. 549 550 2009-08-31 Eli Zaretskii <eliz@gnu.org> 551 552 * function.c (windows32_openpipe): Update envp after calling 553 sync_Path_environment. 554 555 2009-08-02 Paul Smith <psmith@gnu.org> 556 557 * remake.c (notice_finished_file): Ensure file->cmds is not null 558 before looping through them. Fixes Savannah bug #21824. 559 560 * doc/make.texi (Wildcard Examples): Clarify when objects is 561 wildcard-expanded. Fixes Savannah bug #24509. Patch by Martin Dorey. 562 (Include): Clarify the behavior of -include. 563 Fixes Savannah bug #18963. 564 565 2009-08-01 Paul Smith <psmith@gnu.org> 566 567 * doc/make.texi (Catalogue of Rules): Clarify where -c, -F, 568 etc. come on the command line. Fixes Savannah bug #27093. 569 570 * expand.c (expand_argument): If the argument is large enough use 571 xmalloc() instead of alloca(). Fixes Savannah bug #27143. 572 573 * variable.c (do_variable_definition): Avoid using alloca() to 574 hold values, which can be large. Fixes Savannah bug #23960. 575 576 * job.c (new_job): Use memmove() instead of strcpy() since both 577 pointers are in the same memory block. Fixes Savannah bug #27148. 578 Patch by Petr Machata. 579 580 2009-07-29 Ralf Wildenhues <Ralf.Wildenhues@gmx.de> 581 582 * job.c (construct_command_argv_internal): Add "ulimit" and 583 "unset" to the sh_cmds for Unixy shells. 584 585 2009-07-29 Ralf Wildenhues <Ralf.Wildenhues@gmx.de> 586 587 * configure.in: Move side-effects outside AC_CACHE_VAL arguments 588 that set make_cv_sys_gnu_glob, so they are also correctly set 589 when the cache has been populated before. 590 591 2009-07-04 Eli Zaretskii <eliz@gnu.org> 592 593 * function.c (func_realpath) [!HAVE_REALPATH]: Require the file to 594 exist, as realpath(3) does where it's supported. 595 596 2006-07-04 Eli Zaretskii <eliz@gnu.org> 597 598 * function.c (IS_ABSOLUTE, ROOT_LEN): New macros. 599 (abspath): Support systems that define HAVE_DOS_PATHS (have 600 drive letters in their file names). Use IS_PATHSEP instead of a 601 literal '/' comparison. Fixes Savannah bug #26886. 602 603 2009-06-14 Paul Smith <psmith@gnu.org> 604 605 * remake.c (update_file_1): Remember the original file we marked 606 as updating, so we can clear that flag again. If we find a target 607 via vpath, FILE might change. 608 (check_dep): Ditto. Fixes Savannah bug #13529. 609 Patch by Reid Madsen <reid.madsen@tek.com>. 610 611 2009-06-13 Paul Smith <psmith@gnu.org> 612 613 * doc/make.texi (MAKEFILES Variable): Be explicit that files 614 included by MAKEFILES cannot give default goals. 615 * read.c (eval): If set_default is not set, pass the no-default-goal 616 value when we read included makefiles. Fixes Savannah bug #13401. 617 618 * ar.c (ar_name): Ensure that targets with empty parens aren't 619 considered archive member references: archive members must have a 620 non-empty "member" string. Fixes Savannah bug #18435. 621 622 * function.c (string_glob): Rely on multi_glob() to determine 623 whether files exist or not. Remove call to file_exists_p() which 624 is not always correct. Fixes Savannah bug #21231. 625 * read.c (multi_glob): Add a new argument EXISTS_ONLY; if true 626 then only files that really exist will be returned. 627 * dep.h: Add new argument to multi_glob(). 628 * rule.c (install_pattern_rule): Ditto. 629 * read.c (eval): Ditto. 630 * main.c (main): Ditto. 631 * implicit.c (pattern_search): Ditto. 632 * file.c (parse_prereqs): Ditto. 633 * default.c (set_default_suffixes): Ditto. 634 635 2009-06-09 Paul Smith <psmith@gnu.org> 636 637 * commands.c (set_file_variables): If always_make_flag is set, 638 always add the prereq to $?. Fixes Savannah bug #17825. 639 640 * remake.c (update_file_1): When rebuilding deps of FILE, also try 641 to rebuild the deps of all the also_make targets for that file. 642 Fixes Savannah bug #19108. 643 644 * implicit.c (pattern_search): Undo test for is_target, added by 645 BorisK on 21 Sep 2004. This goes against step 5c in the "Implicit 646 Rule Search Algorithm". Fixes Savannah bug #17752. 647 648 * main.c (clean_jobserver): Clear the jobserver_fds options and 649 set job_slots to the default when we clean up. 650 (define_makeflags): Return the new MAKEFLAGS value. 651 (main): Reset MAKEFLAGS in the environment when we re-exec. 652 Fixes Savannah bug #18124. 653 654 2009-06-08 Paul Smith <psmith@gnu.org> 655 656 * read.c (eval): Collapse continuations post-semicolon on target- 657 specific variables. Fixes Savannah bug #17521. 658 659 2009-06-07 Paul Smith <psmith@gnu.org> 660 661 * job.c (reap_children): For older systems without waitpid() (are 662 there any of these left?) run wait(2) inside EINTRLOOP to handle 663 EINTR errors. Fixes Savannah bug #16401. 664 665 * (various): Debug message cleanup. Fixes Savannah bug #16469. 666 667 * main.c: Fix bsd_signal() typedef. Fixes Savannah bug #16473. 668 669 * file.c (snap_deps): Set SNAPPED_DEPS at the start of snapping, 670 not the end, to catch second expansion $(eval ...) defining new 671 target/prereq relationships during snap_deps. 672 Fixes Savannah bug #24622. 673 674 * read.c (record_files): The second-expansion "f->updating" hack 675 was not completely correct: if assumed that the target with 676 commands always had prerequisites; if one didn't then the ordering 677 was messed up. Fixed for now to use f->updating to decide whether 678 to preserve the last element in the deps list... but this whole 679 area of constructing and reversing the deps list is too confusing 680 and needs to be reworked. Fixes Savannah bug #21198. 681 682 2009-06-06 Paul Smith <psmith@gnu.org> 683 684 * hash.c (hash_insert): Remove useless test for NULL. 685 Fixes Savannah bug #21823. 686 687 * make.h: Move SET_STACK_SIZE determination to make.h. 688 * main.c (main): New global variable, STACK_LIMIT, holds the 689 original stack limit when make was started. 690 * job.c (start_job_command): Reset the stack limit, if we changed it. 691 Fixes Savannah bug #22010. 692 693 * remake.c (check_dep): Only set the target's state to not-started 694 if it's not already running. Found this while testing -j10 builds 695 of glibc: various targets were being rebuilt multiple times. 696 Fix from Knut St. Osmundsen; fixes a problem reported in Savannah 697 bug #15919. 698 699 * read.c (multi_glob): Don't pass GLOB_NOCHECK to glob(3); instead 700 handle the GLOB_NOMATCH error. This is to work around Sourceware.org 701 Bugzilla bug 10246. 702 703 2009-06-04 Paul Smith <psmith@gnu.org> 704 705 * read.c (eval): Skip initial whitespace (ffeed, vtab, etc.) 706 707 * maintMakefile: Modify access of config and gnulib Savannah 708 modules to use GIT instead of CVS. 709 710 * main.c (main): Initialize the LENGTH field in SHELL_VAR. 711 Fixes Savannah bug #24655. 712 713 * read.c (eval_buffer): Don't dereference reading_file if it's NULL; 714 this can happen during some invocations of $(eval ...) for example. 715 Fixes Savannah bug #24588. Patch by Lars Jessen <ljessen@ljessen.dk> 716 717 2009-06-02 Paul Smith <psmith@gnu.org> 718 719 * configure.in: Check for fileno() 720 * read.c (eval_makefile): If fileno() is available, set CLOSE_ON_EXEC 721 for the makefile file so invocations of $(shell ...) don't inherit it. 722 Fixes Savannah bug #24277. 723 724 2009-06-01 Paul Smith <psmith@gnu.org> 725 726 * main.c (main): The previous fix for .DEFAULT_GOAL had issues; 727 expansion was handled incorrectly. Rework the default goal 728 handling to save the variable only. Remove default_goal_file and 729 default_goal_name. 730 * read.c (eval): Check default_goal_var, not default_goal_name. 731 * read.c (record_target_var): Don't check default_goal_file here. 732 733 2009-05-31 Paul Smith <psmith@gnu.org> 734 735 * main.c (main): Expand the .DEFAULT_GOAL variable before using 736 it, and if the multi_glob() returns nothing (say it expanded to 737 nothing but spaces) then don't crash. Fixes Savannah bug #25697. 738 739 * doc/make.texi (Quick Reference): Add $(if ..), $(or ..), and 740 $(and ..) to the reference. Fixes Savannah bug #25694. 741 742 * make.1: Be clear that some recipes will be executed even with -n. 743 * doc/make.texi: Ditto. Fixes Savannah bug #25460. 744 745 * doc/make.texi (Override Directive): Make more clear how 746 overrides and appends interact. 747 Elucidates part of Savannah bug #26207. 748 749 * read.c (record_target_var): Don't reset the origin on 750 target-specific variables; try_variable_definition() will handle 751 this correctly. Fixes Savannah bug #26207. 752 753 * maintMakefile (do-po-update): Copy PO files into $(top_srcdir). 754 Fixes Savannah bug #25712. 755 756 * implicit.c (pattern_search): Keep a pointer to the beginning of 757 the filename and save that instead of the constructed pointer. 758 Fixes Savannah bug #26593. 759 Patch by Mark Seaborn <mrs@mythic-beasts.com> 760 761 2009-05-30 Paul Smith <psmith@gnu.org> 762 763 * doc/make.texi (Multi-Line): Add a description of the new abilities 764 of define/endef. Rename "Sequences" to "Multi-Line" and fix some 765 "command sequence" vs. "recipe" syntax. 766 * read.c (do_define): Modify to allow assignment tokens (=, :=, etc.) 767 after a define, to create variables with those flavors. 768 769 2009-05-25 Paul Smith <psmith@gnu.org> 770 771 Reworked the parser for variable assignments to allow multiple 772 modifiers, and in any order. Also allows variable and 773 prerequisites to be modifier names ('export', 'private', etc.) 774 775 * NEWS: Add notes about user-visible changes. 776 777 * read.c (struct vmodifiers): Remember what modifiers were seen. 778 (parse_var_assignment): New function to parse variable assignments. 779 (eval): Call the new function. Handle variable assignments earlier. 780 781 * variable.c (parse_variable_definition): Only parse; don't create var. 782 (assign_variable_definition): Call parse, then create the var. 783 784 2009-05-24 Paul Smith <psmith@gnu.org> 785 786 * doc/make.texi: Fix the ISBN for the GNU make manual. Incorrect 787 value noticed by Hans Stol <hans.stol@nc3a.nato.int>. 788 789 2009-03-14 Eli Zaretskii <eliz@gnu.org> 790 791 * w32/pathstuff.c (convert_Path_to_windows32): Fix last change. 792 Fixes Savannah bug #25412. 793 794 * w32/subproc/sub_proc.c <top level>: Update Copyright years. Add 795 prototype for xmalloc. 796 (find_file): Accept 3 arguments PATH_VAR, FULL_FNAME, and FULL_LEN 797 instead of an LPOFSTRUCT pointer. Use xmalloc instead of malloc. 798 Loop over an array of extensions, instead of duplicating the same 799 code inline. Use SearchPath followed by CreateFile, instead of 800 the obsolete OpenFile. Fixes Savannah bug #17277. 801 (process_begin): Find $(PATH) in `envp', and pass a pointer to it 802 to `find_file'. Fixes Savannah bug #25662. 803 804 2009-03-07 Eli Zaretskii <eliz@gnu.org> 805 806 * function.c (func_shell): Don't close pipedes[1] if it is -1. 807 Fixes Savannah bug #20495. 808 809 2009-02-28 Ralf Wildenhues <address@hidden> 810 811 * doc/make.texi (Instead of Execution): Document interaction of 812 -t with phony targets. 813 814 2009-02-23 Ramon Garcia <ramon.garcia.f@gmail.com> 815 816 Introduce a new keyword "private" which applies to target-specific 817 variables and prevents their values from being inherited. 818 819 * variable.h (struct variable): Add private_var flag to each variable. 820 Add a flag to specify which list entry switches to the parent target. 821 * variable.c (define_variable_in_set): Initialize private_var flag. 822 (lookup_variable): Skip private variables in parent contexts. 823 (initialize_file_variables): Set next_is_parent appropriately. 824 (print_variable): Show the private_var flag. 825 * read.c (eval): Recognize the private keyword. 826 (record_target_var): Set private_var. 827 * doc/make.texi (Suppressing Inheritance): Add documentation. 828 829 2008-10-26 Paul Smith <psmith@gnu.org> 830 831 * configure.in: Check for strndup(). 832 * misc.c (xstrndup): Rename savestring to xstrndup. Use strndup 833 if it's available. 834 * make.h: Rename savestring to xstrndup. 835 * commands.c (chop_commands): Ditto. 836 * function.c (func_foreach): Ditto. 837 * read.c (eval, record_files): Ditto. 838 * variable.c (define_variable_in_set): Ditto. 839 1 840 2008-09-30 Eli Zaretskii <eliz@gnu.org> 2 841 … … 816 1655 817 1656 * make.1: Fix some display errors and document all existing options. 818 Patch providedby Mike Frysinger <vapier@gentoo.org>.1657 Patch by Mike Frysinger <vapier@gentoo.org>. 819 1658 820 1659 2005-12-11 Paul D. Smith <psmith@gnu.org> … … 3164 4003 3165 4004 3166 Copyright (C) 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007 Free Software3167 Foundation, Inc.4005 Copyright (C) 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009 Free 4006 Software Foundation, Inc. 3168 4007 This file is part of GNU Make. 3169 4008 -
vendor/gnumake/current/ChangeLog.1
r1989 r2596 4984 4984 4985 4985 Copyright (C) 1988, 1989, 1990, 1991, 1992, 1993, 1994, 1995, 1996, 1997, 4986 1998, 1999, 2000, 2001, 2002, 2003, 2005, 2006, 2007 Free Software Foundation,4987 Inc.4986 1998, 1999, 2000, 2001, 2002, 2003, 2005, 2006, 2007, 2008, 2009 Free 4987 Software Foundation, Inc. 4988 4988 This file is part of GNU Make. 4989 4989 -
vendor/gnumake/current/Makefile.DOS.template
r1989 r2596 3 3 # 4 4 # Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 5 # 2004, 2005, 2006, 2007 Free Software Foundation, Inc.5 # 2004, 2005, 2006, 2007, 2008, 2009, 2010 Free Software Foundation, Inc. 6 6 # This file is part of GNU Make. 7 7 # … … 86 86 man_MANS = make.1 87 87 88 INCLUDES = -I$(srcdir)/glob -DLIBDIR=\" c:/djgpp/lib\" -DINCLUDEDIR=\"c:/djgpp/include\" -DLOCALEDIR=\"$(localedir)\"88 INCLUDES = -I$(srcdir)/glob -DLIBDIR=\"$(prefix)$(libdir)\" -DINCLUDEDIR=\"$(prefix)$(includedir)\" -DLOCALEDIR=\"$(prefix)$(localedir)\" 89 89 90 90 BUILT_SOURCES = README build.sh-in … … 92 92 EXTRA_DIST = $(BUILT_SOURCES) $(man_MANS) README.customs remote-cstms.c make-stds.texi texinfo.tex SCOPTIONS SMakefile Makefile.ami README.Amiga config.ami amiga.c amiga.h NMakefile README.DOS configh.dos configure.bat makefile.com README.W32 build_w32.bat config.h-W32 subproc.bat make.lnk config.h-vms makefile.vms readme.vms vmsdir.h vmsfunctions.c vmsify.c 93 93 94 SUBDIRS = glob 94 SUBDIRS = glob doc 95 95 mkinstalldirs = ${exec_prefix}/bin/gmkdir -p 96 96 CONFIG_HEADER = config.h … … 116 116 TEXI2DVI = texi2dvi 117 117 TEXINFO_TEX = $(srcdir)/config/texinfo.tex 118 INFO_DEPS = make.info119 DVIS = make.dvi118 INFO_DEPS = doc/make.info 119 DVIS = doc/make.dvi 120 120 TEXINFOS = doc/make.texi 121 121 noinst_TEXINFOS = doc/fdl.texi doc/make-stds.texi 122 122 man1dir = $(mandir)/man1 123 123 MANS = $(man_MANS) 124 125 TEXI2HTML = texi2html126 TEXI2HTML_FLAGS = -split_chapter127 124 128 125 NROFF = nroff … … 192 189 # Documentation 193 190 194 make.info: doc/make.texi 195 make.dvi: doc/make.texi 191 make.info: make.texi 192 make.dvi: make.texi 193 make.ps: make.dvi make.texi 194 make.html: make.texi 196 195 197 196 … … 201 200 @command.com /c if exist make.info* del make.info* 202 201 @command.com /c if exist make.i* del make.i* 203 $(MAKEINFO) -I$(srcdir) /doc--no-split $< -o ./$@202 $(MAKEINFO) -I$(srcdir) --no-split $< -o ./$@ 204 203 205 204 .texi: 206 205 @command.com /c if exist make.info* del make.info* 207 206 @command.com /c if exist make.i* del make.i* 208 $(MAKEINFO) -I$(srcdir) /doc--no-split $< -o ./$@207 $(MAKEINFO) -I$(srcdir) --no-split $< -o ./$@ 209 208 210 209 .texi.dvi: 211 TEXINPUTS="$(srcdir) /doc;$$TEXINPUTS" MAKEINFO='$(MAKEINFO) -I $(srcdir)/doc' $(TEXI2DVI) $<210 TEXINPUTS="$(srcdir);$$TEXINPUTS" MAKEINFO='$(MAKEINFO) -I $(srcdir)' $(TEXI2DVI) $< 212 211 213 212 .dvi.ps: … … 216 215 # Other documentation formats 217 216 218 html: make_1.html 219 220 make_1.html: $(TEXINFOS) $(noinst_TEXINFOS) 221 $(TEXI2HTML) $(TEXI2HTML_FLAGS) $(srcdir)/doc/make.texi 217 html: html-recursive 218 219 .texi.html: 220 @command.com /c if exist make.html* del make.html* 221 $(MAKEINFO) --html -I$(srcdir) --no-split $< -o ./$@ 222 222 223 223 install-info-am: $(INFO_DEPS) 224 224 @$(NORMAL_INSTALL) 225 225 $(mkinstalldirs) $(DESTDIR)$(infodir) 226 @for file in $(INFO_DEPS); do d=$(srcdir); for ifile in `cd $$d && echo $$file`; do if test -f $$d/$$ifile; then echo " $(INSTALL_DATA) $$d/$$ifile $(DESTDIR)$(infodir)/$$ifile"; $(INSTALL_DATA) $$d/$$ifile $(DESTDIR)$(infodir)/$$ifile; else : ; fi; done; done226 @for file in $(INFO_DEPS); do iifile=`echo $$file | sed "s|doc/||"`; d=$(srcdir); for ifile in `cd $$d && echo $$file`; do if test -f $$d/$$ifile; then echo " $(INSTALL_DATA) $$d/$$ifile $(DESTDIR)$(infodir)/$$iifile"; $(INSTALL_DATA) $$d/$$ifile $(DESTDIR)$(infodir)/$$iifile; else : ; fi; done; done 227 227 @$(POST_INSTALL) 228 @if $(SHELL) -c 'install-info --version | sed 1q | fgrep -s -v -i debian' >/dev/null 2>&1; then for file in $(INFO_DEPS); do echo " install-info --info-dir=$(DESTDIR)$(infodir) $(DESTDIR)$(infodir)/$$file"; install-info --info-dir=$(DESTDIR)$(infodir) $(DESTDIR)$(infodir)/$$file || :; done; else : ; fi228 @if $(SHELL) -c 'install-info --version | sed 1q | fgrep -s -v -i debian' >/dev/null 2>&1; then for file in $(INFO_DEPS); do iifile=`echo $$file | sed "s|doc/||"`; echo " install-info --info-dir=$(DESTDIR)$(infodir) $(DESTDIR)$(infodir)/$$iifile"; install-info --info-dir=$(DESTDIR)$(infodir) $(DESTDIR)$(infodir)/$$iifile || :; done; else : ; fi 229 229 230 230 uninstall-info: … … 238 238 239 239 mostlyclean-aminfo: 240 -rm -f make.aux make.cp make.cps make.dvi make.fn make.fns make.ky \ 241 make.kys make.ps make.log make.pg make.toc make.tp make.tps \ 242 make.vr make.vrs make.op make.tr make.cv make.cn 240 -rm -f $(srcdir)/doc/make.aux $(srcdir)/doc/make.cp $(srcdir)/doc/make.cps $(srcdir)/doc/make.dvi \ 241 $(srcdir)/doc/make.fn $(srcdir)/doc/make.fns $(srcdir)/doc/make.ky $(srcdir)/doc/make.kys \ 242 $(srcdir)/doc/make.ps $(srcdir)/doc/make.log $(srcdir)/doc/make.pg $(srcdir)/doc/make.toc \ 243 $(srcdir)/doc/make.tp $(srcdir)/doc/make.tps $(srcdir)/doc/make.vr $(srcdir)/doc/make.vrs \ 244 $(srcdir)/doc/make.op $(srcdir)/doc/make.tr $(srcdir)/doc/make.cv $(srcdir)/doc/make.cn \ 245 $(srcdir)/doc/make.html 243 246 244 247 clean-aminfo: … … 292 295 # a single directory, yell bloody murder. 293 296 all-recursive: 294 ifeq ($( words $(SUBDIRS)), 1)297 ifeq ($(findstring glob, $(SUBDIRS)), glob) 295 298 @command.com /c if not exist glob\\nul md glob 296 @echo Making all in $(SUBDIRS) 297 $(MAKE) -C $(SUBDIRS) -f ../Makefile INCLUDES='-I$(srcdir) -I$(srcdir)/glob' DEFS='-I.. -I$(srcdir)' VPATH=$(srcdir)/glob libglob.a 298 else 299 @echo FATAL: There is more than one directory in "($(SUBDIRS))" 300 @$(EXIT_FAIL) 299 @echo Making all in glob 300 $(MAKE) -C glob -f ../Makefile INCLUDES='-I$(srcdir) -I$(srcdir)/glob' DEFS='-I.. -I$(srcdir)' VPATH=$(srcdir)/glob libglob.a 301 301 endif 302 302 … … 311 311 mostlyclean-recursive clean-recursive distclean-recursive \ 312 312 maintainer-clean-recursive check-recursive: 313 ifeq ($(words $(SUBDIRS)), 1) 314 @echo Making $(shell echo $@ | sed s/-recursive//) in $(SUBDIRS) 315 $(MAKE) -C $(SUBDIRS) -f ../Makefile $(shell echo $@ | sed s/-recursive//)-am 313 ifeq ($(words $(SUBDIRS)), 2) 314 @echo Making $(shell echo $@ | sed s/-recursive//) in glob 315 $(MAKE) -C glob -f ../Makefile $(shell echo $@ | sed s/-recursive//)-am 316 @echo Making $(shell echo $@ | sed s/-recursive//) in doc 317 $(MAKE) -C doc -f ../Makefile $(shell echo $@ | sed s/-recursive//)-am 316 318 else 317 @echo FATAL: There is more than onedirectory in "($(SUBDIRS))"319 @echo FATAL: There is more than two directory in "($(SUBDIRS))" 318 320 @$(EXIT_FAIL) 319 321 endif … … 323 325 324 326 tags-recursive: 325 ifeq ($(words $(SUBDIRS)), 1)327 ifeq ($(words $(SUBDIRS)), 2) 326 328 $(MAKE) tags-in-glob 327 329 else 328 @echo FATAL: There is more than onedirectory in "($(SUBDIRS))"330 @echo FATAL: There is more than two directory in "($(SUBDIRS))" 329 331 @$(EXIT_FAIL) 330 332 endif … … 377 379 $(MAKE) top_distdir="$(top_distdir)" distdir="$(distdir)" dist-hook 378 380 379 info: $(INFO_DEPS) info-recursive 380 dvi: $(DVIS) dvi-recursive 381 info: info-recursive 382 info-recursive: 383 ifeq ($(findstring doc, $(SUBDIRS)), doc) 384 @command.com /c if not exist doc\\nul md doc 385 @echo Making all in doc 386 $(MAKE) -C doc -f ../Makefile VPATH=$(srcdir)/doc make.info 387 endif 388 389 dvi: dvi-recursive 390 dvi-recursive: 391 ifeq ($(findstring doc, $(SUBDIRS)), doc) 392 @command.com /c if not exist doc\\nul md doc 393 @echo Making all in doc 394 $(MAKE) -C doc -f ../Makefile VPATH=$(srcdir)/doc make.dvi 395 endif 396 397 ps: ps-recursive 398 ps-recursive: 399 ifeq ($(findstring doc, $(SUBDIRS)), doc) 400 @command.com /c if not exist doc\\nul md doc 401 @echo Making all in doc 402 $(MAKE) -C doc -f ../Makefile VPATH=$(srcdir)/doc make.ps 403 endif 404 405 html-recursive: 406 ifeq ($(findstring doc, $(SUBDIRS)), doc) 407 @command.com /c if not exist doc\\nul md doc 408 @echo Making all in doc 409 $(MAKE) -C doc -f ../Makefile VPATH=$(srcdir)/doc make.html 410 endif 411 381 412 check: all-am check-recursive check-local 382 413 @: … … 385 416 $(MAKE) all-recursive 386 417 387 all-am: Makefile $( INFO_DEPS) $(PROGRAMS) config.h418 all-am: Makefile $(PROGRAMS) config.h info 388 419 389 420 install-exec-am: install-binPROGRAMS -
vendor/gnumake/current/Makefile.am
r1989 r2596 2 2 # 3 3 # Copyright (C) 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006, 4 # 2007 Free Software Foundation, Inc.4 # 2007, 2008, 2009, 2010 Free Software Foundation, Inc. 5 5 # This file is part of GNU Make. 6 6 # -
vendor/gnumake/current/Makefile.ami
r1989 r2596 5 5 # 6 6 # Copyright (C) 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, 7 # 2005, 2006, 2007 Free Software Foundation, Inc.7 # 2005, 2006, 2007, 2008, 2009, 2010 Free Software Foundation, Inc. 8 8 # This file is part of GNU Make. 9 9 # -
vendor/gnumake/current/NEWS
r1989 r2596 1 1 GNU make NEWS -*-indented-text-*- 2 2 History of user-visible changes. 3 1 April 20063 28 July 2010 4 4 5 5 See the end of this file for copyrights and conditions. … … 11 11 12 12 13 Version 3.81.90 13 Version 3.82 14 15 A complete list of bugs fixed in this version is available here: 16 17 http://sv.gnu.org/bugs/index.php?group=make&report_id=111&fix_release_id=104&set=custom 14 18 15 19 * Compiling GNU make now requires a conforming ISO C 1989 compiler and 16 20 standard runtime library. 21 22 * WARNING: Future backward-incompatibility! 23 Wildcards are not documented as returning sorted values, but up to and 24 including this release the results have been sorted and some makefiles are 25 apparently depending on that. In the next release of GNU make, for 26 performance reasons, we may remove that sorting. If your makefiles 27 require sorted results from wildcard expansions, use the $(sort ...) 28 function to request it explicitly. 29 30 * WARNING: Backward-incompatibility! 31 The POSIX standard for make was changed in the 2008 version in a 32 fundamentally incompatible way: make is required to invoke the shell as if 33 the '-e' flag were provided. Because this would break many makefiles that 34 have been written to conform to the original text of the standard, the 35 default behavior of GNU make remains to invoke the shell with simply '-c'. 36 However, any makefile specifying the .POSIX special target will follow the 37 new POSIX standard and pass '-e' to the shell. See also .SHELLFLAGS 38 below. 39 40 * WARNING: Backward-incompatibility! 41 The '$?' variable now contains all prerequisites that caused the target to 42 be considered out of date, even if they do not exist (previously only 43 existing targets were provided in $?). 44 45 * WARNING: Backward-incompatibility! 46 As a result of parser enhancements, three backward-compatibility issues 47 exist: first, a prerequisite containing an "=" cannot be escaped with a 48 backslash any longer. You must create a variable containing an "=" and 49 use that variable in the prerequisite. Second, variable names can no 50 longer contain whitespace, unless you put the whitespace in a variable and 51 use the variable. Third, in previous versions of make it was sometimes 52 not flagged as an error for explicit and pattern targets to appear in the 53 same rule. Now this is always reported as an error. 54 55 * WARNING: Backward-incompatibility! 56 The pattern-specific variables and pattern rules are now applied in the 57 shortest stem first order instead of the definition order (variables 58 and rules with the same stem length are still applied in the definition 59 order). This produces the usually-desired behavior where more specific 60 patterns are preferred. To detect this feature search for 'shortest-stem' 61 in the .FEATURES special variable. 62 63 * WARNING: Backward-incompatibility! 64 The library search behavior has changed to be compatible with the standard 65 linker behavior. Prior to this version for prerequisites specified using 66 the -lfoo syntax make first searched for libfoo.so in the current 67 directory, vpath directories, and system directories. If that didn't yield 68 a match, make then searched for libfoo.a in these directories. Starting 69 with this version make searches first for libfoo.so and then for libfoo.a 70 in each of these directories in order. 71 72 * New command line option: --eval=STRING causes STRING to be evaluated as 73 makefile syntax (akin to using the $(eval ...) function). The evaluation 74 is performed after all default rules and variables are defined, but before 75 any makefiles are read. 17 76 18 77 * New special variable: .RECIPEPREFIX allows you to reset the recipe 19 78 introduction character from the default (TAB) to something else. The 20 79 first character of this variable value is the new recipe introduction 21 character. If the variable is set to the empty string, TAB is used 22 again. It can be set and reset at will; rules will be parsed 23 according to the current value. 80 character. If the variable is set to the empty string, TAB is used again. 81 It can be set and reset at will; recipes will use the value active when 82 they were first parsed. To detect this feature check the value of 83 $(.RECIPEPREFIX). 84 85 * New special variable: .SHELLFLAGS allows you to change the options passed 86 to the shell when it invokes recipes. By default the value will be "-c" 87 (or "-ec" if .POSIX is set). 88 89 * New special target: .ONESHELL instructs make to invoke a single instance 90 of the shell and provide it with the entire recipe, regardless of how many 91 lines it contains. As a special feature to allow more straightforward 92 conversion of makefiles to use .ONESHELL, any recipe line control 93 characters ('@', '+', or '-') will be removed from the second and 94 subsequent recipe lines. This happens _only_ if the SHELL value is deemed 95 to be a standard POSIX-style shell. If not, then no interior line control 96 characters are removed (as they may be part of the scripting language used 97 with the alternate SHELL). 98 99 * New variable modifier 'private': prefixing a variable assignment with the 100 modifier 'private' suppresses inheritance of that variable by 101 prerequisites. This is most useful for target- and pattern-specific 102 variables. 103 104 * New make directive: 'undefine' allows you to undefine a variable so that 105 it appears as if it was never set. Both $(flavor) and $(origin) functions 106 will return 'undefined' for such a variable. To detect this feature search 107 for 'undefine' in the .FEATURES special variable. 108 109 * The parser for variable assignments has been enhanced to allow multiple 110 modifiers ('export', 'override', 'private') on the same line as variables, 111 including define/endef variables, and in any order. Also, it is possible 112 to create variables and targets named as these modifiers. 113 114 * The 'define' make directive now allows a variable assignment operator 115 after the variable name, to allow for simple, conditional, or appending 116 multi-line variable assignment. 24 117 25 118 … … 60 153 61 154 * WARNING: Backward-incompatibility! 62 63 155 In order to comply with POSIX, the way in which GNU make processes 64 156 backslash-newline sequences in recipes has changed. If your makefiles … … 1059 1151 ------------------------------------------------------------------------------- 1060 1152 Copyright (C) 1988, 1989, 1990, 1991, 1992, 1993, 1994, 1995, 1996, 1997, 1061 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007 Free Software 1062 Foundation, Inc. 1063 This file is part of GNU Make. 1153 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 1154 2010 Free Software Foundation, Inc. This file is part of GNU Make. 1064 1155 1065 1156 GNU Make is free software; you can redistribute it and/or modify it under the -
vendor/gnumake/current/NMakefile.template
r1989 r2596 5 5 # 6 6 # Copyright (C) 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005, 7 # 2006, 2007 Free Software Foundation, Inc.7 # 2006, 2007, 2008, 2009, 2010 Free Software Foundation, Inc. 8 8 # This file is part of GNU Make. 9 9 # … … 34 34 35 35 LDFLAGS_debug = w32\subproc\WinDebug\subproc.lib /NOLOGO /SUBSYSTEM:console\ 36 /INCREMENTAL:no /PDB:WinDebug/make.pdb /MACHINE:I386 \ 37 /OUT:WinDebug/make.exe /DEBUG 36 /INCREMENTAL:no /PDB:WinDebug/make.pdb /OUT:WinDebug/make.exe /DEBUG 38 37 LDFLAGS_release = w32\subproc\WinRel\subproc.lib /NOLOGO /SUBSYSTEM:console\ 39 /INCREMENTAL:no / MACHINE:I386 /OUT:WinRel/make.exe38 /INCREMENTAL:no /OUT:WinRel/make.exe 40 39 41 40 all: config.h subproc Release Debug -
vendor/gnumake/current/README.Amiga
r1989 r2596 64 64 ------------------------------------------------------------------------------- 65 65 Copyright (C) 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, 66 2005, 2006, 2007 Free Software Foundation, Inc.66 2005, 2006, 2007, 2008, 2009, 2010 Free Software Foundation, Inc. 67 67 This file is part of GNU Make. 68 68 -
vendor/gnumake/current/README.DOS.template
r1989 r2596 327 327 ------------------------------------------------------------------------------- 328 328 Copyright (C) 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005, 329 2006, 2007 Free Software Foundation, Inc.329 2006, 2007, 2008, 2009, 2010 Free Software Foundation, Inc. 330 330 This file is part of GNU Make. 331 331 -
vendor/gnumake/current/README.OS2.template
r1989 r2596 162 162 163 163 ------------------------------------------------------------------------------- 164 Copyright (C) 2003, 2004, 2005, 2006, 2007 Free Software Foundation, Inc. 164 Copyright (C) 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010 Free Software 165 Foundation, Inc. 165 166 This file is part of GNU Make. 166 167 -
vendor/gnumake/current/README.W32.template
r1989 r2596 275 275 ------------------------------------------------------------------------------- 276 276 Copyright (C) 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005, 277 2006, 2007, 2008 Free Software Foundation, Inc.277 2006, 2007, 2008, 2009, 2010 Free Software Foundation, Inc. 278 278 This file is part of GNU Make. 279 279 -
vendor/gnumake/current/README.customs
r1989 r2596 98 98 99 99 ------------------------------------------------------------------------------- 100 Copyright (C) 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007 Free101 Software Foundation, Inc.100 Copyright (C) 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 101 2009, 2010 Free Software Foundation, Inc. 102 102 This file is part of GNU Make. 103 103 -
vendor/gnumake/current/README.cvs
r1989 r2596 2 2 3 3 ------------------------------------------------------------------------------- 4 Copyright (C) 2002, 2003, 2004, 2005, 2006, 2007 Free Software Foundation, Inc.5 This file is part of GNU Make.4 Copyright (C) 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010 Free 5 Software Foundation, Inc. This file is part of GNU Make. 6 6 7 7 GNU Make is free software; you can redistribute it and/or modify it under the … … 211 211 make check 212 212 213 Or, for a debugging version: 214 215 autoreconf -i && ./configure CFLAGS=-g && make update && make && make check 216 213 217 Or, all-in-one: 214 218 -
vendor/gnumake/current/README.template
r1989 r2596 174 174 ------------------------------------------------------------------------------- 175 175 Copyright (C) 1988, 1989, 1990, 1991, 1992, 1993, 1994, 1995, 1996, 1997, 176 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007 Free Software177 Foundation, Inc.176 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 177 2010 Free Software Foundation, Inc. 178 178 This file is part of GNU Make. 179 179 -
vendor/gnumake/current/SMakefile.template
r1989 r2596 5 5 # 6 6 # Copyright (C) 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, 7 # 2005, 2006, 2007 Free Software Foundation, Inc.7 # 2005, 2006, 2007, 2008, 2009, 2010 Free Software Foundation, Inc. 8 8 # This file is part of GNU Make. 9 9 # -
vendor/gnumake/current/TODO.private
r1989 r2596 66 66 67 67 3) Multi-token pattern rule matching (allow %1/%2.c : %1/obj/%2.o, 68 etc., or something like that). I have an implementation of this 69 already, it just needs some refinement... maybe. Additionally I 70 think it only works for static pattern rules; it might need to be 71 fixed up to work with normal pattern rules, too. 68 etc., or something like that). Maybe using regex? 72 69 73 70 4) Provide a .TARGETS variable, containing the names of the targets … … 130 127 131 128 ------------------------------------------------------------------------------- 132 Copyright (C) 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007133 Free Software Foundation, Inc.129 Copyright (C) 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006, 130 2007, 2008, 2009, 2010 Free Software Foundation, Inc. 134 131 This file is part of GNU Make. 135 132 -
vendor/gnumake/current/acinclude.m4
r1989 r2596 2 2 dnl 3 3 dnl Automake will incorporate this into its generated aclocal.m4. 4 dnl Copyright (C) 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007 5 dnl Free Software Foundation, Inc.4 dnl Copyright (C) 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007, 5 dnl 2008, 2009, 2010 Free Software Foundation, Inc. 6 6 dnl This file is part of GNU Make. 7 7 dnl -
vendor/gnumake/current/amiga.c
r1989 r2596 1 1 /* Running commands on Amiga 2 2 Copyright (C) 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, 3 2005, 2006, 2007 Free Software Foundation, Inc.3 2005, 2006, 2007, 2008, 2009, 2010 Free Software Foundation, Inc. 4 4 This file is part of GNU Make. 5 5 -
vendor/gnumake/current/amiga.h
r1989 r2596 1 1 /* Definitions for amiga specific things 2 2 Copyright (C) 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, 3 2005, 2006, 2007 Free Software Foundation, Inc.3 2005, 2006, 2007, 2008, 2009, 2010 Free Software Foundation, Inc. 4 4 This file is part of GNU Make. 5 5 -
vendor/gnumake/current/ar.c
r1989 r2596 1 1 /* Interface to `ar' archives for GNU Make. 2 2 Copyright (C) 1988, 1989, 1990, 1991, 1992, 1993, 1994, 1995, 1996, 1997, 3 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007 Free Software 4 Foundation, Inc. 3 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 4 2010 Free Software Foundation, Inc. 5 5 6 This file is part of GNU Make. 6 7 … … 25 26 #include <fnmatch.h> 26 27 27 /* Return nonzero if NAME is an archive-member reference, zero if not. 28 An archive-member reference is a name like `lib(member)'. 28 /* Return nonzero if NAME is an archive-member reference, zero if not. An 29 archive-member reference is a name like `lib(member)' where member is a 30 non-empty string. 29 31 If a name like `lib((entry))' is used, a fatal error is signaled at 30 32 the attempt to use this unsupported feature. */ … … 40 42 41 43 end = p + strlen (p) - 1; 42 if (*end != ')' )44 if (*end != ')' || end == p + 1) 43 45 return 0; 44 46 … … 199 201 { 200 202 /* We have a match. Add it to the chain. */ 201 struct nameseq *new = xmalloc (state->size); 202 memset (new, '\0', state->size); 203 new->name = strcache_add (concat (state->arname, mem, ")")); 203 struct nameseq *new = xcalloc (state->size); 204 new->name = strcache_add (concat (4, state->arname, "(", mem, ")")); 204 205 new->next = state->chain; 205 206 state->chain = new; … … 216 217 { 217 218 const char *p; 218 int open = 0;219 int opened = 0; 219 220 220 221 for (p = pattern; *p != '\0'; ++p) … … 231 232 232 233 case '[': 233 open = 1;234 opened = 1; 234 235 break; 235 236 236 237 case ']': 237 if (open )238 if (opened) 238 239 return 1; 239 240 break; … … 252 253 struct nameseq *n; 253 254 const char **names; 254 char *name;255 255 unsigned int i; 256 256 … … 260 260 /* Scan the archive for matches. 261 261 ar_glob_match will accumulate them in STATE.chain. */ 262 i = strlen (arname); 263 name = alloca (i + 2); 264 memcpy (name, arname, i); 265 name[i] = '('; 266 name[i + 1] = '\0'; 267 state.arname = name; 262 state.arname = arname; 268 263 state.pattern = member_pattern; 269 264 state.size = size; … … 282 277 283 278 /* Sort them alphabetically. */ 284 qsort (names, i, sizeof (*names), alpha_compare); 279 /* MSVC erroneously warns without a cast here. */ 280 qsort ((void *)names, i, sizeof (*names), alpha_compare); 285 281 286 282 /* Put them back into the chain in the sorted order. */ -
vendor/gnumake/current/arscan.c
r1989 r2596 1 1 /* Library function for scanning an archive file. 2 2 Copyright (C) 1987, 1988, 1989, 1990, 1991, 1992, 1993, 1994, 1995, 1996, 1997, 3 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007 Free Software4 Foundation, Inc.3 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 4 2010 Free Software Foundation, Inc. 5 5 This file is part of GNU Make. 6 6 … … 67 67 if (! (status & 1)) 68 68 { 69 error (NILF, _("lbr$set_module failed to extract module info, status = %d"),69 error (NILF, _("lbr$set_module() failed to extract module info, status = %d"), 70 70 status); 71 71 … … 82 82 * know if this causes problems in other VMS environments. 83 83 */ 84 val = decc$fix_time (&mhd->mhd$l_datim) + timezone - daylight*3600; 84 { 85 /* Modified by M. Gehre at 11-JAN-2008 because old formula is wrong: 86 * val = decc$fix_time (&mhd->mhd$l_datim) + timezone - daylight*3600; 87 * a) daylight specifies, if the timezone has daylight saving enabled, not 88 * if it is active 89 * b) what we need is the information, if daylight saving was active, if 90 * the library module was replaced. This information we get using the 91 * localtime function 92 */ 93 94 struct tm *tmp; 95 96 /* Conversion from VMS time to C time */ 97 val = decc$fix_time (&mhd->mhd$l_datim); 98 99 /* 100 * Conversion from local time (stored in library) to GMT (needed for gmake) 101 * Note: The tm_gmtoff element is a VMS extension to the ANSI standard. 102 */ 103 tmp = localtime (&val); 104 val -= tmp->tm_gmtoff; 105 } 85 106 #endif 86 107 … … 152 173 if (! (status & 1)) 153 174 { 154 error (NILF, _("lbr$ini_control failed with status = %d"),status);175 error (NILF, _("lbr$ini_control() failed with status = %d"), status); 155 176 return -2; 156 177 } 157 178 158 libdesc.dsc$a_pointer = archive; 179 /* there is no such descriptor with "const char *dsc$a_pointer" */ 180 libdesc.dsc$a_pointer = (char *)archive; 159 181 libdesc.dsc$w_length = strlen (archive); 160 182 … … 251 273 }; 252 274 # endif 275 # define TOCHAR(_m) (_m) 253 276 #else 254 277 /* These should allow us to read Windows (VC++) libraries (according to Frank … … 267 290 # define ar_uid UserID 268 291 # define ar_gid GroupID 292 /* In Windows the member names have type BYTE so we must cast them. */ 293 # define TOCHAR(_m) ((char *)(_m)) 269 294 #endif 270 295 … … 610 635 611 636 #ifndef M_XENIX 612 sscanf ( member_header.ar_mode, "%o", &eltmode);613 eltsize = atol ( member_header.ar_size);637 sscanf (TOCHAR (member_header.ar_mode), "%o", &eltmode); 638 eltsize = atol (TOCHAR (member_header.ar_size)); 614 639 #else /* Xenix. */ 615 640 eltmode = (unsigned short int) member_header.ar_mode; … … 621 646 member_offset + AR_HDR_SIZE, eltsize, 622 647 #ifndef M_XENIX 623 atol ( member_header.ar_date),624 atoi ( member_header.ar_uid),625 atoi ( member_header.ar_gid),648 atol (TOCHAR (member_header.ar_date)), 649 atoi (TOCHAR (member_header.ar_uid)), 650 atoi (TOCHAR (member_header.ar_gid)), 626 651 #else /* Xenix. */ 627 652 member_header.ar_date, … … 794 819 for (ui = 0; ui < sizeof ar_hdr.ar_date; ui++) 795 820 ar_hdr.ar_date[ui] = ' '; 796 sprintf ( ar_hdr.ar_date, "%ld", (long int) statbuf.st_mtime);821 sprintf (TOCHAR (ar_hdr.ar_date), "%ld", (long int) statbuf.st_mtime); 797 822 #ifdef AIAMAG 798 823 ar_hdr.ar_date[strlen(ar_hdr.ar_date)] = ' '; -
vendor/gnumake/current/build.template
r1989 r2596 4 4 5 5 # Copyright (C) 1993, 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, 6 # 2003, 2004, 2005, 2006, 2007 Free Software Foundation, Inc.6 # 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010 Free Software Foundation, Inc. 7 7 # This file is part of GNU Make. 8 8 # -
vendor/gnumake/current/build_w32.bat
r1991 r2596 1 1 @echo off 2 2 rem Copyright (C) 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005, 3 rem 2006, 2007 Free Software Foundation, Inc.3 rem 2006, 2007, 2008, 2009, 2010 Free Software Foundation, Inc. 4 4 rem This file is part of GNU Make. 5 5 rem … … 95 95 echo off 96 96 echo "Linking WinDebug/%make%.exe" 97 rem link.exe kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib w32\subproc\windebug\subproc.lib /NOLOGO /SUBSYSTEM:console /INCREMENTAL:yes /PDB:.\WinDebug/%make%.pdb /DEBUG / MACHINE:I386 /OUT:.\WinDebug/%make%.exe .\WinDebug/variable.obj .\WinDebug/rule.obj .\WinDebug/remote-stub.obj .\WinDebug/commands.obj .\WinDebug/file.obj .\WinDebug/getloadavg.obj .\WinDebug/default.obj .\WinDebug/signame.obj .\WinDebug/expand.obj .\WinDebug/dir.obj .\WinDebug/main.obj .\WinDebug/getopt1.obj .\WinDebug/job.obj .\WinDebug/read.obj .\WinDebug/version.obj .\WinDebug/getopt.obj .\WinDebug/arscan.obj .\WinDebug/remake.obj .\WinDebug/hash.obj .\WinDebug/strcache.obj .\WinDebug/misc.obj .\WinDebug/ar.obj .\WinDebug/function.obj .\WinDebug/vpath.obj .\WinDebug/implicit.obj .\WinDebug/dirent.obj .\WinDebug/glob.obj .\WinDebug/fnmatch.obj .\WinDebug/pathstuff.obj97 rem link.exe kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib w32\subproc\windebug\subproc.lib /NOLOGO /SUBSYSTEM:console /INCREMENTAL:yes /PDB:.\WinDebug/%make%.pdb /DEBUG /OUT:.\WinDebug/%make%.exe .\WinDebug/variable.obj .\WinDebug/rule.obj .\WinDebug/remote-stub.obj .\WinDebug/commands.obj .\WinDebug/file.obj .\WinDebug/getloadavg.obj .\WinDebug/default.obj .\WinDebug/signame.obj .\WinDebug/expand.obj .\WinDebug/dir.obj .\WinDebug/main.obj .\WinDebug/getopt1.obj .\WinDebug/job.obj .\WinDebug/read.obj .\WinDebug/version.obj .\WinDebug/getopt.obj .\WinDebug/arscan.obj .\WinDebug/remake.obj .\WinDebug/hash.obj .\WinDebug/strcache.obj .\WinDebug/misc.obj .\WinDebug/ar.obj .\WinDebug/function.obj .\WinDebug/vpath.obj .\WinDebug/implicit.obj .\WinDebug/dirent.obj .\WinDebug/glob.obj .\WinDebug/fnmatch.obj .\WinDebug/pathstuff.obj 98 98 echo kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib w32\subproc\windebug\subproc.lib >>link.dbg 99 link.exe /NOLOGO /SUBSYSTEM:console /INCREMENTAL:yes /PDB:.\WinDebug/%make%.pdb /DEBUG / MACHINE:I386 /OUT:.\WinDebug/%make%.exe @link.dbg99 link.exe /NOLOGO /SUBSYSTEM:console /INCREMENTAL:yes /PDB:.\WinDebug/%make%.pdb /DEBUG /OUT:.\WinDebug/%make%.exe @link.dbg 100 100 if not exist .\WinDebug/%make%.exe echo "WinDebug build failed" 101 101 if exist .\WinDebug/%make%.exe echo "WinDebug build succeeded!" … … 162 162 echo off 163 163 echo "Linking WinRel/%make%.exe" 164 rem link.exe kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib w32\subproc\winrel\subproc.lib /NOLOGO /SUBSYSTEM:console /INCREMENTAL:no /PDB:.\WinRel/%make%.pdb / MACHINE:I386 /OUT:.\WinRel/%make%.exe .\WinRel/variable.obj .\WinRel/rule.obj .\WinRel/remote-stub.obj .\WinRel/commands.obj .\WinRel/file.obj .\WinRel/getloadavg.obj .\WinRel/default.obj .\WinRel/signame.obj .\WinRel/expand.obj .\WinRel/dir.obj .\WinRel/main.obj .\WinRel/getopt1.obj .\WinRel/job.obj .\WinRel/read.obj .\WinRel/version.obj .\WinRel/getopt.obj .\WinRel/arscan.obj .\WinRel/remake.obj .\WinRel/misc.obj .\WinRel/hash.obj .\WinRel/strcache.obj .\WinRel/ar.obj .\WinRel/function.obj .\WinRel/vpath.obj .\WinRel/implicit.obj .\WinRel/dirent.obj .\WinRel/glob.obj .\WinRel/fnmatch.obj .\WinRel/pathstuff.obj164 rem link.exe kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib w32\subproc\winrel\subproc.lib /NOLOGO /SUBSYSTEM:console /INCREMENTAL:no /PDB:.\WinRel/%make%.pdb /OUT:.\WinRel/%make%.exe .\WinRel/variable.obj .\WinRel/rule.obj .\WinRel/remote-stub.obj .\WinRel/commands.obj .\WinRel/file.obj .\WinRel/getloadavg.obj .\WinRel/default.obj .\WinRel/signame.obj .\WinRel/expand.obj .\WinRel/dir.obj .\WinRel/main.obj .\WinRel/getopt1.obj .\WinRel/job.obj .\WinRel/read.obj .\WinRel/version.obj .\WinRel/getopt.obj .\WinRel/arscan.obj .\WinRel/remake.obj .\WinRel/misc.obj .\WinRel/hash.obj .\WinRel/strcache.obj .\WinRel/ar.obj .\WinRel/function.obj .\WinRel/vpath.obj .\WinRel/implicit.obj .\WinRel/dirent.obj .\WinRel/glob.obj .\WinRel/fnmatch.obj .\WinRel/pathstuff.obj 165 165 echo kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib w32\subproc\winrel\subproc.lib >>link.rel 166 link.exe /NOLOGO /SUBSYSTEM:console /INCREMENTAL:no /PDB:.\WinRel/%make%.pdb / MACHINE:I386 /OUT:.\WinRel/%make%.exe @link.rel166 link.exe /NOLOGO /SUBSYSTEM:console /INCREMENTAL:no /PDB:.\WinRel/%make%.pdb /OUT:.\WinRel/%make%.exe @link.rel 167 167 if not exist .\WinRel/%make%.exe echo "WinRel build failed" 168 168 if exist .\WinRel/%make%.exe echo "WinRel build succeeded!" -
vendor/gnumake/current/commands.c
r1989 r2596 1 1 /* Command processing for GNU Make. 2 2 Copyright (C) 1988, 1989, 1990, 1991, 1992, 1993, 1994, 1995, 1996, 1997, 3 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007 Free Software4 Foundation, Inc.3 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 4 2010 Free Software Foundation, Inc. 5 5 This file is part of GNU Make. 6 6 … … 41 41 42 42 43 44 static unsigned long 45 dep_hash_1 (const void *key) 46 { 47 const struct dep *d = key; 48 return_STRING_HASH_1 (dep_name (d)); 49 } 50 51 static unsigned long 52 dep_hash_2 (const void *key) 53 { 54 const struct dep *d = key; 55 return_STRING_HASH_2 (dep_name (d)); 56 } 57 58 static int 59 dep_hash_cmp (const void *x, const void *y) 60 { 61 const struct dep *dx = x; 62 const struct dep *dy = y; 63 return strcmp (dep_name (dx), dep_name (dy)); 64 } 65 43 66 /* Set FILE's automatic variables up. */ 44 67 … … 46 69 set_file_variables (struct file *file) 47 70 { 48 conststruct dep *d;71 struct dep *d; 49 72 const char *at, *percent, *star, *less; 50 73 … … 118 141 if (!d->ignore_mtime) 119 142 { 120 less = dep_name (d); 143 if (!d->need_2nd_expansion) 144 less = dep_name (d); 121 145 break; 122 146 } … … 150 174 unsigned int len; 151 175 176 struct hash_table dep_hash; 177 void **slot; 178 152 179 /* Compute first the value for $+, which is supposed to contain 153 180 duplicate dependencies as they were listed in the makefile. */ 154 181 155 182 plus_len = 0; 183 bar_len = 0; 156 184 for (d = file->deps; d != 0; d = d->next) 157 if (! d->ignore_mtime) 158 plus_len += strlen (dep_name (d)) + 1; 185 { 186 if (!d->need_2nd_expansion) 187 { 188 if (d->ignore_mtime) 189 bar_len += strlen (dep_name (d)) + 1; 190 else 191 plus_len += strlen (dep_name (d)) + 1; 192 } 193 } 194 195 if (bar_len == 0) 196 bar_len++; 197 159 198 if (plus_len == 0) 160 199 plus_len++; … … 162 201 if (plus_len > plus_max) 163 202 plus_value = xrealloc (plus_value, plus_max = plus_len); 203 164 204 cp = plus_value; 165 205 166 206 qmark_len = plus_len + 1; /* Will be this or less. */ 167 207 for (d = file->deps; d != 0; d = d->next) 168 if (! d->ignore_mtime )208 if (! d->ignore_mtime && ! d->need_2nd_expansion) 169 209 { 170 210 const char *c = dep_name (d); … … 183 223 cp += len; 184 224 *cp++ = FILE_LIST_SEPARATOR; 185 if (! d->changed)225 if (! (d->changed || always_make_flag)) 186 226 qmark_len -= len + 1; /* Don't space in $? for this one. */ 187 227 } … … 191 231 cp[cp > plus_value ? -1 : 0] = '\0'; 192 232 DEFINE_VARIABLE ("+", 1, plus_value); 193 194 /* Make sure that no dependencies are repeated. This does not195 really matter for the purpose of updating targets, but it196 might make some names be listed twice for $^ and $?. */197 198 uniquize_deps (file->deps);199 200 bar_len = 0;201 for (d = file->deps; d != 0; d = d->next)202 if (d->ignore_mtime)203 bar_len += strlen (dep_name (d)) + 1;204 if (bar_len == 0)205 bar_len++;206 233 207 234 /* Compute the values for $^, $?, and $|. */ … … 217 244 bp = bar_value; 218 245 246 /* Make sure that no dependencies are repeated in $^, $?, and $|. It 247 would be natural to combine the next two loops but we can't do it 248 because of a situation where we have two dep entries, the first 249 is order-only and the second is normal (see below). */ 250 251 hash_init (&dep_hash, 500, dep_hash_1, dep_hash_2, dep_hash_cmp); 252 219 253 for (d = file->deps; d != 0; d = d->next) 220 254 { 221 const char *c = dep_name (d); 222 255 if (d->need_2nd_expansion) 256 continue; 257 258 slot = hash_find_slot (&dep_hash, d); 259 if (HASH_VACANT (*slot)) 260 hash_insert_at (&dep_hash, d, slot); 261 else 262 { 263 /* Check if the two prerequisites have different ignore_mtime. 264 If so then we need to "upgrade" one that is order-only. */ 265 266 struct dep* hd = (struct dep*) *slot; 267 268 if (d->ignore_mtime != hd->ignore_mtime) 269 d->ignore_mtime = hd->ignore_mtime = 0; 270 } 271 } 272 273 for (d = file->deps; d != 0; d = d->next) 274 { 275 const char *c; 276 277 if (d->need_2nd_expansion || hash_find_item (&dep_hash, d) != d) 278 continue; 279 280 c = dep_name (d); 223 281 #ifndef NO_ARCHIVES 224 282 if (ar_name (c)) 225 283 { 226 284 c = strchr (c, '(') + 1; … … 233 291 if (d->ignore_mtime) 234 292 { 235 293 memcpy (bp, c, len); 236 294 bp += len; 237 295 *bp++ = FILE_LIST_SEPARATOR; 238 296 } 239 297 else 240 298 { 241 299 memcpy (cp, c, len); 242 300 cp += len; 243 301 *cp++ = FILE_LIST_SEPARATOR; 244 if (d->changed )302 if (d->changed || always_make_flag) 245 303 { 246 304 memcpy (qp, c, len); … … 251 309 } 252 310 311 hash_free (&dep_hash, 0); 312 253 313 /* Kill the last spaces and define the variables. */ 254 314 … … 273 333 chop_commands (struct commands *cmds) 274 334 { 275 const char *p;276 335 unsigned int nlines, idx; 277 336 char **lines; … … 283 342 return; 284 343 285 /* Chop CMDS->commands up into lines in CMDS->command_lines. 286 Also set the corresponding CMDS->lines_flags elements, 287 and the CMDS->any_recurse flag. */ 288 289 nlines = 5; 290 lines = xmalloc (5 * sizeof (char *)); 291 idx = 0; 292 p = cmds->commands; 293 while (*p != '\0') 294 { 295 const char *end = p; 296 find_end:; 297 end = strchr (end, '\n'); 298 if (end == 0) 299 end = p + strlen (p); 300 else if (end > p && end[-1] == '\\') 344 /* Chop CMDS->commands up into lines in CMDS->command_lines. */ 345 346 if (one_shell) 347 { 348 int l = strlen (cmds->commands); 349 350 nlines = 1; 351 lines = xmalloc (nlines * sizeof (char *)); 352 lines[0] = xstrdup (cmds->commands); 353 354 /* Strip the trailing newline. */ 355 if (l > 0 && lines[0][l-1] == '\n') 356 lines[0][l-1] = '\0'; 357 } 358 else 359 { 360 const char *p; 361 362 nlines = 5; 363 lines = xmalloc (nlines * sizeof (char *)); 364 idx = 0; 365 p = cmds->commands; 366 while (*p != '\0') 301 367 { 302 int backslash = 1; 303 const char *b; 304 for (b = end - 2; b >= p && *b == '\\'; --b) 305 backslash = !backslash; 306 if (backslash) 368 const char *end = p; 369 find_end:; 370 end = strchr (end, '\n'); 371 if (end == 0) 372 end = p + strlen (p); 373 else if (end > p && end[-1] == '\\') 307 374 { 308 ++end; 309 goto find_end; 375 int backslash = 1; 376 const char *b; 377 for (b = end - 2; b >= p && *b == '\\'; --b) 378 backslash = !backslash; 379 if (backslash) 380 { 381 ++end; 382 goto find_end; 383 } 310 384 } 385 386 if (idx == nlines) 387 { 388 nlines += 2; 389 lines = xrealloc (lines, nlines * sizeof (char *)); 390 } 391 lines[idx++] = xstrndup (p, end - p); 392 p = end; 393 if (*p != '\0') 394 ++p; 311 395 } 312 396 313 if (idx == nlines)397 if (idx != nlines) 314 398 { 315 nlines += 2;399 nlines = idx; 316 400 lines = xrealloc (lines, nlines * sizeof (char *)); 317 401 } 318 lines[idx++] = savestring (p, end - p); 319 p = end; 320 if (*p != '\0') 321 ++p; 322 } 323 324 if (idx != nlines) 325 { 326 nlines = idx; 327 lines = xrealloc (lines, nlines * sizeof (char *)); 328 } 402 } 403 404 /* Finally, set the corresponding CMDS->lines_flags elements and the 405 CMDS->any_recurse flag. */ 329 406 330 407 cmds->ncommand_lines = nlines; … … 333 410 cmds->any_recurse = 0; 334 411 cmds->lines_flags = xmalloc (nlines); 412 335 413 for (idx = 0; idx < nlines; ++idx) 336 414 { 337 415 int flags = 0; 338 339 for (p = lines[idx]; 340 isblank ((unsigned char)*p) || *p == '-' || *p == '@' || *p == '+'; 341 ++p) 342 switch (*p) 416 const char *p = lines[idx]; 417 418 while (isblank (*p) || *p == '-' || *p == '@' || *p == '+') 419 switch (*(p++)) 343 420 { 344 421 case '+': -
vendor/gnumake/current/commands.h
r1989 r2596 1 1 /* Definition of data structures describing shell commands for GNU Make. 2 2 Copyright (C) 1988, 1989, 1990, 1991, 1992, 1993, 1994, 1995, 1996, 1997, 3 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007 Free Software4 Foundation, Inc.3 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 4 2010 Free Software Foundation, Inc. 5 5 This file is part of GNU Make. 6 6 -
vendor/gnumake/current/config
- Property svn:ignore deleted
-
vendor/gnumake/current/config.ami.template
r1989 r2596 1 1 /* config.h -- hand-massaged for Amiga -*-C-*- 2 2 Copyright (C) 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, 3 2005, 2006, 2007 Free Software Foundation, Inc.3 2005, 2006, 2007, 2008, 2009, 2010 Free Software Foundation, Inc. 4 4 This file is part of GNU Make. 5 5 -
vendor/gnumake/current/config.h-vms.template
r1989 r2596 2 2 3 3 Copyright (C) 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005, 4 2006, 2007 Free Software Foundation, Inc.4 2006, 2007, 2008, 2009, 2010 Free Software Foundation, Inc. 5 5 This file is part of GNU Make. 6 6 … … 76 76 /* Define to 1 if you don't have vprintf but do have _doprnt. */ 77 77 /* #undef HAVE_DOPRNT */ 78 79 /* Define to 1 if you have the fdopen function. */ 80 #define HAVE_FDOPEN 1 78 81 79 82 /* Define to 1 if your system has a working fnmatch function. */ … … 290 293 291 294 /* Define to 1 if you have the strcasecmp function. */ 292 /* #undef HAVE_STRCASECMP */ 295 #define HAVE_STRCASECMP 1 293 296 294 297 /* Define to 1 if you have the strcmpi function. */ -
vendor/gnumake/current/config.h.W32.template
r1989 r2596 2 2 3 3 Copyright (C) 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005, 4 2006, 2007 Free Software Foundation, Inc.4 2006, 2007, 2008, 2009, 2010 Free Software Foundation, Inc. 5 5 This file is part of GNU Make. 6 6 … … 25 25 # pragma warning(disable:4131) /* uses old-style declarator */ 26 26 # pragma warning(disable:4702) /* unreachable code */ 27 # define _CRT_SECURE_NO_WARNINGS /* function or variable may be unsafe */ 28 # define _CRT_NONSTDC_NO_WARNINGS /* functions w/o a leading underscore */ 27 29 #endif 28 30 … … 228 230 229 231 /* Define to 1 if you have the `strcmpi' function. */ 230 #define HAVE_STRCMPI 1 232 /* #undef HAVE_STRCMPI */ 231 233 232 234 /* Define to 1 if you have the `stricmp' function. */ 233 /* #undef HAVE_STRICMP */ 235 #define HAVE_STRICMP 1 236 237 /* Define to 1 if you have the `strncasecmp' function. */ 238 /* #undef HAVE_STRNCASECMP */ 239 240 /* Define to 1 if you have the `strncmpi' function. */ 241 /* #undef HAVE_STRNCMPI */ 242 243 /* Define to 1 if you have the `strnicmp' function. */ 244 #define HAVE_STRNICMP 1 234 245 235 246 /* Define to 1 if you have the `strchr' function. */ … … 427 438 /* GCC 4.x reportedly defines pid_t. */ 428 439 #ifndef _PID_T_ 440 #ifdef _WIN64 441 #define pid_t __int64 442 #else 429 443 #define pid_t int 444 #endif 430 445 #endif 431 446 -
vendor/gnumake/current/config/ChangeLog
r1989 r2596 30 30 31 31 32 Copyright (C) 2002, 2003, 2004, 2005, 2006, 2007 Free Software Foundation, Inc. 32 Copyright (C) 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009 Free Software 33 Foundation, Inc. 33 34 This file is part of GNU Make. 34 35 -
vendor/gnumake/current/config/Makefile.am
r1989 r2596 1 1 # -*-Makefile-*-, or close enough 2 # Copyright (C) 2002, 2003, 2004, 2005, 2006, 2007 Free Software Foundation,3 # Inc.2 # Copyright (C) 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010 Free 3 # Software Foundation, Inc. 4 4 # This file is part of GNU Make. 5 5 # -
vendor/gnumake/current/config/dospaths.m4
r1989 r2596 3 3 # 4 4 # Copyright (C) 1993, 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, 5 # 2003, 2004, 2005, 2006, 2007 Free Software Foundation, Inc.5 # 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010 Free Software Foundation, Inc. 6 6 # This file is part of GNU Make. 7 7 # -
vendor/gnumake/current/configh.dos.template
r1989 r2596 2 2 3 3 Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 4 2004, 2005, 2006, 2007 Free Software Foundation, Inc.4 2004, 2005, 2006, 2007, 2008, 2009, 2010 Free Software Foundation, Inc. 5 5 This file is part of GNU Make. 6 6 … … 17 17 this program. If not, see <http://www.gnu.org/licenses/>. */ 18 18 19 /* Include this header to make __DJGPP_MINOR__ available because DJGPP ports 20 of GCC 4.3.0 and later no longer do it automatically. */ 21 #include <sys/version.h> 22 19 23 /* Many things are defined already by a system header. */ 20 24 #include <sys/config.h> … … 22 26 #if __DJGPP__ > 2 || __DJGPP_MINOR__ > 1 23 27 24 /* Define to 1 if `sys_siglist' is declared by <signal.h> .*/28 /* Define to 1 if `sys_siglist' is declared by <signal.h> or <unistd.h>. */ 25 29 # define SYS_SIGLIST_DECLARED 1 26 30 … … 108 112 #define PROTOTYPES 1 109 113 110 /* Define to 1 if `sys_siglist' is declared by <signal.h> or <unistd.h>. */111 #define SYS_SIGLIST_DECLARED 1112 113 114 /* Version number of package */ 114 115 #define VERSION "%VERSION%" -
vendor/gnumake/current/configure.bat
r1991 r2596 1 1 @echo off 2 2 rem Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 3 rem 2004, 2005, 2006, 2007 Free Software Foundation, Inc.3 rem 2004, 2005, 2006, 2007, 2008, 2009, 2010 Free Software Foundation, Inc. 4 4 rem This file is part of GNU Make. 5 5 rem -
vendor/gnumake/current/configure.in
r1989 r2596 2 2 # 3 3 # Copyright (C) 1993, 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, 4 # 2003, 2004, 2005, 2006, 2007 Free Software Foundation, Inc.4 # 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010 Free Software Foundation, Inc. 5 5 # This file is part of GNU Make. 6 6 # … … 18 18 # this program. If not, see <http://www.gnu.org/licenses/>. 19 19 20 AC_INIT([GNU make],[3.8 1.90],[bug-make@gnu.org])20 AC_INIT([GNU make],[3.82],[bug-make@gnu.org]) 21 21 22 22 AC_PREREQ(2.59) 23 AC_REVISION([[$Id: configure.in,v 1.1 48 2007/07/04 19:35:17psmith Exp $]])23 AC_REVISION([[$Id: configure.in,v 1.156 2010/07/28 05:39:50 psmith Exp $]]) 24 24 25 25 # Autoconf setup … … 148 148 fi 149 149 150 AC_CHECK_FUNCS( strdup mkstemp mktemp fdopen\151 bsd_signaldup2 getcwd realpath sigsetmask sigaction \150 AC_CHECK_FUNCS( strdup strndup mkstemp mktemp fdopen fileno \ 151 dup2 getcwd realpath sigsetmask sigaction \ 152 152 getgroups seteuid setegid setlinebuf setreuid setregid \ 153 153 getrlimit setrlimit setvbuf pipe strerror strsignal \ 154 154 lstat readlink atexit) 155 155 156 # We need to check declarations, not just existence, because on Tru64 this 157 # function is not declared without special flags, which themselves cause 158 # other problems. We'll just use our own. 159 AC_CHECK_DECLS([bsd_signal], [], [], [[#include <signal.h>]]) 160 156 161 AC_FUNC_SETVBUF_REVERSED 157 162 … … 159 164 # It doesn't hurt much to use our own if we can't find it so I don't 160 165 # make the effort here. 161 AC_CHECK_FUNCS(strcasecmp str cmpi stricmp)166 AC_CHECK_FUNCS(strcasecmp strncasecmp strcmpi strncmpi stricmp strnicmp) 162 167 163 168 # strcoll() is used by the GNU glob library … … 348 353 # Check the system to see if it provides GNU glob. If not, use our 349 354 # local version. 350 351 355 AC_MSG_CHECKING(if system libc has GNU glob) 352 356 AC_CACHE_VAL(make_cv_sys_gnu_glob, [ … … 365 369 ], [AC_MSG_RESULT(yes) 366 370 make_cv_sys_gnu_glob=yes], [AC_MSG_RESULT([no; using local copy]) 367 AC_SUBST(GLOBINC) GLOBINC='-I$(srcdir)/glob'368 AC_SUBST(GLOBLIB) GLOBLIB=glob/libglob.a369 371 make_cv_sys_gnu_glob=no])]) 372 if test "$make_cv_sys_gnu_glob" = no; then 373 GLOBINC='-I$(srcdir)/glob' 374 GLOBLIB=glob/libglob.a 375 fi 376 AC_SUBST(GLOBINC) 377 AC_SUBST(GLOBLIB) 378 370 379 # Tell automake about this, so it can build the right .c files. 371 380 AM_CONDITIONAL(USE_LOCAL_GLOB, test "$make_cv_sys_gnu_glob" = no) -
vendor/gnumake/current/debug.h
r1989 r2596 1 1 /* Debugging macros and interface. 2 Copyright (C) 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007 Free3 Software Foundation, Inc.2 Copyright (C) 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 3 2009, 2010 Free Software Foundation, Inc. 4 4 This file is part of GNU Make. 5 5 -
vendor/gnumake/current/default.c
r1989 r2596 1 1 /* Data base of default implicit rules for GNU Make. 2 2 Copyright (C) 1988, 1989, 1990, 1991, 1992, 1993, 1994, 1995, 1996, 1997, 3 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007 Free Software4 Foundation, Inc.3 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 4 2010 Free Software Foundation, Inc. 5 5 This file is part of GNU Make. 6 6 … … 540 540 541 541 if (no_builtin_rules_flag) 542 define_variable ("SUFFIXES", 8, "", o_default, 0);542 define_variable_cname ("SUFFIXES", "", o_default, 0); 543 543 else 544 544 { 545 545 char *p = default_suffixes; 546 suffix_file->deps = (struct dep *)547 multi_glob (parse_file_seq (&p, '\0', sizeof (struct dep), 1),548 sizeof (struct dep));549 define_variable ("SUFFIXES", 8, default_suffixes, o_default, 0);546 suffix_file->deps = enter_prereqs(PARSE_FILE_SEQ (&p, struct dep, '\0', 547 NULL, 0), 548 NULL); 549 define_variable_cname ("SUFFIXES", default_suffixes, o_default, 0); 550 550 } 551 551 } -
vendor/gnumake/current/dep.h
r1989 r2596 1 1 /* Definitions of dependency data structures for GNU Make. 2 2 Copyright (C) 1988, 1989, 1990, 1991, 1992, 1993, 1994, 1995, 1996, 1997, 3 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007 Free Software4 Foundation, Inc.3 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 4 2010 Free Software Foundation, Inc. 5 5 This file is part of GNU Make. 6 6 … … 44 44 unsigned int staticpattern : 1; 45 45 unsigned int need_2nd_expansion : 1; 46 unsigned int dontcare : 1; 46 47 }; 47 48 … … 56 57 57 58 58 struct nameseq *multi_glob (struct nameseq *chain, unsigned int size); 59 #define PARSEFS_NONE (0x0000) 60 #define PARSEFS_NOSTRIP (0x0001) 61 #define PARSEFS_NOAR (0x0002) 62 #define PARSEFS_NOGLOB (0x0004) 63 #define PARSEFS_EXISTS (0x0008) 64 #define PARSEFS_NOCACHE (0x0010) 65 66 #define PARSE_FILE_SEQ(_s,_t,_c,_p,_f) \ 67 (_t *)parse_file_seq ((_s),sizeof (_t),(_c),(_p),(_f)) 68 59 69 #ifdef VMS 60 struct nameseq*parse_file_seq ();70 void *parse_file_seq (); 61 71 #else 62 struct nameseq *parse_file_seq (char **stringp, int stopchar, unsigned int size, int strip); 72 void *parse_file_seq (char **stringp, unsigned int size, 73 int stopchar, const char *prefix, int flags); 63 74 #endif 75 64 76 char *tilde_expand (const char *name); 65 77 … … 68 80 #endif 69 81 70 #define dep_name(d) ((d)->name == 0 ? (d)->file->name : (d)->name)82 #define dep_name(d) ((d)->name == 0 ? (d)->file->name : (d)->name) 71 83 72 struct dep *alloc_dep (void); 73 void free_dep (struct dep *d); 84 #define alloc_dep() (xcalloc (sizeof (struct dep))) 85 #define free_ns(_n) free (_n) 86 #define free_dep(_d) free_ns (_d) 87 74 88 struct dep *copy_dep_chain (const struct dep *d); 75 89 void free_dep_chain (struct dep *d); 76 90 void free_ns_chain (struct nameseq *n); 77 91 struct dep *read_all_makefiles (const char **makefiles); 78 inteval_buffer (char *buffer);92 void eval_buffer (char *buffer); 79 93 int update_goal_chain (struct dep *goals); 80 void uniquize_deps (struct dep *); -
vendor/gnumake/current/dir.c
r1989 r2596 1 1 /* Directory hashing for GNU Make. 2 2 Copyright (C) 1988, 1989, 1990, 1991, 1992, 1993, 1994, 1995, 1996, 1997, 3 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007 Free Software4 Foundation, Inc.3 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 4 2010 Free Software Foundation, Inc. 5 5 This file is part of GNU Make. 6 6 … … 24 24 # define NAMLEN(dirent) strlen((dirent)->d_name) 25 25 # ifdef VMS 26 char *vmsify (char *name, int type); 26 /* its prototype is in vmsdir.h, which is not needed for HAVE_DIRENT_H */ 27 const char *vmsify (const char *name, int type); 27 28 # endif 28 29 #else … … 124 125 static PATH_VAR (new_filename); 125 126 char *df; 126 int i;127 127 128 128 if (filename == 0) … … 130 130 131 131 df = new_filename; 132 133 /* First, transform the name part. */134 132 while (*filename != '\0') 135 133 { … … 147 145 148 146 static int 149 vms_hash (c har *name)147 vms_hash (const char *name) 150 148 { 151 149 int h = 0; … … 173 171 /* fake stat entry for a directory */ 174 172 static int 175 vmsstat_dir (c har *name, struct stat *st)173 vmsstat_dir (const char *name, struct stat *st) 176 174 { 177 175 char *s; … … 186 184 if (s) 187 185 { 186 /* to keep the compiler happy we said "const char *name", now we cheat */ 188 187 *s++ = 0; 189 188 st->st_dev = (char *)vms_hash (name); … … 194 193 { 195 194 st->st_dev = 0; 196 s = name; 197 h = vms_hash (s); 195 h = vms_hash (name); 198 196 } 199 197 … … 453 451 p = name + strlen (name); 454 452 dir = xmalloc (sizeof (struct directory)); 453 #if defined(HAVE_CASE_INSENSITIVE_FS) && defined(VMS) 454 dir->name = strcache_add_len (downcase(name), p - name); 455 #else 455 456 dir->name = strcache_add_len (name, p - name); 457 #endif 456 458 hash_insert_at (&directories, dir, dir_slot); 457 459 /* The directory is not in the name hash table. … … 711 713 { 712 714 df = xmalloc (sizeof (struct dirfile)); 715 #if defined(HAVE_CASE_INSENSITIVE_FS) && defined(VMS) 716 df->name = strcache_add_len (downcase(d->d_name), len); 717 #else 713 718 df->name = strcache_add_len (d->d_name, len); 719 #endif 714 720 df->length = len; 715 721 df->impossible = 0; … … 717 723 } 718 724 /* Check if the name matches the one we're searching for. */ 719 if (filename != 0 && strieq (d->d_name, filename))725 if (filename != 0 && patheq (d->d_name, filename)) 720 726 return 1; 721 727 } … … 870 876 871 877 if (dir->contents == 0) 872 { 873 /* The directory could not be stat'd. We allocate a contents 874 structure for it, but leave it out of the contents hash table. */ 875 dir->contents = xmalloc (sizeof (struct directory_contents)); 876 memset (dir->contents, '\0', sizeof (struct directory_contents)); 877 } 878 /* The directory could not be stat'd. We allocate a contents 879 structure for it, but leave it out of the contents hash table. */ 880 dir->contents = xcalloc (sizeof (struct directory_contents)); 878 881 879 882 if (dir->contents->dirfiles.ht_vec == 0) … … 887 890 new = xmalloc (sizeof (struct dirfile)); 888 891 new->length = strlen (filename); 892 #if defined(HAVE_CASE_INSENSITIVE_FS) && defined(VMS) 893 new->name = strcache_add_len (downcase(filename), new->length); 894 #else 889 895 new->name = strcache_add_len (filename, new->length); 896 #endif 890 897 new->impossible = 1; 891 898 hash_insert (&dir->contents->dirfiles, new); -
vendor/gnumake/current/doc
- Property svn:ignore deleted
-
vendor/gnumake/current/doc/Makefile.am
r1989 r2596 1 1 # -*-Makefile-*-, or close enough 2 # Copyright (C) 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007 Free Software3 # Foundation, Inc.2 # Copyright (C) 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 3 # 2010 Free Software Foundation, Inc. 4 4 # This file is part of GNU Make. 5 5 # -
vendor/gnumake/current/doc/make.texi
r1989 r2596 4 4 5 5 @include version.texi 6 @set EDITION 0.7 07 @set RCSID $Id: make.texi,v 1. 52 2008/05/18 15:11:40psmith Exp $6 @set EDITION 0.71 7 @set RCSID $Id: make.texi,v 1.66 2010/07/19 07:10:54 psmith Exp $ 8 8 9 9 @settitle GNU @code{make} … … 14 14 @syncodeindex pg cp 15 15 @c FSF publishers: format makebook.texi instead of using this file directly. 16 @c ISBN provided by Lisa M. Opus Goldstein <opus@gnu.org>, 5 May 200417 @set ISBN 1-882114-83- 516 @c ISBN confirmed by Jasimin Huang <jasimin@fsf.org> on 25 Mar 2009 17 @set ISBN 1-882114-83-3 18 18 @c %**end of header 19 19 … … 27 27 28 28 Copyright @copyright{} 1988, 1989, 1990, 1991, 1992, 1993, 1994, 1995, 29 1996, 1997, 1998, 1999, 2000, 2002, 2003, 2004, 2005, 2006, 2007 30 Free Software Foundation, Inc.29 1996, 1997, 1998, 1999, 2000, 2002, 2003, 2004, 2005, 2006, 2007, 30 2008, 2009, 2010 Free Software Foundation, Inc. 31 31 32 32 @quotation … … 39 39 License.'' 40 40 41 (a) The FSF's Back-Cover Text is: ``You are free to copy and modify42 this GNU Manual. Buying copies from GNU Press supports the FSFin41 (a) The FSF's Back-Cover Text is: ``You have the freedom to copy and 42 modify this GNU manual. Buying copies from the FSF supports it in 43 43 developing GNU and promoting software freedom.'' 44 44 @end quotation … … 202 202 * Interrupts:: What happens when a recipe is interrupted. 203 203 * Recursion:: Invoking @code{make} from makefiles. 204 * Sequences::Defining canned recipes.204 * Canned Recipes:: Defining canned recipes. 205 205 * Empty Recipes:: Defining useful, do-nothing recipes. 206 206 … … 234 234 * Override Directive:: How to set a variable in the makefile even if 235 235 the user has set it with a command argument. 236 * Defining::An alternate way to set a variable237 to a verbatimstring.236 * Multi-Line:: An alternate way to set a variable 237 to a multi-line string. 238 238 * Environment:: Variable values can come from the environment. 239 239 * Target-specific:: Variable values can be defined on a per-target … … 241 241 * Pattern-specific:: Target-specific variable values can be applied 242 242 to a group of targets that match a pattern. 243 * Suppressing Inheritance:: Suppress inheritance of variables. 243 244 * Special Variables:: Variables with special meaning or behavior. 244 245 … … 524 525 525 526 @cindex tabs in rules 526 A @dfn{recipe} is an action that @code{make} carries out. 527 A recipe may have more than one command, each on its own line. 528 @strong{Please note:} you need to put a tab character at the beginning of 529 every command line! This is an obscurity that catches the unwary. If 530 you prefer to prefix your recipes with a character other than tab, 531 you can set the @code{.CMDPREFIX} variable to an alternate character 532 (@pxref{Special Variables}).527 A @dfn{recipe} is an action that @code{make} carries out. A recipe 528 may have more than one command, either on the same line or each on its 529 own line. @strong{Please note:} you need to put a tab character at 530 the beginning of every recipe line! This is an obscurity that catches 531 the unwary. If you prefer to prefix your recipes with a character 532 other than tab, you can set the @code{.RECIPEPREFIX} variable to an 533 alternate character (@pxref{Special Variables}). 533 534 534 535 Usually a recipe is in a rule with prerequisites and serves to create a … … 629 630 prerequisites. These recipes say how to update the target file. A 630 631 tab character (or whatever character is specified by the 631 @code{. CMDPREFIX} variable; @pxref{Special Variables}) must come at632 @code{.RECIPEPREFIX} variable; @pxref{Special Variables}) must come at 632 633 the beginning of every line in the recipe to distinguish recipes from 633 634 other lines in the makefile. (Bear in mind that @code{make} does not 634 635 know anything about how the recipes work. It is up to you to supply 635 636 recipes that will update the target file properly. All @code{make} 636 does is execute the commands in the recipe you have specified when the637 target fileneeds to be updated.)@refill637 does is execute the recipe you have specified when the target file 638 needs to be updated.)@refill 638 639 @cindex recipe 639 640 … … 996 997 @item 997 998 Defining a variable from a verbatim string containing multiple lines 998 (@pxref{ Defining, ,Defining Variables Verbatim}).999 (@pxref{Multi-Line, ,Defining Multi-Line Variables}). 999 1000 @end itemize 1000 1001 … … 1097 1098 Extra spaces are allowed and ignored at the beginning of the line, but 1098 1099 the first character must not be a tab (or the value of 1099 @code{. CMDPREFIX})---if the line begins with a tab, it will be1100 @code{.RECIPEPREFIX})---if the line begins with a tab, it will be 1100 1101 considered a recipe line. Whitespace is required between 1101 1102 @code{include} and the file names, and between file names; extra … … 1171 1172 1172 1173 If you want @code{make} to simply ignore a makefile which does not exist 1173 andcannot be remade, with no error message, use the @w{@code{-include}}1174 or cannot be remade, with no error message, use the @w{@code{-include}} 1174 1175 directive instead of @code{include}, like this: 1175 1176 … … 1179 1180 1180 1181 This acts like @code{include} in every way except that there is no 1181 error (not even a warning) if any of the @var{filenames} do not exist. 1182 error (not even a warning) if any of the @var{filenames} (or any 1183 prerequisites of any of the @var{filenames}) do not exist or cannot be 1184 remade. 1185 1182 1186 For compatibility with some other @code{make} implementations, 1183 1187 @code{sinclude} is another name for @w{@code{-include}}. … … 1191 1195 If the environment variable @code{MAKEFILES} is defined, @code{make} 1192 1196 considers its value as a list of names (separated by whitespace) of 1193 additional makefiles to be read before the others. This works much like 1194 the @code{include} directive: various directories are searched for those 1195 files (@pxref{Include, ,Including Other Makefiles}). In addition, the 1196 default goal is never taken from one of these makefiles and it is not an 1197 error if the files listed in @code{MAKEFILES} are not found.@refill 1197 additional makefiles to be read before the others. This works much 1198 like the @code{include} directive: various directories are searched 1199 for those files (@pxref{Include, ,Including Other Makefiles}). In 1200 addition, the default goal is never taken from one of these makefiles 1201 (or any makefile included by them) and it is not an error if the files 1202 listed in @code{MAKEFILES} are not found.@refill 1198 1203 1199 1204 @cindex recursion, and @code{MAKEFILES} variable … … 1269 1274 1270 1275 When you use the @samp{-t} or @samp{--touch} option 1271 (@pxref{Instead of Execution, ,Instead of Executing the Recipe}),1276 (@pxref{Instead of Execution, ,Instead of Executing Recipes}), 1272 1277 you would not want to use an out-of-date makefile to decide which 1273 1278 targets to touch. So the @samp{-t} option has no effect on updating … … 1387 1392 define @var{immediate} 1388 1393 @var{deferred} 1394 endef 1395 1396 define @var{immediate} = 1397 @var{deferred} 1398 endef 1399 1400 define @var{immediate} ?= 1401 @var{deferred} 1402 endef 1403 1404 define @var{immediate} := 1405 @var{immediate} 1406 endef 1407 1408 define @var{immediate} += 1409 @var{deferred} or @var{immediate} 1389 1410 endef 1390 1411 @end example … … 1748 1769 @cindex tab character (in commands) 1749 1770 The @var{recipe} lines start with a tab character (or the first 1750 character in the value of the @code{. CMDPREFIX} variable;1771 character in the value of the @code{.RECIPEPREFIX} variable; 1751 1772 @pxref{Special Variables}). The first recipe line may appear on the line 1752 1773 after the prerequisites, with a tab character, or may appear on the … … 1802 1823 GNU @code{make}: normal prerequisites such as described in the 1803 1824 previous section, and @dfn{order-only} prerequisites. A normal 1804 prerequisite makes two statements: first, it imposes an order of1805 execution of recipes: any recipes necessary to build any of a 1806 target's prerequisites will be fully executed before any recipe 1807 necessary to build the target. Second, it imposes a dependency 1808 relationship: if any prerequisite is newer than the target, then the1809 target is considered out-of-date and must berebuilt.1825 prerequisite makes two statements: first, it imposes an order in which 1826 recipes will be invoked: the recipes for all prerequisites of a target 1827 will be completed before the recipe for the target is run. Second, it 1828 imposes a dependency relationship: if any prerequisite is newer than 1829 the target, then the target is considered out-of-date and must be 1830 rebuilt. 1810 1831 1811 1832 Normally, this is exactly what you want: if a target's prerequisite is … … 1949 1970 @noindent 1950 1971 then the value of the variable @code{objects} is the actual string 1951 @samp{*.o}. However, if you use the value of @code{objects} in a target, 1952 prerequisite, or recipe, wildcard expansion will take place at that time. 1953 To set @code{objects} to the expansion, instead use: 1972 @samp{*.o}. However, if you use the value of @code{objects} in a 1973 target or prerequisite, wildcard expansion will take place there. If 1974 you use the value of @code{objects} in a recipe, the shell may perform 1975 wildcard expansion when the recipe runs. To set @code{objects} to the 1976 expansion, instead use: 1954 1977 1955 1978 @example … … 2403 2426 2404 2427 When a prerequisite's name has the form @samp{-l@var{name}}, @code{make} 2405 handles it specially by searching for the file @file{lib@var{name}.so} in 2406 the current directory, in directories specified by matching @code{vpath} 2428 handles it specially by searching for the file @file{lib@var{name}.so}, 2429 and, if it is not found, for the file @file{lib@var{name}.a} in the current 2430 directory, in directories specified by matching @code{vpath} 2407 2431 search paths and the @code{VPATH} search path, and then in the 2408 2432 directories @file{/lib}, @file{/usr/lib}, and @file{@var{prefix}/lib} … … 2410 2434 @code{make} behave as if @var{prefix} is defined to be the root of the 2411 2435 DJGPP installation tree). 2412 2413 If that file is not found, then the file @file{lib@var{name}.a} is2414 searched for, in the same directories as above.2415 2436 2416 2437 For example, if there is a @file{/usr/lib/libcurses.a} library on your … … 2435 2456 @samp{-l@var{name}} is seen, @code{make} will replace the percent in 2436 2457 each pattern in the list with @var{name} and perform the above directory 2437 searches using that library filename. If no library is found, the next 2438 word in the list will be used. 2458 searches using each library filename. 2439 2459 2440 2460 The default value for @code{.LIBPATTERNS} is @samp{lib%.so lib%.a}, … … 2854 2874 recipes in parallel (unless its makefile also contains this target). 2855 2875 Any prerequisites on this target are ignored. 2876 2877 @findex .ONESHELL 2878 @item .ONESHELL 2879 @cindex recipe execution, single invocation 2880 2881 If @code{.ONESHELL} is mentioned as a target, then when a target is 2882 built all lines of the recipe will be given to a single invocation of 2883 the shell rather than each line being invoked separately 2884 (@pxref{Execution, ,Recipe Execution}). 2885 2886 @findex .POSIX 2887 @item .POSIX 2888 @cindex POSIX-conforming mode, setting 2889 2890 If @code{.POSIX} is mentioned as a target, then the makefile will be 2891 parsed and run in POSIX-conforming mode. This does @emph{not} mean 2892 that only POSIX-conforming makefiles will be accepted: all advanced 2893 GNU @code{make} features are still available. Rather, this target 2894 causes @code{make} to behave as required by POSIX in those areas 2895 where @code{make}'s default behavior differs. 2896 2897 In particular, if this target is mentioned then recipes will be 2898 invoked as if the shell had been passed the @code{-e} flag: the first 2899 failing command in a recipe will cause the recipe to fail immediately. 2856 2900 @end table 2857 2901 … … 3168 3212 @cindex @code{::} rules (double-colon) 3169 3213 3170 @dfn{Double-colon} rules are rules written with @samp{::} instead of 3171 @samp{:} after the target names. They are handled differently from 3172 ordinary rules when the same target appears in more than one rule. 3214 @dfn{Double-colon} rules are explicit rules written with @samp{::} 3215 instead of @samp{:} after the target names. They are handled 3216 differently from ordinary rules when the same target appears in more 3217 than one rule. Pattern rules with double-colons have an entirely 3218 different meaning (@pxref{Match-Anything Rules}). 3173 3219 3174 3220 When a target appears in multiple rules, all the rules must be the same … … 3351 3397 Users use many different shell programs, but recipes in makefiles are 3352 3398 always interpreted by @file{/bin/sh} unless the makefile specifies 3353 otherwise. @xref{Execution, , CommandExecution}.3399 otherwise. @xref{Execution, ,Recipe Execution}. 3354 3400 3355 3401 @menu … … 3361 3407 * Interrupts:: What happens when a recipe is interrupted. 3362 3408 * Recursion:: Invoking @code{make} from makefiles. 3363 * Sequences::Defining canned recipes.3409 * Canned Recipes:: Defining canned recipes. 3364 3410 * Empty Recipes:: Defining useful, do-nothing recipes. 3365 3411 @end menu … … 3379 3425 3380 3426 Each line in the recipe must start with a tab (or the first character 3381 in the value of the @code{. CMDPREFIX} variable; @pxref{Special3427 in the value of the @code{.RECIPEPREFIX} variable; @pxref{Special 3382 3428 Variables}), except that the first recipe line may be attached to the 3383 3429 target-and-prerequisites line with a semicolon in between. @emph{Any} … … 3629 3675 @cindex @code{--dry-run} 3630 3676 @cindex @code{--recon} 3631 When @code{make} is given the flag @samp{-n} or @samp{--just-print} 3632 it only echoes recipes, it won't execute them. @xref{Options Summary, 3633 ,Summary of Options}. In this case and only this case, even the 3634 recipe lines starting with @samp{@@} are printed. This flag is useful for 3635 finding out which recipes @code{make} thinks are necessary without 3636 actuallydoing them.3677 When @code{make} is given the flag @samp{-n} or @samp{--just-print} it 3678 only echoes most recipes, without executing them. @xref{Options 3679 Summary, ,Summary of Options}. In this case even the recipe lines 3680 starting with @samp{@@} are printed. This flag is useful for finding 3681 out which recipes @code{make} thinks are necessary without actually 3682 doing them. 3637 3683 3638 3684 @cindex @code{-s} … … 3654 3700 3655 3701 When it is time to execute recipes to update a target, they are 3656 executed by invoking a new subshell for each line of the recipe. (In 3657 practice, @code{make} may take shortcuts that do not affect the 3658 results.) 3702 executed by invoking a new subshell for each line of the recipe, 3703 unless the @code{.ONESHELL} special target is in effect 3704 (@pxref{One Shell, ,Using One Shell}) (In practice, @code{make} may 3705 take shortcuts that do not affect the results.) 3659 3706 3660 3707 @cindex @code{cd} (shell command) … … 3684 3731 3685 3732 @menu 3733 * One Shell:: One shell for all lines in a recipe 3686 3734 * Choosing the Shell:: How @code{make} chooses the shell used 3687 3735 to run recipes. 3688 3736 @end menu 3689 3737 3690 @node Choosing the Shell, , Execution, Execution 3738 @node One Shell, Choosing the Shell, Execution, Execution 3739 @subsection Using One Shell 3740 @cindex recipe lines, single shell 3741 @cindex @code{.ONESHELL}, use of 3742 @findex .ONESHELL 3743 3744 Sometimes you would prefer that all the lines in the recipe be passed 3745 to a single invocation of the shell. There are generally two 3746 situations where this is useful: first, it can improve performance in 3747 makefiles where recipes consist of many command lines, by avoiding 3748 extra processes. Second, you might want newlines to be included in 3749 your recipe command (for example perhaps you are using a very 3750 different interpreter as your @code{SHELL}). If the @code{.ONESHELL} 3751 special target appears anywhere in the makefile then @emph{all} 3752 recipe lines for each target will be provided to a single invocation 3753 of the shell. Newlines between recipe lines will be preserved. For 3754 example: 3755 3756 @example 3757 .ONESHELL: 3758 foo : bar/lose 3759 cd $(@@D) 3760 gobble $(@@F) > ../$@@ 3761 @end example 3762 3763 @noindent 3764 would now work as expected even though the commands are on different 3765 recipe lines. 3766 3767 If @code{.ONESHELL} is provided, then only the first line of the 3768 recipe will be checked for the special prefix characters (@samp{@@}, 3769 @samp{-}, and @samp{+}). Subsequent lines will include the special 3770 characters in the recipe line when the @code{SHELL} is invoked. If 3771 you want your recipe to start with one of these special characters 3772 you'll need to arrange for them to not be the first characters on the 3773 first line, perhaps by adding a comment or similar. For example, this 3774 would be a syntax error in Perl because the first @samp{@@} is removed 3775 by make: 3776 3777 @example 3778 .ONESHELL: 3779 SHELL = /usr/bin/perl 3780 .SHELLFLAGS = -e 3781 show : 3782 @@f = qw(a b c); 3783 print "@@f\n"; 3784 @end example 3785 3786 @noindent 3787 However, either of these alternatives would work properly: 3788 3789 @example 3790 .ONESHELL: 3791 SHELL = /usr/bin/perl 3792 .SHELLFLAGS = -e 3793 show : 3794 # Make sure "@@" is not the first character on the first line 3795 @@f = qw(a b c); 3796 print "@@f\n"; 3797 @end example 3798 3799 @noindent 3800 or 3801 3802 @example 3803 .ONESHELL: 3804 SHELL = /usr/bin/perl 3805 .SHELLFLAGS = -e 3806 show : 3807 my @@f = qw(a b c); 3808 print "@@f\n"; 3809 @end example 3810 3811 As a special feature, if @code{SHELL} is determined to be a 3812 POSIX-style shell, the special prefix characters in ``internal'' 3813 recipe lines will @emph{removed} before the recipe is processed. This 3814 feature is intended to allow existing makefiles to add the 3815 @code{.ONESHELL} special target and still run properly without 3816 extensive modifications. Since the special prefix characters are not 3817 legal at the beginning of a line in a POSIX shell script this is not a 3818 loss in functionality. For example, this works as expected: 3819 3820 @example 3821 .ONESHELL: 3822 foo : bar/lose 3823 @@cd $(@@D) 3824 @@gobble $(@@F) > ../$@@ 3825 @end example 3826 3827 Even with this special feature, however, makefiles with 3828 @code{.ONESHELL} will behave differently in ways that could be 3829 noticeable. For example, normally if any line in the recipe fails, 3830 that causes the rule to fail and no more recipe lines are processed. 3831 Under @code{.ONESHELL} a failure of any but the final recipe line will 3832 not be noticed by @code{make}. You can modify @code{.SHELLFLAGS} to 3833 add the @code{-e} option to the shell which will cause any failure 3834 anywhere in the command line to cause the shell to fail, but this 3835 could itself cause your recipe to behave differently. Ultimately you 3836 may need to harden your recipe lines to allow them to work with 3837 @code{.ONESHELL}. 3838 3839 @node Choosing the Shell, , One Shell, Execution 3691 3840 @subsection Choosing the Shell 3692 3841 @cindex shell, choosing the 3693 3842 @cindex @code{SHELL}, value of 3843 @cindex @code{.SHELLFLAGS}, value of 3694 3844 3695 3845 @vindex SHELL 3846 @vindex .SHELLFLAGS 3696 3847 The program used as the shell is taken from the variable @code{SHELL}. 3697 3848 If this variable is not set in your makefile, the program 3698 @file{/bin/sh} is used as the shell. 3849 @file{/bin/sh} is used as the shell. The argument(s) passed to the 3850 shell are taken from the variable @code{.SHELLFLAGS}. The default 3851 value of @code{.SHELLFLAGS} is @code{-c} normally, or @code{-ec} in 3852 POSIX-conforming mode. 3699 3853 3700 3854 @cindex environment, @code{SHELL} in … … 3786 3940 on MS-DOS unaltered if you have e.g.@: @file{sh.exe} installed in some 3787 3941 directory along your @code{PATH}. 3942 3943 @vindex SHELL 3944 @vindex .SHELLFLAGS 3788 3945 3789 3946 @node Parallel, Errors, Execution, Recipes … … 4014 4171 times to prevent other sorts of trouble. 4015 4172 4016 @node Recursion, Sequences, Interrupts, Recipes4173 @node Recursion, Canned Recipes, Interrupts, Recipes 4017 4174 @section Recursive Use of @code{make} 4018 4175 @cindex recursion … … 4360 4517 ensure that there are only @samp{N} jobs running at the same time 4361 4518 between them all. Note that any job that is marked recursive 4362 (@pxref{Instead of Execution, ,Instead of Executing theRecipes})4519 (@pxref{Instead of Execution, ,Instead of Executing Recipes}) 4363 4520 doesn't count against the total jobs (otherwise we could get @samp{N} 4364 4521 sub-@code{make}s running and have no slots left over for any real work!) … … 4496 4653 disable it. 4497 4654 4498 @node Sequences, Empty Recipes, Recursion, Recipes4655 @node Canned Recipes, Empty Recipes, Recursion, Recipes 4499 4656 @section Defining Canned Recipes 4500 4657 @cindex canned recipes … … 4509 4666 not conflict with other variable names. 4510 4667 4511 Here is an example of defining a canned recipe s:4512 4513 @example 4514 define run-yacc 4668 Here is an example of defining a canned recipe: 4669 4670 @example 4671 define run-yacc = 4515 4672 yacc $(firstword $^) 4516 4673 mv y.tab.c $@@ … … 4526 4683 parentheses, variable names, and so on, all become part of the value of the 4527 4684 variable you are defining. 4528 @xref{ Defining, ,Defining Variables Verbatim},4685 @xref{Multi-Line, ,Defining Multi-Line Variables}, 4529 4686 for a complete explanation of @code{define}. 4530 4687 … … 4567 4724 4568 4725 @example 4569 define frobnicate 4726 define frobnicate = 4570 4727 @@echo "frobnicating target $@@" 4571 4728 frob-step-1 $< -o $@@-step-1 … … 4590 4747 (@xref{Echoing, ,Recipe Echoing}, for a full explanation of @samp{@@}.) 4591 4748 4592 @node Empty Recipes, , Sequences, Recipes4749 @node Empty Recipes, , Canned Recipes, Recipes 4593 4750 @section Using Empty Recipes 4594 4751 @cindex empty recipes … … 4685 4842 * Override Directive:: How to set a variable in the makefile even if 4686 4843 the user has set it with a command argument. 4687 * Defining:: An alternate way to set a variable 4688 to a verbatim string. 4844 * Multi-Line:: An alternate way to set a variable 4845 to a multi-line string. 4846 * Undefine Directive:: How to undefine a variable so that it appears 4847 as if it was never set. 4689 4848 * Environment:: Variable values can come from the environment. 4690 4849 * Target-specific:: Variable values can be defined on a per-target … … 4692 4851 * Pattern-specific:: Target-specific variable values can be applied 4693 4852 to a group of targets that match a pattern. 4853 * Suppressing Inheritance:: Suppress inheritance of variables. 4694 4854 * Special Variables:: Variables with special meaning or behavior. 4695 4855 @end menu … … 4761 4921 Variables of this sort are defined by lines using @samp{=} 4762 4922 (@pxref{Setting, ,Setting Variables}) or by the @code{define} directive 4763 (@pxref{ Defining, ,Defining Variables Verbatim}). The value you specify4923 (@pxref{Multi-Line, ,Defining Multi-Line Variables}). The value you specify 4764 4924 is installed verbatim; if it contains references to other variables, 4765 4925 these references are expanded whenever this variable is substituted (in … … 5188 5348 dir = foo 5189 5349 $(dir)_sources := $(wildcard $(dir)/*.c) 5190 define $(dir)_print 5350 define $(dir)_print = 5191 5351 lpr $($(dir)_sources) 5192 5352 endef … … 5217 5377 You can specify a value in the makefile, either 5218 5378 with an assignment (@pxref{Setting, ,Setting Variables}) or with a 5219 verbatim definition (@pxref{ Defining, ,Defining Variables Verbatim}).@refill5379 verbatim definition (@pxref{Multi-Line, ,Defining Multi-Line Variables}).@refill 5220 5380 5221 5381 @item … … 5425 5585 value. 5426 5586 5427 @node Override Directive, Defining, Appending, Using Variables5587 @node Override Directive, Multi-Line, Appending, Using Variables 5428 5588 @section The @code{override} Directive 5429 5589 @findex override … … 5458 5618 @xref{Appending, ,Appending More Text to Variables}. 5459 5619 5620 Variable assignments marked with the @code{override} flag have a 5621 higher priority than all other assignments, except another 5622 @code{override}. Subsequent assignments or appends to this variable 5623 which are not marked @code{override} will be ignored. 5624 5460 5625 The @code{override} directive was not invented for escalation in the war 5461 5626 between makefiles and command arguments. It was invented so you can alter … … 5475 5640 5476 5641 @example 5477 override define foo 5642 override define foo = 5478 5643 bar 5479 5644 endef … … 5485 5650 @end iftex 5486 5651 @ifnottex 5487 @xref{ Defining, ,Defining Variables Verbatim}.5652 @xref{Multi-Line, ,Defining Multi-Line Variables}. 5488 5653 @end ifnottex 5489 5654 5490 @node Defining, Environment, Override Directive, Using Variables5491 @section Defining Variables Verbatim5655 @node Multi-Line, Undefine Directive, Override Directive, Using Variables 5656 @section Defining Multi-Line Variables 5492 5657 @findex define 5493 5658 @findex endef 5659 @cindex multi-line variable definition 5660 @cindex variables, multi-line 5494 5661 @cindex verbatim variable definition 5495 5662 @cindex defining variables verbatim … … 5498 5665 Another way to set the value of a variable is to use the @code{define} 5499 5666 directive. This directive has an unusual syntax which allows newline 5500 characters to be included in the value, which is convenient for defining5501 both canned sequences of commands 5502 (@pxref{Sequences, ,Defining Canned Command Sequences}), and also5503 sections of makefile syntax to use with @code{eval} (@pxref{Eval Function}). 5504 5505 The @code{define} directive is followed on the same line by the name of the5506 variable and nothing more. The value to give the variable appears on the 5507 following lines. The end of the value is marked by a line containing just 5508 the word @code{endef}. Aside from this difference in syntax, @code{define} 5509 works just like @samp{=}: it creates a recursively-expanded variable 5510 (@pxref{Flavors, ,The Two Flavors of Variables}). 5511 The variable name may contain function and variable references, which 5512 areexpanded when the directive is read to find the actual variable name5667 characters to be included in the value, which is convenient for 5668 defining both canned sequences of commands (@pxref{Canned Recipes, 5669 ,Defining Canned Recipes}), and also sections of makefile syntax to 5670 use with @code{eval} (@pxref{Eval Function}).@refill 5671 5672 The @code{define} directive is followed on the same line by the name 5673 of the variable being defined and an (optional) assignment operator, 5674 and nothing more. The value to give the variable appears on the 5675 following lines. The end of the value is marked by a line containing 5676 just the word @code{endef}. Aside from this difference in syntax, 5677 @code{define} works just like any other variable definition. The 5678 variable name may contain function and variable references, which are 5679 expanded when the directive is read to find the actual variable name 5513 5680 to use. 5681 5682 You may omit the variable assignment operator if you prefer. If 5683 omitted, @code{make} assumes it to be @samp{=} and creates a 5684 recursively-expanded variable (@pxref{Flavors, ,The Two Flavors of Variables}). 5685 When using a @samp{+=} operator, the value is appended to the previous 5686 value as with any other append operation: with a single space 5687 separating the old and new values. 5514 5688 5515 5689 You may nest @code{define} directives: @code{make} will keep track of … … 5518 5692 prefix character are considered part of a recipe, so any @code{define} 5519 5693 or @code{endef} strings appearing on such a line will not be 5520 considered @code{make} operators.5521 5522 @example 5523 define two-lines 5694 considered @code{make} directives. 5695 5696 @example 5697 define two-lines = 5524 5698 echo foo 5525 5699 echo $(bar) … … 5551 5725 5552 5726 @example 5553 override define two-lines 5727 override define two-lines = 5554 5728 foo 5555 5729 $(bar) … … 5560 5734 @xref{Override Directive, ,The @code{override} Directive}. 5561 5735 5562 @node Environment, Target-specific, Defining, Using Variables 5736 @node Undefine Directive, Environment, Multi-Line, Using Variables 5737 @section Undefining Variables 5738 @findex undefine 5739 @cindex undefining variable 5740 5741 If you want to clear a variable, setting its value to empty is usually 5742 sufficient. Expanding such a variable will yield the same result (empty 5743 string) regardless of whether it was set or not. However, if you are 5744 using the @code{flavor} (@pxref{Flavor Function}) and 5745 @code{origin} (@pxref{Origin Function}) functions, there is a difference 5746 between a variable that was never set and a variable with an empty value. 5747 In such situations you may want to use the @code{undefine} directive to 5748 make a variable appear as if it was never set. For example: 5749 5750 @example 5751 foo := foo 5752 bar = bar 5753 5754 undefine foo 5755 undefine bar 5756 5757 $(info $(origin foo)) 5758 $(info $(flavor bar)) 5759 @end example 5760 5761 This example will print ``undefined'' for both variables. 5762 5763 If you want to undefine a command-line variable definition, you can use 5764 the @code{override} directive together with @code{undefine}, similar to 5765 how this is done for variable definitions: 5766 5767 @example 5768 override undefine CFLAGS 5769 @end example 5770 5771 @node Environment, Target-specific, Undefine Directive, Using Variables 5563 5772 @section Variables from the Environment 5564 5773 … … 5626 5835 @end example 5627 5836 5628 @noindent 5629 or like this: 5630 5631 @example 5632 @var{target} @dots{} : override @var{variable-assignment} 5633 @end example 5634 5635 @noindent 5636 or like this: 5637 5638 @example 5639 @var{target} @dots{} : export @var{variable-assignment} 5640 @end example 5837 Target-specific variable assignments can be prefixed with any or all of the 5838 special keywords @code{export}, @code{override}, or @code{private}; 5839 these apply their normal behavior to this instance of the variable only. 5641 5840 5642 5841 Multiple @var{target} values create a target-specific variable value for … … 5684 5883 ignore the target-specific values from any other targets. 5685 5884 5686 @node Pattern-specific, S pecial Variables, Target-specific, Using Variables5885 @node Pattern-specific, Suppressing Inheritance, Target-specific, Using Variables 5687 5886 @section Pattern-specific Variable Values 5688 5887 @cindex pattern-specific variables … … 5693 5892 @code{make} supports pattern-specific variable values. In this form, 5694 5893 the variable is defined for any target that matches the pattern 5695 specified. If a target matches more than one pattern, all the 5696 matching pattern-specific variables are interpreted in the order in 5697 which they were defined in the makefile, and collected together into 5698 one set. Variables defined in this way are searched after any 5699 target-specific variables defined explicitly for that target, and 5700 before target-specific variables defined for the parent target. 5894 specified. 5701 5895 5702 5896 Set a pattern-specific variable value like this: … … 5705 5899 @var{pattern} @dots{} : @var{variable-assignment} 5706 5900 @end example 5707 5708 @noindent5709 or like this:5710 5711 @example5712 @var{pattern} @dots{} : override @var{variable-assignment}5713 @end example5714 5715 @noindent5716 5901 where @var{pattern} is a %-pattern. As with target-specific variable 5717 5902 values, multiple @var{pattern} values create a pattern-specific variable … … 5730 5915 matching the pattern @code{%.o}. 5731 5916 5732 @node Special Variables, , Pattern-specific, Using Variables 5917 If a target matches more than one pattern, the matching pattern-specific 5918 variables with longer stems are interpreted first. This results in more 5919 specific variables taking precedence over the more generic ones, for 5920 example: 5921 5922 @example 5923 %.o: %.c 5924 $(CC) -c $(CFLAGS) $(CPPFLAGS) $< -o $@@ 5925 5926 lib/%.o: CFLAGS := -fPIC -g 5927 %.o: CFLAGS := -g 5928 5929 all: foo.o lib/bar.o 5930 @end example 5931 5932 In this example the first definition of the @code{CFLAGS} variable 5933 will be used to update @file{lib/bar.o} even though the second one 5934 also applies to this target. Pattern-specific variables which result 5935 in the same stem length are considered in the order in which they 5936 were defined in the makefile. 5937 5938 Pattern-specific variables are searched after any target-specific 5939 variables defined explicitly for that target, and before target-specific 5940 variables defined for the parent target. 5941 5942 @node Suppressing Inheritance, Special Variables, Pattern-specific, Using Variables 5943 @section Suppressing Inheritance 5944 @findex private 5945 @cindex suppressing inheritance 5946 @cindex inheritance, suppressing 5947 5948 As described in previous sections, @code{make} variables are inherited 5949 by prerequisites. This capability allows you to modify the behavior 5950 of a prerequisite based on which targets caused it to be rebuilt. For 5951 example, you might set a target-specific variable on a @code{debug} 5952 target, then running @samp{make debug} will cause that variable to be 5953 inherited by all prerequisites of @code{debug}, while just running 5954 @samp{make all} (for example) would not have that assignment. 5955 5956 Sometimes, however, you may not want a variable to be inherited. For 5957 these situations, @code{make} provides the @code{private} modifier. 5958 Although this modifier can be used with any variable assignment, it 5959 makes the most sense with target- and pattern-specific variables. Any 5960 variable marked @code{private} will be visible to its local target but 5961 will not be inherited by prerequisites of that target. A global 5962 variable marked @code{private} will be visible in the global scope but 5963 will not be inherited by any target, and hence will not be visible 5964 in any recipe. 5965 5966 As an example, consider this makefile: 5967 @example 5968 EXTRA_CFLAGS = 5969 5970 prog: private EXTRA_CFLAGS = -L/usr/local/lib 5971 prog: a.o b.o 5972 @end example 5973 5974 Due to the @code{private} modifier, @code{a.o} and @code{b.o} will not 5975 inherit the @code{EXTRA_CFLAGS} variable assignment from the 5976 @code{progs} target. 5977 5978 @node Special Variables, , Suppressing Inheritance, Using Variables 5733 5979 @comment node-name, next, previous, up 5734 5980 @section Other Special Variables … … 5834 6080 variable). You should not set, modify, or export this variable. 5835 6081 5836 @vindex . CMDPREFIX @r{(change the recipe prefix character)}5837 @item . CMDPREFIX6082 @vindex .RECIPEPREFIX @r{(change the recipe prefix character)} 6083 @item .RECIPEPREFIX 5838 6084 The first character of the value of this variable is used as the 5839 6085 character make assumes is introducing a recipe line. If the variable … … 5843 6089 @example 5844 6090 @group 5845 . CMDPREFIX = >6091 .RECIPEPREFIX = > 5846 6092 all: 5847 6093 > @@echo Hello, world … … 5849 6095 @end example 5850 6096 5851 The value of @code{. CMDPREFIX} can be changed multiple times; once set6097 The value of @code{.RECIPEPREFIX} can be changed multiple times; once set 5852 6098 it stays in effect for all rules parsed until it is modified. 5853 6099 … … 7175 7421 all: $(PROGRAMS) 7176 7422 7177 define PROGRAM_template 7423 define PROGRAM_template = 7178 7424 $(1): $$($(1)_OBJS) $$($(1)_LIBS:%=-l%) 7179 7425 ALL_OBJS += $$($(1)_OBJS) … … 7228 7474 @item environment 7229 7475 7230 if @var{variable} was defined as an environment variable and the7231 @ samp{-e} option is @emph{not} turned on (@pxref{Options Summary, ,Summary of Options}).7476 if @var{variable} was inherited from the environment provided to 7477 @code{make}. 7232 7478 7233 7479 @item environment override 7234 7480 7235 if @var{variable} was defined as an environment variable and the 7236 @w{@samp{-e}} option @emph{is} turned on (@pxref{Options Summary, 7237 ,Summary of Options}).@refill 7481 if @var{variable} was inherited from the environment provided to 7482 @code{make}, and is overriding a setting for @var{variable} in the 7483 makefile as a result of the @w{@samp{-e}} option (@pxref{Options 7484 Summary, ,Summary of Options}).@refill 7238 7485 7239 7486 @item file … … 7476 7723 The exit status is one if you use the @samp{-q} flag and @code{make} 7477 7724 determines that some target is not already up to date. 7478 @xref{Instead of Execution, ,Instead of Executing theRecipes}.7725 @xref{Instead of Execution, ,Instead of Executing Recipes}. 7479 7726 @end table 7480 7727 … … 7653 7900 7654 7901 @node Instead of Execution, Avoiding Compilation, Goals, Running 7655 @section Instead of Executing theRecipes7902 @section Instead of Executing Recipes 7656 7903 @cindex execution, instead of 7657 7904 @cindex recipes, instead of executing … … 7673 7920 7674 7921 ``No-op''. The activity is to print what recipe would be used to make 7675 the targets up to date, but not actually execute it. 7922 the targets up to date, but not actually execute it. Some recipes are 7923 still executed, even with this flag (@pxref{MAKE Variable, ,How the @code{MAKE} Variable Works}). 7676 7924 7677 7925 @item -t … … 7715 7963 7716 7964 With the @samp{-n} flag, @code{make} prints the recipe that it would 7717 normally execute but does not execute it.7965 normally execute but usually does not execute it. 7718 7966 7719 7967 With the @samp{-t} flag, @code{make} ignores the recipes in the rules … … 7741 7989 not run unless they too begin with @samp{+} or contain @samp{$(MAKE)} or 7742 7990 @samp{$@{MAKE@}} (@xref{MAKE Variable, ,How the @code{MAKE} Variable Works}.) 7991 7992 @cindex phony targets and recipe execution 7993 The @samp{-t} flag prevents phony targets (@pxref{Phony Targets}) from 7994 being updated, unless there are recipe lines beginning with @samp{+} 7995 or containing @samp{$(MAKE)} or @samp{$@{MAKE@}}. 7743 7996 7744 7997 The @samp{-W} flag provides two features: … … 8007 8260 @xref{Environment, ,Variables from the Environment}. 8008 8261 8262 @item --eval=@var{string} 8263 @cindex @code{--eval} 8264 @c Extra blank line here makes the table look better. 8265 8266 Evaluate @var{string} as makefile syntax. This is a command-line 8267 version of the @code{eval} function (@pxref{Eval Function}). The 8268 evaluation is performed after the default rules and variables have 8269 been defined, but before any makefiles are read. 8270 8009 8271 @item -f @var{file} 8010 8272 @cindex @code{-f} … … 8090 8352 @c Extra blank line here makes the table look better. 8091 8353 8092 Print the recipe that would be executed, but do not execute it. 8093 @xref{Instead of Execution, ,Instead of Executing the Recipes}. 8354 Print the recipe that would be executed, but do not execute it (except 8355 in certain circumstances). 8356 @xref{Instead of Execution, ,Instead of Executing Recipes}. 8094 8357 8095 8358 @item -o @var{file} … … 8128 8391 return an exit status that is zero if the specified targets are already 8129 8392 up to date, one if any remaking is required, or two if an error is 8130 encountered. @xref{Instead of Execution, ,Instead of Executing the8393 encountered. @xref{Instead of Execution, ,Instead of Executing 8131 8394 Recipes}.@refill 8132 8395 … … 8190 8453 instead of running their recipes. This is used to pretend that the 8191 8454 recipes were done, in order to fool future invocations of 8192 @code{make}. @xref{Instead of Execution, ,Instead of Executing theRecipes}.8455 @code{make}. @xref{Instead of Execution, ,Instead of Executing Recipes}. 8193 8456 8194 8457 @item -v … … 8231 8494 @code{make}, except that the modification time is changed only in the 8232 8495 imagination of @code{make}. 8233 @xref{Instead of Execution, ,Instead of Executing theRecipes}.8496 @xref{Instead of Execution, ,Instead of Executing Recipes}. 8234 8497 8235 8498 @item --warn-undefined-variables … … 8421 8684 @pindex .c 8422 8685 @file{@var{n}.o} is made automatically from @file{@var{n}.c} with 8423 a recipe of the form @samp{$(CC) -c $(CPPFLAGS) $(CFLAGS)}.@refill8686 a recipe of the form @samp{$(CC) $(CPPFLAGS) $(CFLAGS) -c}.@refill 8424 8687 8425 8688 @item Compiling C++ programs … … 8431 8694 @file{@var{n}.o} is made automatically from @file{@var{n}.cc}, 8432 8695 @file{@var{n}.cpp}, or @file{@var{n}.C} with a recipe of the form 8433 @samp{$(CXX) -c $(CPPFLAGS) $(CXXFLAGS)}. We encourage you to use the8696 @samp{$(CXX) $(CPPFLAGS) $(CXXFLAGS) -c}. We encourage you to use the 8434 8697 suffix @samp{.cc} for C++ source files instead of @samp{.C}.@refill 8435 8698 … … 8439 8702 @pindex .p 8440 8703 @file{@var{n}.o} is made automatically from @file{@var{n}.p} 8441 with the recipe @samp{$(PC) -c $(PFLAGS)}.@refill8704 with the recipe @samp{$(PC) $(PFLAGS) -c}.@refill 8442 8705 8443 8706 @item Compiling Fortran and Ratfor programs … … 8454 8717 @table @samp 8455 8718 @item .f 8456 @samp{$(FC) -c $(FFLAGS)}.8719 @samp{$(FC) $(FFLAGS) -c}. 8457 8720 @item .F 8458 @samp{$(FC) -c $(FFLAGS) $(CPPFLAGS)}.8721 @samp{$(FC) $(FFLAGS) $(CPPFLAGS) -c}. 8459 8722 @item .r 8460 @samp{$(FC) -c $(FFLAGS) $(RFLAGS)}.8723 @samp{$(FC) $(FFLAGS) $(RFLAGS) -c}. 8461 8724 @end table 8462 8725 … … 8469 8732 @table @samp 8470 8733 @item .F 8471 @samp{$(FC) -F $(CPPFLAGS) $(FFLAGS)}.8734 @samp{$(FC) $(CPPFLAGS) $(FFLAGS) -F}. 8472 8735 @item .r 8473 @samp{$(FC) -F $(FFLAGS) $(RFLAGS)}.8736 @samp{$(FC) $(FFLAGS) $(RFLAGS) -F}. 8474 8737 @end table 8475 8738 … … 9066 9329 pattern. @xref{Last Resort}. 9067 9330 9331 More than one pattern rule may match a target. In this case 9332 @code{make} will choose the ``best fit'' rule. @xref{Pattern Match, 9333 ,How Patterns Match}. 9334 9068 9335 @c !!! The end of of this paragraph should be rewritten. --bob 9069 9336 Pattern rules may have more than one target. Unlike normal rules, … … 9081 9348 @cindex target, multiple in pattern rule 9082 9349 9083 The order in which pattern rules appear in the makefile is important9084 since this is the order in which they are considered.9085 Of equally applicable9086 rules, only the first one found is used. The rules you write take precedence9087 over those that are built in. Note however, that a rule whose9088 prerequisites actually exist or are mentioned always takes priority over a9089 rule with prerequisites that must be made by chaining other implicit rules.9090 @cindex pattern rules, order of9091 @cindex order of pattern rules9092 9093 9350 @node Pattern Examples, Automatic Variables, Pattern Intro, Pattern Rules 9094 9351 @subsection Pattern Rule Examples … … 9403 9660 @file{src/car}.@refill 9404 9661 9662 @cindex pattern rules, order of 9663 @cindex order of pattern rules 9664 A pattern rule can be used to build a given file only if there is a 9665 target pattern that matches the file name, @emph{and} all 9666 prerequisites in that rule either exist or can be built. The rules 9667 you write take precedence over those that are built in. Note however, 9668 that a rule whose prerequisites actually exist or are mentioned always 9669 takes priority over a rule with prerequisites that must be made by 9670 chaining other implicit rules. 9671 9672 @cindex stem, shortest 9673 It is possible that more than one pattern rule will meet these 9674 criteria. In that case, @code{make} will choose the rule with the 9675 shortest stem (that is, the pattern that matches most specifically). 9676 If more than one pattern rule has the shortest stem, @code{make} will 9677 choose the first one found in the makefile. 9678 9679 This algorithm results in more specific rules being preferred over 9680 more generic ones; for example: 9681 9682 @example 9683 %.o: %.c 9684 $(CC) -c $(CFLAGS) $(CPPFLAGS) $< -o $@@ 9685 9686 %.o : %.f 9687 $(COMPILE.F) $(OUTPUT_OPTION) $< 9688 9689 lib/%.o: lib/%.c 9690 $(CC) -fPIC -c $(CFLAGS) $(CPPFLAGS) $< -o $@@ 9691 @end example 9692 9693 Given these rules and asked to build @file{bar.o} where both 9694 @file{bar.c} and @file{bar.f} exist, @code{make} will choose the first 9695 rule and compile @file{bar.c} into @file{bar.o}. In the same 9696 situation where @file{bar.c} does not exist, then @code{make} will 9697 choose the second rule and compile @file{bar.f} into @file{bar.o}. 9698 9699 If @code{make} is asked to build @file{lib/bar.o} and both 9700 @file{lib/bar.c} and @file{lib/bar.f} exist, then the third rule will 9701 be chosen since the stem for this rule (@samp{bar}) is shorter than 9702 the stem for the first rule (@samp{lib/bar}). If @file{lib/bar.c} 9703 does not exist then the third rule is not eligible and the second rule 9704 will be used, even though the stem is longer. 9705 9405 9706 @node Match-Anything Rules, Canceling Rules, Pattern Match, Pattern Rules 9406 9707 @subsection Match-Anything Pattern Rules … … 10084 10385 The ``what if'' flag (@samp{-W} in GNU @code{make}) was (as far as we know) 10085 10386 invented by Andrew Hume in @code{mk}. 10086 @xref{Instead of Execution, ,Instead of Executing theRecipes}.10387 @xref{Instead of Execution, ,Instead of Executing Recipes}. 10087 10388 10088 10389 @item … … 10102 10403 @item 10103 10404 The special significance of @samp{+} characters preceding recipe lines 10104 (@pxref{Instead of Execution, ,Instead of Executing theRecipes}) is10405 (@pxref{Instead of Execution, ,Instead of Executing Recipes}) is 10105 10406 mandated by @cite{IEEE Standard 1003.2-1992} (POSIX.2). 10106 10407 … … 10147 10448 @item 10148 10449 Make verbatim variable definitions with @code{define}. 10149 @xref{ Defining, ,Defining Variables Verbatim}.10450 @xref{Multi-Line, ,Defining Multi-Line Variables}. 10150 10451 10151 10452 @item … … 10355 10656 @table @code 10356 10657 @item define @var{variable} 10658 @itemx define @var{variable} = 10659 @itemx define @var{variable} := 10660 @itemx define @var{variable} += 10661 @itemx define @var{variable} ?= 10357 10662 @itemx endef 10358 10359 Define a multi-line, recursively-expanded variable.@* 10360 @xref{Sequences}. 10663 Define multi-line variables.@* 10664 @xref{Multi-Line}. 10665 10666 @item undefine @var{variable} 10667 Undefining variables.@* 10668 @xref{Undefine Directive}. 10361 10669 10362 10670 @item ifdef @var{variable} … … 10370 10678 @itemx else 10371 10679 @itemx endif 10372 10373 10680 Conditionally evaluate part of the makefile.@* 10374 10681 @xref{Conditionals}. … … 10377 10684 @itemx -include @var{file} 10378 10685 @itemx sinclude @var{file} 10379 10380 10686 Include another makefile.@* 10381 10687 @xref{Include, ,Including Other Makefiles}. 10382 10688 10383 @item override @var{variable} = @var{value} 10384 @itemx override @var{variable} := @var{value} 10385 @itemx override @var{variable} += @var{value} 10386 @itemx override @var{variable} ?= @var{value} 10387 @itemx override define @var{variable} 10388 @itemx endef 10389 10689 @item override @var{variable-assignment} 10390 10690 Define a variable, overriding any previous definition, even one from 10391 10691 the command line.@* … … 10393 10693 10394 10694 @item export 10395 10396 10695 Tell @code{make} to export all variables to child processes by default.@* 10397 10696 @xref{Variables/Recursion, , Communicating Variables to a Sub-@code{make}}. 10398 10697 10399 10698 @item export @var{variable} 10400 @itemx export @var{variable} = @var{value} 10401 @itemx export @var{variable} := @var{value} 10402 @itemx export @var{variable} += @var{value} 10403 @itemx export @var{variable} ?= @var{value} 10699 @itemx export @var{variable-assignment} 10404 10700 @itemx unexport @var{variable} 10405 10701 Tell @code{make} whether or not to export a particular variable to child 10406 10702 processes.@* 10407 10703 @xref{Variables/Recursion, , Communicating Variables to a Sub-@code{make}}. 10704 10705 @item private @var{variable-assignment} 10706 Do not allow this variable assignment to be inherited by prerequisites.@* 10707 @xref{Suppressing Inheritance}. 10408 10708 10409 10709 @item vpath @var{pattern} @var{path} … … 10515 10815 10516 10816 @item $(error @var{text}@dots{}) 10517 10518 10817 When this function is evaluated, @code{make} generates a fatal error 10519 10818 with the message @var{text}.@* … … 10521 10820 10522 10821 @item $(warning @var{text}@dots{}) 10523 10524 10822 When this function is evaluated, @code{make} generates a warning with 10525 10823 the message @var{text}.@* … … 10527 10825 10528 10826 @item $(shell @var{command}) 10529 10530 10827 Execute a shell command and return its output.@* 10531 10828 @xref{Shell Function, , The @code{shell} Function}. 10532 10829 10533 10830 @item $(origin @var{variable}) 10534 10535 10831 Return a string describing how the @code{make} variable @var{variable} was 10536 10832 defined.@* … … 10538 10834 10539 10835 @item $(flavor @var{variable}) 10540 10541 10836 Return a string describing the flavor of the @code{make} variable 10542 10837 @var{variable}.@* … … 10544 10839 10545 10840 @item $(foreach @var{var},@var{words},@var{text}) 10546 10547 10841 Evaluate @var{text} with @var{var} bound to each word in @var{words}, 10548 10842 and concatenate the results.@* 10549 10843 @xref{Foreach Function, ,The @code{foreach} Function}. 10550 10844 10845 @item $(if @var{condition},@var{then-part}[,@var{else-part}]) 10846 Evaluate the condition @var{condition}; if it's non-empty substitute 10847 the expansion of the @var{then-part} otherwise substitute the 10848 expansion of the @var{else-part}.@* 10849 @xref{Conditional Functions, ,Functions for Conditionals}. 10850 10851 @item $(or @var{condition1}[,@var{condition2}[,@var{condition3}@dots{}]]) 10852 Evaluate each condition @var{conditionN} one at a time; substitute the 10853 first non-empty expansion. If all expansions are empty, substitute 10854 the empty string.@* 10855 @xref{Conditional Functions, ,Functions for Conditionals}. 10856 10857 @item $(and @var{condition1}[,@var{condition2}[,@var{condition3}@dots{}]]) 10858 Evaluate each condition @var{conditionN} one at a time; if any 10859 expansion results in the empty string substitute the empty string. If 10860 all expansions result in a non-empty string, substitute the expansion 10861 of the last @var{condition}.@* 10862 @xref{Conditional Functions, ,Functions for Conditionals}. 10863 10551 10864 @item $(call @var{var},@var{param},@dots{}) 10552 10553 10865 Evaluate the variable @var{var} replacing any references to @code{$(1)}, 10554 10866 @code{$(2)} with the first, second, etc.@: @var{param} values.@* … … 10556 10868 10557 10869 @item $(eval @var{text}) 10558 10559 10870 Evaluate @var{text} then read the results as makefile commands. 10560 10871 Expands to the empty string.@* … … 10562 10873 10563 10874 @item $(value @var{var}) 10564 10565 10875 Evaluates to the contents of the variable @var{var}, with no expansion 10566 10876 performed on it.@* … … 10747 11057 second form of the error above. Remember that every line in the 10748 11058 recipe must begin with a tab character (unless you set 10749 @code{. CMDPREFIX}; @pxref{Special Variables}). Eight spaces do not11059 @code{.RECIPEPREFIX}; @pxref{Special Variables}). Eight spaces do not 10750 11060 count. @xref{Rule Syntax}. 10751 11061 … … 11007 11317 #### End of system configuration section. #### 11008 11318 11009 SRC1 = tar.c create.c extract.c buffer.c \ 11010 getoldopt.c update.c gnu.c mangle.c 11011 SRC2 = version.c list.c names.c diffarch.c \ 11012 port.c wildmat.c getopt.c 11013 SRC3 = getopt1.c regex.c getdate.y 11014 SRCS = $(SRC1) $(SRC2) $(SRC3) 11015 OBJ1 = tar.o create.o extract.o buffer.o \ 11016 getoldopt.o update.o gnu.o mangle.o 11017 OBJ2 = version.o list.o names.o diffarch.o \ 11018 port.o wildmat.o getopt.o 11019 OBJ3 = getopt1.o regex.o getdate.o $(RTAPELIB) 11020 OBJS = $(OBJ1) $(OBJ2) $(OBJ3) 11319 @group 11320 SRCS_C = tar.c create.c extract.c buffer.c \ 11321 getoldopt.c update.c gnu.c mangle.c \ 11322 version.c list.c names.c diffarch.c \ 11323 port.c wildmat.c getopt.c getopt1.c \ 11324 regex.c 11325 SRCS_Y = getdate.y 11326 SRCS = $(SRCS_C) $(SRCS_Y) 11327 OBJS = $(SRCS_C:.c=.o) $(SRCS_Y:.y=.o) $(RTAPELIB) 11328 @end group 11021 11329 @group 11022 11330 AUX = README COPYING ChangeLog Makefile.in \ -
vendor/gnumake/current/dosbuild.bat
r1991 r2596 1 1 @echo off 2 rem Copyright (C) 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007 3 rem Free Software Foundation, Inc.2 rem Copyright (C) 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007, 3 rem 2008, 2009, 2010 Free Software Foundation, Inc. 4 4 rem This file is part of GNU Make. 5 5 rem -
vendor/gnumake/current/expand.c
r1989 r2596 1 1 /* Variable expansion functions for GNU Make. 2 2 Copyright (C) 1988, 1989, 1990, 1991, 1992, 1993, 1994, 1995, 1996, 1997, 3 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007 Free Software4 Foundation, Inc.3 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 4 2010 Free Software Foundation, Inc. 5 5 This file is part of GNU Make. 6 6 … … 410 410 if (*p == '\0') 411 411 break; 412 else 413 412 413 ++p; 414 414 } 415 415 … … 443 443 expand_argument (const char *str, const char *end) 444 444 { 445 char *tmp; 445 char *tmp, *alloc = NULL; 446 char *r; 446 447 447 448 if (str == end) … … 451 452 return allocated_variable_expand (str); 452 453 453 tmp = alloca (end - str + 1); 454 if (end - str + 1 > 1000) 455 tmp = alloc = xmalloc (end - str + 1); 456 else 457 tmp = alloca (end - str + 1); 458 454 459 memcpy (tmp, str, end - str); 455 460 tmp[end - str] = '\0'; 456 461 457 return allocated_variable_expand (tmp); 462 r = allocated_variable_expand (tmp); 463 464 if (alloc) 465 free (alloc); 466 467 return r; 458 468 } 459 469 … … 570 580 value = variable_expand_for_file (line, file); 571 581 572 #if 0573 /* Waste a little memory and save time. */574 value = xrealloc (value, strlen (value))575 #endif576 577 582 variable_buffer = obuf; 578 583 variable_buffer_length = olen; -
vendor/gnumake/current/file.c
r1989 r2596 1 1 /* Target file management for GNU Make. 2 2 Copyright (C) 1988, 1989, 1990, 1991, 1992, 1993, 1994, 1995, 1996, 1997, 3 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007 Free Software4 Foundation, Inc.3 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 4 2010 Free Software Foundation, Inc. 5 5 This file is part of GNU Make. 6 6 … … 104 104 name += 2; 105 105 #endif 106 while (name[0] == '.' && name[1] == '/' && name[2] != '\0') 106 while (name[0] == '.' 107 #ifdef HAVE_DOS_PATHS 108 && (name[1] == '/' || name[1] == '\\') 109 #else 110 && name[1] == '/' 111 #endif 112 && name[2] != '\0') 107 113 { 108 114 name += 2; 109 while (*name == '/') 115 while (*name == '/' 116 #ifdef HAVE_DOS_PATHS 117 || *name == '\\' 118 #endif 119 ) 110 120 /* Skip following slashes: ".//foo" is "foo", not "/foo". */ 111 121 ++name; … … 172 182 return f; 173 183 174 new = xmalloc (sizeof (struct file)); 175 memset (new, '\0', sizeof (struct file)); 184 new = xcalloc (sizeof (struct file)); 176 185 new->name = new->hname = name; 177 186 new->update_status = -1; … … 415 424 416 425 426 /* Given a string containing prerequisites (fully expanded), break it up into 427 a struct dep list. Enter each of these prereqs into the file database. 428 */ 417 429 struct dep * 418 parse_prereqs (char *p) 419 { 420 struct dep *new = (struct dep *) 421 multi_glob (parse_file_seq (&p, '|', sizeof (struct dep), 1), 422 sizeof (struct dep)); 430 split_prereqs (char *p) 431 { 432 struct dep *new = PARSE_FILE_SEQ (&p, struct dep, '|', NULL, 0); 423 433 424 434 if (*p) … … 429 439 430 440 ++p; 431 ood = (struct dep *) 432 multi_glob (parse_file_seq (&p, '\0', sizeof (struct dep), 1), 433 sizeof (struct dep)); 441 ood = PARSE_FILE_SEQ (&p, struct dep, '\0', NULL, 0); 434 442 435 443 if (! new) … … 450 458 } 451 459 460 /* Given a list of prerequisites, enter them into the file database. 461 If STEM is set then first expand patterns using STEM. */ 462 struct dep * 463 enter_prereqs (struct dep *deps, const char *stem) 464 { 465 struct dep *d1; 466 467 if (deps == 0) 468 return 0; 469 470 /* If we have a stem, expand the %'s. We use patsubst_expand to translate 471 the prerequisites' patterns into plain prerequisite names. */ 472 if (stem) 473 { 474 const char *pattern = "%"; 475 char *buffer = variable_expand (""); 476 struct dep *dp = deps, *dl = 0; 477 478 while (dp != 0) 479 { 480 char *percent; 481 int nl = strlen (dp->name) + 1; 482 char *nm = alloca (nl); 483 memcpy (nm, dp->name, nl); 484 percent = find_percent (nm); 485 if (percent) 486 { 487 char *o; 488 489 /* We have to handle empty stems specially, because that 490 would be equivalent to $(patsubst %,dp->name,) which 491 will always be empty. */ 492 if (stem[0] == '\0') 493 { 494 memmove (percent, percent+1, strlen (percent)); 495 o = variable_buffer_output (buffer, nm, strlen (nm) + 1); 496 } 497 else 498 o = patsubst_expand_pat (buffer, stem, pattern, nm, 499 pattern+1, percent+1); 500 501 /* If the name expanded to the empty string, ignore it. */ 502 if (buffer[0] == '\0') 503 { 504 struct dep *df = dp; 505 if (dp == deps) 506 dp = deps = deps->next; 507 else 508 dp = dl->next = dp->next; 509 free_dep (df); 510 continue; 511 } 512 513 /* Save the name. */ 514 dp->name = strcache_add_len (buffer, o - buffer); 515 } 516 dp->stem = stem; 517 dp->staticpattern = 1; 518 dl = dp; 519 dp = dp->next; 520 } 521 } 522 523 /* Enter them as files, unless they need a 2nd expansion. */ 524 for (d1 = deps; d1 != 0; d1 = d1->next) 525 { 526 if (d1->need_2nd_expansion) 527 continue; 528 529 d1->file = lookup_file (d1->name); 530 if (d1->file == 0) 531 d1->file = enter_file (d1->name); 532 d1->staticpattern = 0; 533 d1->name = 0; 534 } 535 536 return deps; 537 } 538 452 539 /* Set the intermediate flag. */ 453 540 … … 464 551 { 465 552 struct dep *d; 466 struct dep * old = f->deps;553 struct dep **dp; 467 554 const char *file_stem = f->stem; 468 unsigned int last_dep_has_cmds = f->updating;469 555 int initialized = 0; 470 556 471 557 f->updating = 0; 472 f->deps = 0; 473 474 for (d = old; d != 0; d = d->next) 475 { 476 struct dep *new, *d1; 558 559 /* Walk through the dependencies. For any dependency that needs 2nd 560 expansion, expand it then insert the result into the list. */ 561 dp = &f->deps; 562 d = f->deps; 563 while (d != 0) 564 { 477 565 char *p; 478 479 if (! d->name) 480 continue; 481 482 /* Create the dependency list. 483 If we're not doing 2nd expansion, then it's just the name. We will 484 still need to massage it though. */ 485 if (! d->need_2nd_expansion) 566 struct dep *new, *next; 567 char *name = (char *)d->name; 568 569 if (! d->name || ! d->need_2nd_expansion) 486 570 { 487 p = variable_expand (""); 488 variable_buffer_output (p, d->name, strlen (d->name) + 1); 489 p = variable_buffer; 571 /* This one is all set already. */ 572 dp = &d->next; 573 d = d->next; 574 continue; 490 575 } 491 else 576 577 /* If it's from a static pattern rule, convert the patterns into 578 "$*" so they'll expand properly. */ 579 if (d->staticpattern) 492 580 { 493 /* If it's from a static pattern rule, convert the patterns into 494 "$*" so they'll expand properly. */ 495 if (d->staticpattern) 496 { 497 char *o; 498 char *buffer = variable_expand (""); 499 500 o = subst_expand (buffer, d->name, "%", "$*", 1, 2, 0); 501 502 d->name = strcache_add_len (variable_buffer, 503 o - variable_buffer); 504 d->staticpattern = 0; /* Clear staticpattern so that we don't 505 re-expand %s below. */ 506 } 507 508 /* We are going to do second expansion so initialize file variables 509 for the file. Since the stem for static pattern rules comes from 510 individual dep lines, we will temporarily set f->stem to d->stem. 511 */ 512 if (!initialized) 513 { 514 initialize_file_variables (f, 0); 515 initialized = 1; 516 } 517 518 if (d->stem != 0) 519 f->stem = d->stem; 520 521 set_file_variables (f); 522 523 p = variable_expand_for_file (d->name, f); 524 525 if (d->stem != 0) 526 f->stem = file_stem; 581 char *o; 582 d->name = o = variable_expand (""); 583 o = subst_expand (o, name, "%", "$*", 1, 2, 0); 584 *o = '\0'; 585 free (name); 586 d->name = name = xstrdup (d->name); 587 d->staticpattern = 0; 527 588 } 528 589 529 /* Parse the prerequisites. */ 530 new = parse_prereqs (p); 531 532 /* If this dep list was from a static pattern rule, expand the %s. We 533 use patsubst_expand to translate the prerequisites' patterns into 534 plain prerequisite names. */ 535 if (new && d->staticpattern) 590 /* We're going to do second expansion so initialize file variables for 591 the file. Since the stem for static pattern rules comes from 592 individual dep lines, we will temporarily set f->stem to d->stem. */ 593 if (!initialized) 536 594 { 537 const char *pattern = "%"; 538 char *buffer = variable_expand (""); 539 struct dep *dp = new, *dl = 0; 540 541 while (dp != 0) 542 { 543 char *percent; 544 int nl = strlen (dp->name) + 1; 545 char *nm = alloca (nl); 546 memcpy (nm, dp->name, nl); 547 percent = find_percent (nm); 548 if (percent) 549 { 550 char *o; 551 552 /* We have to handle empty stems specially, because that 553 would be equivalent to $(patsubst %,dp->name,) which 554 will always be empty. */ 555 if (d->stem[0] == '\0') 556 { 557 memmove (percent, percent+1, strlen (percent)); 558 o = variable_buffer_output (buffer, nm, strlen (nm) + 1); 559 } 560 else 561 o = patsubst_expand_pat (buffer, d->stem, pattern, nm, 562 pattern+1, percent+1); 563 564 /* If the name expanded to the empty string, ignore it. */ 565 if (buffer[0] == '\0') 566 { 567 struct dep *df = dp; 568 if (dp == new) 569 dp = new = new->next; 570 else 571 dp = dl->next = dp->next; 572 free_dep (df); 573 continue; 574 } 575 576 /* Save the name. */ 577 dp->name = strcache_add_len (buffer, o - buffer); 578 } 579 dl = dp; 580 dp = dp->next; 581 } 595 initialize_file_variables (f, 0); 596 initialized = 1; 582 597 } 583 598 584 /* Enter them as files. */ 585 for (d1 = new; d1 != 0; d1 = d1->next) 599 if (d->stem != 0) 600 f->stem = d->stem; 601 602 set_file_variables (f); 603 604 p = variable_expand_for_file (d->name, f); 605 606 if (d->stem != 0) 607 f->stem = file_stem; 608 609 /* At this point we don't need the name anymore: free it. */ 610 free (name); 611 612 /* Parse the prerequisites and enter them into the file database. */ 613 new = enter_prereqs (split_prereqs (p), d->stem); 614 615 /* If there were no prereqs here (blank!) then throw this one out. */ 616 if (new == 0) 586 617 { 587 d1->file = lookup_file (d1->name); 588 if (d1->file == 0) 589 d1->file = enter_file (d1->name); 590 d1->name = 0; 591 d1->staticpattern = 0; 592 d1->need_2nd_expansion = 0; 618 *dp = d->next; 619 free_dep (d); 620 d = *dp; 621 continue; 593 622 } 594 623 595 /* Add newly parsed deps to f->deps. If this is the last dependency 596 line and this target has commands then put it in front so the 597 last dependency line (the one with commands) ends up being the 598 first. This is important because people expect $< to hold first 599 prerequisite from the rule with commands. If it is not the last 600 dependency line or the rule does not have commands then link it 601 at the end so it appears in makefile order. */ 602 603 if (new != 0) 604 { 605 if (d->next == 0 && last_dep_has_cmds) 606 { 607 struct dep **d_ptr; 608 for (d_ptr = &new; *d_ptr; d_ptr = &(*d_ptr)->next) 609 ; 610 611 *d_ptr = f->deps; 612 f->deps = new; 613 } 614 else 615 { 616 struct dep **d_ptr; 617 for (d_ptr = &f->deps; *d_ptr; d_ptr = &(*d_ptr)->next) 618 ; 619 620 *d_ptr = new; 621 } 622 } 623 } 624 625 free_dep_chain (old); 624 /* Add newly parsed prerequisites. */ 625 next = d->next; 626 *dp = new; 627 for (dp = &new->next, d = new->next; d != 0; dp = &d->next, d = d->next) 628 ; 629 *dp = next; 630 d = *dp; 631 } 632 } 633 634 /* Reset the updating flag. */ 635 636 static void 637 reset_updating (const void *item) 638 { 639 struct file *f = (struct file *) item; 640 f->updating = 0; 626 641 } 627 642 … … 638 653 struct file *f2; 639 654 struct dep *d; 640 struct file **file_slot_0; 641 struct file **file_slot; 642 struct file **file_end; 643 644 /* Perform second expansion and enter each dependency name as a file. */ 645 646 /* Expand .SUFFIXES first; it's dependencies are used for $$* calculation. */ 647 for (f = lookup_file (".SUFFIXES"); f != 0; f = f->prev) 648 expand_deps (f); 649 650 /* For every target that's not .SUFFIXES, expand its dependencies. 651 We must use hash_dump (), because within this loop we might add new files 652 to the table, possibly causing an in-situ table expansion. */ 653 file_slot_0 = (struct file **) hash_dump (&files, 0, 0); 654 file_end = file_slot_0 + files.ht_fill; 655 for (file_slot = file_slot_0; file_slot < file_end; file_slot++) 656 for (f = *file_slot; f != 0; f = f->prev) 657 if (strcmp (f->name, ".SUFFIXES") != 0) 655 656 /* Remember that we've done this. Once we start snapping deps we can no 657 longer define new targets. */ 658 snapped_deps = 1; 659 660 /* Perform second expansion and enter each dependency name as a file. We 661 must use hash_dump() here because within these loops we likely add new 662 files to the table, possibly causing an in-situ table expansion. 663 664 We only need to do this if second_expansion has been defined; if it 665 hasn't then all deps were expanded as the makefile was read in. If we 666 ever change make to be able to unset .SECONDARY_EXPANSION this will have 667 to change. */ 668 669 if (second_expansion) 670 { 671 struct file **file_slot_0 = (struct file **) hash_dump (&files, 0, 0); 672 struct file **file_end = file_slot_0 + files.ht_fill; 673 struct file **file_slot; 674 const char *suffixes; 675 676 /* Expand .SUFFIXES: its prerequisites are used for $$* calc. */ 677 f = lookup_file (".SUFFIXES"); 678 suffixes = f ? f->name : 0; 679 for (; f != 0; f = f->prev) 658 680 expand_deps (f); 659 free (file_slot_0); 681 682 /* For every target that's not .SUFFIXES, expand its prerequisites. */ 683 684 for (file_slot = file_slot_0; file_slot < file_end; file_slot++) 685 for (f = *file_slot; f != 0; f = f->prev) 686 if (f->name != suffixes) 687 expand_deps (f); 688 free (file_slot_0); 689 } 690 else 691 /* We're not doing second expansion, so reset updating. */ 692 hash_map (&files, reset_updating); 660 693 661 694 /* Now manage all the special targets. */ … … 738 771 /* This needs more work: what if the user sets this in the makefile? 739 772 if (posix_pedantic) 740 define_variable (STRING_SIZE_TUPLE("OUTPUT_OPTION"), "", o_default, 1);773 define_variable_cname ("OUTPUT_OPTION", "", o_default, 1); 741 774 */ 742 775 #endif 743 744 /* Remember that we've done this. */745 snapped_deps = 1;746 776 } 747 777 … … 868 898 /* Print the data base of files. */ 869 899 900 void 901 print_prereqs (const struct dep *deps) 902 { 903 const struct dep *ood = 0; 904 905 /* Print all normal dependencies; note any order-only deps. */ 906 for (; deps != 0; deps = deps->next) 907 if (! deps->ignore_mtime) 908 printf (" %s", dep_name (deps)); 909 else if (! ood) 910 ood = deps; 911 912 /* Print order-only deps, if we have any. */ 913 if (ood) 914 { 915 printf (" | %s", dep_name (ood)); 916 for (ood = ood->next; ood != 0; ood = ood->next) 917 if (ood->ignore_mtime) 918 printf (" %s", dep_name (ood)); 919 } 920 921 putchar ('\n'); 922 } 923 870 924 static void 871 925 print_file (const void *item) 872 926 { 873 927 const struct file *f = item; 874 struct dep *d;875 struct dep *ood = 0;876 928 877 929 putchar ('\n'); … … 879 931 puts (_("# Not a target:")); 880 932 printf ("%s:%s", f->name, f->double_colon ? ":" : ""); 881 882 /* Print all normal dependencies; note any order-only deps. */ 883 for (d = f->deps; d != 0; d = d->next) 884 if (! d->ignore_mtime) 885 printf (" %s", dep_name (d)); 886 else if (! ood) 887 ood = d; 888 889 /* Print order-only deps, if we have any. */ 890 if (ood) 891 { 892 printf (" | %s", dep_name (ood)); 893 for (d = ood->next; d != 0; d = d->next) 894 if (d->ignore_mtime) 895 printf (" %s", dep_name (d)); 896 } 897 898 putchar ('\n'); 933 print_prereqs (f->deps); 899 934 900 935 if (f->precious) … … 915 950 if (f->also_make != 0) 916 951 { 952 const struct dep *d; 917 953 fputs (_("# Also makes:"), stdout); 918 954 for (d = f->also_make; d != 0; d = d->next) … … 999 1035 do{\ 1000 1036 if (_p->_n && _p->_n[0] && !strcache_iscached (_p->_n)) \ 1001 printf ("%s: Field %snot cached: %s\n", _p->name, # _n, _p->_n); \1037 error (NULL, "%s: Field '%s' not cached: %s\n", _p->name, # _n, _p->_n); \ 1002 1038 }while(0) 1003 1039 … … 1016 1052 for (d = f->deps; d != 0; d = d->next) 1017 1053 { 1018 VERIFY_CACHED (d, name); 1054 if (! d->need_2nd_expansion) 1055 VERIFY_CACHED (d, name); 1019 1056 VERIFY_CACHED (d, stem); 1020 1057 } -
vendor/gnumake/current/filedef.h
r1989 r2596 1 1 /* Definition of target file data structures for GNU Make. 2 2 Copyright (C) 1988, 1989, 1990, 1991, 1992, 1993, 1994, 1995, 1996, 1997, 3 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007 Free Software4 Foundation, Inc.3 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 4 2010 Free Software Foundation, Inc. 5 5 This file is part of GNU Make. 6 6 … … 95 95 unsigned int considered:1; /* equal to 'considered' if file has been 96 96 considered on current scan of goal chain */ 97 unsigned int no_diag:1; /* True if the file failed to update and no 98 diagnostics has been issued (dontcare). */ 97 99 }; 98 100 99 101 100 extern struct file *default_goal_file, *suffix_file, *default_file; 101 extern char **default_goal_name; 102 extern struct file *suffix_file, *default_file; 102 103 103 104 104 105 struct file *lookup_file (const char *name); 105 106 struct file *enter_file (const char *name); 106 struct dep *parse_prereqs (char *prereqs); 107 struct dep *split_prereqs (char *prereqstr); 108 struct dep *enter_prereqs (struct dep *prereqs, const char *stem); 107 109 void remove_intermediates (int sig); 108 110 void snap_deps (void); … … 113 115 void init_hash_files (void); 114 116 char *build_target_list (char *old_list); 117 void print_prereqs (const struct dep *deps); 118 void print_file_data_base (void); 115 119 116 120 #if FILE_TIMESTAMP_HI_RES -
vendor/gnumake/current/function.c
r1989 r2596 1 1 /* Builtin function expansion for GNU Make. 2 2 Copyright (C) 1988, 1989, 1990, 1991, 1992, 1993, 1994, 1995, 1996, 1997, 3 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007 Free Software4 Foundation, Inc.3 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 4 2010 Free Software Foundation, Inc. 5 5 This file is part of GNU Make. 6 6 … … 362 362 unsigned int idx; 363 363 364 chain = multi_glob (parse_file_seq 365 (&line, '\0', sizeof (struct nameseq), 366 /* We do not want parse_file_seq to strip `./'s. 367 That would break examples like: 368 $(patsubst ./%.c,obj/%.o,$(wildcard ./?*.c)). */ 369 0), 370 sizeof (struct nameseq)); 364 chain = PARSE_FILE_SEQ (&line, struct nameseq, '\0', NULL, 365 /* We do not want parse_file_seq to strip `./'s. 366 That would break examples like: 367 $(patsubst ./%.c,obj/%.o,$(wildcard ./?*.c)). */ 368 PARSEFS_NOSTRIP|PARSEFS_NOCACHE|PARSEFS_EXISTS); 371 369 372 370 if (result == 0) … … 379 377 while (chain != 0) 380 378 { 381 const char *name = chain->name;382 unsigned int len = strlen (name);383 384 379 struct nameseq *next = chain->next; 380 unsigned int len = strlen (chain->name); 381 382 if (idx + len + 1 > length) 383 { 384 length += (len + 1) * 2; 385 result = xrealloc (result, length); 386 } 387 memcpy (&result[idx], chain->name, len); 388 idx += len; 389 result[idx++] = ' '; 390 391 /* Because we used PARSEFS_NOCACHE above, we have to free() NAME. */ 392 free ((char *)chain->name); 385 393 free (chain); 386 394 chain = next; 387 388 /* multi_glob will pass names without globbing metacharacters389 through as is, but we want only files that actually exist. */390 if (file_exists_p (name))391 {392 if (idx + len + 1 > length)393 {394 length += (len + 1) * 2;395 result = xrealloc (result, length);396 }397 memcpy (&result[idx], name, len);398 idx += len;399 result[idx++] = ' ';400 }401 395 } 402 396 … … 861 855 862 856 free (var->value); 863 var->value = savestring(p, len);857 var->value = xstrndup (p, len); 864 858 865 859 result = allocated_variable_expand (body); … … 1448 1442 1449 1443 void 1450 windows32_openpipe (int *pipedes, int *pid_p, char **command_argv, char **envp)1444 windows32_openpipe (int *pipedes, pid_t *pid_p, char **command_argv, char **envp) 1451 1445 { 1452 1446 SECURITY_ATTRIBUTES saAttr; … … 1469 1463 TRUE, 1470 1464 DUPLICATE_SAME_ACCESS) == FALSE) { 1471 fatal (NILF, _(" create_child_process: DuplicateHandle(In) failed (e=%ld)\n"),1465 fatal (NILF, _("windows32_openpipe(): DuplicateHandle(In) failed (e=%ld)\n"), 1472 1466 GetLastError()); 1473 1467 … … 1480 1474 TRUE, 1481 1475 DUPLICATE_SAME_ACCESS) == FALSE) { 1482 fatal (NILF, _(" create_child_process: DuplicateHandle(Err) failed (e=%ld)\n"),1476 fatal (NILF, _("windows32_open_pipe(): DuplicateHandle(Err) failed (e=%ld)\n"), 1483 1477 GetLastError()); 1484 1478 } … … 1490 1484 1491 1485 if (!hProcess) 1492 fatal (NILF, _("windows32_openpipe 1486 fatal (NILF, _("windows32_openpipe(): process_init_fd() failed\n")); 1493 1487 1494 1488 /* make sure that CreateProcess() has Path it needs */ 1495 1489 sync_Path_environment(); 1490 /* `sync_Path_environment' may realloc `environ', so take note of 1491 the new value. */ 1492 envp = environ; 1496 1493 1497 1494 if (!process_begin(hProcess, command_argv, envp, command_argv[0], NULL)) { … … 1500 1497 1501 1498 /* set the pid for returning to caller */ 1502 *pid_p = ( int) hProcess;1499 *pid_p = (pid_t) hProcess; 1503 1500 1504 1501 /* set up to read data from child */ 1505 pipedes[0] = _open_osfhandle(( long) hChildOutRd, O_RDONLY);1502 pipedes[0] = _open_osfhandle((intptr_t) hChildOutRd, O_RDONLY); 1506 1503 1507 1504 /* this will be closed almost right away */ 1508 pipedes[1] = _open_osfhandle(( long) hChildOutWr, O_APPEND);1505 pipedes[1] = _open_osfhandle((intptr_t) hChildOutWr, O_APPEND); 1509 1506 } else { 1510 1507 /* reap/cleanup the failed process */ … … 1521 1518 /* set status for return */ 1522 1519 pipedes[0] = pipedes[1] = -1; 1523 *pid_p = -1;1520 *pid_p = (pid_t)-1; 1524 1521 } 1525 1522 } … … 1605 1602 char **envp; 1606 1603 int pipedes[2]; 1607 int pid;1604 pid_t pid; 1608 1605 1609 1606 #ifndef __MSDOS__ … … 1695 1692 free (command_argv); 1696 1693 1697 /* Close the write side of the pipe. */ 1698 close (pipedes[1]); 1694 /* Close the write side of the pipe. We test for -1, since 1695 pipedes[1] is -1 on MS-Windows, and some versions of MS 1696 libraries barf when `close' is called with -1. */ 1697 if (pipedes[1] >= 0) 1698 close (pipedes[1]); 1699 1699 #endif 1700 1700 … … 1887 1887 1888 1888 1889 #ifdef HAVE_DOS_PATHS 1890 #define IS_ABSOLUTE(n) (n[0] && n[1] == ':') 1891 #define ROOT_LEN 3 1892 #else 1893 #define IS_ABSOLUTE(n) (n[0] == '/') 1894 #define ROOT_LEN 1 1895 #endif 1896 1889 1897 /* Return the absolute name of file NAME which does not contain any `.', 1890 1898 `..' components nor any repeated path separators ('/'). */ … … 1895 1903 char *dest; 1896 1904 const char *start, *end, *apath_limit; 1905 unsigned long root_len = ROOT_LEN; 1897 1906 1898 1907 if (name[0] == '\0' || apath == NULL) … … 1901 1910 apath_limit = apath + GET_PATH_MAX; 1902 1911 1903 if ( name[0] != '/')1912 if (!IS_ABSOLUTE(name)) 1904 1913 { 1905 1914 /* It is unlikely we would make it until here but just to make sure. */ … … 1909 1918 strcpy (apath, starting_directory); 1910 1919 1920 #ifdef HAVE_DOS_PATHS 1921 if (IS_PATHSEP(name[0])) 1922 { 1923 if (IS_PATHSEP(name[1])) 1924 { 1925 /* A UNC. Don't prepend a drive letter. */ 1926 apath[0] = name[0]; 1927 apath[1] = name[1]; 1928 root_len = 2; 1929 } 1930 /* We have /foo, an absolute file name except for the drive 1931 letter. Assume the missing drive letter is the current 1932 drive, which we can get if we remove from starting_directory 1933 everything past the root directory. */ 1934 apath[root_len] = '\0'; 1935 } 1936 #endif 1937 1911 1938 dest = strchr (apath, '\0'); 1912 1939 } 1913 1940 else 1914 1941 { 1915 apath[0] = '/'; 1916 dest = apath + 1; 1942 strncpy (apath, name, root_len); 1943 apath[root_len] = '\0'; 1944 dest = apath + root_len; 1945 /* Get past the root, since we already copied it. */ 1946 name += root_len; 1947 #ifdef HAVE_DOS_PATHS 1948 if (!IS_PATHSEP(apath[2])) 1949 { 1950 /* Convert d:foo into d:./foo and increase root_len. */ 1951 apath[2] = '.'; 1952 apath[3] = '/'; 1953 dest++; 1954 root_len++; 1955 /* strncpy above copied one character too many. */ 1956 name--; 1957 } 1958 else 1959 apath[2] = '/'; /* make sure it's a forward slash */ 1960 #endif 1917 1961 } 1918 1962 … … 1922 1966 1923 1967 /* Skip sequence of multiple path-separators. */ 1924 while ( *start == '/')1968 while (IS_PATHSEP(*start)) 1925 1969 ++start; 1926 1970 1927 1971 /* Find end of path component. */ 1928 for (end = start; *end != '\0' && *end != '/'; ++end)1972 for (end = start; *end != '\0' && !IS_PATHSEP(*end); ++end) 1929 1973 ; 1930 1974 … … 1938 1982 { 1939 1983 /* Back up to previous component, ignore if at root already. */ 1940 if (dest > apath + 1)1941 while ((--dest)[-1] != '/');1984 if (dest > apath + root_len) 1985 for (--dest; !IS_PATHSEP(dest[-1]); --dest); 1942 1986 } 1943 1987 else 1944 1988 { 1945 if ( dest[-1] != '/')1989 if (!IS_PATHSEP(dest[-1])) 1946 1990 *dest++ = '/'; 1947 1991 … … 1956 2000 1957 2001 /* Unless it is root strip trailing separator. */ 1958 if (dest > apath + 1 && dest[-1] == '/')2002 if (dest > apath + root_len && IS_PATHSEP(dest[-1])) 1959 2003 --dest; 1960 2004 … … 1973 2017 int doneany = 0; 1974 2018 unsigned int len = 0; 2019 #ifndef HAVE_REALPATH 2020 struct stat st; 2021 #endif 1975 2022 PATH_VAR (in); 1976 2023 PATH_VAR (out); … … 1987 2034 realpath (in, out) 1988 2035 #else 1989 abspath (in, out) 2036 abspath (in, out) && stat (out, &st) == 0 1990 2037 #endif 1991 2038 ) -
vendor/gnumake/current/getloadavg.c
r1989 r2596 1 1 /* Get the system load averages. 2 2 Copyright (C) 1985, 1986, 1987, 1988, 1989, 1990, 1991, 1992, 1993, 1994, 3 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007 4 Free Software Foundation, Inc.3 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007, 4 2008, 2009, 2010 Free Software Foundation, Inc. 5 5 6 6 GNU Make is free software; you can redistribute it and/or modify it under the -
vendor/gnumake/current/getopt.c
r1989 r2596 5 5 6 6 Copyright (C) 1987, 1988, 1989, 1990, 1991, 1992, 1993, 1994, 1995, 1996, 7 1997, 1998, 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007 Free Software8 Foundation, Inc.7 1997, 1998, 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 8 2010 Free Software Foundation, Inc. 9 9 10 10 NOTE: The canonical source of this file is maintained with the GNU C Library. -
vendor/gnumake/current/getopt.h
r1989 r2596 1 1 /* Declarations for getopt. 2 2 Copyright (C) 1989, 1990, 1991, 1992, 1993, 1994, 1995, 1996, 1997, 1998, 3 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007 Free Software Foundation,4 Inc.3 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010 Free 4 Software Foundation, Inc. 5 5 6 6 NOTE: The canonical source of this file is maintained with the GNU C Library. -
vendor/gnumake/current/getopt1.c
r1989 r2596 1 1 /* getopt_long and getopt_long_only entry points for GNU getopt. 2 2 Copyright (C) 1987, 1988, 1989, 1990, 1991, 1992, 1993, 1994, 1996, 1997, 3 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007 Free Software4 Foundation, Inc.3 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 4 2010 Free Software Foundation, Inc. 5 5 6 6 NOTE: The canonical source of this file is maintained with the GNU C Library. -
vendor/gnumake/current/gettext.h
r1989 r2596 1 1 /* Convenience header for conditional use of GNU <libintl.h>. 2 2 Copyright (C) 1995, 1996, 1997, 1998, 2000, 2001, 2002, 2003, 2004, 2005, 3 2006, 2007 Free Software Foundation, Inc.3 2006, 2007, 2008, 2009, 2010 Free Software Foundation, Inc. 4 4 This file is part of GNU Make. 5 5 -
vendor/gnumake/current/glob
- Property svn:ignore deleted
-
vendor/gnumake/current/glob/ChangeLog
r1989 r2596 1 2008-09-28 Juan Manuel Guerrero <juan.guerrero@gmx.de> 2 3 * glob.c (my_realloc) [__DJGPP__]: Don't define, and don't 4 redefine realloc to call it, since the DJGPP's realloc handles 5 NULL pointers correctly. 6 1 7 2007-12-22 Juan Manuel Guerrero <juan.guerrero@gmx.de> (tiny change) 2 8 3 * glob /glob.c [__GNU_LIBRARY__ && __DJGPP__]: Add a realloc9 * glob.c [__GNU_LIBRARY__ && __DJGPP__]: Add a realloc 4 10 declaration that matches the one in the DJGPP libc. 5 11 -
vendor/gnumake/current/glob/glob.c
r1989 r2596 183 183 #endif 184 184 185 #if ndef __GNU_LIBRARY__185 #if !defined __GNU_LIBRARY__ && !defined __DJGPP__ 186 186 # ifdef __GNUC__ 187 187 __inline … … 191 191 static void * 192 192 my_realloc (void *p, unsigned int n) 193 # elif defined(__DJGPP__)194 static void *195 my_realloc (void *p, size_t n)196 193 # else 197 194 static char * … … 209 206 # define realloc my_realloc 210 207 # endif /* __SASC */ 211 #endif /* __GNU_LIBRARY__ */208 #endif /* __GNU_LIBRARY__ || __DJGPP__ */ 212 209 213 210 -
vendor/gnumake/current/hash.c
r1989 r2596 1 1 /* hash.c -- hash table maintenance 2 Copyright (C) 1995, 1999, 2002 Free Software Foundation, Inc.2 Copyright (C) 1995, 1999, 2002, 2010 Free Software Foundation, Inc. 3 3 Written by Greg McGary <gkm@gnu.org> <greg@mcgary.org> 4 4 … … 47 47 if (ht->ht_vec == 0) 48 48 { 49 fprintf (stderr, _("can't allocate %l dbytes for hash table: memory exhausted"),50 ht->ht_size * sizeof(struct token *));49 fprintf (stderr, _("can't allocate %lu bytes for hash table: memory exhausted"), 50 ht->ht_size * (unsigned long) sizeof (struct token *)); 51 51 exit (1); 52 52 } … … 127 127 { 128 128 void **slot = hash_find_slot (ht, item); 129 const void *old_item = slot ? *slot : 0;129 const void *old_item = *slot; 130 130 hash_insert_at (ht, item, slot); 131 131 return (void *)((HASH_VACANT (old_item)) ? 0 : old_item); -
vendor/gnumake/current/hash.h
r1989 r2596 1 1 /* hash.h -- decls for hash table 2 Copyright (C) 1995, 1999, 2002 Free Software Foundation, Inc.2 Copyright (C) 1995, 1999, 2002, 2010 Free Software Foundation, Inc. 3 3 Written by Greg McGary <gkm@gnu.org> <greg@mcgary.org> 4 4 … … 81 81 /* hash and comparison macros for case-sensitive string keys. */ 82 82 83 /* Due to the strcache, it's not uncommon for the string pointers to 84 be identical. Take advantage of that to short-circuit string compares. */ 85 83 86 #define STRING_HASH_1(KEY, RESULT) do { \ 84 87 unsigned char const *_key_ = (unsigned char const *) (KEY) - 1; \ … … 104 107 105 108 #define STRING_COMPARE(X, Y, RESULT) do { \ 106 RESULT =strcmp ((X), (Y)); \109 RESULT = (X) == (Y) ? 0 : strcmp ((X), (Y)); \ 107 110 } while (0) 108 111 #define return_STRING_COMPARE(X, Y) do { \ 109 return strcmp ((X), (Y)); \112 return (X) == (Y) ? 0 : strcmp ((X), (Y)); \ 110 113 } while (0) 111 114 … … 140 143 141 144 #define STRING_N_COMPARE(X, Y, N, RESULT) do { \ 142 RESULT = strncmp ((X), (Y), (N)); \145 RESULT = (X) == (Y) ? 0 : strncmp ((X), (Y), (N)); \ 143 146 } while (0) 144 147 #define return_STRING_N_COMPARE(X, Y, N) do { \ 145 return strncmp ((X), (Y), (N)); \148 return (X) == (Y) ? 0 : strncmp ((X), (Y), (N)); \ 146 149 } while (0) 147 150 … … 173 176 174 177 #define ISTRING_COMPARE(X, Y, RESULT) do { \ 175 RESULT = strcasecmp ((X), (Y)); \178 RESULT = (X) == (Y) ? 0 : strcasecmp ((X), (Y)); \ 176 179 } while (0) 177 180 #define return_ISTRING_COMPARE(X, Y) do { \ 178 return strcasecmp ((X), (Y)); \181 return (X) == (Y) ? 0 : strcasecmp ((X), (Y)); \ 179 182 } while (0) 180 183 -
vendor/gnumake/current/implicit.c
r1989 r2596 1 1 /* Implicit rule searching for GNU Make. 2 2 Copyright (C) 1988, 1989, 1990, 1991, 1992, 1993, 1994, 1995, 1996, 1997, 3 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007 Free Software4 Foundation, Inc.3 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 4 2010 Free Software Foundation, Inc. 5 5 This file is part of GNU Make. 6 6 … … 49 49 return 1; 50 50 51 #ifndef 51 #ifndef NO_ARCHIVES 52 52 /* If this is an archive member reference, use just the 53 53 archive member name to search for implicit rules. */ … … 57 57 _("Looking for archive-member implicit rule for `%s'.\n")); 58 58 if (pattern_search (file, 1, depth, 0)) 59 59 return 1; 60 60 } 61 61 #endif … … 64 64 } 65 65 66 67 68 /* Struct idep captures information about implicit prerequisites69 that come from implicit rules. */70 struct idep71 {72 struct idep *next; /* struct dep -compatible interface */73 const char *name; /* name of the prerequisite */74 struct file *intermediate_file; /* intermediate file, 0 otherwise */75 const char *intermediate_pattern; /* pattern for intermediate file */76 unsigned char had_stem; /* had % substituted with stem */77 unsigned char ignore_mtime; /* ignore_mtime flag */78 };79 80 static void81 free_idep_chain (struct idep *p)82 {83 struct idep *n;84 85 for (; p != 0; p = n)86 {87 n = p->next;88 free (p);89 }90 }91 66 92 67 … … 95 70 length of the word. */ 96 71 97 static c har *72 static const char * 98 73 get_next_word (const char *buffer, unsigned int *length) 99 74 { … … 169 144 *length = p - beg; 170 145 171 return (char *)beg; 146 return beg; 147 } 148 149 /* This structure stores information about the expanded prerequisites for a 150 pattern rule. NAME is always set to the strcache'd name of the prereq. 151 FILE and PATTERN will be set for intermediate files only. IGNORE_MTIME is 152 copied from the prerequisite we expanded. 153 */ 154 struct patdeps 155 { 156 const char *name; 157 const char *pattern; 158 struct file *file; 159 unsigned int ignore_mtime : 1; 160 }; 161 162 /* This structure stores information about pattern rules that we need 163 to try. 164 */ 165 struct tryrule 166 { 167 struct rule *rule; 168 169 /* Index of the target in this rule that matched the file. */ 170 unsigned int matches; 171 172 /* Stem length for this match. */ 173 unsigned int stemlen; 174 175 /* Definition order of this rule. Used to implement stable sort.*/ 176 unsigned int order; 177 178 /* Nonzero if the LASTSLASH logic was used in matching this rule. */ 179 char checked_lastslash; 180 }; 181 182 int 183 stemlen_compare (const void *v1, const void *v2) 184 { 185 const struct tryrule *r1 = v1; 186 const struct tryrule *r2 = v2; 187 int r = r1->stemlen - r2->stemlen; 188 return r != 0 ? r : (int)(r1->order - r2->order); 172 189 } 173 190 … … 197 214 198 215 /* The last slash in FILENAME (or nil if there is none). */ 199 c har *lastslash;216 const char *lastslash; 200 217 201 218 /* This is a file-object used as an argument in 202 219 recursive calls. It never contains any data 203 220 except during a recursive call. */ 204 struct file *int ermediate_file = 0;205 206 /* This linked list records all the prerequisites actually207 found for a rule along with some other useful information208 (see struct idep for details). */209 struct idep* deps = 0;210 211 /* 1 if we need to remove explicit prerequisites, 0 otherwise.*/212 unsigned int remove_explicit_deps = 0;221 struct file *int_file = 0; 222 223 /* List of dependencies found recursively. */ 224 struct patdeps *deplist 225 = xmalloc (max_pattern_deps * sizeof (struct patdeps)); 226 struct patdeps *pat = deplist; 227 228 /* All the prerequisites actually found for a rule, after expansion. */ 229 struct dep *deps; 213 230 214 231 /* Names of possible dependencies are constructed in this buffer. */ … … 221 238 222 239 /* Buffer in which we store all the rules that are possibly applicable. */ 223 struct rule **tryrules = xmalloc (num_pattern_rules * max_pattern_targets224 * sizeof (struct rule *));240 struct tryrule *tryrules = xmalloc (num_pattern_rules * max_pattern_targets 241 * sizeof (struct tryrule)); 225 242 226 243 /* Number of valid elements in TRYRULES. */ 227 244 unsigned int nrules; 228 245 229 /* The numbers of the rule targets of each rule230 in TRYRULES that matched the target file. */231 unsigned int *matches = alloca (num_pattern_rules * sizeof (unsigned int));232 233 /* Each element is nonzero if LASTSLASH was used in234 matching the corresponding element of TRYRULES. */235 char *checked_lastslash = alloca (num_pattern_rules * sizeof (char));236 237 246 /* The index in TRYRULES of the rule we found. */ 238 247 unsigned int foundrule; … … 240 249 /* Nonzero if should consider intermediate files as dependencies. */ 241 250 int intermed_ok; 251 252 /* Nonzero if we have initialized file variables for this target. */ 253 int file_vars_initialized = 0; 242 254 243 255 /* Nonzero if we have matched a pattern-rule target … … 245 257 int specific_rule_matched = 0; 246 258 259 struct dep dep_simple; 260 247 261 unsigned int ri; /* uninit checks OK */ 248 262 struct rule *rule; 249 struct dep *dep, *expl_d; 250 251 struct idep *d; 252 struct idep **id_ptr; 253 struct dep **d_ptr; 263 264 char *pathdir = NULL; 265 unsigned long pathlen; 254 266 255 267 PATH_VAR (stem_str); /* @@ Need to get rid of stem, stemlen, etc. */ 256 268 257 #ifndef 269 #ifndef NO_ARCHIVES 258 270 if (archive || ar_name (filename)) 259 271 lastslash = 0; … … 262 274 { 263 275 /* Set LASTSLASH to point at the last slash in FILENAME 264 265 276 but not counting any slash at the end. (foo/bar/ counts as 277 bar/ in directory foo/, not empty in directory foo/bar/.) */ 266 278 #ifdef VMS 267 279 lastslash = strrchr (filename, ']'); 268 280 if (lastslash == 0) 269 281 lastslash = strrchr (filename, ':'); 270 282 #else 271 283 lastslash = strrchr (filename, '/'); 272 284 #ifdef HAVE_DOS_PATHS 273 285 /* Handle backslashes (possibly mixed with forward slashes) 274 286 and the case of "d:file". */ 275 287 { 276 277 278 279 280 288 char *bslash = strrchr (filename, '\\'); 289 if (lastslash == 0 || bslash > lastslash) 290 lastslash = bslash; 291 if (lastslash == 0 && filename[0] && filename[1] == ':') 292 lastslash = filename + 1; 281 293 } 282 294 #endif 283 295 #endif 284 296 if (lastslash != 0 && lastslash[1] == '\0') 285 297 lastslash = 0; 286 298 } 287 299 288 /* First see which pattern rules match this target 289 and may be considered. Put them in TRYRULES. */ 300 pathlen = lastslash - filename + 1; 301 302 /* First see which pattern rules match this target and may be considered. 303 Put them in TRYRULES. */ 290 304 291 305 nrules = 0; … … 295 309 296 310 /* If the pattern rule has deps but no commands, ignore it. 297 311 Users cancel built-in rules by redefining them without commands. */ 298 312 if (rule->deps != 0 && rule->cmds == 0) 299 313 continue; 300 314 301 315 /* If this rule is in use by a parent pattern_search, 302 316 don't use it here. */ 303 317 if (rule->in_use) 304 305 306 307 318 { 319 DBS (DB_IMPLICIT, (_("Avoiding implicit rule recursion.\n"))); 320 continue; 321 } 308 322 309 323 for (ti = 0; ti < rule->num; ++ti) 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 324 { 325 const char *target = rule->targets[ti]; 326 const char *suffix = rule->suffixes[ti]; 327 int check_lastslash; 328 329 /* Rules that can match any filename and are not terminal 330 are ignored if we're recursing, so that they cannot be 331 intermediate files. */ 332 if (recursions > 0 && target[1] == '\0' && !rule->terminal) 333 continue; 334 335 if (rule->lens[ti] > namelen) 336 /* It can't possibly match. */ 337 continue; 338 339 /* From the lengths of the filename and the pattern parts, 340 find the stem: the part of the filename that matches the %. */ 341 stem = filename + (suffix - target - 1); 342 stemlen = namelen - rule->lens[ti] + 1; 343 344 /* Set CHECK_LASTSLASH if FILENAME contains a directory 345 prefix and the target pattern does not contain a slash. */ 332 346 333 347 check_lastslash = 0; … … 349 363 #endif 350 364 } 351 if (check_lastslash) 352 { 353 /* If so, don't include the directory prefix in STEM here. */ 354 unsigned int difference = lastslash - filename + 1; 355 if (difference > stemlen) 356 continue; 357 stemlen -= difference; 358 stem += difference; 359 } 360 361 /* Check that the rule pattern matches the text before the stem. */ 362 if (check_lastslash) 363 { 364 if (stem > (lastslash + 1) 365 && !strneq (target, lastslash + 1, stem - lastslash - 1)) 366 continue; 367 } 368 else if (stem > filename 369 && !strneq (target, filename, stem - filename)) 370 continue; 371 372 /* Check that the rule pattern matches the text after the stem. 373 We could test simply use streq, but this way we compare the 374 first two characters immediately. This saves time in the very 375 common case where the first character matches because it is a 376 period. */ 377 if (*suffix != stem[stemlen] 378 || (*suffix != '\0' && !streq (&suffix[1], &stem[stemlen + 1]))) 379 continue; 380 381 /* Record if we match a rule that not all filenames will match. */ 382 if (target[1] != '\0') 383 specific_rule_matched = 1; 384 385 /* A rule with no dependencies and no commands exists solely to set 386 specific_rule_matched when it matches. Don't try to use it. */ 387 if (rule->deps == 0 && rule->cmds == 0) 388 continue; 389 390 /* Record this rule in TRYRULES and the index of the matching 391 target in MATCHES. If several targets of the same rule match, 392 that rule will be in TRYRULES more than once. */ 393 tryrules[nrules] = rule; 394 matches[nrules] = ti; 395 checked_lastslash[nrules] = check_lastslash; 396 ++nrules; 397 } 365 if (check_lastslash) 366 { 367 /* If so, don't include the directory prefix in STEM here. */ 368 if (pathlen > stemlen) 369 continue; 370 stemlen -= pathlen; 371 stem += pathlen; 372 } 373 374 /* Check that the rule pattern matches the text before the stem. */ 375 if (check_lastslash) 376 { 377 if (stem > (lastslash + 1) 378 && !strneq (target, lastslash + 1, stem - lastslash - 1)) 379 continue; 380 } 381 else if (stem > filename 382 && !strneq (target, filename, stem - filename)) 383 continue; 384 385 /* Check that the rule pattern matches the text after the stem. 386 We could test simply use streq, but this way we compare the 387 first two characters immediately. This saves time in the very 388 common case where the first character matches because it is a 389 period. */ 390 if (*suffix != stem[stemlen] 391 || (*suffix != '\0' && !streq (&suffix[1], &stem[stemlen + 1]))) 392 continue; 393 394 /* Record if we match a rule that not all filenames will match. */ 395 if (target[1] != '\0') 396 specific_rule_matched = 1; 397 398 /* A rule with no dependencies and no commands exists solely to set 399 specific_rule_matched when it matches. Don't try to use it. */ 400 if (rule->deps == 0 && rule->cmds == 0) 401 continue; 402 403 /* Record this rule in TRYRULES and the index of the matching 404 target in MATCHES. If several targets of the same rule match, 405 that rule will be in TRYRULES more than once. */ 406 tryrules[nrules].rule = rule; 407 tryrules[nrules].matches = ti; 408 tryrules[nrules].stemlen = stemlen + (check_lastslash ? pathlen : 0); 409 tryrules[nrules].order = nrules; 410 tryrules[nrules].checked_lastslash = check_lastslash; 411 ++nrules; 412 } 398 413 } 414 415 /* Bail out early if we haven't found any rules. */ 416 if (nrules == 0) 417 goto done; 418 419 /* Sort the rules to place matches with the shortest stem first. This 420 way the most specific rules will be tried first. */ 421 if (nrules > 1) 422 qsort (tryrules, nrules, sizeof (struct tryrule), stemlen_compare); 399 423 400 424 /* If we have found a matching rule that won't match all filenames, … … 402 426 if (specific_rule_matched) 403 427 for (ri = 0; ri < nrules; ++ri) 404 if (!tryrules[ri] ->terminal)405 406 407 for (j = 0; j < tryrules[ri]->num; ++j)408 if (tryrules[ri]->targets[j][1] == '\0')428 if (!tryrules[ri].rule->terminal) 429 { 430 unsigned int j; 431 for (j = 0; j < tryrules[ri].rule->num; ++j) 432 if (tryrules[ri].rule->targets[j][1] == '\0') 409 433 { 410 tryrules[ri] = 0;434 tryrules[ri].rule = 0; 411 435 break; 412 436 } 413 } 414 415 /* We are going to do second expansion so initialize file variables 416 for the rule. */ 417 initialize_file_variables (file, 0); 437 } 418 438 419 439 /* Try each rule once without intermediate files, then once with them. */ 420 for (intermed_ok = 0; intermed_ok == !!intermed_ok; ++intermed_ok)440 for (intermed_ok = 0; intermed_ok < 2; ++intermed_ok) 421 441 { 422 /* Try each pattern rule till we find one that applies.423 If it does, expand its dependencies (as substituted) 424 and chain them in DEPS. */ 425 442 pat = deplist; 443 444 /* Try each pattern rule till we find one that applies. If it does, 445 expand its dependencies (as substituted) and chain them in DEPS. */ 426 446 for (ri = 0; ri < nrules; ri++) 427 { 428 struct file *f; 447 { 448 struct dep *dep; 449 int check_lastslash; 429 450 unsigned int failed = 0; 430 int check_lastslash;431 451 int file_variables_set = 0; 432 433 rule = tryrules[ri]; 434 435 remove_explicit_deps = 0; 436 437 /* RULE is nil when we discover that a rule, 438 already placed in TRYRULES, should not be applied. */ 439 if (rule == 0) 440 continue; 441 442 /* Reject any terminal rules if we're 443 looking to make intermediate files. */ 444 if (intermed_ok && rule->terminal) 445 continue; 446 447 /* Mark this rule as in use so a recursive 448 pattern_search won't try to use it. */ 449 rule->in_use = 1; 450 451 /* From the lengths of the filename and the matching pattern parts, 452 find the stem: the part of the filename that matches the %. */ 453 stem = filename 454 + (rule->suffixes[matches[ri]] - rule->targets[matches[ri]]) - 1; 455 stemlen = namelen - rule->lens[matches[ri]] + 1; 456 check_lastslash = checked_lastslash[ri]; 457 if (check_lastslash) 458 { 459 stem += lastslash - filename + 1; 460 stemlen -= (lastslash - filename) + 1; 461 } 462 463 DBS (DB_IMPLICIT, (_("Trying pattern rule with stem `%.*s'.\n"), 452 unsigned int deps_found = 0; 453 /* NPTR points to the part of the prereq we haven't processed. */ 454 const char *nptr = 0; 455 const char *dir = NULL; 456 int order_only = 0; 457 unsigned int matches; 458 459 rule = tryrules[ri].rule; 460 461 /* RULE is nil when we discover that a rule, already placed in 462 TRYRULES, should not be applied. */ 463 if (rule == 0) 464 continue; 465 466 /* Reject any terminal rules if we're looking to make intermediate 467 files. */ 468 if (intermed_ok && rule->terminal) 469 continue; 470 471 /* From the lengths of the filename and the matching pattern parts, 472 find the stem: the part of the filename that matches the %. */ 473 matches = tryrules[ri].matches; 474 stem = filename + (rule->suffixes[matches] 475 - rule->targets[matches]) - 1; 476 stemlen = (namelen - rule->lens[matches]) + 1; 477 check_lastslash = tryrules[ri].checked_lastslash; 478 if (check_lastslash) 479 { 480 stem += pathlen; 481 stemlen -= pathlen; 482 483 /* We need to add the directory prefix, so set it up. */ 484 if (! pathdir) 485 { 486 pathdir = alloca (pathlen + 1); 487 memcpy (pathdir, filename, pathlen); 488 pathdir[pathlen] = '\0'; 489 } 490 dir = pathdir; 491 } 492 493 DBS (DB_IMPLICIT, (_("Trying pattern rule with stem `%.*s'.\n"), 464 494 (int) stemlen, stem)); 465 495 466 496 strncpy (stem_str, stem, stemlen); 467 497 stem_str[stemlen] = '\0'; 498 499 /* If there are no prerequisites, then this rule matches. */ 500 if (rule->deps == 0) 501 break; 468 502 469 503 /* Temporary assign STEM to file->stem (needed to set file … … 471 505 file->stem = stem_str; 472 506 473 /* Try each dependency; see if it "exists". */ 474 475 for (dep = rule->deps; dep != 0; dep = dep->next) 476 { 477 unsigned int len; 507 /* Mark this rule as in use so a recursive pattern_search won't try 508 to use it. */ 509 rule->in_use = 1; 510 511 /* Try each prerequisite; see if it exists or can be created. We'll 512 build a list of prereq info in DEPLIST. Due to 2nd expansion we 513 may have to process multiple prereqs for a single dep entry. */ 514 515 pat = deplist; 516 dep = rule->deps; 517 nptr = dep_name (dep); 518 while (1) 519 { 520 struct dep *dl, *d; 478 521 char *p; 479 char *p2; 480 unsigned int order_only = 0; /* Set if '|' was seen. */ 481 482 /* In an ideal world we would take the dependency line, 483 substitute the stem, re-expand the whole line and chop it 484 into individual prerequisites. Unfortunately this won't work 485 because of the "check_lastslash" twist. Instead, we will 486 have to go word by word, taking $()'s into account, for each 487 word we will substitute the stem, re-expand, chop it up, and, 488 if check_lastslash != 0, add the directory part to each 522 523 /* If we're out of name to parse, start the next prereq. */ 524 if (! nptr) 525 { 526 dep = dep->next; 527 if (dep == 0) 528 break; 529 nptr = dep_name (dep); 530 } 531 532 /* If we don't need a second expansion, just replace the %. */ 533 if (! dep->need_2nd_expansion) 534 { 535 dep_simple = *dep; 536 dep_simple.next = 0; 537 p = strchr (nptr, '%'); 538 if (p == 0) 539 dep_simple.name = nptr; 540 else 541 { 542 char *o = depname; 543 if (check_lastslash) 544 { 545 memcpy (o, filename, pathlen); 546 o += pathlen; 547 } 548 memcpy (o, nptr, p - nptr); 549 o += p - nptr; 550 memcpy (o, stem_str, stemlen); 551 o += stemlen; 552 strcpy (o, p + 1); 553 dep_simple.name = strcache_add (depname); 554 } 555 dl = &dep_simple; 556 557 /* We've used up this dep, so next time get a new one. */ 558 nptr = 0; 559 ++deps_found; 560 } 561 562 /* We have to perform second expansion on this prereq. In an 563 ideal world we would take the dependency line, substitute the 564 stem, re-expand the whole line and chop it into individual 565 prerequisites. Unfortunately this won't work because of the 566 "check_lastslash" twist. Instead, we will have to go word by 567 word, taking $()'s into account. For each word we will 568 substitute the stem, re-expand, chop it up, and, if 569 check_lastslash != 0, add the directory part to each 489 570 resulting prerequisite. */ 490 491 p = get_next_word (dep->name, &len); 492 493 while (1) 571 else 494 572 { 495 573 int add_dir = 0; 496 int had_stem = 0; 497 574 unsigned int len; 575 576 nptr = get_next_word (nptr, &len); 577 if (nptr == 0) 578 continue; 579 580 /* See this is a transition to order-only prereqs. */ 581 if (! order_only && len == 1 && nptr[0] == '|') 582 { 583 order_only = 1; 584 nptr += len; 585 continue; 586 } 587 588 /* If the dependency name has %, substitute the stem. If we 589 just replace % with the stem value then later, when we do 590 the 2nd expansion, we will re-expand this stem value 591 again. This is not good if you have certain characters 592 in your stem (like $). 593 594 Instead, we will replace % with $* and allow the second 595 expansion to take care of it for us. This way (since $* 596 is a simple variable) there won't be additional 597 re-expansion of the stem. */ 598 599 p = lindex (nptr, nptr + len, '%'); 498 600 if (p == 0) 499 break; /* No more words */ 500 501 /* Is there a pattern in this prerequisite? */ 502 503 for (p2 = p; p2 < p + len && *p2 != '%'; ++p2) 504 ; 505 506 if (dep->need_2nd_expansion) 507 { 508 /* If the dependency name has %, substitute the stem. 509 510 Watch out, we are going to do something tricky 511 here. If we just replace % with the stem value, 512 later, when we do the second expansion, we will 513 re-expand this stem value once again. This is not 514 good especially if you have certain characters in 515 your stem (like $). 516 517 Instead, we will replace % with $* and allow the 518 second expansion to take care of it for us. This way 519 (since $* is a simple variable) there won't be 520 additional re-expansion of the stem. */ 521 522 if (p2 < p + len) 523 { 524 unsigned int i = p2 - p; 525 memcpy (depname, p, i); 526 memcpy (depname + i, "$*", 2); 527 memcpy (depname + i + 2, p2 + 1, len - i - 1); 528 depname[len + 2 - 1] = '\0'; 529 530 if (check_lastslash) 531 add_dir = 1; 532 533 had_stem = 1; 534 } 535 else 536 { 537 memcpy (depname, p, len); 538 depname[len] = '\0'; 539 } 540 541 /* Set file variables. Note that we cannot do it once 542 at the beginning of the function because of the stem 543 value. */ 544 if (!file_variables_set) 545 { 546 set_file_variables (file); 547 file_variables_set = 1; 548 } 549 550 p2 = variable_expand_for_file (depname, file); 601 { 602 memcpy (depname, nptr, len); 603 depname[len] = '\0'; 551 604 } 552 605 else 553 606 { 554 if (p2 < p + len) 555 { 556 unsigned int i = p2 - p; 557 memcpy (depname, p, i); 558 memcpy (depname + i, stem_str, stemlen); 559 memcpy (depname + i + stemlen, p2 + 1, len - i - 1); 560 depname[len + stemlen - 1] = '\0'; 561 562 if (check_lastslash) 563 add_dir = 1; 564 565 had_stem = 1; 566 } 567 else 568 { 569 memcpy (depname, p, len); 570 depname[len] = '\0'; 571 } 572 573 p2 = depname; 574 } 575 576 /* Parse the dependencies. */ 577 578 while (1) 579 { 580 id_ptr = &deps; 581 582 for (; *id_ptr; id_ptr = &(*id_ptr)->next) 583 ; 584 585 *id_ptr = (struct idep *) 586 multi_glob ( 587 parse_file_seq (&p2, 588 order_only ? '\0' : '|', 589 sizeof (struct idep), 590 1), sizeof (struct idep)); 591 592 /* @@ It would be nice to teach parse_file_seq or 593 multi_glob to add prefix. This would save us some 594 reallocations. */ 595 596 if (order_only || add_dir || had_stem) 597 { 598 unsigned long l = lastslash - filename + 1; 599 600 for (d = *id_ptr; d != 0; d = d->next) 601 { 602 if (order_only) 603 d->ignore_mtime = 1; 604 605 if (add_dir) 606 { 607 char *n = alloca (strlen (d->name) + l + 1); 608 memcpy (n, filename, l); 609 memcpy (n+l, d->name, strlen (d->name) + 1); 610 d->name = strcache_add (n); 611 } 612 613 if (had_stem) 614 d->had_stem = 1; 615 } 616 } 617 618 if (!order_only && *p2) 607 unsigned int i = p - nptr; 608 memcpy (depname, nptr, i); 609 memcpy (depname + i, "$*", 2); 610 memcpy (depname + i + 2, p + 1, len - i - 1); 611 depname[len + 2 - 1] = '\0'; 612 613 if (check_lastslash) 614 add_dir = 1; 615 } 616 617 /* Initialize and set file variables if we haven't already 618 done so. */ 619 if (!file_vars_initialized) 620 { 621 initialize_file_variables (file, 0); 622 set_file_variables (file); 623 file_vars_initialized = 1; 624 } 625 /* Update the stem value in $* for this rule. */ 626 else if (!file_variables_set) 627 { 628 define_variable_for_file ( 629 "*", 1, file->stem, o_automatic, 0, file); 630 file_variables_set = 1; 631 } 632 633 /* Perform the 2nd expansion. */ 634 p = variable_expand_for_file (depname, file); 635 636 /* Parse the expanded string. */ 637 dl = PARSE_FILE_SEQ (&p, struct dep, order_only ? '\0' : '|', 638 add_dir ? dir : NULL, 0); 639 640 for (d = dl; d != NULL; d = d->next) 641 { 642 ++deps_found; 643 if (order_only) 644 d->ignore_mtime = 1; 645 } 646 647 /* Set up for the next word. */ 648 nptr += len; 649 } 650 651 /* If there are more than max_pattern_deps prerequisites (due to 652 2nd expansion), reset it and realloc the arrays. */ 653 654 if (deps_found > max_pattern_deps) 655 { 656 unsigned int l = pat - deplist; 657 deplist = xrealloc (deplist, 658 deps_found * sizeof (struct patdeps)); 659 pat = deplist + l; 660 max_pattern_deps = deps_found; 661 } 662 663 /* Go through the nameseq and handle each as a prereq name. */ 664 for (d = dl; d != 0; d = d->next) 665 { 666 struct dep *expl_d; 667 int is_rule = d->name == dep_name (dep); 668 669 if (file_impossible_p (d->name)) 670 { 671 /* If this prereq has already been ruled "impossible", 672 then the rule fails. Don't bother trying it on the 673 second pass either since we know that will fail. */ 674 DBS (DB_IMPLICIT, 675 (is_rule 676 ? _("Rejecting impossible rule prerequisite `%s'.\n") 677 : _("Rejecting impossible implicit prerequisite `%s'.\n"), 678 d->name)); 679 tryrules[ri].rule = 0; 680 681 failed = 1; 682 break; 683 } 684 685 memset (pat, '\0', sizeof (struct patdeps)); 686 pat->ignore_mtime = d->ignore_mtime; 687 688 DBS (DB_IMPLICIT, 689 (is_rule 690 ? _("Trying rule prerequisite `%s'.\n") 691 : _("Trying implicit prerequisite `%s'.\n"), d->name)); 692 693 /* If this prereq is also explicitly mentioned for FILE, 694 skip all tests below since it must be built no matter 695 which implicit rule we choose. */ 696 697 for (expl_d = file->deps; expl_d != 0; expl_d = expl_d->next) 698 if (streq (dep_name (expl_d), d->name)) 699 break; 700 if (expl_d != 0) 701 { 702 (pat++)->name = d->name; 703 continue; 704 } 705 706 /* The DEP->changed flag says that this dependency resides 707 in a nonexistent directory. So we normally can skip 708 looking for the file. However, if CHECK_LASTSLASH is 709 set, then the dependency file we are actually looking for 710 is in a different directory (the one gotten by prepending 711 FILENAME's directory), so it might actually exist. */ 712 713 /* @@ dep->changed check is disabled. */ 714 if (lookup_file (d->name) != 0 715 /*|| ((!dep->changed || check_lastslash) && */ 716 || file_exists_p (d->name)) 717 { 718 (pat++)->name = d->name; 719 continue; 720 } 721 722 /* This code, given FILENAME = "lib/foo.o", dependency name 723 "lib/foo.c", and VPATH=src, searches for 724 "src/lib/foo.c". */ 725 { 726 const char *vname = vpath_search (d->name, 0, NULL, NULL); 727 if (vname) 619 728 { 620 ++p2; 621 order_only = 1; 729 DBS (DB_IMPLICIT, 730 (_("Found prerequisite `%s' as VPATH `%s'\n"), 731 d->name, vname)); 732 (pat++)->name = d->name; 622 733 continue; 623 734 } 624 625 break; 626 } 627 628 p += len; 629 p = get_next_word (p, &len); 630 } 631 } 632 633 /* Reset the stem in FILE. */ 634 635 file->stem = 0; 636 637 /* @@ This loop can be combined with the previous one. I do 638 it separately for now for transparency.*/ 639 640 for (d = deps; d != 0; d = d->next) 641 { 642 const char *name = d->name; 643 644 if (file_impossible_p (name)) 645 { 646 /* If this dependency has already been ruled "impossible", 647 then the rule fails and don't bother trying it on the 648 second pass either since we know that will fail too. */ 649 DBS (DB_IMPLICIT, 650 (d->had_stem 651 ? _("Rejecting impossible implicit prerequisite `%s'.\n") 652 : _("Rejecting impossible rule prerequisite `%s'.\n"), 653 name)); 654 tryrules[ri] = 0; 655 735 } 736 737 /* We could not find the file in any place we should look. 738 Try to make this dependency as an intermediate file, but 739 only on the second pass. */ 740 741 if (intermed_ok) 742 { 743 DBS (DB_IMPLICIT, 744 (_("Looking for a rule with intermediate file `%s'.\n"), 745 d->name)); 746 747 if (int_file == 0) 748 int_file = alloca (sizeof (struct file)); 749 memset (int_file, '\0', sizeof (struct file)); 750 int_file->name = d->name; 751 752 if (pattern_search (int_file, 753 0, 754 depth + 1, 755 recursions + 1)) 756 { 757 pat->pattern = int_file->name; 758 int_file->name = d->name; 759 pat->file = int_file; 760 (pat++)->name = d->name; 761 int_file = 0; 762 continue; 763 } 764 765 /* If we have tried to find P as an intermediate file 766 and failed, mark that name as impossible so we won't 767 go through the search again later. */ 768 if (int_file->variables) 769 free_variable_set (int_file->variables); 770 if (int_file->pat_variables) 771 free_variable_set (int_file->pat_variables); 772 file_impossible (d->name); 773 } 774 775 /* A dependency of this rule does not exist. Therefore, this 776 rule fails. */ 656 777 failed = 1; 657 778 break; 658 779 } 659 780 660 DBS (DB_IMPLICIT, 661 (d->had_stem 662 ? _("Trying implicit prerequisite `%s'.\n") 663 : _("Trying rule prerequisite `%s'.\n"), name)); 664 665 /* If this prerequisite also happened to be explicitly mentioned 666 for FILE skip all the test below since it it has to be built 667 anyway, no matter which implicit rule we choose. */ 668 669 for (expl_d = file->deps; expl_d != 0; expl_d = expl_d->next) 670 if (streq (dep_name (expl_d), name)) 671 break; 672 if (expl_d != 0) 673 continue; 674 675 /* The DEP->changed flag says that this dependency resides in a 676 nonexistent directory. So we normally can skip looking for 677 the file. However, if CHECK_LASTSLASH is set, then the 678 dependency file we are actually looking for is in a different 679 directory (the one gotten by prepending FILENAME's directory), 680 so it might actually exist. */ 681 682 /* @@ dep->changed check is disabled. */ 683 if (((f = lookup_file (name)) != 0 && f->is_target) 684 /*|| ((!dep->changed || check_lastslash) && */ 685 || file_exists_p (name)) 686 continue; 687 688 /* This code, given FILENAME = "lib/foo.o", dependency name 689 "lib/foo.c", and VPATH=src, searches for "src/lib/foo.c". */ 690 { 691 const char *vname = vpath_search (name, 0); 692 if (vname) 693 { 694 DBS (DB_IMPLICIT, 695 (_("Found prerequisite `%s' as VPATH `%s'\n"), 696 name, vname)); 697 continue; 698 } 699 } 700 701 702 /* We could not find the file in any place we should look. Try 703 to make this dependency as an intermediate file, but only on 704 the second pass. */ 705 706 if (intermed_ok) 707 { 708 if (intermediate_file == 0) 709 intermediate_file = alloca (sizeof (struct file)); 710 711 DBS (DB_IMPLICIT, 712 (_("Looking for a rule with intermediate file `%s'.\n"), 713 name)); 714 715 memset (intermediate_file, '\0', sizeof (struct file)); 716 intermediate_file->name = name; 717 if (pattern_search (intermediate_file, 718 0, 719 depth + 1, 720 recursions + 1)) 721 { 722 d->intermediate_pattern = intermediate_file->name; 723 intermediate_file->name = strcache_add (name); 724 d->intermediate_file = intermediate_file; 725 intermediate_file = 0; 726 727 continue; 728 } 729 730 /* If we have tried to find P as an intermediate 731 file and failed, mark that name as impossible 732 so we won't go through the search again later. */ 733 if (intermediate_file->variables) 734 free_variable_set (intermediate_file->variables); 735 file_impossible (name); 736 } 737 738 /* A dependency of this rule does not exist. Therefore, 739 this rule fails. */ 740 failed = 1; 741 break; 781 /* Free the ns chain. */ 782 if (dl != &dep_simple) 783 free_dep_chain (dl); 784 785 if (failed) 786 break; 742 787 } 743 788 789 /* Reset the stem in FILE. */ 790 791 file->stem = 0; 792 744 793 /* This rule is no longer `in use' for recursive searches. */ 745 rule->in_use = 0; 746 747 if (failed) 748 { 749 /* This pattern rule does not apply. If some of its 750 dependencies succeeded, free the data structure 751 describing them. */ 752 free_idep_chain (deps); 753 deps = 0; 754 } 755 else 756 /* This pattern rule does apply. Stop looking for one. */ 757 break; 758 } 759 760 /* If we found an applicable rule without 761 intermediate files, don't try with them. */ 794 rule->in_use = 0; 795 796 if (! failed) 797 /* This pattern rule does apply. Stop looking for one. */ 798 break; 799 800 /* This pattern rule does not apply. If some of its dependencies 801 succeeded, free the data structure describing them. */ 802 /* free_idep_chain (deps); */ 803 deps = 0; 804 } 805 806 /* If we found an applicable rule without intermediate files, don't try 807 with them. */ 762 808 if (ri < nrules) 763 809 break; 764 810 765 811 rule = 0; 766 812 } 767 813 768 /* RULE is nil if the loop went all the way 769 through the list and everything failed. */ 814 /* RULE is nil if the loop went through the list but everything failed. */ 770 815 if (rule == 0) 771 816 goto done; … … 773 818 foundrule = ri; 774 819 775 /* If we are recursing, store the pattern that matched 776 FILE NAME in FILE->name for use in upper levels. */820 /* If we are recursing, store the pattern that matched FILENAME in 821 FILE->name for use in upper levels. */ 777 822 778 823 if (recursions > 0) 779 824 /* Kludge-o-matic */ 780 file->name = rule->targets[ matches[foundrule]];781 782 /* FOUND_FILES lists the dependencies for the rule we found.783 This includes the intermediate files, if any.784 Convert them into entries on the deps-chainof FILE. */785 786 if (remove_explicit_deps)825 file->name = rule->targets[tryrules[foundrule].matches]; 826 827 /* DEPLIST lists the prerequisites for the rule we found. This includes the 828 intermediate files, if any. Convert them into entries on the deps-chain 829 of FILE. */ 830 831 while (pat-- > deplist) 787 832 { 788 /* Remove all the dependencies that didn't come from 789 this implicit rule. */ 790 791 dep = file->deps; 792 while (dep != 0) 833 struct dep *dep; 834 const char *s; 835 836 if (pat->file != 0) 793 837 { 794 struct dep *next = dep->next; 795 free_dep (dep); 796 dep = next; 797 } 798 file->deps = 0; 799 } 800 801 expl_d = file->deps; /* We will add them at the end. */ 802 d_ptr = &file->deps; 803 804 for (d = deps; d != 0; d = d->next) 805 { 806 const char *s; 807 808 if (d->intermediate_file != 0) 809 { 810 /* If we need to use an intermediate file, 811 make sure it is entered as a target, with the info that was 812 found for it in the recursive pattern_search call. 813 We know that the intermediate file did not already exist as 814 a target; therefore we can assume that the deps and cmds 815 of F below are null before we change them. */ 816 817 struct file *imf = d->intermediate_file; 818 register struct file *f = lookup_file (imf->name); 838 /* If we need to use an intermediate file, make sure it is entered 839 as a target, with the info that was found for it in the recursive 840 pattern_search call. We know that the intermediate file did not 841 already exist as a target; therefore we can assume that the deps 842 and cmds of F below are null before we change them. */ 843 844 struct file *imf = pat->file; 845 struct file *f = lookup_file (imf->name); 819 846 820 847 /* We don't want to delete an intermediate file that happened … … 824 851 f->precious = 1; 825 852 else 826 f = enter_file (strcache_add (imf->name)); 827 828 f->deps = imf->deps; 829 f->cmds = imf->cmds; 830 f->stem = imf->stem; 853 f = enter_file (imf->name); 854 855 f->deps = imf->deps; 856 f->cmds = imf->cmds; 857 f->stem = imf->stem; 858 f->variables = imf->variables; 859 f->pat_variables = imf->pat_variables; 860 f->pat_searched = imf->pat_searched; 831 861 f->also_make = imf->also_make; 832 862 f->is_target = 1; 833 834 if (!f->precious) 863 f->intermediate = 1; 864 f->tried_implicit = 1; 865 866 imf = lookup_file (pat->pattern); 867 if (imf != 0 && imf->precious) 868 f->precious = 1; 869 870 for (dep = f->deps; dep != 0; dep = dep->next) 835 871 { 836 imf = lookup_file (d->intermediate_pattern);837 if (imf != 0 && imf->precious)838 f->precious = 1;872 dep->file = enter_file (dep->name); 873 dep->name = 0; 874 dep->file->tried_implicit |= dep->changed; 839 875 } 840 841 f->intermediate = 1; 842 f->tried_implicit = 1; 843 for (dep = f->deps; dep != 0; dep = dep->next) 844 { 845 dep->file = enter_file (dep->name); 846 dep->name = 0; 847 dep->file->tried_implicit |= dep->changed; 848 } 849 } 876 } 850 877 851 878 dep = alloc_dep (); 852 dep->ignore_mtime = d->ignore_mtime; 853 s = d->name; /* Hijacking the name. */ 854 d->name = 0; 855 if (recursions == 0) 856 { 857 dep->file = lookup_file (s); 858 if (dep->file == 0) 859 dep->file = enter_file (s); 860 } 879 dep->ignore_mtime = pat->ignore_mtime; 880 s = strcache_add (pat->name); 881 if (recursions) 882 dep->name = s; 861 883 else 862 dep->name = s; 863 864 if (d->intermediate_file == 0 && tryrules[foundrule]->terminal) 865 { 866 /* If the file actually existed (was not an intermediate file), 867 and the rule that found it was a terminal one, then we want 868 to mark the found file so that it will not have implicit rule 869 search done for it. If we are not entering a `struct file' for 870 it now, we indicate this with the `changed' flag. */ 871 if (dep->file == 0) 872 dep->changed = 1; 873 else 874 dep->file->tried_implicit = 1; 875 } 876 877 *d_ptr = dep; 878 d_ptr = &dep->next; 884 { 885 dep->file = lookup_file (s); 886 if (dep->file == 0) 887 dep->file = enter_file (s); 888 } 889 890 if (pat->file == 0 && tryrules[foundrule].rule->terminal) 891 { 892 /* If the file actually existed (was not an intermediate file), and 893 the rule that found it was a terminal one, then we want to mark 894 the found file so that it will not have implicit rule search done 895 for it. If we are not entering a `struct file' for it now, we 896 indicate this with the `changed' flag. */ 897 if (dep->file == 0) 898 dep->changed = 1; 899 else 900 dep->file->tried_implicit = 1; 901 } 902 903 dep->next = file->deps; 904 file->deps = dep; 879 905 } 880 906 881 *d_ptr = expl_d; 882 883 if (!checked_lastslash[foundrule]) 907 if (!tryrules[foundrule].checked_lastslash) 884 908 { 885 /* Always allocate new storage, since STEM might be 886 on the stack for anintermediate file. */909 /* Always allocate new storage, since STEM might be on the stack for an 910 intermediate file. */ 887 911 file->stem = strcache_add_len (stem, stemlen); 888 912 fullstemlen = stemlen; … … 894 918 895 919 /* We want to prepend the directory from 896 920 the original FILENAME onto the stem. */ 897 921 fullstemlen = dirlen + stemlen; 898 922 sp = alloca (fullstemlen + 1); … … 908 932 /* Set precious flag. */ 909 933 { 910 struct file *f = lookup_file (rule->targets[ matches[foundrule]]);934 struct file *f = lookup_file (rule->targets[tryrules[foundrule].matches]); 911 935 if (f && f->precious) 912 936 file->precious = 1; … … 918 942 if (rule->num > 1) 919 943 for (ri = 0; ri < rule->num; ++ri) 920 if (ri != matches[foundrule]) 921 { 922 char *p = alloca (rule->lens[ri] + fullstemlen + 1); 923 struct file *f; 924 struct dep *new = alloc_dep (); 925 926 /* GKM FIMXE: handle '|' here too */ 927 memcpy (p, rule->targets[ri], 944 if (ri != tryrules[foundrule].matches) 945 { 946 char *nm = alloca (rule->lens[ri] + fullstemlen + 1); 947 char *p = nm; 948 struct file *f; 949 struct dep *new = alloc_dep (); 950 951 /* GKM FIMXE: handle '|' here too */ 952 memcpy (p, rule->targets[ri], 928 953 rule->suffixes[ri] - rule->targets[ri] - 1); 929 930 931 932 954 p += rule->suffixes[ri] - rule->targets[ri] - 1; 955 memcpy (p, file->stem, fullstemlen); 956 p += fullstemlen; 957 memcpy (p, rule->suffixes[ri], 933 958 rule->lens[ri] - (rule->suffixes[ri] - rule->targets[ri])+1); 934 new->name = strcache_add ( p);935 936 937 938 939 940 959 new->name = strcache_add (nm); 960 new->file = enter_file (new->name); 961 new->next = file->also_make; 962 963 /* Set precious flag. */ 964 f = lookup_file (rule->targets[ri]); 965 if (f && f->precious) 941 966 new->file->precious = 1; 942 967 943 /* Set the is_target flag so that this file is not treated 944 asintermediate by the pattern rule search algorithm and968 /* Set the is_target flag so that this file is not treated as 969 intermediate by the pattern rule search algorithm and 945 970 file_exists_p cannot pick it up yet. */ 946 971 new->file->is_target = 1; 947 972 948 949 973 file->also_make = new; 974 } 950 975 951 976 done: 952 free_idep_chain (deps);953 977 free (tryrules); 978 free (deplist); 954 979 955 980 return rule != 0; -
vendor/gnumake/current/job.c
r1989 r2596 1 1 /* Job execution and handling for GNU Make. 2 2 Copyright (C) 1988, 1989, 1990, 1991, 1992, 1993, 1994, 1995, 1996, 1997, 3 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007 Free Software4 Foundation, Inc.3 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 4 2010 Free Software Foundation, Inc. 5 5 This file is part of GNU Make. 6 6 … … 175 175 #endif /* Don't have `union wait'. */ 176 176 177 #if ndef HAVE_UNISTD_H177 #if !defined(HAVE_UNISTD_H) && !defined(WINDOWS32) 178 178 int dup2 (); 179 179 int execve (); … … 187 187 #endif 188 188 189 /* Different systems have different requirements for pid_t. 190 Plus we have to support gettext string translation... Argh. */ 191 static const char * 192 pid2str (pid_t pid) 193 { 194 static char pidstring[100]; 195 #if defined(WINDOWS32) && (__GNUC__ > 3 || _MSC_VER > 1300) 196 /* %Id is only needed for 64-builds, which were not supported by 197 older versions of Windows compilers. */ 198 sprintf (pidstring, "%Id", pid); 199 #else 200 sprintf (pidstring, "%lu", (unsigned long) pid); 201 #endif 202 return pidstring; 203 } 204 189 205 int getloadavg (double loadavg[], int nelem); 190 206 int start_remote_job (char **argv, char **envp, int stdin_fd, int *is_remote, … … 236 252 */ 237 253 int 238 w32_kill( int pid, int sig)254 w32_kill(pid_t pid, int sig) 239 255 { 240 256 return ((process_kill((HANDLE)pid, sig) == TRUE) ? 0 : -1); … … 249 265 { 250 266 const char *const ext = unixy ? "sh" : "bat"; 251 const char *error = NULL;267 const char *error_string = NULL; 252 268 char temp_path[MAXPATHLEN]; /* need to know its length */ 253 269 unsigned path_size = GetTempPath(sizeof temp_path, temp_path); … … 295 311 else 296 312 { 297 error = map_windows32_error_to_string (er);313 error_string = map_windows32_error_to_string (er); 298 314 break; 299 315 } … … 304 320 char *const path = xmalloc (final_size); 305 321 memcpy (path, temp_path, final_size); 306 *fd = _open_osfhandle (( long)h, 0);322 *fd = _open_osfhandle ((intptr_t)h, 0); 307 323 if (unixy) 308 324 { … … 318 334 319 335 *fd = -1; 320 if (error == NULL)321 error = _("Cannot create a temporary file\n");322 fatal (NILF, error );336 if (error_string == NULL) 337 error_string = _("Cannot create a temporary file\n"); 338 fatal (NILF, error_string); 323 339 324 340 /* not reached */ … … 371 387 #endif /* __EMX__ */ 372 388 389 /* determines whether path looks to be a Bourne-like shell. */ 390 int 391 is_bourne_compatible_shell (const char *path) 392 { 393 /* list of known unix (Bourne-like) shells */ 394 const char *unix_shells[] = { 395 "sh", 396 "bash", 397 "ksh", 398 "rksh", 399 "zsh", 400 "ash", 401 "dash", 402 NULL 403 }; 404 unsigned i, len; 405 406 /* find the rightmost '/' or '\\' */ 407 const char *name = strrchr (path, '/'); 408 char *p = strrchr (path, '\\'); 409 410 if (name && p) /* take the max */ 411 name = (name > p) ? name : p; 412 else if (p) /* name must be 0 */ 413 name = p; 414 else if (!name) /* name and p must be 0 */ 415 name = path; 416 417 if (*name == '/' || *name == '\\') name++; 418 419 /* this should be able to deal with extensions on Windows-like systems */ 420 for (i = 0; unix_shells[i] != NULL; i++) { 421 len = strlen(unix_shells[i]); 422 #if defined(WINDOWS32) || defined(__MSDOS__) 423 if ((strncasecmp (name, unix_shells[i], len) == 0) && 424 (strlen(name) >= len && (name[len] == '\0' || name[len] == '.'))) 425 #else 426 if ((strncmp (name, unix_shells[i], len) == 0) && 427 (strlen(name) >= len && name[len] == '\0')) 428 #endif 429 return 1; /* a known unix-style shell */ 430 } 431 432 /* if not on the list, assume it's not a Bourne-like shell */ 433 return 0; 434 } 435 373 436 374 437 … … 518 581 any_remote |= c->remote; 519 582 any_local |= ! c->remote; 520 DB (DB_JOBS, (_("Live child 0x%08lx (%s) PID %ld%s\n"),521 (unsigned long int) c, c->file->name,522 (long) c->pid,c->remote ? _(" (remote)") : ""));583 DB (DB_JOBS, (_("Live child %p (%s) PID %s %s\n"), 584 c, c->file->name, pid2str (c->pid), 585 c->remote ? _(" (remote)") : "")); 523 586 #ifdef VMS 524 587 break; … … 556 619 else 557 620 #endif 558 pid = wait (&status);621 EINTRLOOP(pid, wait (&status)); 559 622 #endif /* !VMS */ 560 623 } … … 641 704 } 642 705 else 643 DB (DB_VERBOSE, ("Main thread handle = 0x%08lx\n", 644 (unsigned long)main_thread)); 706 DB (DB_VERBOSE, ("Main thread handle = %p\n", main_thread)); 645 707 } 646 708 … … 698 760 699 761 DB (DB_JOBS, (child_failed 700 ? _("Reaping losing child 0x%08lx PID %ld %s\n") 701 : _("Reaping winning child 0x%08lx PID %ld %s\n"), 702 (unsigned long int) c, (long) c->pid, 703 c->remote ? _(" (remote)") : "")); 762 ? _("Reaping losing child %p PID %s %s\n") 763 : _("Reaping winning child %p PID %s %s\n"), 764 c, pid2str (c->pid), c->remote ? _(" (remote)") : "")); 704 765 705 766 if (c->sh_batch_file) { … … 802 863 notice_finished_file (c->file); 803 864 804 DB (DB_JOBS, (_("Removing child 0x%08lx PID %ld%s from chain.\n"), 805 (unsigned long int) c, (long) c->pid, 806 c->remote ? _(" (remote)") : "")); 865 DB (DB_JOBS, (_("Removing child %p PID %s%s from chain.\n"), 866 c, pid2str (c->pid), c->remote ? _(" (remote)") : "")); 807 867 808 868 /* Block fatal signals while frobnicating the list, so that … … 848 908 { 849 909 if (!jobserver_tokens) 850 fatal (NILF, "INTERNAL: Freeing child 0x%08lx(%s) but no tokens left!\n",851 (unsigned long int)child, child->file->name);910 fatal (NILF, "INTERNAL: Freeing child %p (%s) but no tokens left!\n", 911 child, child->file->name); 852 912 853 913 /* If we're using the jobserver and this child is not the only outstanding … … 865 925 pfatal_with_name (_("write jobserver")); 866 926 867 DB (DB_JOBS, (_("Released token for child 0x%08lx(%s).\n"),868 (unsigned long int)child, child->file->name));927 DB (DB_JOBS, (_("Released token for child %p (%s).\n"), 928 child, child->file->name)); 869 929 } 870 930 … … 974 1034 static int bad_stdin = -1; 975 1035 #endif 976 register char *p; 977 int flags; 1036 char *p; 1037 /* Must be volatile to silence bogus GCC warning about longjmp/vfork. */ 1038 volatile int flags; 978 1039 #ifdef VMS 979 1040 char *argv; … … 1112 1173 unixy_shell /* the test is complicated and we already did it */ 1113 1174 #else 1114 (argv[0] && !strcmp (argv[0], "/bin/sh")) 1115 #endif 1116 && (argv[1] 1117 && argv[1][0] == '-' && argv[1][1] == 'c' && argv[1][2] == '\0') 1175 (argv[0] && is_bourne_compatible_shell(argv[0])) 1176 #endif 1177 && (argv[1] && argv[1][0] == '-' 1178 && 1179 ((argv[1][1] == 'c' && argv[1][2] == '\0') 1180 || 1181 (argv[1][1] == 'e' && argv[1][2] == 'c' && argv[1][3] == '\0'))) 1118 1182 && (argv[2] && argv[2][0] == ':' && argv[2][1] == '\0') 1119 1183 && argv[3] == NULL) … … 1282 1346 close (job_rfd); 1283 1347 1348 #ifdef SET_STACK_SIZE 1349 /* Reset limits, if necessary. */ 1350 if (stack_limit.rlim_cur) 1351 setrlimit (RLIMIT_STACK, &stack_limit); 1352 #endif 1353 1284 1354 child_execute_job (child->good_stdin ? 0 : bad_stdin, 1, 1285 1355 argv, child->environment); … … 1382 1452 1383 1453 if (hPID != INVALID_HANDLE_VALUE) 1384 child->pid = ( int) hPID;1454 child->pid = (pid_t) hPID; 1385 1455 else { 1386 1456 int i; … … 1459 1529 case cs_running: 1460 1530 c->next = children; 1461 DB (DB_JOBS, (_("Putting child 0x%08lx (%s) PID %ld%s on the chain.\n"),1462 (unsigned long int) c, c->file->name,1463 (long) c->pid,c->remote ? _(" (remote)") : ""));1531 DB (DB_JOBS, (_("Putting child %p (%s) PID %s%s on the chain.\n"), 1532 c, c->file->name, pid2str (c->pid), 1533 c->remote ? _(" (remote)") : "")); 1464 1534 children = c; 1465 1535 /* One more job slot is in use. */ … … 1601 1671 Copy the remaining uninteresting text to the output. */ 1602 1672 if (out != in) 1603 strcpy (out, in);1673 memmove (out, in, strlen (in) + 1); 1604 1674 1605 1675 /* Finally, expand the line. */ … … 1611 1681 `struct child', and add that to the chain. */ 1612 1682 1613 c = xmalloc (sizeof (struct child)); 1614 memset (c, '\0', sizeof (struct child)); 1683 c = xcalloc (sizeof (struct child)); 1615 1684 c->file = file; 1616 1685 c->command_lines = lines; … … 1713 1782 if (got_token == 1) 1714 1783 { 1715 DB (DB_JOBS, (_("Obtained token for child 0x%08lx(%s).\n"),1716 (unsigned long int)c, c->file->name));1784 DB (DB_JOBS, (_("Obtained token for child %p (%s).\n"), 1785 c, c->file->name)); 1717 1786 break; 1718 1787 } … … 2032 2101 int i; 2033 2102 fprintf(stderr, 2034 _("process_easy() failed failedto launch process (e=%ld)\n"),2103 _("process_easy() failed to launch process (e=%ld)\n"), 2035 2104 process_last_err(hPID)); 2036 2105 for (i = 0; argv[i]; i++) … … 2061 2130 break; 2062 2131 else 2132 { 2133 char *pidstr = xstrdup (pid2str ((pid_t)hWaitPID)); 2134 2063 2135 fprintf(stderr, 2064 _("make reaped child pid %ld, still waiting for pid %ld\n"), 2065 (DWORD)hWaitPID, (DWORD)hPID); 2136 _("make reaped child pid %s, still waiting for pid %s\n"), 2137 pidstr, pid2str ((pid_t)hPID)); 2138 free (pidstr); 2139 } 2066 2140 } 2067 2141 … … 2222 2296 static char ** 2223 2297 construct_command_argv_internal (char *line, char **restp, char *shell, 2224 char * ifs, int flags,2298 char *shellflags, char *ifs, int flags, 2225 2299 char **batch_filename_ptr) 2226 2300 { … … 2263 2337 "continue", "export", "read", "readonly", 2264 2338 "shift", "times", "trap", "switch", "unset", 2265 0 };2339 "ulimit", 0 }; 2266 2340 2267 2341 char *sh_chars; … … 2305 2379 #elif defined (WINDOWS32) 2306 2380 static char sh_chars_dos[] = "\"|&<>"; 2307 static char *sh_cmds_dos[] = { "break", "call", "cd", "chcp", "chdir", "cls", 2308 "copy", "ctty", "date", "del", "dir", "echo", 2309 "erase", "exit", "for", "goto", "if", "if", "md", 2310 "mkdir", "path", "pause", "prompt", "rd", "rem", 2311 "ren", "rename", "rmdir", "set", "shift", "time", 2312 "type", "ver", "verify", "vol", ":", 0 }; 2381 static char *sh_cmds_dos[] = { "assoc", "break", "call", "cd", "chcp", 2382 "chdir", "cls", "color", "copy", "ctty", 2383 "date", "del", "dir", "echo", "echo.", 2384 "endlocal", "erase", "exit", "for", "ftype", 2385 "goto", "if", "if", "md", "mkdir", "path", 2386 "pause", "prompt", "rd", "rem", "ren", 2387 "rename", "rmdir", "set", "setlocal", 2388 "shift", "time", "title", "type", "ver", 2389 "verify", "vol", ":", 0 }; 2313 2390 static char sh_chars_sh[] = "#;\"*?[]&|<>(){}$`^"; 2314 2391 static char *sh_cmds_sh[] = { "cd", "eval", "exec", "exit", "login", … … 2332 2409 "login", "logout", "read", "readonly", "set", 2333 2410 "shift", "switch", "test", "times", "trap", 2334 "u mask", "wait", "while", 0 };2411 "ulimit", "umask", "unset", "wait", "while", 0 }; 2335 2412 # ifdef HAVE_DOS_PATHS 2336 2413 /* This is required if the MSYS/Cygwin ports (which do not define … … 2426 2503 if (*ap != ' ' && *ap != '\t' && *ap != '\n') 2427 2504 goto slow; 2505 2506 if (shellflags != 0) 2507 if (shellflags[0] != '-' 2508 || ((shellflags[1] != 'c' || shellflags[2] != '\0') 2509 && (shellflags[1] != 'e' || shellflags[2] != 'c' || shellflags[3] != '\0'))) 2510 goto slow; 2428 2511 2429 2512 i = strlen (line) + 1; … … 2491 2574 /* Not inside a string, but it's a special char. */ 2492 2575 goto slow; 2576 else if (one_shell && *p == '\n') 2577 /* In .ONESHELL mode \n is a separator like ; or && */ 2578 goto slow; 2493 2579 #ifdef __MSDOS__ 2494 2580 else if (*p == '.' && p[1] == '.' && p[2] == '.' && p[3] != '.') … … 2708 2794 return 0; 2709 2795 #endif /* WINDOWS32 */ 2796 2710 2797 { 2711 2798 /* SHELL may be a multi-word command. Construct a command line 2712 " SHELL -cLINE", with all special chars in LINE escaped.2799 "$(SHELL) $(.SHELLFLAGS) LINE", with all special chars in LINE escaped. 2713 2800 Then recurse, expanding this command line to get the final 2714 2801 argument list. */ 2715 2802 2716 2803 unsigned int shell_len = strlen (shell); 2717 #ifndef VMS2718 static char minus_c[] = " -c ";2719 #else2720 static char minus_c[] = "";2721 #endif2722 2804 unsigned int line_len = strlen (line); 2723 2724 char *new_line = alloca (shell_len + (sizeof (minus_c)-1) 2725 + (line_len*2) + 1); 2805 unsigned int sflags_len = strlen (shellflags); 2726 2806 char *command_ptr = NULL; /* used for batch_mode_shell mode */ 2807 char *new_line; 2727 2808 2728 2809 # ifdef __EMX__ /* is this necessary? */ 2729 2810 if (!unixy_shell) 2730 minus_c[1] = '/'; /* " /c" */2811 shellflags[0] = '/'; /* "/c" */ 2731 2812 # endif 2732 2813 2814 /* In .ONESHELL mode we are allowed to throw the entire current 2815 recipe string at a single shell and trust that the user 2816 has configured the shell and shell flags, and formatted 2817 the string, appropriately. */ 2818 if (one_shell) 2819 { 2820 /* If the shell is Bourne compatible, we must remove and ignore 2821 interior special chars [@+-] because they're meaningless to 2822 the shell itself. If, however, we're in .ONESHELL mode and 2823 have changed SHELL to something non-standard, we should 2824 leave those alone because they could be part of the 2825 script. In this case we must also leave in place 2826 any leading [@+-] for the same reason. */ 2827 2828 /* Remove and ignore interior prefix chars [@+-] because they're 2829 meaningless given a single shell. */ 2830 #if defined __MSDOS__ || defined (__EMX__) 2831 if (unixy_shell) /* the test is complicated and we already did it */ 2832 #else 2833 if (is_bourne_compatible_shell(shell)) 2834 #endif 2835 { 2836 const char *f = line; 2837 char *t = line; 2838 2839 /* Copy the recipe, removing and ignoring interior prefix chars 2840 [@+-]: they're meaningless in .ONESHELL mode. */ 2841 while (f[0] != '\0') 2842 { 2843 int esc = 0; 2844 2845 /* This is the start of a new recipe line. 2846 Skip whitespace and prefix characters. */ 2847 while (isblank (*f) || *f == '-' || *f == '@' || *f == '+') 2848 ++f; 2849 2850 /* Copy until we get to the next logical recipe line. */ 2851 while (*f != '\0') 2852 { 2853 *(t++) = *(f++); 2854 if (f[-1] == '\\') 2855 esc = !esc; 2856 else 2857 { 2858 /* On unescaped newline, we're done with this line. */ 2859 if (f[-1] == '\n' && ! esc) 2860 break; 2861 2862 /* Something else: reset the escape sequence. */ 2863 esc = 0; 2864 } 2865 } 2866 } 2867 *t = '\0'; 2868 } 2869 2870 new_argv = xmalloc (4 * sizeof (char *)); 2871 new_argv[0] = xstrdup(shell); 2872 new_argv[1] = xstrdup(shellflags); 2873 new_argv[2] = line; 2874 new_argv[3] = NULL; 2875 return new_argv; 2876 } 2877 2878 new_line = alloca (shell_len + 1 + sflags_len + 1 2879 + (line_len*2) + 1); 2733 2880 ap = new_line; 2734 2881 memcpy (ap, shell, shell_len); 2735 2882 ap += shell_len; 2736 memcpy (ap, minus_c, sizeof (minus_c) - 1); 2737 ap += sizeof (minus_c) - 1; 2883 *(ap++) = ' '; 2884 memcpy (ap, shellflags, sflags_len); 2885 ap += sflags_len; 2886 *(ap++) = ' '; 2738 2887 command_ptr = ap; 2739 2888 for (p = line; *p != '\0'; ++p) … … 2785 2934 *ap++ = *p; 2786 2935 } 2787 if (ap == new_line + shell_len + s izeof (minus_c) - 1)2936 if (ap == new_line + shell_len + sflags_len + 2) 2788 2937 /* Line was empty. */ 2789 2938 return 0; … … 2837 2986 } else 2838 2987 #endif /* WINDOWS32 */ 2988 2839 2989 if (unixy_shell) 2840 new_argv = construct_command_argv_internal (new_line, 0, 0, 0, flags, 0); 2990 new_argv = construct_command_argv_internal (new_line, 0, 0, 0, 0, flags, 0); 2991 2841 2992 #ifdef __EMX__ 2842 2993 else if (!unixy_shell) … … 2849 3000 char *q = new_line; 2850 3001 memcpy (new_line, line, line_len + 1); 2851 /* replace all backslash-newline combination and also following tabs */ 2852 while (*q != '\0') 3002 /* Replace all backslash-newline combination and also following tabs. 3003 Important: stop at the first '\n' because that's what the loop above 3004 did. The next line starting at restp[0] will be executed during the 3005 next call of this function. */ 3006 while (*q != '\0' && *q != '\n') 2853 3007 { 2854 3008 if (q[0] == '\\' && q[1] == '\n') … … 2911 3065 cannot backslash-escape the special characters (see above). */ 2912 3066 new_argv = xmalloc (sizeof (char *)); 2913 line_len = strlen (new_line) - shell_len - s izeof (minus_c) + 1;3067 line_len = strlen (new_line) - shell_len - sflags_len - 2; 2914 3068 new_argv[0] = xmalloc (line_len + 1); 2915 3069 strncpy (new_argv[0], 2916 new_line + shell_len + s izeof (minus_c) - 1, line_len);3070 new_line + shell_len + sflags_len + 2, line_len); 2917 3071 new_argv[0][line_len] = '\0'; 2918 3072 } … … 2946 3100 int cmd_flags, char **batch_filename_ptr) 2947 3101 { 2948 char *shell, *ifs ;3102 char *shell, *ifs, *shellflags; 2949 3103 char **argv; 2950 3104 … … 3051 3205 #endif /* __EMX__ */ 3052 3206 3207 shellflags = allocated_variable_expand_for_file ("$(.SHELLFLAGS)", file); 3053 3208 ifs = allocated_variable_expand_for_file ("$(IFS)", file); 3054 3209 … … 3056 3211 } 3057 3212 3058 argv = construct_command_argv_internal (line, restp, shell, ifs,3213 argv = construct_command_argv_internal (line, restp, shell, shellflags, ifs, 3059 3214 cmd_flags, batch_filename_ptr); 3060 3215 3061 3216 free (shell); 3217 free (shellflags); 3062 3218 free (ifs); 3063 3219 #endif /* !VMS */ … … 3083 3239 return fd; 3084 3240 } 3085 #endif /* !HA PE_DUP2 && !_AMIGA */3241 #endif /* !HAVE_DUP2 && !_AMIGA */ 3086 3242 3087 3243 /* On VMS systems, include special VMS functions. */ -
vendor/gnumake/current/job.h
r1989 r2596 1 1 /* Definitions for managing subprocesses in GNU Make. 2 2 Copyright (C) 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 3 2002, 2003, 2004, 2005, 2006, 2007 Free Software Foundation, Inc. 3 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010 Free Software 4 Foundation, Inc. 4 5 This file is part of GNU Make. 5 6 … … 54 55 int efn; /* Completion event flag number */ 55 56 int cstatus; /* Completion status */ 57 char *comname; /* Temporary command file name */ 56 58 #endif 57 59 char *sh_batch_file; /* Script file for shell commands */ … … 67 69 extern struct child *children; 68 70 71 int is_bourne_compatible_shell(const char *path); 69 72 void new_job (struct file *file); 70 73 void reap_children (int block, int err); -
vendor/gnumake/current/main.c
r1989 r2596 1 1 /* Argument parsing and main program of GNU Make. 2 2 Copyright (C) 1988, 1989, 1990, 1991, 1992, 1993, 1994, 1995, 1996, 1997, 3 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007 Free Software4 Foundation, Inc.3 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 4 2010 Free Software Foundation, Inc. 5 5 This file is part of GNU Make. 6 6 … … 45 45 #endif 46 46 47 #if defined(HAVE_SYS_RESOURCE_H) && defined(HAVE_GETRLIMIT) && defined(HAVE_SETRLIMIT)48 # define SET_STACK_SIZE49 #endif50 51 #ifdef SET_STACK_SIZE52 # include <sys/resource.h>53 #endif54 55 47 #ifdef _AMIGA 56 48 int __stack = 20000; /* Make sure we have 20K of stack space */ … … 65 57 void print_dir_data_base (void); 66 58 void print_rule_data_base (void); 67 void print_file_data_base (void);68 59 void print_vpath_data_base (void); 69 60 … … 89 80 static void decode_switches (int argc, char **argv, int env); 90 81 static void decode_env_switches (char *envar, unsigned int len); 91 static voiddefine_makeflags (int all, int makefile);82 static const char *define_makeflags (int all, int makefile); 92 83 static char *quote_for_env (char *out, const char *in); 93 84 static void initialize_global_hash_tables (void); … … 222 213 static struct stringlist *makefiles = 0; 223 214 215 /* Size of the stack when we started. */ 216 217 #ifdef SET_STACK_SIZE 218 struct rlimit stack_limit; 219 #endif 220 221 224 222 /* Number of job slots (commands that can be run at once). */ 225 223 … … 266 264 267 265 static struct stringlist *new_files = 0; 266 267 /* List of strings to be eval'd. */ 268 static struct stringlist *eval_strings = 0; 268 269 269 270 /* If nonzero, we should just print usage and exit. */ … … 317 318 -e, --environment-overrides\n\ 318 319 Environment variables override makefiles.\n"), 320 N_("\ 321 --eval=STRING Evaluate STRING as a makefile statement.\n"), 319 322 N_("\ 320 323 -f FILE, --file=FILE, --makefile=FILE\n\ … … 423 426 { CHAR_MAX+5, flag, &warn_undefined_variables_flag, 1, 1, 0, 0, 0, 424 427 "warn-undefined-variables" }, 428 { CHAR_MAX+6, string, &eval_strings, 1, 0, 0, 0, 0, "eval" }, 425 429 { 0, 0, 0, 0, 0, 0, 0, 0, 0 } 426 430 }; … … 472 476 unsigned int makelevel; 473 477 474 /* First file defined in the makefile whose name does not 475 start with `.'. This is the default to remake if the 476 command line does not specify. */ 477 478 struct file *default_goal_file; 479 480 /* Pointer to the value of the .DEFAULT_GOAL special 481 variable. */ 482 char ** default_goal_name; 478 /* Pointer to the value of the .DEFAULT_GOAL special variable. 479 The value will be the name of the goal to remake if the command line 480 does not override it. It can be set by the makefile, or else it's 481 the first target defined in the makefile whose name does not start 482 with '.'. */ 483 484 struct variable * default_goal_var; 483 485 484 486 /* Pointer to structure for the file .DEFAULT … … 497 499 498 500 int second_expansion; 501 502 /* Nonzero if we have seen the '.ONESHELL' target. 503 This causes the entire recipe to be handed to SHELL 504 as a single string, potentially containing newlines. */ 505 506 int one_shell; 499 507 500 508 /* Nonzero if we have seen the `.NOTPARALLEL' target. … … 520 528 #endif 521 529 522 #if ! defined HAVE_BSD_SIGNAL && !defined bsd_signal530 #if !HAVE_DECL_BSD_SIGNAL && !defined bsd_signal 523 531 # if !defined HAVE_SIGACTION 524 532 # define bsd_signal signal 525 533 # else 526 typedef RETSIGTYPE (*bsd_signal_ret_t) ( );534 typedef RETSIGTYPE (*bsd_signal_ret_t) (int); 527 535 528 536 static bsd_signal_ret_t … … 684 692 { 685 693 sprintf(errmsg, 686 _("%s: Interrupt/Exception caught (code = 0x%lx, addr = 0x% lx)\n"),687 prg, exrec->ExceptionCode, (DWORD)exrec->ExceptionAddress);694 _("%s: Interrupt/Exception caught (code = 0x%lx, addr = 0x%p)\n"), 695 prg, exrec->ExceptionCode, exrec->ExceptionAddress); 688 696 fprintf(stderr, errmsg); 689 697 exit(255); … … 691 699 692 700 sprintf(errmsg, 693 _("\nUnhandled exception filter called from program %s\nExceptionCode = %lx\nExceptionFlags = %lx\nExceptionAddress = %lx\n"),701 _("\nUnhandled exception filter called from program %s\nExceptionCode = %lx\nExceptionFlags = %lx\nExceptionAddress = 0x%p\n"), 694 702 prg, exrec->ExceptionCode, exrec->ExceptionFlags, 695 (DWORD)exrec->ExceptionAddress);703 exrec->ExceptionAddress); 696 704 697 705 if (exrec->ExceptionCode == EXCEPTION_ACCESS_VIOLATION … … 699 707 sprintf(&errmsg[strlen(errmsg)], 700 708 (exrec->ExceptionInformation[0] 701 ? _("Access violation: write operation at address %lx\n")702 : _("Access violation: read operation at address %lx\n")),703 exrec->ExceptionInformation[1]);709 ? _("Access violation: write operation at address 0x%p\n") 710 : _("Access violation: read operation at address 0x%p\n")), 711 (PVOID)exrec->ExceptionInformation[1]); 704 712 705 713 /* turn this on if we want to put stuff in the event log too */ … … 775 783 sprintf (sh_path, "%s", search_token); 776 784 default_shell = xstrdup (w32ify (sh_path, 0)); 777 DB (DB_VERBOSE, 778 (_("find_and_set_shell setting default_shell = %s\n"),default_shell));785 DB (DB_VERBOSE, (_("find_and_set_shell() setting default_shell = %s\n"), 786 default_shell)); 779 787 sh_found = 1; 780 788 } else if (!no_default_sh_exe && … … 786 794 sprintf (sh_path, "%s", search_token); 787 795 default_shell = xstrdup (w32ify (sh_path, 0)); 788 DB (DB_VERBOSE, 789 (_("find_and_set_shell setting default_shell = %s\n"),default_shell));796 DB (DB_VERBOSE, (_("find_and_set_shell() setting default_shell = %s\n"), 797 default_shell)); 790 798 sh_found = 1; 791 799 } else { … … 828 836 if (sh_found) 829 837 DB (DB_VERBOSE, 830 (_("find_and_set_shell path search set default_shell = %s\n"),838 (_("find_and_set_shell() path search set default_shell = %s\n"), 831 839 default_shell)); 832 840 } … … 935 943 936 944 /* Set the stack limit huge so that alloca does not fail. */ 937 if (getrlimit (RLIMIT_STACK, &rlim) == 0) 945 if (getrlimit (RLIMIT_STACK, &rlim) == 0 946 && rlim.rlim_cur > 0 && rlim.rlim_cur < rlim.rlim_max) 938 947 { 948 stack_limit = rlim; 939 949 rlim.rlim_cur = rlim.rlim_max; 940 950 setrlimit (RLIMIT_STACK, &rlim); 941 951 } 952 else 953 stack_limit.rlim_cur = 0; 942 954 } 943 955 #endif … … 950 962 initialize_main(&argc, &argv); 951 963 952 default_goal_file = 0;953 964 reading_file = 0; 954 965 … … 967 978 /* Set up gettext/internationalization support. */ 968 979 setlocale (LC_ALL, ""); 969 bindtextdomain (PACKAGE, LOCALEDIR); 970 textdomain (PACKAGE); 980 /* The cast to void shuts up compiler warnings on systems that 981 disable NLS. */ 982 (void)bindtextdomain (PACKAGE, LOCALEDIR); 983 (void)textdomain (PACKAGE); 971 984 972 985 #ifdef POSIX … … 978 991 #define ADD_SIG(sig) fatal_signal_mask |= sigmask (sig) 979 992 #else 980 #define ADD_SIG(sig) 993 #define ADD_SIG(sig) (void)sig /* Needed to avoid warnings in MSVC. */ 981 994 #endif 982 995 #endif … … 1120 1133 1121 1134 /* Initialize the special variables. */ 1122 define_variable (".VARIABLES", 10, "", o_default, 0)->special = 1; 1123 /* define_variable (".TARGETS", 8, "", o_default, 0)->special = 1; */ 1124 define_variable (".RECIPEPREFIX", 13, "", o_default, 0)->special = 1; 1125 1126 /* Set up .FEATURES */ 1127 define_variable (".FEATURES", 9, 1128 "target-specific order-only second-expansion else-if", 1129 o_default, 0); 1135 define_variable_cname (".VARIABLES", "", o_default, 0)->special = 1; 1136 /* define_variable_cname (".TARGETS", "", o_default, 0)->special = 1; */ 1137 define_variable_cname (".RECIPEPREFIX", "", o_default, 0)->special = 1; 1138 define_variable_cname (".SHELLFLAGS", "-c", o_default, 0); 1139 1140 /* Set up .FEATURES 1141 We must do this in multiple calls because define_variable_cname() is 1142 a macro and some compilers (MSVC) don't like conditionals in macros. */ 1143 { 1144 const char *features = "target-specific order-only second-expansion" 1145 " else-if shortest-stem undefine" 1130 1146 #ifndef NO_ARCHIVES 1131 do_variable_definition (NILF, ".FEATURES", "archives", 1132 o_default, f_append, 0); 1147 " archives" 1133 1148 #endif 1134 1149 #ifdef MAKE_JOBSERVER 1135 do_variable_definition (NILF, ".FEATURES", "jobserver", 1136 o_default, f_append, 0); 1150 " jobserver" 1137 1151 #endif 1138 1152 #ifdef MAKE_SYMLINKS 1139 do_variable_definition (NILF, ".FEATURES", "check-symlink", 1140 o_default, f_append, 0); 1141 #endif 1153 " check-symlink" 1154 #endif 1155 ; 1156 1157 define_variable_cname (".FEATURES", features, o_default, 0); 1158 } 1142 1159 1143 1160 /* Read in variables from the environment. It is important that this be … … 1191 1208 #endif 1192 1209 shell_var.name = "SHELL"; 1210 shell_var.length = 5; 1193 1211 shell_var.value = xstrdup (ep + 1); 1194 1212 } … … 1208 1226 */ 1209 1227 if (!unix_path) 1210 define_variable("PATH", 4, 1211 windows32_path ? windows32_path : "", 1212 o_env, 1)->export = v_export; 1228 define_variable_cname ("PATH", windows32_path ? windows32_path : "", 1229 o_env, 1)->export = v_export; 1213 1230 #endif 1214 1231 #else /* For Amiga, read the ENV: device, ignoring all dirs */ … … 1252 1269 decode_env_switches (STRING_SIZE_TUPLE ("MFLAGS")); 1253 1270 #endif 1271 1254 1272 decode_switches (argc, argv, 0); 1273 1255 1274 #ifdef WINDOWS32 1256 1275 if (suspend_flag) { … … 1316 1335 # endif 1317 1336 ) 1318 argv[0] = xstrdup (concat ( current_directory, "/", argv[0]));1337 argv[0] = xstrdup (concat (3, current_directory, "/", argv[0])); 1319 1338 #else /* !__MSDOS__ */ 1320 1339 if (current_directory[0] != '\0' … … 1325 1344 #endif 1326 1345 ) 1327 argv[0] = xstrdup (concat ( current_directory, "/", argv[0]));1346 argv[0] = xstrdup (concat (3, current_directory, "/", argv[0])); 1328 1347 #endif /* !__MSDOS__ */ 1329 1348 #endif /* WINDOWS32 */ … … 1332 1351 /* The extra indirection through $(MAKE_COMMAND) is done 1333 1352 for hysterical raisins. */ 1334 (void) define_variable ("MAKE_COMMAND", 12, argv[0], o_default, 0);1335 (void) define_variable ("MAKE", 4, "$(MAKE_COMMAND)", o_default, 1);1353 define_variable_cname ("MAKE_COMMAND", argv[0], o_default, 0); 1354 define_variable_cname ("MAKE", "$(MAKE_COMMAND)", o_default, 1); 1336 1355 1337 1356 if (command_variables != 0) … … 1371 1390 /* Define an unchangeable variable with a name that no POSIX.2 1372 1391 makefile could validly use for its own variable. */ 1373 (void) define_variable ("-*-command-variables-*-", 23, 1374 value, o_automatic, 0); 1392 define_variable_cname ("-*-command-variables-*-", value, o_automatic, 0); 1375 1393 1376 1394 /* Define the variable; this will not override any user definition. … … 1380 1398 allow the user's setting of MAKEOVERRIDES to affect MAKEFLAGS, so 1381 1399 a reference to this hidden variable is written instead. */ 1382 (void) define_variable ("MAKEOVERRIDES", 13,1383 "${-*-command-variables-*-}",o_env, 1);1400 define_variable_cname ("MAKEOVERRIDES", "${-*-command-variables-*-}", 1401 o_env, 1); 1384 1402 } 1385 1403 … … 1395 1413 But allow -C/ just in case someone wants that. */ 1396 1414 { 1397 char *p = dir + strlen (dir) - 1;1415 char *p = (char *)dir + strlen (dir) - 1; 1398 1416 while (p > dir && (p[0] == '/' || p[0] == '\\')) 1399 1417 --p; … … 1468 1486 } 1469 1487 1470 (void) define_variable ("CURDIR", 6, current_directory, o_file, 0);1488 define_variable_cname ("CURDIR", current_directory, o_file, 0); 1471 1489 1472 1490 /* Read any stdin makefiles into temporary files. */ … … 1608 1626 default_file = enter_file (strcache_add (".DEFAULT")); 1609 1627 1610 { 1611 struct variable *v = define_variable (".DEFAULT_GOAL", 13, "", o_file, 0); 1612 default_goal_name = &v->value; 1613 } 1628 default_goal_var = define_variable_cname (".DEFAULT_GOAL", "", o_file, 0); 1629 1630 /* Evaluate all strings provided with --eval. 1631 Also set up the $(-*-eval-flags-*-) variable. */ 1632 1633 if (eval_strings) 1634 { 1635 char *p, *value; 1636 unsigned int i; 1637 unsigned int len = sizeof ("--eval=") * eval_strings->idx; 1638 1639 for (i = 0; i < eval_strings->idx; ++i) 1640 { 1641 p = xstrdup (eval_strings->list[i]); 1642 len += 2 * strlen (p); 1643 eval_buffer (p); 1644 free (p); 1645 } 1646 1647 p = value = alloca (len); 1648 for (i = 0; i < eval_strings->idx; ++i) 1649 { 1650 strcpy (p, "--eval="); 1651 p += strlen (p); 1652 p = quote_for_env (p, eval_strings->list[i]); 1653 *(p++) = ' '; 1654 } 1655 p[-1] = '\0'; 1656 1657 define_variable_cname ("-*-eval-flags-*-", value, o_automatic, 0); 1658 } 1614 1659 1615 1660 /* Read all the makefiles. */ … … 1670 1715 1671 1716 if (jobserver_fds) 1672 { 1673 const char *cp; 1674 unsigned int ui; 1675 1676 for (ui=1; ui < jobserver_fds->idx; ++ui) 1677 if (!streq (jobserver_fds->list[0], jobserver_fds->list[ui])) 1678 fatal (NILF, _("internal error: multiple --jobserver-fds options")); 1679 1680 /* Now parse the fds string and make sure it has the proper format. */ 1681 1682 cp = jobserver_fds->list[0]; 1683 1684 if (sscanf (cp, "%d,%d", &job_fds[0], &job_fds[1]) != 2) 1685 fatal (NILF, 1686 _("internal error: invalid --jobserver-fds string `%s'"), cp); 1687 1688 DB (DB_JOBS, 1689 (_("Jobserver client (fds %d,%d)\n"), job_fds[0], job_fds[1])); 1690 1691 /* The combination of a pipe + !job_slots means we're using the 1692 jobserver. If !job_slots and we don't have a pipe, we can start 1693 infinite jobs. If we see both a pipe and job_slots >0 that means the 1694 user set -j explicitly. This is broken; in this case obey the user 1695 (ignore the jobserver pipe for this make) but print a message. */ 1696 1697 if (job_slots > 0) 1698 error (NILF, 1699 _("warning: -jN forced in submake: disabling jobserver mode.")); 1700 1701 /* Create a duplicate pipe, that will be closed in the SIGCHLD 1702 handler. If this fails with EBADF, the parent has closed the pipe 1703 on us because it didn't think we were a submake. If so, print a 1704 warning then default to -j1. */ 1705 1706 else if ((job_rfd = dup (job_fds[0])) < 0) 1707 { 1708 if (errno != EBADF) 1709 pfatal_with_name (_("dup jobserver")); 1710 1717 { 1718 const char *cp; 1719 unsigned int ui; 1720 1721 for (ui=1; ui < jobserver_fds->idx; ++ui) 1722 if (!streq (jobserver_fds->list[0], jobserver_fds->list[ui])) 1723 fatal (NILF, _("internal error: multiple --jobserver-fds options")); 1724 1725 /* Now parse the fds string and make sure it has the proper format. */ 1726 1727 cp = jobserver_fds->list[0]; 1728 1729 if (sscanf (cp, "%d,%d", &job_fds[0], &job_fds[1]) != 2) 1730 fatal (NILF, 1731 _("internal error: invalid --jobserver-fds string `%s'"), cp); 1732 1733 DB (DB_JOBS, 1734 (_("Jobserver client (fds %d,%d)\n"), job_fds[0], job_fds[1])); 1735 1736 /* The combination of a pipe + !job_slots means we're using the 1737 jobserver. If !job_slots and we don't have a pipe, we can start 1738 infinite jobs. If we see both a pipe and job_slots >0 that means the 1739 user set -j explicitly. This is broken; in this case obey the user 1740 (ignore the jobserver pipe for this make) but print a message. */ 1741 1742 if (job_slots > 0) 1711 1743 error (NILF, 1712 _("warning: jobserver unavailable: using -j1. Add `+' to parent make rule.")); 1713 job_slots = 1; 1714 } 1715 1716 if (job_slots > 0) 1717 { 1718 close (job_fds[0]); 1719 close (job_fds[1]); 1720 job_fds[0] = job_fds[1] = -1; 1721 free (jobserver_fds->list); 1722 free (jobserver_fds); 1723 jobserver_fds = 0; 1724 } 1725 } 1744 _("warning: -jN forced in submake: disabling jobserver mode.")); 1745 1746 /* Create a duplicate pipe, that will be closed in the SIGCHLD 1747 handler. If this fails with EBADF, the parent has closed the pipe 1748 on us because it didn't think we were a submake. If so, print a 1749 warning then default to -j1. */ 1750 1751 else if ((job_rfd = dup (job_fds[0])) < 0) 1752 { 1753 if (errno != EBADF) 1754 pfatal_with_name (_("dup jobserver")); 1755 1756 error (NILF, 1757 _("warning: jobserver unavailable: using -j1. Add `+' to parent make rule.")); 1758 job_slots = 1; 1759 } 1760 1761 if (job_slots > 0) 1762 { 1763 close (job_fds[0]); 1764 close (job_fds[1]); 1765 job_fds[0] = job_fds[1] = -1; 1766 free (jobserver_fds->list); 1767 free (jobserver_fds); 1768 jobserver_fds = 0; 1769 } 1770 } 1726 1771 1727 1772 /* If we have >1 slot but no jobserver-fds, then we're a top-level make. … … 1841 1886 FILE_TIMESTAMP *makefile_mtimes = 0; 1842 1887 unsigned int mm_idx = 0; 1843 char **nargv = argv;1844 int nargc = argc;1888 char **nargv; 1889 int nargc; 1845 1890 int orig_db_level = db_level; 1846 1891 int status; … … 2011 2056 if (strneq (argv[i], "-f", 2)) /* XXX */ 2012 2057 { 2013 char *p = &argv[i][2]; 2014 if (*p == '\0') 2058 if (argv[i][2] == '\0') 2015 2059 /* This cast is OK since we never modify argv. */ 2016 2060 argv[++i] = (char *) makefiles->list[j]; 2017 2061 else 2018 argv[i] = xstrdup (concat ( "-f", makefiles->list[j], ""));2062 argv[i] = xstrdup (concat (2, "-f", makefiles->list[j])); 2019 2063 ++j; 2020 2064 } … … 2022 2066 2023 2067 /* Add -o option for the stdin temporary file, if necessary. */ 2068 nargc = argc; 2024 2069 if (stdin_nm) 2025 2070 { 2026 2071 nargv = xmalloc ((nargc + 2) * sizeof (char *)); 2027 2072 memcpy (nargv, argv, argc * sizeof (char *)); 2028 nargv[nargc++] = xstrdup (concat ( "-o", stdin_nm, ""));2073 nargv[nargc++] = xstrdup (concat (2, "-o", stdin_nm)); 2029 2074 nargv[nargc] = 0; 2030 2075 } 2076 else 2077 nargv = argv; 2031 2078 2032 2079 if (directories != 0 && directories->idx > 0) … … 2045 2092 2046 2093 ++restarts; 2094 2095 /* Reset makeflags in case they were changed. */ 2096 { 2097 const char *pv = define_makeflags (1, 1); 2098 char *p = alloca (sizeof ("MAKEFLAGS=") + strlen (pv) + 1); 2099 sprintf (p, "MAKEFLAGS=%s", pv); 2100 putenv (p); 2101 } 2047 2102 2048 2103 if (ISDB (DB_BASIC)) … … 2164 2219 perror_with_name (_("unlink (temporary file): "), stdin_nm); 2165 2220 2221 /* If there were no command-line goals, use the default. */ 2222 if (goals == 0) 2223 { 2224 char *p; 2225 2226 if (default_goal_var->recursive) 2227 p = variable_expand (default_goal_var->value); 2228 else 2229 { 2230 p = variable_buffer_output (variable_buffer, default_goal_var->value, 2231 strlen (default_goal_var->value)); 2232 *p = '\0'; 2233 p = variable_buffer; 2234 } 2235 2236 if (*p != '\0') 2237 { 2238 struct file *f = lookup_file (p); 2239 2240 /* If .DEFAULT_GOAL is a non-existent target, enter it into the 2241 table and let the standard logic sort it out. */ 2242 if (f == 0) 2243 { 2244 struct nameseq *ns; 2245 2246 ns = PARSE_FILE_SEQ (&p, struct nameseq, '\0', NULL, 0); 2247 if (ns) 2248 { 2249 /* .DEFAULT_GOAL should contain one target. */ 2250 if (ns->next != 0) 2251 fatal (NILF, _(".DEFAULT_GOAL contains more than one target")); 2252 2253 f = enter_file (strcache_add (ns->name)); 2254 2255 ns->name = 0; /* It was reused by enter_file(). */ 2256 free_ns_chain (ns); 2257 } 2258 } 2259 2260 if (f) 2261 { 2262 goals = alloc_dep (); 2263 goals->file = f; 2264 } 2265 } 2266 } 2267 else 2268 lastgoal->next = 0; 2269 2270 2271 if (!goals) 2272 { 2273 if (read_makefiles == 0) 2274 fatal (NILF, _("No targets specified and no makefile found")); 2275 2276 fatal (NILF, _("No targets")); 2277 } 2278 2279 /* Update the goals. */ 2280 2281 DB (DB_BASIC, (_("Updating goal targets....\n"))); 2282 2166 2283 { 2167 2284 int status; 2168 2169 /* If there were no command-line goals, use the default. */2170 if (goals == 0)2171 {2172 if (**default_goal_name != '\0')2173 {2174 if (default_goal_file == 0 ||2175 strcmp (*default_goal_name, default_goal_file->name) != 0)2176 {2177 default_goal_file = lookup_file (*default_goal_name);2178 2179 /* In case user set .DEFAULT_GOAL to a non-existent target2180 name let's just enter this name into the table and let2181 the standard logic sort it out. */2182 if (default_goal_file == 0)2183 {2184 struct nameseq *ns;2185 char *p = *default_goal_name;2186 2187 ns = multi_glob (2188 parse_file_seq (&p, '\0', sizeof (struct nameseq), 1),2189 sizeof (struct nameseq));2190 2191 /* .DEFAULT_GOAL should contain one target. */2192 if (ns->next != 0)2193 fatal (NILF, _(".DEFAULT_GOAL contains more than one target"));2194 2195 default_goal_file = enter_file (strcache_add (ns->name));2196 2197 ns->name = 0; /* It was reused by enter_file(). */2198 free_ns_chain (ns);2199 }2200 }2201 2202 goals = alloc_dep ();2203 goals->file = default_goal_file;2204 }2205 }2206 else2207 lastgoal->next = 0;2208 2209 2210 if (!goals)2211 {2212 if (read_makefiles == 0)2213 fatal (NILF, _("No targets specified and no makefile found"));2214 2215 fatal (NILF, _("No targets"));2216 }2217 2218 /* Update the goals. */2219 2220 DB (DB_BASIC, (_("Updating goal targets....\n")));2221 2285 2222 2286 switch (update_goal_chain (goals)) … … 2391 2455 value = vp; 2392 2456 } 2393 define_variable ("MAKECMDGOALS", 12, value, o_default, 0);2457 define_variable_cname ("MAKECMDGOALS", value, o_default, 0); 2394 2458 } 2395 2459 } … … 2493 2557 else if (*optarg == '\0') 2494 2558 { 2495 error (NILF, _("the `-%c' option requires a non-empty string argument"), 2496 cs->c); 2559 char opt[2] = "c"; 2560 const char *op = opt; 2561 2562 if (short_option (cs->c)) 2563 opt[0] = cs->c; 2564 else 2565 op = cs->long_name; 2566 2567 error (NILF, _("the `%s%s' option requires a non-empty string argument"), 2568 short_option (cs->c) ? "-" : "--", op); 2497 2569 bad = 1; 2498 2570 } … … 2511 2583 { 2512 2584 sl->max += 5; 2513 sl->list = xrealloc (sl->list, 2585 /* MSVC erroneously warns without a cast here. */ 2586 sl->list = xrealloc ((void *)sl->list, 2514 2587 sl->max * sizeof (char *)); 2515 2588 } … … 2658 2731 need permanent storage for this in case decode_switches saves 2659 2732 pointers into the value. */ 2660 argv[1] = xstrdup (concat ( "-", argv[1], ""));2733 argv[1] = xstrdup (concat (2, "-", argv[1])); 2661 2734 2662 2735 /* Parse those words. */ … … 2690 2763 Don't include options with the `no_makefile' flag set if MAKEFILE. */ 2691 2764 2692 static void2765 static const char * 2693 2766 define_makeflags (int all, int makefile) 2694 2767 { 2695 static const char ref[] = "$(MAKEOVERRIDES)"; 2696 static const char posixref[] = "$(-*-command-variables-*-)"; 2697 register const struct command_switch *cs; 2768 const char ref[] = "$(MAKEOVERRIDES)"; 2769 const char posixref[] = "$(-*-command-variables-*-)"; 2770 const char evalref[] = "$(-*-eval-flags-*-)"; 2771 const struct command_switch *cs; 2698 2772 char *flagstring; 2699 2773 register char *p; … … 2716 2790 #define ADD_FLAG(ARG, LEN) \ 2717 2791 do { \ 2718 struct flag *new = alloca (sizeof (struct flag)); 2792 struct flag *new = alloca (sizeof (struct flag)); \ 2719 2793 new->cs = cs; \ 2720 2794 new->arg = (ARG); \ … … 2724 2798 ++flagslen; /* Just a single flag letter. */ \ 2725 2799 else \ 2726 flagslen += 1 + 1 + 1 + 1 + 3 * (LEN); /* " -x foo" */ \ 2800 /* " -x foo", plus space to expand "foo". */ \ 2801 flagslen += 1 + 1 + 1 + 1 + (3 * (LEN)); \ 2727 2802 if (!short_option (cs->c)) \ 2728 2803 /* This switch has no single-letter version, so we use the long. */ \ … … 2811 2886 } 2812 2887 2813 flagslen += 4 + sizeof posixref; /* Four more for the possible " -- ". */ 2888 /* Four more for the possible " -- ". */ 2889 flagslen += 4 + sizeof (posixref) + sizeof (evalref); 2814 2890 2815 2891 #undef ADD_FLAG … … 2883 2959 /* Since MFLAGS is not parsed for flags, there is no reason to 2884 2960 override any makefile redefinition. */ 2885 (void) define_variable ("MFLAGS", 6, flagstring, o_env, 1); 2961 define_variable_cname ("MFLAGS", flagstring, o_env, 1); 2962 2963 /* Write a reference to -*-eval-flags-*-, which contains all the --eval 2964 flag options. */ 2965 if (eval_strings) 2966 { 2967 if (p == &flagstring[1]) 2968 /* No flags written, so elide the leading dash already written. */ 2969 p = flagstring; 2970 else 2971 *p++ = ' '; 2972 memcpy (p, evalref, sizeof (evalref) - 1); 2973 p += sizeof (evalref) - 1; 2974 } 2886 2975 2887 2976 if (all && command_variables != 0) … … 2910 2999 if (posix_pedantic) 2911 3000 { 2912 memcpy (p, posixref, sizeof posixref- 1);2913 p += sizeof posixref- 1;3001 memcpy (p, posixref, sizeof (posixref) - 1); 3002 p += sizeof (posixref) - 1; 2914 3003 } 2915 3004 else 2916 3005 { 2917 memcpy (p, ref, sizeof ref- 1);2918 p += sizeof ref- 1;3006 memcpy (p, ref, sizeof (ref) - 1); 3007 p += sizeof (ref) - 1; 2919 3008 } 2920 3009 } … … 2930 3019 *p = '\0'; 2931 3020 2932 v = define_variable ("MAKEFLAGS", 9,2933 /* If there are switches, omit the leading dash 2934 unless it is a single long option with two 2935 leading dashes. */ 2936 &flagstring[(flagstring[0] == '-' 2937 && flagstring[1] != '-') 2938 ? 1 : 0], 2939 /* This used to use o_env, but that lost when a 2940 makefile defined MAKEFLAGS. Makefiles set2941 MAKEFLAGS to add switches, but we still want 2942 to redefine its value with the full set of 2943 switches. Of course, an override or command 2944 definition will still take precedence. */ 2945 o_file, 1); 3021 /* If there are switches, omit the leading dash unless it is a single long 3022 option with two leading dashes. */ 3023 if (flagstring[0] == '-' && flagstring[1] != '-') 3024 ++flagstring; 3025 3026 v = define_variable_cname ("MAKEFLAGS", flagstring, 3027 /* This used to use o_env, but that lost when a 3028 makefile defined MAKEFLAGS. Makefiles set 3029 MAKEFLAGS to add switches, but we still want 3030 to redefine its value with the full set of 3031 switches. Of course, an override or command 3032 definition will still take precedence. */ 3033 o_file, 1); 3034 2946 3035 if (! all) 2947 3036 /* The first time we are called, set MAKEFLAGS to always be exported. … … 2949 3038 after reading makefiles which might have done `unexport MAKEFLAGS'. */ 2950 3039 v->export = v_export; 3040 3041 return v->value; 2951 3042 } 2952 3043 … … 2978 3069 word "Copyright", so it hardly seems worth it. */ 2979 3070 2980 printf ("%sCopyright (C) 20 07Free Software Foundation, Inc.\n", precede);3071 printf ("%sCopyright (C) 2010 Free Software Foundation, Inc.\n", precede); 2981 3072 2982 3073 printf (_("%sLicense GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html>\n\ … … 3060 3151 3061 3152 close (job_fds[0]); 3153 3154 /* Clean out jobserver_fds so we don't pass this information to any 3155 sub-makes. Also reset job_slots since it will be put on the command 3156 line, not in MAKEFLAGS. */ 3157 job_slots = default_job_slots; 3158 if (jobserver_fds) 3159 { 3160 /* MSVC erroneously warns without a cast here. */ 3161 free ((void *)jobserver_fds->list); 3162 free (jobserver_fds); 3163 jobserver_fds = 0; 3164 } 3062 3165 } 3063 3166 } … … 3104 3207 of relative pathnames fail. */ 3105 3208 if (directory_before_chdir != 0) 3106 chdir (directory_before_chdir); 3209 { 3210 /* If it fails we don't care: shut up GCC. */ 3211 int _x; 3212 _x = chdir (directory_before_chdir); 3213 } 3107 3214 3108 3215 log_working_directory (0); -
vendor/gnumake/current/maintMakefile
r1989 r2596 144 144 && (cd "$$tmppo" \ 145 145 && $(WGET) -r -l1 -nd --no-parent -A '*.po' $(po_repo)) \ 146 && cp "$$tmppo"/*.po po && rm -rf "$$tmppo"146 && cp "$$tmppo"/*.po $(top_srcdir)/po && rm -rf "$$tmppo" 147 147 cd po && $(MAKE) update-po 148 148 $(MAKE) po-check 149 149 150 150 po-update: 151 if test -d "po"; then \ 152 $(MAKE) do-po-update; \ 153 fi 151 [ -d "po" ] && $(MAKE) do-po-update 154 152 155 153 # -------------------------- # … … 161 159 # regularly updated from the specified URL. 162 160 163 savannah-url = http://savannah.gnu.org/cgi-bin/viewcvs/~checkout~ 161 cvs-url = http://savannah.gnu.org/cgi-bin/viewcvs/~checkout~ 162 git-url = http://git.savannah.gnu.org/cgit 164 163 target = $(patsubst get-%,%,$@) 165 164 166 config-url = $( savannah-url)/config/config/$(patsubst get-config/%,%,$@)165 config-url = $(git-url)/config.git/plain/$(patsubst get-config/%,%,$@) 167 166 get-config/config.guess get-config/config.sub: 168 167 @echo $(WGET) $(config-url) -O $(target) \ … … 170 169 && $(move_if_change) 171 170 172 gnulib-url = $( savannah-url)/gnulib/gnulib/build-aux/$(patsubst get-config/%,%,$@)171 gnulib-url = $(git-url)/gnulib.git/plain/build-aux/$(patsubst get-config/%,%,$@) 173 172 get-config/texinfo.tex: 174 173 @echo $(WGET) $(gnulib-url) -O $(target) \ … … 176 175 && $(move_if_change) 177 176 178 gnustandards-url = $( savannah-url)/gnustandards/gnustandards/$(patsubst get-doc/%,%,$@)177 gnustandards-url = $(cvs-url)/gnustandards/gnustandards/$(patsubst get-doc/%,%,$@) 179 178 get-doc/make-stds.texi get-doc/fdl.texi: 180 179 @echo $(WGET) $(gnustandards-url) -O $(target) \ … … 182 181 && $(move_if_change) 183 182 184 .PHONY: cvs-update185 cvs-update: get-config/texinfo.tex get-config/config.guess get-config/config.sub get-doc/make-stds.texi get-doc/fdl.texi183 .PHONY: scm-update 184 scm-update: get-config/texinfo.tex get-config/config.guess get-config/config.sub get-doc/make-stds.texi get-doc/fdl.texi 186 185 187 186 … … 191 190 192 191 .PHONY: update 193 update: po-update cvs-update192 update: po-update scm-update 194 193 195 194 … … 205 204 206 205 changelog-check: 207 if head ChangeLog | grep 'Version $(VERSION)' >/dev/null; then \206 if head $(top_srcdir)/ChangeLog | grep 'Version $(VERSION)' >/dev/null; then \ 208 207 :; \ 209 208 else \ … … 247 246 @echo "Creating directive file '$@':" 248 247 @( \ 249 echo 'vers tion: 1.1'; \248 echo 'version: 1.1'; \ 250 249 echo 'directory: make'; \ 251 250 echo 'filename: $*'; \ … … 258 257 259 258 FTPPUT = ncftpput 260 gnu-url = ftp-upload.gnu.org /incoming 259 gnu-upload-host = ftp-upload.gnu.org 260 gnu-upload-dir = /incoming 261 261 262 262 263 UPLOADS = upload-alpha upload-ftp 263 264 .PHONY: $(UPLOADS) 264 265 $(UPLOADS): $(DIST_ARCHIVES) $(DIST_ARCHIVES_SIG) $(DIST_ARCHIVES_DIRECTIVE) 265 $(FTPPUT) "$(gnu-u rl)/$(@:upload-%=%)" $^266 $(FTPPUT) "$(gnu-upload-host)" "$(gnu-upload-dir)/$(@:upload-%=%)" $^ 266 267 267 268 268 269 # Copyright (C) 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006, 269 # 2007 Free Software Foundation, Inc.270 # 2007, 2008, 2009, 2010 Free Software Foundation, Inc. 270 271 # This file is part of GNU Make. 271 272 # -
vendor/gnumake/current/make.1
r1989 r2596 224 224 .TP 0.5i 225 225 .BR \-n , " \-\-just\-print" , " \-\-dry\-run" , " \-\-recon" 226 Print the commands that would be executed, but do not execute them. 226 Print the commands that would be executed, but do not execute them (except in 227 certain circumstances). 227 228 .TP 0.5i 228 229 \fB\-o\fR \fIfile\fR, \fB\-\-old\-file\fR=\fIfile\fR, \fB\-\-assume\-old\fR=\fIfile\fR -
vendor/gnumake/current/make.h
r1989 r2596 1 1 /* Miscellaneous global declarations and portability cruft for GNU Make. 2 2 Copyright (C) 1988, 1989, 1990, 1991, 1992, 1993, 1994, 1995, 1996, 1997, 3 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007 Free Software4 Foundation, Inc.3 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 4 2010 Free Software Foundation, Inc. 5 5 This file is part of GNU Make. 6 6 … … 24 24 #define HAVE_CONFIG_H 1 25 25 26 /* Specify we want GNU source code. This must be defined before any 27 system headers are included. */ 28 29 #define _GNU_SOURCE 1 30 26 31 /* AIX requires this to be the first thing in the file. */ 27 #ifndef __GNUC__ 28 # if HAVE_ALLOCA_H 29 # include <alloca.h> 30 # else 31 # ifdef _AIX 32 #if HAVE_ALLOCA_H 33 # include <alloca.h> 34 #else 35 # ifdef _AIX 32 36 #pragma alloca 33 # else 37 # else 38 # if !defined(__GNUC__) && !defined(WINDOWS32) 34 39 # ifndef alloca /* predefined by HP cc +Olibcalls */ 35 40 char *alloca (); … … 38 43 # endif 39 44 #endif 40 41 42 /* Specify we want GNU source code. This must be defined before any43 system headers are included. */44 45 #define _GNU_SOURCE 146 45 47 46 … … 268 267 #define ISDIGIT(c) ((unsigned) (c) - '0' <= 9) 269 268 270 #ifndef iAPX286 271 # 269 /* Test if two strings are equal. Is this worthwhile? Should be profiled. */ 270 #define streq(a, b) \ 272 271 ((a) == (b) || \ 273 272 (*(a) == *(b) && (*(a) == '\0' || !strcmp ((a) + 1, (b) + 1)))) 274 # ifdef HAVE_CASE_INSENSITIVE_FS 275 # define strieq(a, b) \ 273 274 /* Test if two strings are equal, but match case-insensitively on systems 275 which have case-insensitive filesystems. Should only be used for 276 filenames! */ 277 #ifdef HAVE_CASE_INSENSITIVE_FS 278 # define patheq(a, b) \ 276 279 ((a) == (b) \ 277 280 || (tolower((unsigned char)*(a)) == tolower((unsigned char)*(b)) \ 278 281 && (*(a) == '\0' || !strcasecmp ((a) + 1, (b) + 1)))) 279 # else 280 # define strieq(a, b) streq(a, b) 281 # endif 282 #else 283 /* Buggy compiler can't handle this. */ 284 # define streq(a, b) (strcmp ((a), (b)) == 0) 285 # define strieq(a, b) (strcmp ((a), (b)) == 0) 286 #endif 282 #else 283 # define patheq(a, b) streq(a, b) 284 #endif 285 287 286 #define strneq(a, b, l) (strncmp ((a), (b), (l)) == 0) 288 287 … … 330 329 331 330 void sync_Path_environment (void); 332 int w32_kill ( int pid, int sig);331 int w32_kill (pid_t pid, int sig); 333 332 char *end_of_token_w32 (const char *s, char stopchar); 334 333 int find_and_set_default_shell (const char *token); … … 340 339 extern int unixy_shell; 341 340 #endif /* WINDOWS32 */ 341 342 #if defined(HAVE_SYS_RESOURCE_H) && defined(HAVE_GETRLIMIT) && defined(HAVE_SETRLIMIT) 343 # define SET_STACK_SIZE 344 #endif 345 #ifdef SET_STACK_SIZE 346 # include <sys/resource.h> 347 struct rlimit stack_limit; 348 #endif 342 349 343 350 struct floc … … 362 369 363 370 #if HAVE_ANSI_COMPILER && USE_VARIADIC && HAVE_STDARG_H 371 const char *concat (unsigned int, ...); 364 372 void message (int prefix, const char *fmt, ...) 365 373 __attribute__ ((__format__ (__printf__, 2, 3))); … … 369 377 __attribute__ ((noreturn, __format__ (__printf__, 2, 3))); 370 378 #else 379 const char *concat (); 371 380 void message (); 372 381 void error (); … … 378 387 void pfatal_with_name (const char *) __attribute__ ((noreturn)); 379 388 void perror_with_name (const char *, const char *); 380 char *savestring (const char *, unsigned int);381 char *concat (const char *, const char *, const char *);382 389 void *xmalloc (unsigned int); 390 void *xcalloc (unsigned int); 383 391 void *xrealloc (void *, unsigned int); 384 392 char *xstrdup (const char *); 393 char *xstrndup (const char *, unsigned int); 385 394 char *find_next_token (const char **, unsigned int *); 386 395 char *next_token (const char *); … … 426 435 void build_vpath_lists (void); 427 436 void construct_vpath_list (char *pattern, char *dirpath); 428 const char *vpath_search (const char *file, FILE_TIMESTAMP *mtime_ptr); 437 const char *vpath_search (const char *file, FILE_TIMESTAMP *mtime_ptr, 438 unsigned int* vpath_index, unsigned int* path_index); 429 439 int gpath_search (const char *file, unsigned int len); 430 440 … … 483 493 #endif 484 494 495 #if !HAVE_STRNCASECMP 496 # if HAVE_STRNICMP 497 # define strncasecmp strnicmp 498 # elif HAVE_STRNCMPI 499 # define strncasecmp strncmpi 500 # else 501 /* Create our own, in misc.c */ 502 int strncasecmp (const char *s1, const char *s2, int n); 503 # endif 504 #endif 505 485 506 extern const struct floc *reading_file; 486 507 extern const struct floc **expanding_var; … … 494 515 extern int warn_undefined_variables_flag, posix_pedantic, not_parallel; 495 516 extern int second_expansion, clock_skew_detected, rebuilding_makefiles; 517 extern int one_shell; 496 518 497 519 /* can we run commands via 'sh -c xxx' or must we use batch files? */ -
vendor/gnumake/current/makefile.com
r1989 r2596 140 140 $!----------------------------------------------------------------------------- 141 141 $!Copyright (C) 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005, 142 $!2006, 2007 Free Software Foundation, Inc.142 $!2006, 2007, 2008, 2009, 2010 Free Software Foundation, Inc. 143 143 $!This file is part of GNU Make. 144 144 $! -
vendor/gnumake/current/makefile.vms
r1989 r2596 2 2 # 3 3 # Copyright (C) 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005, 4 # 2006, 2007 Free Software Foundation, Inc.4 # 2006, 2007, 2008, 2009, 2010 Free Software Foundation, Inc. 5 5 # This file is part of GNU Make. 6 6 # -
vendor/gnumake/current/misc.c
r1989 r2596 1 1 /* Miscellaneous generic support functions for GNU Make. 2 2 Copyright (C) 1988, 1989, 1990, 1991, 1992, 1993, 1994, 1995, 1996, 1997, 3 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007 Free Software4 Foundation, Inc.3 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 4 2010 Free Software Foundation, Inc. 5 5 This file is part of GNU Make. 6 6 … … 114 114 ++in; 115 115 116 /* If the newline is quoted, discard following whitespace 117 and any preceding whitespace; leave just one space. */ 116 /* If the newline is escaped, discard following whitespace leaving just 117 one space. POSIX requires that each backslash/newline/following 118 whitespace sequence be reduced to a single space. */ 118 119 if (backslash) 119 120 { 120 121 in = next_token (in); 122 /* Removing this loop will fix Savannah bug #16670: do we want to? */ 121 123 while (out > line && isblank ((unsigned char)out[-1])) 122 124 --out; … … 162 164 163 165 164 /* Return a string whose contents concatenate th ose of s1, s2, s3.166 /* Return a string whose contents concatenate the NUM strings provided 165 167 This string lives in static, re-used memory. */ 166 168 167 char * 168 concat (const char *s1, const char *s2, const char *s3) 169 { 170 unsigned int len1, len2, len3; 169 const char * 170 #if HAVE_ANSI_COMPILER && USE_VARIADIC && HAVE_STDARG_H 171 concat (unsigned int num, ...) 172 #else 173 concat (num, va_alist) 174 unsigned int num; 175 va_dcl 176 #endif 177 { 171 178 static unsigned int rlen = 0; 172 179 static char *result = NULL; 173 174 len1 = (s1 && *s1 != '\0') ? strlen (s1) : 0; 175 len2 = (s2 && *s2 != '\0') ? strlen (s2) : 0; 176 len3 = (s3 && *s3 != '\0') ? strlen (s3) : 0; 177 178 if (len1 + len2 + len3 + 1 > rlen) 179 result = xrealloc (result, (rlen = len1 + len2 + len3 + 10)); 180 181 if (len1) 182 memcpy (result, s1, len1); 183 if (len2) 184 memcpy (result + len1, s2, len2); 185 if (len3) 186 memcpy (result + len1 + len2, s3, len3); 187 188 result[len1+len2+len3] = '\0'; 180 int ri = 0; 181 182 #if USE_VARIADIC 183 va_list args; 184 #endif 185 186 VA_START (args, num); 187 188 while (num-- > 0) 189 { 190 const char *s = va_arg (args, const char *); 191 unsigned int l = s ? strlen (s) : 0; 192 193 if (l == 0) 194 continue; 195 196 if (ri + l > rlen) 197 { 198 rlen = ((rlen ? rlen : 60) + l) * 2; 199 result = xrealloc (result, rlen); 200 } 201 202 memcpy (result + ri, s, l); 203 ri += l; 204 } 205 206 VA_END (args); 207 208 /* Get some more memory if we don't have enough space for the 209 terminating '\0'. */ 210 if (ri == rlen) 211 { 212 rlen = (rlen ? rlen : 60) * 2; 213 result = xrealloc (result, rlen); 214 } 215 216 result[ri] = '\0'; 189 217 190 218 return result; … … 341 369 342 370 #undef xmalloc 371 #undef xcalloc 343 372 #undef xrealloc 344 373 #undef xstrdup … … 347 376 xmalloc (unsigned int size) 348 377 { 349 /* Make sure we don't allocate 0, for pre- ANSI libraries. */378 /* Make sure we don't allocate 0, for pre-ISO implementations. */ 350 379 void *result = malloc (size ? size : 1); 351 380 if (result == 0) … … 356 385 357 386 void * 387 xcalloc (unsigned int size) 388 { 389 /* Make sure we don't allocate 0, for pre-ISO implementations. */ 390 void *result = calloc (size ? size : 1, 1); 391 if (result == 0) 392 fatal (NILF, _("virtual memory exhausted")); 393 return result; 394 } 395 396 397 void * 358 398 xrealloc (void *ptr, unsigned int size) 359 399 { 360 400 void *result; 361 401 362 /* Some older implementations of realloc() don't conform to ANSI. */402 /* Some older implementations of realloc() don't conform to ISO. */ 363 403 if (! size) 364 404 size = 1; … … 394 434 395 435 char * 396 savestring (const char *str, unsigned int length) 397 { 398 char *out = xmalloc (length + 1); 436 xstrndup (const char *str, unsigned int length) 437 { 438 char *result; 439 440 #ifdef HAVE_STRNDUP 441 result = strndup (str, length); 442 if (result == 0) 443 fatal (NILF, _("virtual memory exhausted")); 444 #else 445 result = xmalloc (length + 1); 399 446 if (length > 0) 400 memcpy (out, str, length); 401 out[length] = '\0'; 402 return out; 447 strncpy (result, str, length); 448 result[length] = '\0'; 449 #endif 450 451 return result; 403 452 } 404 453 … … 493 542 494 543 495 /* Allocate a new `struct dep' with all fields initialized to 0. */ 496 497 struct dep * 498 alloc_dep () 499 { 500 struct dep *d = xmalloc (sizeof (struct dep)); 501 memset (d, '\0', sizeof (struct dep)); 502 return d; 503 } 504 505 506 /* Free `struct dep' along with `name' and `stem'. */ 507 508 void 509 free_dep (struct dep *d) 510 { 511 free (d); 512 } 513 514 /* Copy a chain of `struct dep', making a new chain 515 with the same contents as the old one. */ 544 /* Copy a chain of `struct dep'. For 2nd expansion deps, dup the name. */ 516 545 517 546 struct dep * … … 525 554 struct dep *c = xmalloc (sizeof (struct dep)); 526 555 memcpy (c, d, sizeof (struct dep)); 556 557 if (c->need_2nd_expansion) 558 c->name = xstrdup (c->name); 527 559 528 560 c->next = 0; … … 590 622 return (c1 - c2); 591 623 } 624 } 625 #endif 626 627 #if !HAVE_STRNCASECMP && !HAVE_STRNICMP && !HAVE_STRNCMPI 628 629 /* If we don't have strncasecmp() (from POSIX), or anything that can 630 substitute for it, define our own version. */ 631 632 int 633 strncasecmp (const char *s1, const char *s2, int n) 634 { 635 while (n-- > 0) 636 { 637 int c1 = (int) *(s1++); 638 int c2 = (int) *(s2++); 639 640 if (isalpha (c1)) 641 c1 = tolower (c1); 642 if (isalpha (c2)) 643 c2 = tolower (c2); 644 645 if (c1 != '\0' && c1 == c2) 646 continue; 647 648 return (c1 - c2); 649 } 650 651 return 0; 592 652 } 593 653 #endif -
vendor/gnumake/current/po
- Property svn:ignore deleted
-
vendor/gnumake/current/po/ChangeLog
r1989 r2596 1 2009-09-16 Paul Smith <psmith@gnu.org> 2 3 * LINGUAS: Added new translation for Italian (it). 4 1 5 2008-05-17 Paul Smith <psmith@gnu.org> 2 6 … … 63 67 64 68 65 Copyright (C) 2002, 2003, 2004, 2005, 2006, 2007 Free Software Foundation, Inc. 69 Copyright (C) 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009 Free Software 70 Foundation, Inc. 66 71 This file is part of GNU Make. 67 72 -
vendor/gnumake/current/po/LINGUAS
r1989 r2596 1 # Set of available languages: 2 3languages1 # Set of available languages: 24 languages 2 2 3 be da de es fi fr ga gl he hr id ja ko lt nl pl pt_BR ru sv tr uk vi zh_CN3 be da de es fi fr ga gl he hr id it ja ko lt nl pl pt_BR ru sv tr uk vi zh_CN 4 4 5 5 # Can't seem to get en@quot and en@boldquot to build properly? -
vendor/gnumake/current/po/Makevars
r1989 r2596 1 1 # This is a -*-Makefile-*- 2 # Copyright (C) 2002, 2003, 2004, 2005, 2006, 2007 Free Software Foundation,3 # Inc.2 # Copyright (C) 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010 Free 3 # Software Foundation, Inc. 4 4 # This file is part of GNU Make. 5 5 # -
vendor/gnumake/current/po/POTFILES.in
r1989 r2596 1 1 # List of source files containing translatable strings. 2 # Copyright (C) 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007 Free Software3 # Foundation, Inc.2 # Copyright (C) 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 3 # 2010 Free Software Foundation, Inc. 4 4 # This file is part of GNU Make. 5 5 # -
vendor/gnumake/current/read.c
r1989 r2596 1 1 /* Reading and parsing of makefiles for GNU Make. 2 2 Copyright (C) 1988, 1989, 1990, 1991, 1992, 1993, 1994, 1995, 1996, 1997, 3 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007 Free Software4 Foundation, Inc.3 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 4 2010 Free Software Foundation, Inc. 5 5 This file is part of GNU Make. 6 6 … … 55 55 FILE *fp; /* File, or NULL if this is an internal buffer. */ 56 56 struct floc floc; /* Info on the file in fp (if any). */ 57 }; 58 59 /* Track the modifiers we can have on variable assignments */ 60 61 struct vmodifiers 62 { 63 unsigned int assign_v:1; 64 unsigned int define_v:1; 65 unsigned int undefine_v:1; 66 unsigned int export_v:1; 67 unsigned int override_v:1; 68 unsigned int private_v:1; 57 69 }; 58 70 … … 123 135 124 136 static int eval_makefile (const char *filename, int flags); 125 static inteval (struct ebuffer *buffer, int flags);137 static void eval (struct ebuffer *buffer, int flags); 126 138 127 139 static long readline (struct ebuffer *ebuf); 128 static void do_define (char *name, unsigned int namelen, 129 enum variable_origin origin, struct ebuffer *ebuf); 140 static void do_undefine (char *name, enum variable_origin origin, 141 struct ebuffer *ebuf); 142 static struct variable *do_define (char *name, enum variable_origin origin, 143 struct ebuffer *ebuf); 130 144 static int conditional_line (char *line, int len, const struct floc *flocp); 131 145 static void record_files (struct nameseq *filenames, const char *pattern, 132 const char *pattern_percent, struct dep *deps,146 const char *pattern_percent, char *depstr, 133 147 unsigned int cmds_started, char *commands, 134 148 unsigned int commands_idx, int two_colon, 135 149 const struct floc *flocp); 136 150 static void record_target_var (struct nameseq *filenames, char *defn, 137 enum variable_origin origin, int enabled, 151 enum variable_origin origin, 152 struct vmodifiers *vmod, 138 153 const struct floc *flocp); 139 154 static enum make_word_type get_next_mword (char *buffer, char *delim, … … 144 159 145 160 161 /* Compare a word, both length and contents. 162 P must point to the word to be tested, and WLEN must be the length. 163 */ 164 #define word1eq(s) (wlen == sizeof(s)-1 && strneq (s, p, sizeof(s)-1)) 165 166 167 146 168 /* Read in all the makefiles and return the chain of their names. */ 147 169 … … 154 176 we will be reading. */ 155 177 156 define_variable ("MAKEFILE_LIST", sizeof ("MAKEFILE_LIST")-1, "", o_file, 0);178 define_variable_cname ("MAKEFILE_LIST", "", o_file, 0); 157 179 158 180 DB (DB_BASIC, (_("Reading makefiles...\n"))); … … 249 271 struct dep *d = alloc_dep (); 250 272 d->file = enter_file (strcache_add (*p)); 251 d-> file->dontcare = 1;273 d->dontcare = 1; 252 274 /* Tell update_goal_chain to bail out as soon as this file is 253 275 made, and main not to die if we can't make this file. */ … … 305 327 char *expanded = 0; 306 328 int makefile_errno; 307 int r;308 329 309 330 filename = strcache_add (filename); … … 348 369 for (i = 0; include_directories[i] != 0; ++i) 349 370 { 350 const char *included = concat (include_directories[i], "/", filename); 371 const char *included = concat (3, include_directories[i], 372 "/", filename); 351 373 ebuf.fp = fopen (included, "r"); 352 374 if (ebuf.fp) … … 368 390 deps->changed = flags; 369 391 if (flags & RM_DONTCARE) 370 deps-> file->dontcare = 1;392 deps->dontcare = 1; 371 393 372 394 if (expanded) … … 384 406 } 385 407 408 /* Set close-on-exec to avoid leaking the makefile to children, such as 409 $(shell ...). */ 410 #ifdef HAVE_FILENO 411 CLOSE_ON_EXEC (fileno (ebuf.fp)); 412 #endif 413 386 414 /* Add this makefile to the list. */ 387 415 do_variable_definition (&ebuf.floc, "MAKEFILE_LIST", filename, o_file, … … 396 424 reading_file = &ebuf.floc; 397 425 398 r =eval (&ebuf, !(flags & RM_NO_DEFAULT_GOAL));426 eval (&ebuf, !(flags & RM_NO_DEFAULT_GOAL)); 399 427 400 428 reading_file = curfile; … … 404 432 free (ebuf.bufstart); 405 433 alloca (0); 406 return r; 434 435 return 1; 407 436 } 408 437 409 int 438 void 410 439 eval_buffer (char *buffer) 411 440 { … … 414 443 struct conditionals new; 415 444 const struct floc *curfile; 416 int r;417 445 418 446 /* Evaluate the buffer */ … … 422 450 ebuf.fp = NULL; 423 451 424 ebuf.floc = *reading_file; 452 if (reading_file) 453 ebuf.floc = *reading_file; 454 else 455 ebuf.floc.filenm = NULL; 425 456 426 457 curfile = reading_file; … … 429 460 saved = install_conditionals (&new); 430 461 431 r =eval (&ebuf, 1);462 eval (&ebuf, 1); 432 463 433 464 restore_conditionals (saved); … … 436 467 437 468 alloca (0); 438 return r;439 469 } 440 470 441 471 472 /* Check LINE to see if it's a variable assignment or undefine. 473 474 It might use one of the modifiers "export", "override", "private", or it 475 might be one of the conditional tokens like "ifdef", "include", etc. 476 477 If it's not a variable assignment or undefine, VMOD.V_ASSIGN is 0. 478 Returns LINE. 479 480 Returns a pointer to the first non-modifier character, and sets VMOD 481 based on the modifiers found if any, plus V_ASSIGN is 1. 482 */ 483 static char * 484 parse_var_assignment (const char *line, struct vmodifiers *vmod) 485 { 486 const char *p; 487 memset (vmod, '\0', sizeof (*vmod)); 488 489 /* Find the start of the next token. If there isn't one we're done. */ 490 line = next_token (line); 491 if (*line == '\0') 492 return (char *)line; 493 494 p = line; 495 while (1) 496 { 497 int wlen; 498 const char *p2; 499 enum variable_flavor flavor; 500 501 p2 = parse_variable_definition (p, &flavor); 502 503 /* If this is a variable assignment, we're done. */ 504 if (p2) 505 break; 506 507 /* It's not a variable; see if it's a modifier. */ 508 p2 = end_of_token (p); 509 wlen = p2 - p; 510 511 if (word1eq ("export")) 512 vmod->export_v = 1; 513 else if (word1eq ("override")) 514 vmod->override_v = 1; 515 else if (word1eq ("private")) 516 vmod->private_v = 1; 517 else if (word1eq ("define")) 518 { 519 /* We can't have modifiers after 'define' */ 520 vmod->define_v = 1; 521 p = next_token (p2); 522 break; 523 } 524 else if (word1eq ("undefine")) 525 { 526 /* We can't have modifiers after 'undefine' */ 527 vmod->undefine_v = 1; 528 p = next_token (p2); 529 break; 530 } 531 else 532 /* Not a variable or modifier: this is not a variable assignment. */ 533 return (char *)line; 534 535 /* It was a modifier. Try the next word. */ 536 p = next_token (p2); 537 if (*p == '\0') 538 return (char *)line; 539 } 540 541 /* Found a variable assignment or undefine. */ 542 vmod->assign_v = 1; 543 return (char *)p; 544 } 545 546 442 547 443 548 /* Read file FILENAME as a makefile and add its contents to the data base. … … 445 550 SET_DEFAULT is true if we are allowed to set the default goal. */ 446 551 447 448 static int 552 static void 449 553 eval (struct ebuffer *ebuf, int set_default) 450 554 { … … 458 562 int no_targets = 0; /* Set when reading a rule without targets. */ 459 563 struct nameseq *filenames = 0; 460 struct dep *deps= 0;564 char *depstr = 0; 461 565 long nlines = 0; 462 566 int two_colon = 0; … … 472 576 { \ 473 577 fi.lineno = tgts_started; \ 474 record_files (filenames, pattern, pattern_percent, deps ,\578 record_files (filenames, pattern, pattern_percent, depstr, \ 475 579 cmds_started, commands, commands_idx, two_colon, \ 476 580 &fi); \ 581 filenames = 0; \ 477 582 } \ 478 filenames = 0; \479 583 commands_idx = 0; \ 480 584 no_targets = 0; \ … … 507 611 char *p; 508 612 char *p2; 509 613 struct vmodifiers vmod; 614 615 /* At the top of this loop, we are starting a brand new line. */ 510 616 /* Grab the next line to be evaluated */ 511 617 ebuf->floc.lineno += nlines; … … 532 638 533 639 /* If there is no preceding rule line, don't treat this line 534 as a command, even though it begins with a tab character.640 as a command, even though it begins with a recipe prefix. 535 641 SunOS 4 make appears to behave this way. */ 536 642 … … 571 677 } 572 678 573 /* This line is not a shell command line. Don't worry about tabs.679 /* This line is not a shell command line. Don't worry about whitespace. 574 680 Get more space if we need it; we don't need to preserve the current 575 681 contents of the buffer. */ … … 580 686 if (collapsed) 581 687 free (collapsed); 688 /* Don't need xrealloc: we don't need to preserve the content. */ 582 689 collapsed = xmalloc (collapsed_length); 583 690 } … … 587 694 remove_comments (collapsed); 588 695 589 /* Compare a word, both length and contents. */ 590 #define word1eq(s) (wlen == sizeof(s)-1 && strneq (s, p, sizeof(s)-1)) 696 /* Get rid if starting space (including formfeed, vtab, etc.) */ 591 697 p = collapsed; 592 698 while (isspace ((unsigned char)*p)) 593 ++p; 594 595 if (*p == '\0') 596 /* This line is completely empty--ignore it. */ 597 continue; 598 599 /* Find the end of the first token. Note we don't need to worry about 600 * ":" here since we compare tokens by length (so "export" will never 601 * be equal to "export:"). 602 */ 603 for (p2 = p+1; *p2 != '\0' && !isspace ((unsigned char)*p2); ++p2) 604 ; 605 wlen = p2 - p; 606 607 /* Find the start of the second token. If it looks like a target or 608 variable definition it can't be a preprocessor token so skip 609 them--this allows variables/targets named `ifdef', `export', etc. */ 610 while (isspace ((unsigned char)*p2)) 611 ++p2; 612 613 if ((p2[0] == ':' || p2[0] == '+' || p2[0] == '=') && p2[1] == '\0') 699 ++p; 700 701 /* See if this is a variable assignment. We need to do this early, to 702 allow variables with names like 'ifdef', 'export', 'private', etc. */ 703 p = parse_var_assignment(p, &vmod); 704 if (vmod.assign_v) 614 705 { 615 /* It can't be a preprocessor token so skip it if we're ignoring */ 616 if (ignoring) 617 continue; 618 619 goto skip_conditionals; 620 } 621 622 /* We must first check for conditional and `define' directives before 623 ignoring anything, since they control what we will do with 624 following lines. */ 625 626 if (!in_ignored_define) 627 { 628 int i = conditional_line (p, wlen, fstart); 629 if (i != -2) 706 struct variable *v; 707 enum variable_origin origin = vmod.override_v ? o_override : o_file; 708 709 /* If we're ignoring then we're done now. */ 710 if (ignoring) 630 711 { 631 if (i == -1) 632 fatal (fstart, _("invalid syntax in conditional")); 633 634 ignoring = i; 712 if (vmod.define_v) 713 in_ignored_define = 1; 635 714 continue; 636 715 } 637 } 638 639 if (word1eq ("endef")) 716 717 if (vmod.undefine_v) 718 { 719 do_undefine (p, origin, ebuf); 720 721 /* This line has been dealt with. */ 722 goto rule_complete; 723 } 724 else if (vmod.define_v) 725 v = do_define (p, origin, ebuf); 726 else 727 v = try_variable_definition (fstart, p, origin, 0); 728 729 assert (v != NULL); 730 731 if (vmod.export_v) 732 v->export = v_export; 733 if (vmod.private_v) 734 v->private_var = 1; 735 736 /* This line has been dealt with. */ 737 goto rule_complete; 738 } 739 740 /* If this line is completely empty, ignore it. */ 741 if (*p == '\0') 742 continue; 743 744 p2 = end_of_token (p); 745 wlen = p2 - p; 746 p2 = next_token (p2); 747 748 /* If we're in an ignored define, skip this line (but maybe get out). */ 749 if (in_ignored_define) 640 750 { 641 if (!in_ignored_define) 642 fatal (fstart, _("extraneous `endef'")); 643 in_ignored_define = 0; 751 /* See if this is an endef line (plus optional comment). */ 752 if (word1eq ("endef") && (*p2 == '\0' || *p2 == '#')) 753 in_ignored_define = 0; 754 644 755 continue; 645 756 } 646 757 647 if (word1eq ("define")) 758 /* Check for conditional state changes. */ 759 { 760 int i = conditional_line (p, wlen, fstart); 761 if (i != -2) 762 { 763 if (i == -1) 764 fatal (fstart, _("invalid syntax in conditional")); 765 766 ignoring = i; 767 continue; 768 } 769 } 770 771 /* Nothing to see here... move along. */ 772 if (ignoring) 773 continue; 774 775 /* Manage the "export" keyword used outside of variable assignment 776 as well as "unexport". */ 777 if (word1eq ("export") || word1eq ("unexport")) 648 778 { 649 if (ignoring) 650 in_ignored_define = 1; 651 else 652 { 653 if (*p2 == '\0') 654 fatal (fstart, _("empty variable name")); 655 656 /* Let the variable name be the whole rest of the line, 657 with trailing blanks stripped (comments have already been 658 removed), so it could be a complex variable/function 659 reference that might contain blanks. */ 660 p = strchr (p2, '\0'); 661 while (isblank ((unsigned char)p[-1])) 662 --p; 663 do_define (p2, p - p2, o_file, ebuf); 664 } 665 continue; 666 } 667 668 if (word1eq ("override")) 669 { 779 int exporting = *p == 'u' ? 0 : 1; 780 781 /* (un)export by itself causes everything to be (un)exported. */ 670 782 if (*p2 == '\0') 671 error (fstart, _("empty `override' directive")); 672 673 if (strneq (p2, "define", 6) 674 && (isblank ((unsigned char)p2[6]) || p2[6] == '\0')) 675 { 676 if (ignoring) 677 in_ignored_define = 1; 678 else 679 { 680 p2 = next_token (p2 + 6); 681 if (*p2 == '\0') 682 fatal (fstart, _("empty variable name")); 683 684 /* Let the variable name be the whole rest of the line, 685 with trailing blanks stripped (comments have already been 686 removed), so it could be a complex variable/function 687 reference that might contain blanks. */ 688 p = strchr (p2, '\0'); 689 while (isblank ((unsigned char)p[-1])) 690 --p; 691 do_define (p2, p - p2, o_override, ebuf); 692 } 693 } 694 else if (!ignoring 695 && !try_variable_definition (fstart, p2, o_override, 0)) 696 error (fstart, _("invalid `override' directive")); 697 698 continue; 699 } 700 701 if (ignoring) 702 /* Ignore the line. We continue here so conditionals 703 can appear in the middle of a rule. */ 704 continue; 705 706 if (word1eq ("export")) 707 { 708 /* 'export' by itself causes everything to be exported. */ 709 if (*p2 == '\0') 710 export_all_variables = 1; 711 else 712 { 713 struct variable *v; 714 715 v = try_variable_definition (fstart, p2, o_file, 0); 716 if (v != 0) 717 v->export = v_export; 718 else 719 { 720 unsigned int l; 721 const char *cp; 722 char *ap; 723 724 /* Expand the line so we can use indirect and constructed 725 variable names in an export command. */ 726 cp = ap = allocated_variable_expand (p2); 727 728 for (p = find_next_token (&cp, &l); p != 0; 729 p = find_next_token (&cp, &l)) 730 { 731 v = lookup_variable (p, l); 732 if (v == 0) 733 v = define_variable_loc (p, l, "", o_file, 0, fstart); 734 v->export = v_export; 735 } 736 737 free (ap); 738 } 739 } 740 goto rule_complete; 741 } 742 743 if (word1eq ("unexport")) 744 { 745 if (*p2 == '\0') 746 export_all_variables = 0; 783 export_all_variables = exporting; 747 784 else 748 785 { 749 786 unsigned int l; 750 struct variable *v;751 787 const char *cp; 752 788 char *ap; 753 789 754 790 /* Expand the line so we can use indirect and constructed 755 variable names in an unexport command. */791 variable names in an (un)export command. */ 756 792 cp = ap = allocated_variable_expand (p2); 757 793 … … 759 795 p = find_next_token (&cp, &l)) 760 796 { 761 v = lookup_variable (p, l);797 struct variable *v = lookup_variable (p, l); 762 798 if (v == 0) 763 799 v = define_variable_loc (p, l, "", o_file, 0, fstart); 764 765 v->export = v_noexport; 800 v->export = exporting ? v_export : v_noexport; 766 801 } 767 802 … … 771 806 } 772 807 773 skip_conditionals:808 /* Handle the special syntax for vpath. */ 774 809 if (word1eq ("vpath")) 775 810 { … … 781 816 if (p != 0) 782 817 { 783 vpat = savestring(p, l);818 vpat = xstrndup (p, l); 784 819 p = find_next_token (&cp, &l); 785 820 /* No searchpath means remove all previous … … 796 831 } 797 832 833 /* Handle include and variants. */ 798 834 if (word1eq ("include") || word1eq ("-include") || word1eq ("sinclude")) 799 835 { … … 816 852 } 817 853 818 /* Parse the list of file names. */854 /* Parse the list of file names. Don't expand archive references! */ 819 855 p2 = p; 820 files = multi_glob (parse_file_seq (&p2, '\0', 821 sizeof (struct nameseq), 822 1), 823 sizeof (struct nameseq)); 856 files = PARSE_FILE_SEQ (&p2, struct nameseq, '\0', NULL, 857 PARSEFS_NOAR); 824 858 free (p); 825 859 … … 839 873 int r; 840 874 841 free (files);875 free_ns (files); 842 876 files = next; 843 877 844 r = eval_makefile (name, (RM_INCLUDED | RM_NO_TILDE 845 | (noerror ? RM_DONTCARE : 0))); 878 r = eval_makefile (name, 879 (RM_INCLUDED | RM_NO_TILDE 880 | (noerror ? RM_DONTCARE : 0) 881 | (set_default ? 0 : RM_NO_DEFAULT_GOAL))); 846 882 if (!r && !noerror) 847 883 error (fstart, "%s: %s", name, strerror (errno)); … … 853 889 goto rule_complete; 854 890 } 855 856 if (try_variable_definition (fstart, p, o_file, 0))857 /* This line has been dealt with. */858 goto rule_complete;859 891 860 892 /* This line starts with a tab but was not caught above because there … … 876 908 { 877 909 enum make_word_type wtype; 878 enum variable_origin v_origin;879 int exported;880 910 char *cmdleft, *semip, *lb_next; 881 911 unsigned int plen = 0; … … 1009 1039 looking for targets. */ 1010 1040 *colonp = '\0'; 1011 filenames = multi_glob (parse_file_seq (&p2, '\0', 1012 sizeof (struct nameseq), 1013 1), 1014 sizeof (struct nameseq)); 1041 filenames = PARSE_FILE_SEQ (&p2, struct nameseq, '\0', NULL, 0); 1015 1042 *p2 = ':'; 1016 1043 … … 1043 1070 } 1044 1071 1045 /* See if it's an "override" or "export" keyword; if so see if what 1046 comes after it looks like a variable definition. */ 1047 1048 wtype = get_next_mword (p2, NULL, &p, &wlen); 1049 1050 v_origin = o_file; 1051 exported = 0; 1052 if (wtype == w_static) 1053 { 1054 if (word1eq ("override")) 1055 { 1056 v_origin = o_override; 1057 wtype = get_next_mword (p+wlen, NULL, &p, &wlen); 1058 } 1059 else if (word1eq ("export")) 1060 { 1061 exported = 1; 1062 wtype = get_next_mword (p+wlen, NULL, &p, &wlen); 1063 } 1064 } 1065 1066 if (wtype != w_eol) 1067 wtype = get_next_mword (p+wlen, NULL, NULL, NULL); 1068 1069 if (wtype == w_varassign) 1072 p2 = parse_var_assignment (p2, &vmod); 1073 if (vmod.assign_v) 1070 1074 { 1071 1075 /* If there was a semicolon found, add it back, plus anything … … 1075 1079 unsigned int l = p - variable_buffer; 1076 1080 *(--semip) = ';'; 1081 collapse_continuations (semip); 1077 1082 variable_buffer_output (p2 + strlen (p2), 1078 1083 semip, strlen (semip)+1); 1079 1084 p = variable_buffer + l; 1080 1085 } 1081 record_target_var (filenames, p, v_origin, exported, fstart); 1086 record_target_var (filenames, p2, 1087 vmod.override_v ? o_override : o_file, 1088 &vmod, fstart); 1082 1089 filenames = 0; 1083 1090 continue; … … 1111 1118 while (p != 0 && p[-1] == '\\') 1112 1119 { 1113 registerchar *q = &p[-1];1114 registerint backslash = 0;1120 char *q = &p[-1]; 1121 int backslash = 0; 1115 1122 while (*q-- == '\\') 1116 1123 backslash = !backslash; … … 1155 1162 { 1156 1163 struct nameseq *target; 1157 target = parse_file_seq (&p2, ':', sizeof (struct nameseq), 1); 1164 target = PARSE_FILE_SEQ (&p2, struct nameseq, ':', NULL, 1165 PARSEFS_NOGLOB); 1158 1166 ++p2; 1159 1167 if (target == 0) … … 1165 1173 if (pattern_percent == 0) 1166 1174 fatal (fstart, _("target pattern contains no `%%'")); 1167 free (target);1175 free_ns (target); 1168 1176 } 1169 1177 else … … 1175 1183 strip_whitespace (&beg, &end); 1176 1184 1185 /* Put all the prerequisites here; they'll be parsed later. */ 1177 1186 if (beg <= end && *beg != '\0') 1178 { 1179 /* Put all the prerequisites here; they'll be parsed later. */ 1180 deps = alloc_dep (); 1181 deps->name = strcache_add_len (beg, end - beg + 1); 1182 } 1187 depstr = xstrndup (beg, end - beg + 1); 1183 1188 else 1184 deps = 0;1189 depstr = 0; 1185 1190 1186 1191 commands_idx = 0; … … 1216 1221 Because the target is not recorded until after ifeq directive is 1217 1222 evaluated the .DEFAULT_GOAL does not contain foo yet as one 1218 would expect. Because of this we have to move some of the logic 1219 here. */ 1220 1221 if (**default_goal_name == '\0' && set_default) 1223 would expect. Because of this we have to move the logic here. */ 1224 1225 if (set_default && default_goal_var->value[0] == '\0') 1222 1226 { 1223 1227 const char *name; … … 1300 1304 free (collapsed); 1301 1305 free (commands); 1302 1303 return 1;1304 1306 } 1305 1307 … … 1321 1323 } 1322 1324 1325 /* Execute a `undefine' directive. 1326 The undefine line has already been read, and NAME is the name of 1327 the variable to be undefined. */ 1328 1329 static void 1330 do_undefine (char *name, enum variable_origin origin, struct ebuffer *ebuf) 1331 { 1332 char *p, *var; 1333 1334 /* Expand the variable name and find the beginning (NAME) and end. */ 1335 var = allocated_variable_expand (name); 1336 name = next_token (var); 1337 if (*name == '\0') 1338 fatal (&ebuf->floc, _("empty variable name")); 1339 p = name + strlen (name) - 1; 1340 while (p > name && isblank ((unsigned char)*p)) 1341 --p; 1342 p[1] = '\0'; 1343 1344 undefine_variable_global (name, p - name + 1, origin); 1345 free (var); 1346 } 1347 1323 1348 /* Execute a `define' directive. 1324 1349 The first line has already been read, and NAME is the name of 1325 1350 the variable to be defined. The following lines remain to be read. */ 1326 1351 1327 static void 1328 do_define (char *name, unsigned int namelen, 1329 enum variable_origin origin, struct ebuffer *ebuf) 1352 static struct variable * 1353 do_define (char *name, enum variable_origin origin, struct ebuffer *ebuf) 1330 1354 { 1355 struct variable *v; 1356 enum variable_flavor flavor; 1331 1357 struct floc defstart; 1332 long nlines = 0;1333 1358 int nlevels = 1; 1334 1359 unsigned int length = 100; 1335 1360 char *definition = xmalloc (length); 1336 1361 unsigned int idx = 0; 1337 char *p; 1338 1339 /* Expand the variable name. */ 1340 char *var = alloca (namelen + 1); 1341 memcpy (var, name, namelen); 1342 var[namelen] = '\0'; 1343 var = variable_expand (var); 1362 char *p, *var; 1344 1363 1345 1364 defstart = ebuf->floc; 1346 1365 1366 p = parse_variable_definition (name, &flavor); 1367 if (p == NULL) 1368 /* No assignment token, so assume recursive. */ 1369 flavor = f_recursive; 1370 else 1371 { 1372 if (*(next_token (p)) != '\0') 1373 error (&defstart, _("extraneous text after `define' directive")); 1374 1375 /* Chop the string before the assignment token to get the name. */ 1376 p[flavor == f_recursive ? -1 : -2] = '\0'; 1377 } 1378 1379 /* Expand the variable name and find the beginning (NAME) and end. */ 1380 var = allocated_variable_expand (name); 1381 name = next_token (var); 1382 if (*name == '\0') 1383 fatal (&defstart, _("empty variable name")); 1384 p = name + strlen (name) - 1; 1385 while (p > name && isblank ((unsigned char)*p)) 1386 --p; 1387 p[1] = '\0'; 1388 1389 /* Now read the value of the variable. */ 1347 1390 while (1) 1348 1391 { 1349 1392 unsigned int len; 1350 1393 char *line; 1351 1352 nlines = readline (ebuf); 1394 long nlines = readline (ebuf); 1395 1396 /* If there is nothing left to be eval'd, there's no 'endef'!! */ 1397 if (nlines < 0) 1398 fatal (&defstart, _("missing `endef', unterminated `define'")); 1399 1353 1400 ebuf->floc.lineno += nlines; 1354 1355 /* If there is nothing left to eval, we're done. */1356 if (nlines < 0)1357 break;1358 1359 1401 line = ebuf->buffer; 1360 1402 … … 1362 1404 1363 1405 /* If the line doesn't begin with a tab, test to see if it introduces 1364 another define, or ends one. */ 1365 1366 /* Stop if we find an 'endef' */ 1406 another define, or ends one. Stop if we find an 'endef' */ 1367 1407 if (line[0] != cmd_prefix) 1368 1408 { … … 1382 1422 p += 5; 1383 1423 remove_comments (p); 1384 if (* next_token (p) != '\0')1424 if (*(next_token (p)) != '\0') 1385 1425 error (&ebuf->floc, 1386 _(" Extraneous text after `endef' directive"));1426 _("extraneous text after `endef' directive")); 1387 1427 1388 1428 if (--nlevels == 0) 1389 { 1390 /* Define the variable. */ 1391 if (idx == 0) 1392 definition[0] = '\0'; 1393 else 1394 definition[idx - 1] = '\0'; 1395 1396 /* Always define these variables in the global set. */ 1397 define_variable_global (var, strlen (var), definition, 1398 origin, 1, &defstart); 1399 free (definition); 1400 return; 1401 } 1429 break; 1402 1430 } 1403 1431 } 1404 1432 1405 /* Otherwise add this line to the variable definition. */1433 /* Add this line to the variable definition. */ 1406 1434 len = strlen (line); 1407 1435 if (idx + len + 1 > length) … … 1417 1445 } 1418 1446 1419 /* No `endef'!! */ 1420 fatal (&defstart, _("missing `endef', unterminated `define'")); 1421 1422 /* NOTREACHED */ 1423 return; 1447 /* We've got what we need; define the variable. */ 1448 if (idx == 0) 1449 definition[0] = '\0'; 1450 else 1451 definition[idx - 1] = '\0'; 1452 1453 v = do_variable_definition (&defstart, name, definition, origin, flavor, 0); 1454 free (definition); 1455 free (var); 1456 return (v); 1424 1457 } 1425 1458 … … 1695 1728 1696 1729 1697 /* Remove duplicate dependencies in CHAIN. */1698 1699 static unsigned long1700 dep_hash_1 (const void *key)1701 {1702 return_STRING_HASH_1 (dep_name ((struct dep const *) key));1703 }1704 1705 static unsigned long1706 dep_hash_2 (const void *key)1707 {1708 return_STRING_HASH_2 (dep_name ((struct dep const *) key));1709 }1710 1711 static int1712 dep_hash_cmp (const void *x, const void *y)1713 {1714 struct dep *dx = (struct dep *) x;1715 struct dep *dy = (struct dep *) y;1716 int cmp = strcmp (dep_name (dx), dep_name (dy));1717 1718 /* If the names are the same but ignore_mtimes are not equal, one of these1719 is an order-only prerequisite and one isn't. That means that we should1720 remove the one that isn't and keep the one that is. */1721 1722 if (!cmp && dx->ignore_mtime != dy->ignore_mtime)1723 dx->ignore_mtime = dy->ignore_mtime = 0;1724 1725 return cmp;1726 }1727 1728 1729 void1730 uniquize_deps (struct dep *chain)1731 {1732 struct hash_table deps;1733 register struct dep **depp;1734 1735 hash_init (&deps, 500, dep_hash_1, dep_hash_2, dep_hash_cmp);1736 1737 /* Make sure that no dependencies are repeated. This does not1738 really matter for the purpose of updating targets, but it1739 might make some names be listed twice for $^ and $?. */1740 1741 depp = &chain;1742 while (*depp)1743 {1744 struct dep *dep = *depp;1745 struct dep **dep_slot = (struct dep **) hash_find_slot (&deps, dep);1746 if (HASH_VACANT (*dep_slot))1747 {1748 hash_insert_at (&deps, dep, dep_slot);1749 depp = &dep->next;1750 }1751 else1752 {1753 /* Don't bother freeing duplicates.1754 It's dangerous and little benefit accrues. */1755 *depp = dep->next;1756 }1757 }1758 1759 hash_free (&deps, 0);1760 }1761 1762 1730 1763 1731 /* Record target-specific variable values for files FILENAMES. … … 1772 1740 static void 1773 1741 record_target_var (struct nameseq *filenames, char *defn, 1774 enum variable_origin origin, int exported,1742 enum variable_origin origin, struct vmodifiers *vmod, 1775 1743 const struct floc *flocp) 1776 1744 { … … 1792 1760 1793 1761 nextf = filenames->next; 1794 free (filenames);1762 free_ns (filenames); 1795 1763 1796 1764 /* If it's a pattern target, then add it to the pattern-specific … … 1804 1772 /* I don't think this can fail since we already determined it was a 1805 1773 variable definition. */ 1806 v = parse_variable_definition (&p->variable, defn);1774 v = assign_variable_definition (&p->variable, defn); 1807 1775 assert (v != 0); 1808 1776 1777 v->origin = origin; 1809 1778 if (v->flavor == f_simple) 1810 1779 v->value = allocated_variable_expand (v->value); … … 1834 1803 v = try_variable_definition (flocp, defn, origin, 1); 1835 1804 if (!v) 1836 error(flocp, _("Malformed target-specific variable definition"));1805 fatal (flocp, _("Malformed target-specific variable definition")); 1837 1806 current_variable_set_list = global; 1838 1807 } 1839 1808 1840 1809 /* Set up the variable to be *-specific. */ 1841 v->origin = origin;1842 1810 v->per_target = 1; 1843 v->export = exported ? v_export : v_default; 1811 v->private_var = vmod->private_v; 1812 v->export = vmod->export_v ? v_export : v_default; 1844 1813 1845 1814 /* If it's not an override, check to see if there was a command-line 1846 1815 setting. If so, reset the value. */ 1847 if ( origin != o_override)1816 if (v->origin != o_override) 1848 1817 { 1849 1818 struct variable *gv; … … 1878 1847 static void 1879 1848 record_files (struct nameseq *filenames, const char *pattern, 1880 const char *pattern_percent, struct dep *deps,1849 const char *pattern_percent, char *depstr, 1881 1850 unsigned int cmds_started, char *commands, 1882 1851 unsigned int commands_idx, int two_colon, 1883 1852 const struct floc *flocp) 1884 1853 { 1885 struct nameseq *nextf;1886 int implicit = 0;1887 unsigned int max_targets = 0, target_idx = 0;1888 const char **targets = 0, **target_percents = 0;1889 1854 struct commands *cmds; 1855 struct dep *deps; 1856 const char *implicit_percent; 1857 const char *name; 1890 1858 1891 1859 /* If we've already snapped deps, that means we're in an eval being … … 1896 1864 fatal (flocp, _("prerequisites cannot be defined in recipes")); 1897 1865 1866 /* Determine if this is a pattern rule or not. */ 1867 name = filenames->name; 1868 implicit_percent = find_percent_cached (&name); 1869 1870 /* If there's a recipe, set up a struct for it. */ 1898 1871 if (commands_idx > 0) 1899 1872 { … … 1901 1874 cmds->fileinfo.filenm = flocp->filenm; 1902 1875 cmds->fileinfo.lineno = cmds_started; 1903 cmds->commands = savestring(commands, commands_idx);1876 cmds->commands = xstrndup (commands, commands_idx); 1904 1877 cmds->command_lines = 0; 1905 1878 } 1906 1879 else 1907 cmds = 0; 1908 1909 for (; filenames != 0; filenames = nextf) 1880 cmds = 0; 1881 1882 /* If there's a prereq string then parse it--unless it's eligible for 2nd 1883 expansion: if so, snap_deps() will do it. */ 1884 if (depstr == 0) 1885 deps = 0; 1886 else if (second_expansion && strchr (depstr, '$')) 1910 1887 { 1911 const char *name = filenames->name; 1888 deps = alloc_dep (); 1889 deps->name = depstr; 1890 deps->need_2nd_expansion = 1; 1891 deps->staticpattern = pattern != 0; 1892 } 1893 else 1894 { 1895 deps = split_prereqs (depstr); 1896 free (depstr); 1897 1898 /* We'll enter static pattern prereqs later when we have the stem. We 1899 don't want to enter pattern rules at all so that we don't think that 1900 they ought to exist (make manual "Implicit Rule Search Algorithm", 1901 item 5c). */ 1902 if (! pattern && ! implicit_percent) 1903 deps = enter_prereqs (deps, NULL); 1904 } 1905 1906 /* For implicit rules, _all_ the targets must have a pattern. That means we 1907 can test the first one to see if we're working with an implicit rule; if 1908 so we handle it specially. */ 1909 1910 if (implicit_percent) 1911 { 1912 struct nameseq *nextf; 1913 const char **targets, **target_pats; 1914 unsigned int c; 1915 1916 if (pattern != 0) 1917 fatal (flocp, _("mixed implicit and static pattern rules")); 1918 1919 /* Count the targets to create an array of target names. 1920 We already have the first one. */ 1921 nextf = filenames->next; 1922 free_ns (filenames); 1923 filenames = nextf; 1924 1925 for (c = 1; nextf; ++c, nextf = nextf->next) 1926 ; 1927 targets = xmalloc (c * sizeof (const char *)); 1928 target_pats = xmalloc (c * sizeof (const char *)); 1929 1930 targets[0] = name; 1931 target_pats[0] = implicit_percent; 1932 1933 c = 1; 1934 while (filenames) 1935 { 1936 name = filenames->name; 1937 implicit_percent = find_percent_cached (&name); 1938 1939 if (implicit_percent == 0) 1940 fatal (flocp, _("mixed implicit and normal rules")); 1941 1942 targets[c] = name; 1943 target_pats[c] = implicit_percent; 1944 ++c; 1945 1946 nextf = filenames->next; 1947 free_ns (filenames); 1948 filenames = nextf; 1949 } 1950 1951 create_pattern_rule (targets, target_pats, c, two_colon, deps, cmds, 1); 1952 1953 return; 1954 } 1955 1956 1957 /* Walk through each target and create it in the database. 1958 We already set up the first target, above. */ 1959 while (1) 1960 { 1961 struct nameseq *nextf = filenames->next; 1912 1962 struct file *f; 1913 1963 struct dep *this = 0; 1914 const char *implicit_percent; 1915 1916 nextf = filenames->next; 1917 free (filenames); 1964 1965 free_ns (filenames); 1918 1966 1919 1967 /* Check for special targets. Do it here instead of, say, snap_deps() 1920 1968 so that we can immediately use the value. */ 1921 1922 1969 if (streq (name, ".POSIX")) 1923 posix_pedantic = 1; 1970 { 1971 posix_pedantic = 1; 1972 define_variable_cname (".SHELLFLAGS", "-ec", o_default, 0); 1973 } 1924 1974 else if (streq (name, ".SECONDEXPANSION")) 1925 1975 second_expansion = 1; 1926 1927 implicit_percent = find_percent_cached (&name); 1928 implicit |= implicit_percent != 0; 1929 1930 if (implicit) 1931 { 1932 if (pattern != 0) 1933 fatal (flocp, _("mixed implicit and static pattern rules")); 1934 1935 if (implicit_percent == 0) 1936 fatal (flocp, _("mixed implicit and normal rules")); 1937 1938 if (targets == 0) 1939 { 1940 max_targets = 5; 1941 targets = xmalloc (5 * sizeof (char *)); 1942 target_percents = xmalloc (5 * sizeof (char *)); 1943 target_idx = 0; 1944 } 1945 else if (target_idx == max_targets - 1) 1946 { 1947 max_targets += 5; 1948 targets = xrealloc (targets, max_targets * sizeof (char *)); 1949 target_percents = xrealloc (target_percents, 1950 max_targets * sizeof (char *)); 1951 } 1952 targets[target_idx] = name; 1953 target_percents[target_idx] = implicit_percent; 1954 ++target_idx; 1955 continue; 1956 } 1976 #if !defined(WINDOWS32) && !defined (__MSDOS__) && !defined (__EMX__) 1977 else if (streq (name, ".ONESHELL")) 1978 one_shell = 1; 1979 #endif 1957 1980 1958 1981 /* If this is a static pattern rule: 1959 `targets: target%pattern: dep%pattern; cmds',1982 `targets: target%pattern: prereq%pattern; recipe', 1960 1983 make sure the pattern matches this target name. */ 1961 1984 if (pattern && !pattern_matches (pattern, pattern_percent, name)) 1962 1985 error (flocp, _("target `%s' doesn't match the target pattern"), name); 1963 1986 else if (deps) 1964 { 1965 /* If there are multiple filenames, copy the chain DEPS for all but 1966 the last one. It is not safe for the same deps to go in more 1967 than one place in the database. */ 1968 this = nextf != 0 ? copy_dep_chain (deps) : deps; 1969 this->need_2nd_expansion = (second_expansion 1970 && strchr (this->name, '$')); 1971 } 1972 1987 /* If there are multiple targets, copy the chain DEPS for all but the 1988 last one. It is not safe for the same deps to go in more than one 1989 place in the database. */ 1990 this = nextf != 0 ? copy_dep_chain (deps) : deps; 1991 1992 /* Find or create an entry in the file database for this target. */ 1973 1993 if (!two_colon) 1974 1994 { 1975 /* Single-colon. Combine th ese dependencies1976 with others in file's existing record,if any. */1995 /* Single-colon. Combine this rule with the file's existing record, 1996 if any. */ 1977 1997 f = enter_file (strcache_add (name)); 1978 1979 1998 if (f->double_colon) 1980 1999 fatal (flocp, … … 2001 2020 } 2002 2021 2003 f->is_target = 1;2004 2005 2022 /* Defining .DEFAULT with no deps or cmds clears it. */ 2006 2023 if (f == default_file && this == 0 && cmds == 0) … … 2016 2033 f->deps = 0; 2017 2034 } 2018 else if (this != 0)2019 {2020 /* Add the file's old deps and the new ones in THIS together. */2021 2022 if (f->deps != 0)2023 {2024 struct dep **d_ptr = &f->deps;2025 2026 while ((*d_ptr)->next != 0)2027 d_ptr = &(*d_ptr)->next;2028 2029 if (cmds != 0)2030 /* This is the rule with commands, so put its deps2031 last. The rationale behind this is that $< expands to2032 the first dep in the chain, and commands use $<2033 expecting to get the dep that rule specifies. However2034 the second expansion algorithm reverses the order thus2035 we need to make it last here. */2036 (*d_ptr)->next = this;2037 else2038 {2039 /* This is the rule without commands. Put its2040 dependencies at the end but before dependencies from2041 the rule with commands (if any). This way everything2042 appears in makefile order. */2043 2044 if (f->cmds != 0)2045 {2046 this->next = *d_ptr;2047 *d_ptr = this;2048 }2049 else2050 (*d_ptr)->next = this;2051 }2052 }2053 else2054 f->deps = this;2055 2056 /* This is a hack. I need a way to communicate to snap_deps()2057 that the last dependency line in this file came with commands2058 (so that logic in snap_deps() can put it in front and all2059 this $< -logic works). I cannot simply rely on file->cmds2060 being not 0 because of the cases like the following:2061 2062 foo: bar2063 foo:2064 ...2065 2066 I am going to temporarily "borrow" UPDATING member in2067 `struct file' for this. */2068 2069 if (cmds != 0)2070 f->updating = 1;2071 }2072 2035 } 2073 2036 else … … 2076 2039 f = lookup_file (name); 2077 2040 2078 /* Check for both : and :: rules. Check is_target so 2079 we don't loseon default suffix rules or makefiles. */2041 /* Check for both : and :: rules. Check is_target so we don't lose 2042 on default suffix rules or makefiles. */ 2080 2043 if (f != 0 && f->is_target && !f->double_colon) 2081 2044 fatal (flocp, 2082 2045 _("target file `%s' has both : and :: entries"), f->name); 2046 2083 2047 f = enter_file (strcache_add (name)); 2084 2048 /* If there was an existing entry and it was a double-colon entry, … … 2090 2054 double_colon pointer to itself. */ 2091 2055 f->double_colon = f; 2092 f->is_target = 1; 2093 f->deps = this; 2056 2094 2057 f->cmds = cmds; 2095 2058 } 2096 2059 2060 f->is_target = 1; 2061 2097 2062 /* If this is a static pattern rule, set the stem to the part of its 2098 2063 name that matched the `%' in the pattern, so you can use $* in the 2099 commands. */2064 commands. If we didn't do it before, enter the prereqs now. */ 2100 2065 if (pattern) 2101 2066 { … … 2107 2072 if (this) 2108 2073 { 2109 this->staticpattern = 1; 2110 this->stem = f->stem; 2074 if (! this->need_2nd_expansion) 2075 this = enter_prereqs (this, f->stem); 2076 else 2077 this->stem = f->stem; 2111 2078 } 2112 2079 } 2113 2080 2081 /* Add the dependencies to this file entry. */ 2082 if (this != 0) 2083 { 2084 /* Add the file's old deps and the new ones in THIS together. */ 2085 if (f->deps == 0) 2086 f->deps = this; 2087 else if (cmds != 0) 2088 { 2089 struct dep *d = this; 2090 2091 /* If this rule has commands, put these deps first. */ 2092 while (d->next != 0) 2093 d = d->next; 2094 2095 d->next = f->deps; 2096 f->deps = this; 2097 } 2098 else 2099 { 2100 struct dep *d = f->deps; 2101 2102 /* A rule without commands: put its prereqs at the end. */ 2103 while (d->next != 0) 2104 d = d->next; 2105 2106 d->next = this; 2107 } 2108 } 2109 2114 2110 name = f->name; 2115 2111 2116 /* If this target is a default target, update DEFAULT_GOAL_FILE. */ 2117 if (streq (*default_goal_name, name) 2118 && (default_goal_file == 0 2119 || ! streq (default_goal_file->name, name))) 2120 default_goal_file = f; 2121 } 2122 2123 if (implicit) 2124 { 2125 if (deps) 2126 deps->need_2nd_expansion = second_expansion; 2127 create_pattern_rule (targets, target_percents, target_idx, 2128 two_colon, deps, cmds, 1); 2112 /* All done! Set up for the next one. */ 2113 if (nextf == 0) 2114 break; 2115 2116 filenames = nextf; 2117 2118 /* Reduce escaped percents. If there are any unescaped it's an error */ 2119 name = filenames->name; 2120 if (find_percent_cached (&name)) 2121 fatal (flocp, _("mixed implicit and normal rules")); 2129 2122 } 2130 2123 } … … 2250 2243 const char *p = *string; 2251 2244 char *new = 0; 2252 int slen ;2245 int slen = 0; 2253 2246 2254 2247 /* If the first char is a % return now. This lets us avoid extra tests … … 2316 2309 2317 2310 2318 /* Parse a string into a sequence of filenames represented as a 2319 chain of struct nameseq's in reverse order and return that chain. 2311 /* Find the next line of text in an eval buffer, combining continuation lines 2312 into one line. 2313 Return the number of actual lines read (> 1 if continuation lines). 2314 Returns -1 if there's nothing left in the buffer. 2315 2316 After this function, ebuf->buffer points to the first character of the 2317 line we just found. 2318 */ 2319 2320 /* Read a line of text from a STRING. 2321 Since we aren't really reading from a file, don't bother with linenumbers. 2322 */ 2323 2324 static unsigned long 2325 readstring (struct ebuffer *ebuf) 2326 { 2327 char *eol; 2328 2329 /* If there is nothing left in this buffer, return 0. */ 2330 if (ebuf->bufnext >= ebuf->bufstart + ebuf->size) 2331 return -1; 2332 2333 /* Set up a new starting point for the buffer, and find the end of the 2334 next logical line (taking into account backslash/newline pairs). */ 2335 2336 eol = ebuf->buffer = ebuf->bufnext; 2337 2338 while (1) 2339 { 2340 int backslash = 0; 2341 const char *bol = eol; 2342 const char *p; 2343 2344 /* Find the next newline. At EOS, stop. */ 2345 p = eol = strchr (eol , '\n'); 2346 if (!eol) 2347 { 2348 ebuf->bufnext = ebuf->bufstart + ebuf->size + 1; 2349 return 0; 2350 } 2351 2352 /* Found a newline; if it's escaped continue; else we're done. */ 2353 while (p > bol && *(--p) == '\\') 2354 backslash = !backslash; 2355 if (!backslash) 2356 break; 2357 ++eol; 2358 } 2359 2360 /* Overwrite the newline char. */ 2361 *eol = '\0'; 2362 ebuf->bufnext = eol+1; 2363 2364 return 0; 2365 } 2366 2367 static long 2368 readline (struct ebuffer *ebuf) 2369 { 2370 char *p; 2371 char *end; 2372 char *start; 2373 long nlines = 0; 2374 2375 /* The behaviors between string and stream buffers are different enough to 2376 warrant different functions. Do the Right Thing. */ 2377 2378 if (!ebuf->fp) 2379 return readstring (ebuf); 2380 2381 /* When reading from a file, we always start over at the beginning of the 2382 buffer for each new line. */ 2383 2384 p = start = ebuf->bufstart; 2385 end = p + ebuf->size; 2386 *p = '\0'; 2387 2388 while (fgets (p, end - p, ebuf->fp) != 0) 2389 { 2390 char *p2; 2391 unsigned long len; 2392 int backslash; 2393 2394 len = strlen (p); 2395 if (len == 0) 2396 { 2397 /* This only happens when the first thing on the line is a '\0'. 2398 It is a pretty hopeless case, but (wonder of wonders) Athena 2399 lossage strikes again! (xmkmf puts NULs in its makefiles.) 2400 There is nothing really to be done; we synthesize a newline so 2401 the following line doesn't appear to be part of this line. */ 2402 error (&ebuf->floc, 2403 _("warning: NUL character seen; rest of line ignored")); 2404 p[0] = '\n'; 2405 len = 1; 2406 } 2407 2408 /* Jump past the text we just read. */ 2409 p += len; 2410 2411 /* If the last char isn't a newline, the whole line didn't fit into the 2412 buffer. Get some more buffer and try again. */ 2413 if (p[-1] != '\n') 2414 goto more_buffer; 2415 2416 /* We got a newline, so add one to the count of lines. */ 2417 ++nlines; 2418 2419 #if !defined(WINDOWS32) && !defined(__MSDOS__) && !defined(__EMX__) 2420 /* Check to see if the line was really ended with CRLF; if so ignore 2421 the CR. */ 2422 if ((p - start) > 1 && p[-2] == '\r') 2423 { 2424 --p; 2425 p[-1] = '\n'; 2426 } 2427 #endif 2428 2429 backslash = 0; 2430 for (p2 = p - 2; p2 >= start; --p2) 2431 { 2432 if (*p2 != '\\') 2433 break; 2434 backslash = !backslash; 2435 } 2436 2437 if (!backslash) 2438 { 2439 p[-1] = '\0'; 2440 break; 2441 } 2442 2443 /* It was a backslash/newline combo. If we have more space, read 2444 another line. */ 2445 if (end - p >= 80) 2446 continue; 2447 2448 /* We need more space at the end of our buffer, so realloc it. 2449 Make sure to preserve the current offset of p. */ 2450 more_buffer: 2451 { 2452 unsigned long off = p - start; 2453 ebuf->size *= 2; 2454 start = ebuf->buffer = ebuf->bufstart = xrealloc (start, ebuf->size); 2455 p = start + off; 2456 end = start + ebuf->size; 2457 *p = '\0'; 2458 } 2459 } 2460 2461 if (ferror (ebuf->fp)) 2462 pfatal_with_name (ebuf->floc.filenm); 2463 2464 /* If we found some lines, return how many. 2465 If we didn't, but we did find _something_, that indicates we read the last 2466 line of a file with no final newline; return 1. 2467 If we read nothing, we're at EOF; return -1. */ 2468 2469 return nlines ? nlines : p == ebuf->bufstart ? -1 : 1; 2470 } 2471 2472 2473 /* Parse the next "makefile word" from the input buffer, and return info 2474 about it. 2475 2476 A "makefile word" is one of: 2477 2478 w_bogus Should never happen 2479 w_eol End of input 2480 w_static A static word; cannot be expanded 2481 w_variable A word containing one or more variables/functions 2482 w_colon A colon 2483 w_dcolon A double-colon 2484 w_semicolon A semicolon 2485 w_varassign A variable assignment operator (=, :=, +=, or ?=) 2486 2487 Note that this function is only used when reading certain parts of the 2488 makefile. Don't use it where special rules hold sway (RHS of a variable, 2489 in a command list, etc.) */ 2490 2491 static enum make_word_type 2492 get_next_mword (char *buffer, char *delim, char **startp, unsigned int *length) 2493 { 2494 enum make_word_type wtype = w_bogus; 2495 char *p = buffer, *beg; 2496 char c; 2497 2498 /* Skip any leading whitespace. */ 2499 while (isblank ((unsigned char)*p)) 2500 ++p; 2501 2502 beg = p; 2503 c = *(p++); 2504 switch (c) 2505 { 2506 case '\0': 2507 wtype = w_eol; 2508 break; 2509 2510 case ';': 2511 wtype = w_semicolon; 2512 break; 2513 2514 case '=': 2515 wtype = w_varassign; 2516 break; 2517 2518 case ':': 2519 wtype = w_colon; 2520 switch (*p) 2521 { 2522 case ':': 2523 ++p; 2524 wtype = w_dcolon; 2525 break; 2526 2527 case '=': 2528 ++p; 2529 wtype = w_varassign; 2530 break; 2531 } 2532 break; 2533 2534 case '+': 2535 case '?': 2536 if (*p == '=') 2537 { 2538 ++p; 2539 wtype = w_varassign; 2540 break; 2541 } 2542 2543 default: 2544 if (delim && strchr (delim, c)) 2545 wtype = w_static; 2546 break; 2547 } 2548 2549 /* Did we find something? If so, return now. */ 2550 if (wtype != w_bogus) 2551 goto done; 2552 2553 /* This is some non-operator word. A word consists of the longest 2554 string of characters that doesn't contain whitespace, one of [:=#], 2555 or [?+]=, or one of the chars in the DELIM string. */ 2556 2557 /* We start out assuming a static word; if we see a variable we'll 2558 adjust our assumptions then. */ 2559 wtype = w_static; 2560 2561 /* We already found the first value of "c", above. */ 2562 while (1) 2563 { 2564 char closeparen; 2565 int count; 2566 2567 switch (c) 2568 { 2569 case '\0': 2570 case ' ': 2571 case '\t': 2572 case '=': 2573 goto done_word; 2574 2575 case ':': 2576 #ifdef HAVE_DOS_PATHS 2577 /* A word CAN include a colon in its drive spec. The drive 2578 spec is allowed either at the beginning of a word, or as part 2579 of the archive member name, like in "libfoo.a(d:/foo/bar.o)". */ 2580 if (!(p - beg >= 2 2581 && (*p == '/' || *p == '\\') && isalpha ((unsigned char)p[-2]) 2582 && (p - beg == 2 || p[-3] == '('))) 2583 #endif 2584 goto done_word; 2585 2586 case '$': 2587 c = *(p++); 2588 if (c == '$') 2589 break; 2590 2591 /* This is a variable reference, so note that it's expandable. 2592 Then read it to the matching close paren. */ 2593 wtype = w_variable; 2594 2595 if (c == '(') 2596 closeparen = ')'; 2597 else if (c == '{') 2598 closeparen = '}'; 2599 else 2600 /* This is a single-letter variable reference. */ 2601 break; 2602 2603 for (count=0; *p != '\0'; ++p) 2604 { 2605 if (*p == c) 2606 ++count; 2607 else if (*p == closeparen && --count < 0) 2608 { 2609 ++p; 2610 break; 2611 } 2612 } 2613 break; 2614 2615 case '?': 2616 case '+': 2617 if (*p == '=') 2618 goto done_word; 2619 break; 2620 2621 case '\\': 2622 switch (*p) 2623 { 2624 case ':': 2625 case ';': 2626 case '=': 2627 case '\\': 2628 ++p; 2629 break; 2630 } 2631 break; 2632 2633 default: 2634 if (delim && strchr (delim, c)) 2635 goto done_word; 2636 break; 2637 } 2638 2639 c = *(p++); 2640 } 2641 done_word: 2642 --p; 2643 2644 done: 2645 if (startp) 2646 *startp = beg; 2647 if (length) 2648 *length = p - beg; 2649 return wtype; 2650 } 2651 2652 2653 /* Construct the list of include directories 2654 from the arguments and the default list. */ 2655 2656 void 2657 construct_include_path (const char **arg_dirs) 2658 { 2659 #ifdef VAXC /* just don't ask ... */ 2660 stat_t stbuf; 2661 #else 2662 struct stat stbuf; 2663 #endif 2664 const char **dirs; 2665 const char **cpp; 2666 unsigned int idx; 2667 2668 /* Compute the number of pointers we need in the table. */ 2669 idx = sizeof (default_include_directories) / sizeof (const char *); 2670 if (arg_dirs) 2671 for (cpp = arg_dirs; *cpp != 0; ++cpp) 2672 ++idx; 2673 2674 #ifdef __MSDOS__ 2675 /* Add one for $DJDIR. */ 2676 ++idx; 2677 #endif 2678 2679 dirs = xmalloc (idx * sizeof (const char *)); 2680 2681 idx = 0; 2682 max_incl_len = 0; 2683 2684 /* First consider any dirs specified with -I switches. 2685 Ignore any that don't exist. Remember the maximum string length. */ 2686 2687 if (arg_dirs) 2688 while (*arg_dirs != 0) 2689 { 2690 const char *dir = *(arg_dirs++); 2691 char *expanded = 0; 2692 int e; 2693 2694 if (dir[0] == '~') 2695 { 2696 expanded = tilde_expand (dir); 2697 if (expanded != 0) 2698 dir = expanded; 2699 } 2700 2701 EINTRLOOP (e, stat (dir, &stbuf)); 2702 if (e == 0 && S_ISDIR (stbuf.st_mode)) 2703 { 2704 unsigned int len = strlen (dir); 2705 /* If dir name is written with trailing slashes, discard them. */ 2706 while (len > 1 && dir[len - 1] == '/') 2707 --len; 2708 if (len > max_incl_len) 2709 max_incl_len = len; 2710 dirs[idx++] = strcache_add_len (dir, len); 2711 } 2712 2713 if (expanded) 2714 free (expanded); 2715 } 2716 2717 /* Now add the standard default dirs at the end. */ 2718 2719 #ifdef __MSDOS__ 2720 { 2721 /* The environment variable $DJDIR holds the root of the DJGPP directory 2722 tree; add ${DJDIR}/include. */ 2723 struct variable *djdir = lookup_variable ("DJDIR", 5); 2724 2725 if (djdir) 2726 { 2727 unsigned int len = strlen (djdir->value) + 8; 2728 char *defdir = alloca (len + 1); 2729 2730 strcat (strcpy (defdir, djdir->value), "/include"); 2731 dirs[idx++] = strcache_add (defdir); 2732 2733 if (len > max_incl_len) 2734 max_incl_len = len; 2735 } 2736 } 2737 #endif 2738 2739 for (cpp = default_include_directories; *cpp != 0; ++cpp) 2740 { 2741 int e; 2742 2743 EINTRLOOP (e, stat (*cpp, &stbuf)); 2744 if (e == 0 && S_ISDIR (stbuf.st_mode)) 2745 { 2746 unsigned int len = strlen (*cpp); 2747 /* If dir name is written with trailing slashes, discard them. */ 2748 while (len > 1 && (*cpp)[len - 1] == '/') 2749 --len; 2750 if (len > max_incl_len) 2751 max_incl_len = len; 2752 dirs[idx++] = strcache_add_len (*cpp, len); 2753 } 2754 } 2755 2756 dirs[idx] = 0; 2757 2758 /* Now add each dir to the .INCLUDE_DIRS variable. */ 2759 2760 for (cpp = dirs; *cpp != 0; ++cpp) 2761 do_variable_definition (NILF, ".INCLUDE_DIRS", *cpp, 2762 o_default, f_append, 0); 2763 2764 include_directories = dirs; 2765 } 2766 2767 2768 /* Expand ~ or ~USER at the beginning of NAME. 2769 Return a newly malloc'd string or 0. */ 2770 2771 char * 2772 tilde_expand (const char *name) 2773 { 2774 #ifndef VMS 2775 if (name[1] == '/' || name[1] == '\0') 2776 { 2777 extern char *getenv (); 2778 char *home_dir; 2779 int is_variable; 2780 2781 { 2782 /* Turn off --warn-undefined-variables while we expand HOME. */ 2783 int save = warn_undefined_variables_flag; 2784 warn_undefined_variables_flag = 0; 2785 2786 home_dir = allocated_variable_expand ("$(HOME)"); 2787 2788 warn_undefined_variables_flag = save; 2789 } 2790 2791 is_variable = home_dir[0] != '\0'; 2792 if (!is_variable) 2793 { 2794 free (home_dir); 2795 home_dir = getenv ("HOME"); 2796 } 2797 # if !defined(_AMIGA) && !defined(WINDOWS32) 2798 if (home_dir == 0 || home_dir[0] == '\0') 2799 { 2800 extern char *getlogin (); 2801 char *logname = getlogin (); 2802 home_dir = 0; 2803 if (logname != 0) 2804 { 2805 struct passwd *p = getpwnam (logname); 2806 if (p != 0) 2807 home_dir = p->pw_dir; 2808 } 2809 } 2810 # endif /* !AMIGA && !WINDOWS32 */ 2811 if (home_dir != 0) 2812 { 2813 char *new = xstrdup (concat (2, home_dir, name + 1)); 2814 if (is_variable) 2815 free (home_dir); 2816 return new; 2817 } 2818 } 2819 # if !defined(_AMIGA) && !defined(WINDOWS32) 2820 else 2821 { 2822 struct passwd *pwent; 2823 char *userend = strchr (name + 1, '/'); 2824 if (userend != 0) 2825 *userend = '\0'; 2826 pwent = getpwnam (name + 1); 2827 if (pwent != 0) 2828 { 2829 if (userend == 0) 2830 return xstrdup (pwent->pw_dir); 2831 else 2832 return xstrdup (concat (3, pwent->pw_dir, "/", userend + 1)); 2833 } 2834 else if (userend != 0) 2835 *userend = '/'; 2836 } 2837 # endif /* !AMIGA && !WINDOWS32 */ 2838 #endif /* !VMS */ 2839 return 0; 2840 } 2841 2842 2843 /* Parse a string into a sequence of filenames represented as a chain of 2844 struct nameseq's and return that chain. Optionally expand the strings via 2845 glob(). 2320 2846 2321 2847 The string is passed as STRINGP, the address of a string pointer. … … 2327 2853 that have room for additional info. 2328 2854 2329 If STRIP is nonzero, strip `./'s off the beginning. */ 2330 2331 struct nameseq * 2332 parse_file_seq (char **stringp, int stopchar, unsigned int size, int strip) 2855 PREFIX, if non-null, is added to the beginning of each filename. 2856 2857 FLAGS allows one or more of the following bitflags to be set: 2858 PARSEFS_NOSTRIP - Do no strip './'s off the beginning 2859 PARSEFS_NOAR - Do not check filenames for archive references 2860 PARSEFS_NOGLOB - Do not expand globbing characters 2861 PARSEFS_EXISTS - Only return globbed files that actually exist 2862 (cannot also set NOGLOB) 2863 PARSEFS_NOCACHE - Do not add filenames to the strcache (caller frees) 2864 */ 2865 2866 void * 2867 parse_file_seq (char **stringp, unsigned int size, int stopchar, 2868 const char *prefix, int flags) 2333 2869 { 2870 extern void dir_setup_glob (glob_t *glob); 2871 2872 /* tmp points to tmpbuf after the prefix, if any. 2873 tp is the end of the buffer. */ 2874 static char *tmpbuf = NULL; 2875 static int tmpbuf_len = 0; 2876 2877 int cachep = (! (flags & PARSEFS_NOCACHE)); 2878 2334 2879 struct nameseq *new = 0; 2335 struct nameseq *new1, *lastnew1; 2336 char *p = *stringp; 2880 struct nameseq **newp = &new; 2881 #define NEWELT(_n) do { \ 2882 const char *__n = (_n); \ 2883 *newp = xcalloc (size); \ 2884 (*newp)->name = (cachep ? strcache_add (__n) : xstrdup (__n)); \ 2885 newp = &(*newp)->next; \ 2886 } while(0) 2887 2888 char *p; 2889 glob_t gl; 2890 char *tp; 2337 2891 2338 2892 #ifdef VMS … … 2342 2896 #endif 2343 2897 2898 if (size < sizeof (struct nameseq)) 2899 size = sizeof (struct nameseq); 2900 2901 if (! (flags & PARSEFS_NOGLOB)) 2902 dir_setup_glob (&gl); 2903 2904 /* Get enough temporary space to construct the largest possible target. */ 2905 { 2906 int l = strlen (*stringp) + 1; 2907 if (l > tmpbuf_len) 2908 { 2909 tmpbuf = xrealloc (tmpbuf, l); 2910 tmpbuf_len = l; 2911 } 2912 } 2913 tp = tmpbuf; 2914 2915 /* Parse STRING. P will always point to the end of the parsed content. */ 2916 p = *stringp; 2344 2917 while (1) 2345 2918 { 2346 2919 const char *name; 2347 char *q; 2348 2349 /* Skip whitespace; see if any more names are left. */ 2920 const char **nlist = 0; 2921 char *tildep = 0; 2922 #ifndef NO_ARCHIVES 2923 char *arname = 0; 2924 char *memname = 0; 2925 #endif 2926 char *s; 2927 int nlen; 2928 int i; 2929 2930 /* Skip whitespace; at the end of the string or STOPCHAR we're done. */ 2350 2931 p = next_token (p); 2351 if (*p == '\0' )2932 if (*p == '\0' || *p == stopchar) 2352 2933 break; 2353 if (*p == stopchar) 2354 break; 2355 2356 /* There are, so find the end of the next name. */ 2357 q = p; 2358 p = find_char_unquote (q, stopchar, VMS_COMMA, 1, 0); 2934 2935 /* There are names left, so find the end of the next name. 2936 Throughout this iteration S points to the start. */ 2937 s = p; 2938 p = find_char_unquote (p, stopchar, VMS_COMMA, 1, 0); 2359 2939 #ifdef VMS 2360 2940 /* convert comma separated list to space separated */ … … 2379 2959 #endif 2380 2960 if (p == 0) 2381 p = q + strlen (q); 2382 2383 if (strip) 2961 p = s + strlen (s); 2962 2963 /* Strip leading "this directory" references. */ 2964 if (! (flags & PARSEFS_NOSTRIP)) 2384 2965 #ifdef VMS 2385 2966 /* Skip leading `[]'s. */ 2386 while (p - q > 2 && q[0] == '[' && q[1] == ']')2967 while (p - s > 2 && s[0] == '[' && s[1] == ']') 2387 2968 #else 2388 2969 /* Skip leading `./'s. */ 2389 while (p - q > 2 && q[0] == '.' && q[1] == '/')2970 while (p - s > 2 && s[0] == '.' && s[1] == '/') 2390 2971 #endif 2391 2972 { 2392 q += 2; /* Skip "./". */2393 while (q < p && *q == '/')2394 /* Skip following slashes: ".//foo" is "foo", not "/foo". */2395 ++ q;2973 /* Skip "./" and all following slashes. */ 2974 s += 2; 2975 while (*s == '/') 2976 ++s; 2396 2977 } 2397 2978 2398 /* Extract the filename just found, and skip it. */ 2399 2400 if (q == p) 2401 /* ".///" was stripped to "". */ 2979 /* Extract the filename just found, and skip it. 2980 Set NAME to the string, and NLEN to its length. */ 2981 2982 if (s == p) 2983 { 2984 /* The name was stripped to empty ("./"). */ 2402 2985 #if defined(VMS) 2403 2986 continue; 2404 2987 #elif defined(_AMIGA) 2405 name = ""; 2988 /* PDS-- This cannot be right!! */ 2989 tp[0] = '\0'; 2990 nlen = 0; 2406 2991 #else 2407 name = "./"; 2992 tp[0] = '.'; 2993 tp[1] = '/'; 2994 tp[2] = '\0'; 2995 nlen = 2; 2408 2996 #endif 2997 } 2409 2998 else 2999 { 2410 3000 #ifdef VMS 2411 3001 /* VMS filenames can have a ':' in them but they have to be '\'ed but we need 2412 3002 * to remove this '\' before we can use the filename. 2413 * Savestring called because qmay be read-only string constant.3003 * xstrdup called because S may be read-only string constant. 2414 3004 */ 2415 { 2416 char *qbase = xstrdup (q); 2417 char *pbase = qbase + (p-q); 2418 char *q1 = qbase; 2419 char *q2 = q1; 2420 char *p1 = pbase; 2421 2422 while (q1 != pbase) 3005 char *n = tp; 3006 while (s < p) 2423 3007 { 2424 if (*q1 == '\\' && *(q1+1) == ':') 2425 { 2426 q1++; 2427 p1--; 2428 } 2429 *q2++ = *q1++; 3008 if (s[0] == '\\' && s[1] == ':') 3009 ++s; 3010 *(n++) = *(s++); 2430 3011 } 2431 name = strcache_add_len (qbase, p1 - qbase); 2432 free (qbase); 2433 } 3012 n[0] = '\0'; 3013 nlen = strlen (tp); 2434 3014 #else 2435 name = strcache_add_len (q, p - q); 3015 nlen = p - s; 3016 memcpy (tp, s, nlen); 3017 tp[nlen] = '\0'; 2436 3018 #endif 2437 2438 /* Add it to the front of the chain. */ 2439 new1 = xmalloc (size); 2440 memset (new1, '\0', size); 2441 new1->name = name; 2442 new1->next = new; 2443 new = new1; 2444 } 3019 } 3020 3021 /* At this point, TP points to the element and NLEN is its length. */ 2445 3022 2446 3023 #ifndef NO_ARCHIVES 2447 2448 /* Look for multi-word archive references. 2449 They are indicated by a elt ending with an unmatched `)' and 2450 an elt further down the chain (i.e., previous in the file list) 2451 with an unmatched `(' (e.g., "lib(mem"). */ 2452 2453 new1 = new; 2454 lastnew1 = 0; 2455 while (new1 != 0) 2456 if (new1->name[0] != '(' /* Don't catch "(%)" and suchlike. */ 2457 && new1->name[strlen (new1->name) - 1] == ')' 2458 && strchr (new1->name, '(') == 0) 2459 { 2460 /* NEW1 ends with a `)' but does not contain a `('. 2461 Look back for an elt with an opening `(' but no closing `)'. */ 2462 2463 struct nameseq *n = new1->next, *lastn = new1; 2464 char *paren = 0; 2465 while (n != 0 && (paren = strchr (n->name, '(')) == 0) 2466 { 2467 lastn = n; 2468 n = n->next; 2469 } 2470 if (n != 0 2471 /* Ignore something starting with `(', as that cannot actually 2472 be an archive-member reference (and treating it as such 2473 results in an empty file name, which causes much lossage). */ 2474 && n->name[0] != '(') 2475 { 2476 /* N is the first element in the archive group. 2477 Its name looks like "lib(mem" (with no closing `)'). */ 2478 2479 char *libname; 2480 2481 /* Copy "lib(" into LIBNAME. */ 2482 ++paren; 2483 libname = alloca (paren - n->name + 1); 2484 memcpy (libname, n->name, paren - n->name); 2485 libname[paren - n->name] = '\0'; 2486 2487 if (*paren == '\0') 2488 { 2489 /* N was just "lib(", part of something like "lib( a b)". 2490 Edit it out of the chain and free its storage. */ 2491 lastn->next = n->next; 2492 free (n); 2493 /* LASTN->next is the new stopping elt for the loop below. */ 2494 n = lastn->next; 2495 } 2496 else 2497 { 2498 /* Replace N's name with the full archive reference. */ 2499 n->name = strcache_add (concat (libname, paren, ")")); 2500 } 2501 2502 if (new1->name[1] == '\0') 2503 { 2504 /* NEW1 is just ")", part of something like "lib(a b )". 2505 Omit it from the chain and free its storage. */ 2506 if (lastnew1 == 0) 2507 new = new1->next; 2508 else 2509 lastnew1->next = new1->next; 2510 lastn = new1; 2511 new1 = new1->next; 2512 free (lastn); 2513 } 2514 else 2515 { 2516 /* Replace also NEW1->name, which already has closing `)'. */ 2517 new1->name = strcache_add (concat (libname, new1->name, "")); 2518 new1 = new1->next; 2519 } 2520 2521 /* Trace back from NEW1 (the end of the list) until N 2522 (the beginning of the list), rewriting each name 2523 with the full archive reference. */ 2524 2525 while (new1 != n) 2526 { 2527 new1->name = strcache_add (concat (libname, new1->name, ")")); 2528 lastnew1 = new1; 2529 new1 = new1->next; 2530 } 2531 } 2532 else 2533 { 2534 /* No frobnication happening. Just step down the list. */ 2535 lastnew1 = new1; 2536 new1 = new1->next; 2537 } 2538 } 2539 else 2540 { 2541 lastnew1 = new1; 2542 new1 = new1->next; 2543 } 2544 2545 #endif 2546 2547 *stringp = p; 2548 return new; 2549 } 2550 2551 2552 /* Find the next line of text in an eval buffer, combining continuation lines 2553 into one line. 2554 Return the number of actual lines read (> 1 if continuation lines). 2555 Returns -1 if there's nothing left in the buffer. 2556 2557 After this function, ebuf->buffer points to the first character of the 2558 line we just found. 2559 */ 2560 2561 /* Read a line of text from a STRING. 2562 Since we aren't really reading from a file, don't bother with linenumbers. 2563 */ 2564 2565 static unsigned long 2566 readstring (struct ebuffer *ebuf) 2567 { 2568 char *eol; 2569 2570 /* If there is nothing left in this buffer, return 0. */ 2571 if (ebuf->bufnext >= ebuf->bufstart + ebuf->size) 2572 return -1; 2573 2574 /* Set up a new starting point for the buffer, and find the end of the 2575 next logical line (taking into account backslash/newline pairs). */ 2576 2577 eol = ebuf->buffer = ebuf->bufnext; 2578 2579 while (1) 2580 { 2581 int backslash = 0; 2582 char *bol = eol; 2583 char *p; 2584 2585 /* Find the next newline. At EOS, stop. */ 2586 eol = p = strchr (eol , '\n'); 2587 if (!eol) 3024 /* If this is the start of an archive group that isn't complete, set up 3025 to add the archive prefix for future files. A file list like: 3026 "libf.a(x.o y.o z.o)" needs to be expanded as: 3027 "libf.a(x.o) libf.a(y.o) libf.a(z.o)" 3028 3029 TP == TMP means we're not already in an archive group. Ignore 3030 something starting with `(', as that cannot actually be an 3031 archive-member reference (and treating it as such results in an empty 3032 file name, which causes much lossage). Also if it ends in ")" then 3033 it's a complete reference so we don't need to treat it specially. 3034 3035 Finally, note that archive groups must end with ')' as the last 3036 character, so ensure there's some word ending like that before 3037 considering this an archive group. */ 3038 if (! (flags & PARSEFS_NOAR) 3039 && tp == tmpbuf && tp[0] != '(' && tp[nlen-1] != ')') 2588 3040 { 2589 ebuf->bufnext = ebuf->bufstart + ebuf->size + 1; 2590 return 0; 3041 char *n = strchr (tp, '('); 3042 if (n) 3043 { 3044 /* This looks like the first element in an open archive group. 3045 A valid group MUST have ')' as the last character. */ 3046 const char *e = p + nlen; 3047 do 3048 { 3049 e = next_token (e); 3050 /* Find the end of this word. We don't want to unquote and 3051 we don't care about quoting since we're looking for the 3052 last char in the word. */ 3053 while (*e != '\0' && *e != stopchar && *e != VMS_COMMA 3054 && ! isblank ((unsigned char) *e)) 3055 ++e; 3056 if (e[-1] == ')') 3057 { 3058 /* Found the end, so this is the first element in an 3059 open archive group. It looks like "lib(mem". 3060 Reset TP past the open paren. */ 3061 nlen -= (n + 1) - tp; 3062 tp = n + 1; 3063 3064 /* If we have just "lib(", part of something like 3065 "lib( a b)", go to the next item. */ 3066 if (! nlen) 3067 continue; 3068 3069 /* We can stop looking now. */ 3070 break; 3071 } 3072 } 3073 while (*e != '\0'); 3074 } 2591 3075 } 2592 3076 2593 /* Found a newline; if it's escaped continue; else we're done. */ 2594 while (p > bol && *(--p) == '\\') 2595 backslash = !backslash; 2596 if (!backslash) 2597 break; 2598 ++eol; 2599 } 2600 2601 /* Overwrite the newline char. */ 2602 *eol = '\0'; 2603 ebuf->bufnext = eol+1; 2604 2605 return 0; 2606 } 2607 2608 static long 2609 readline (struct ebuffer *ebuf) 2610 { 2611 char *p; 2612 char *end; 2613 char *start; 2614 long nlines = 0; 2615 2616 /* The behaviors between string and stream buffers are different enough to 2617 warrant different functions. Do the Right Thing. */ 2618 2619 if (!ebuf->fp) 2620 return readstring (ebuf); 2621 2622 /* When reading from a file, we always start over at the beginning of the 2623 buffer for each new line. */ 2624 2625 p = start = ebuf->bufstart; 2626 end = p + ebuf->size; 2627 *p = '\0'; 2628 2629 while (fgets (p, end - p, ebuf->fp) != 0) 2630 { 2631 char *p2; 2632 unsigned long len; 2633 int backslash; 2634 2635 len = strlen (p); 2636 if (len == 0) 2637 { 2638 /* This only happens when the first thing on the line is a '\0'. 2639 It is a pretty hopeless case, but (wonder of wonders) Athena 2640 lossage strikes again! (xmkmf puts NULs in its makefiles.) 2641 There is nothing really to be done; we synthesize a newline so 2642 the following line doesn't appear to be part of this line. */ 2643 error (&ebuf->floc, 2644 _("warning: NUL character seen; rest of line ignored")); 2645 p[0] = '\n'; 2646 len = 1; 2647 } 2648 2649 /* Jump past the text we just read. */ 2650 p += len; 2651 2652 /* If the last char isn't a newline, the whole line didn't fit into the 2653 buffer. Get some more buffer and try again. */ 2654 if (p[-1] != '\n') 2655 goto more_buffer; 2656 2657 /* We got a newline, so add one to the count of lines. */ 2658 ++nlines; 2659 2660 #if !defined(WINDOWS32) && !defined(__MSDOS__) && !defined(__EMX__) 2661 /* Check to see if the line was really ended with CRLF; if so ignore 2662 the CR. */ 2663 if ((p - start) > 1 && p[-2] == '\r') 3077 /* If we are inside an archive group, make sure it has an end. */ 3078 if (tp > tmpbuf) 2664 3079 { 2665 --p; 2666 p[-1] = '\n'; 3080 if (tp[nlen-1] == ')') 3081 { 3082 /* This is the natural end; reset TP. */ 3083 tp = tmpbuf; 3084 3085 /* This is just ")", something like "lib(a b )": skip it. */ 3086 if (nlen == 1) 3087 continue; 3088 } 3089 else 3090 { 3091 /* Not the end, so add a "fake" end. */ 3092 tp[nlen++] = ')'; 3093 tp[nlen] = '\0'; 3094 } 2667 3095 } 2668 3096 #endif 2669 3097 2670 backslash = 0; 2671 for (p2 = p - 2; p2 >= start; --p2) 3098 /* If we're not globbing we're done: add it to the end of the chain. 3099 Go to the next item in the string. */ 3100 if (flags & PARSEFS_NOGLOB) 3101 { 3102 NEWELT (concat (2, prefix, tp)); 3103 continue; 3104 } 3105 3106 /* If we get here we know we're doing glob expansion. 3107 TP is a string in tmpbuf. NLEN is no longer used. 3108 We may need to do more work: after this NAME will be set. */ 3109 name = tp; 3110 3111 /* Expand tilde if applicable. */ 3112 if (tp[0] == '~') 2672 3113 { 2673 if (*p2 != '\\')2674 break;2675 backslash = !backslash;3114 tildep = tilde_expand (tp); 3115 if (tildep != 0) 3116 name = tildep; 2676 3117 } 2677 3118 2678 if (!backslash) 3119 #ifndef NO_ARCHIVES 3120 /* If NAME is an archive member reference replace it with the archive 3121 file name, and save the member name in MEMNAME. We will glob on the 3122 archive name and then reattach MEMNAME later. */ 3123 if (! (flags & PARSEFS_NOAR) && ar_name (name)) 2679 3124 { 2680 p[-1] = '\0';2681 break;3125 ar_parse_name (name, &arname, &memname); 3126 name = arname; 2682 3127 } 2683 2684 /* It was a backslash/newline combo. If we have more space, read 2685 another line. */ 2686 if (end - p >= 80) 2687 continue; 2688 2689 /* We need more space at the end of our buffer, so realloc it. 2690 Make sure to preserve the current offset of p. */ 2691 more_buffer: 2692 { 2693 unsigned long off = p - start; 2694 ebuf->size *= 2; 2695 start = ebuf->buffer = ebuf->bufstart = xrealloc (start, ebuf->size); 2696 p = start + off; 2697 end = start + ebuf->size; 2698 *p = '\0'; 2699 } 2700 } 2701 2702 if (ferror (ebuf->fp)) 2703 pfatal_with_name (ebuf->floc.filenm); 2704 2705 /* If we found some lines, return how many. 2706 If we didn't, but we did find _something_, that indicates we read the last 2707 line of a file with no final newline; return 1. 2708 If we read nothing, we're at EOF; return -1. */ 2709 2710 return nlines ? nlines : p == ebuf->bufstart ? -1 : 1; 2711 } 2712 2713 2714 /* Parse the next "makefile word" from the input buffer, and return info 2715 about it. 2716 2717 A "makefile word" is one of: 2718 2719 w_bogus Should never happen 2720 w_eol End of input 2721 w_static A static word; cannot be expanded 2722 w_variable A word containing one or more variables/functions 2723 w_colon A colon 2724 w_dcolon A double-colon 2725 w_semicolon A semicolon 2726 w_varassign A variable assignment operator (=, :=, +=, or ?=) 2727 2728 Note that this function is only used when reading certain parts of the 2729 makefile. Don't use it where special rules hold sway (RHS of a variable, 2730 in a command list, etc.) */ 2731 2732 static enum make_word_type 2733 get_next_mword (char *buffer, char *delim, char **startp, unsigned int *length) 2734 { 2735 enum make_word_type wtype = w_bogus; 2736 char *p = buffer, *beg; 2737 char c; 2738 2739 /* Skip any leading whitespace. */ 2740 while (isblank ((unsigned char)*p)) 2741 ++p; 2742 2743 beg = p; 2744 c = *(p++); 2745 switch (c) 2746 { 2747 case '\0': 2748 wtype = w_eol; 2749 break; 2750 2751 case ';': 2752 wtype = w_semicolon; 2753 break; 2754 2755 case '=': 2756 wtype = w_varassign; 2757 break; 2758 2759 case ':': 2760 wtype = w_colon; 2761 switch (*p) 2762 { 2763 case ':': 2764 ++p; 2765 wtype = w_dcolon; 3128 #endif /* !NO_ARCHIVES */ 3129 3130 switch (glob (name, GLOB_NOSORT|GLOB_ALTDIRFUNC, NULL, &gl)) 3131 { 3132 case GLOB_NOSPACE: 3133 fatal (NILF, _("virtual memory exhausted")); 3134 3135 case 0: 3136 /* Success. */ 3137 i = gl.gl_pathc; 3138 nlist = (const char **)gl.gl_pathv; 2766 3139 break; 2767 3140 2768 case '=': 2769 ++p; 2770 wtype = w_varassign; 2771 break; 2772 } 2773 break; 2774 2775 case '+': 2776 case '?': 2777 if (*p == '=') 2778 { 2779 ++p; 2780 wtype = w_varassign; 2781 break; 2782 } 2783 2784 default: 2785 if (delim && strchr (delim, c)) 2786 wtype = w_static; 2787 break; 2788 } 2789 2790 /* Did we find something? If so, return now. */ 2791 if (wtype != w_bogus) 2792 goto done; 2793 2794 /* This is some non-operator word. A word consists of the longest 2795 string of characters that doesn't contain whitespace, one of [:=#], 2796 or [?+]=, or one of the chars in the DELIM string. */ 2797 2798 /* We start out assuming a static word; if we see a variable we'll 2799 adjust our assumptions then. */ 2800 wtype = w_static; 2801 2802 /* We already found the first value of "c", above. */ 2803 while (1) 2804 { 2805 char closeparen; 2806 int count; 2807 2808 switch (c) 2809 { 2810 case '\0': 2811 case ' ': 2812 case '\t': 2813 case '=': 2814 goto done_word; 2815 2816 case ':': 2817 #ifdef HAVE_DOS_PATHS 2818 /* A word CAN include a colon in its drive spec. The drive 2819 spec is allowed either at the beginning of a word, or as part 2820 of the archive member name, like in "libfoo.a(d:/foo/bar.o)". */ 2821 if (!(p - beg >= 2 2822 && (*p == '/' || *p == '\\') && isalpha ((unsigned char)p[-2]) 2823 && (p - beg == 2 || p[-3] == '('))) 2824 #endif 2825 goto done_word; 2826 2827 case '$': 2828 c = *(p++); 2829 if (c == '$') 2830 break; 2831 2832 /* This is a variable reference, so note that it's expandable. 2833 Then read it to the matching close paren. */ 2834 wtype = w_variable; 2835 2836 if (c == '(') 2837 closeparen = ')'; 2838 else if (c == '{') 2839 closeparen = '}'; 2840 else 2841 /* This is a single-letter variable reference. */ 2842 break; 2843 2844 for (count=0; *p != '\0'; ++p) 3141 case GLOB_NOMATCH: 3142 /* If we want only existing items, skip this one. */ 3143 if (flags & PARSEFS_EXISTS) 2845 3144 { 2846 if (*p == c) 2847 ++count; 2848 else if (*p == closeparen && --count < 0) 2849 { 2850 ++p; 2851 break; 2852 } 2853 } 2854 break; 2855 2856 case '?': 2857 case '+': 2858 if (*p == '=') 2859 goto done_word; 2860 break; 2861 2862 case '\\': 2863 switch (*p) 2864 { 2865 case ':': 2866 case ';': 2867 case '=': 2868 case '\\': 2869 ++p; 3145 i = 0; 2870 3146 break; 2871 3147 } 3148 /* FALLTHROUGH */ 3149 3150 default: 3151 /* By default keep this name. */ 3152 i = 1; 3153 nlist = &name; 2872 3154 break; 2873 2874 default: 2875 if (delim && strchr (delim, c)) 2876 goto done_word; 2877 break; 2878 } 2879 2880 c = *(p++); 2881 } 2882 done_word: 2883 --p; 2884 2885 done: 2886 if (startp) 2887 *startp = beg; 2888 if (length) 2889 *length = p - beg; 2890 return wtype; 2891 } 2892 2893 2894 /* Construct the list of include directories 2895 from the arguments and the default list. */ 2896 2897 void 2898 construct_include_path (const char **arg_dirs) 2899 { 2900 #ifdef VAXC /* just don't ask ... */ 2901 stat_t stbuf; 2902 #else 2903 struct stat stbuf; 2904 #endif 2905 const char **dirs; 2906 const char **cpp; 2907 unsigned int idx; 2908 2909 /* Compute the number of pointers we need in the table. */ 2910 idx = sizeof (default_include_directories) / sizeof (const char *); 2911 if (arg_dirs) 2912 for (cpp = arg_dirs; *cpp != 0; ++cpp) 2913 ++idx; 2914 2915 #ifdef __MSDOS__ 2916 /* Add one for $DJDIR. */ 2917 ++idx; 2918 #endif 2919 2920 dirs = xmalloc (idx * sizeof (const char *)); 2921 2922 idx = 0; 2923 max_incl_len = 0; 2924 2925 /* First consider any dirs specified with -I switches. 2926 Ignore any that don't exist. Remember the maximum string length. */ 2927 2928 if (arg_dirs) 2929 while (*arg_dirs != 0) 2930 { 2931 const char *dir = *(arg_dirs++); 2932 char *expanded = 0; 2933 int e; 2934 2935 if (dir[0] == '~') 2936 { 2937 expanded = tilde_expand (dir); 2938 if (expanded != 0) 2939 dir = expanded; 2940 } 2941 2942 EINTRLOOP (e, stat (dir, &stbuf)); 2943 if (e == 0 && S_ISDIR (stbuf.st_mode)) 3155 } 3156 3157 /* For each matched element, add it to the list. */ 3158 while (i-- > 0) 3159 #ifndef NO_ARCHIVES 3160 if (memname != 0) 2944 3161 { 2945 unsigned int len = strlen (dir); 2946 /* If dir name is written with trailing slashes, discard them. */ 2947 while (len > 1 && dir[len - 1] == '/') 2948 --len; 2949 if (len > max_incl_len) 2950 max_incl_len = len; 2951 dirs[idx++] = strcache_add_len (dir, len); 3162 /* Try to glob on MEMNAME within the archive. */ 3163 struct nameseq *found = ar_glob (nlist[i], memname, size); 3164 if (! found) 3165 /* No matches. Use MEMNAME as-is. */ 3166 NEWELT (concat (5, prefix, nlist[i], "(", memname, ")")); 3167 else 3168 { 3169 /* We got a chain of items. Attach them. */ 3170 (*newp)->next = found; 3171 3172 /* Find and set the new end. Massage names if necessary. */ 3173 while (1) 3174 { 3175 if (! cachep) 3176 found->name = xstrdup (concat (2, prefix, name)); 3177 else if (prefix) 3178 found->name = strcache_add (concat (2, prefix, name)); 3179 3180 if (found->next == 0) 3181 break; 3182 3183 found = found->next; 3184 } 3185 newp = &found->next; 3186 } 2952 3187 } 2953 2954 if (expanded) 2955 free (expanded); 2956 } 2957 2958 /* Now add the standard default dirs at the end. */ 2959 2960 #ifdef __MSDOS__ 2961 { 2962 /* The environment variable $DJDIR holds the root of the DJGPP directory 2963 tree; add ${DJDIR}/include. */ 2964 struct variable *djdir = lookup_variable ("DJDIR", 5); 2965 2966 if (djdir) 2967 { 2968 unsigned int len = strlen (djdir->value) + 8; 2969 char *defdir = alloca (len + 1); 2970 2971 strcat (strcpy (defdir, djdir->value), "/include"); 2972 dirs[idx++] = strcache_add (defdir); 2973 2974 if (len > max_incl_len) 2975 max_incl_len = len; 2976 } 2977 } 2978 #endif 2979 2980 for (cpp = default_include_directories; *cpp != 0; ++cpp) 2981 { 2982 int e; 2983 2984 EINTRLOOP (e, stat (*cpp, &stbuf)); 2985 if (e == 0 && S_ISDIR (stbuf.st_mode)) 2986 { 2987 unsigned int len = strlen (*cpp); 2988 /* If dir name is written with trailing slashes, discard them. */ 2989 while (len > 1 && (*cpp)[len - 1] == '/') 2990 --len; 2991 if (len > max_incl_len) 2992 max_incl_len = len; 2993 dirs[idx++] = strcache_add_len (*cpp, len); 2994 } 2995 } 2996 2997 dirs[idx] = 0; 2998 2999 /* Now add each dir to the .INCLUDE_DIRS variable. */ 3000 3001 for (cpp = dirs; *cpp != 0; ++cpp) 3002 do_variable_definition (NILF, ".INCLUDE_DIRS", *cpp, 3003 o_default, f_append, 0); 3004 3005 include_directories = dirs; 3006 } 3007 3008 3009 /* Expand ~ or ~USER at the beginning of NAME. 3010 Return a newly malloc'd string or 0. */ 3011 3012 char * 3013 tilde_expand (const char *name) 3014 { 3015 #ifndef VMS 3016 if (name[1] == '/' || name[1] == '\0') 3017 { 3018 extern char *getenv (); 3019 char *home_dir; 3020 int is_variable; 3021 3022 { 3023 /* Turn off --warn-undefined-variables while we expand HOME. */ 3024 int save = warn_undefined_variables_flag; 3025 warn_undefined_variables_flag = 0; 3026 3027 home_dir = allocated_variable_expand ("$(HOME)"); 3028 3029 warn_undefined_variables_flag = save; 3030 } 3031 3032 is_variable = home_dir[0] != '\0'; 3033 if (!is_variable) 3034 { 3035 free (home_dir); 3036 home_dir = getenv ("HOME"); 3037 } 3038 # if !defined(_AMIGA) && !defined(WINDOWS32) 3039 if (home_dir == 0 || home_dir[0] == '\0') 3040 { 3041 extern char *getlogin (); 3042 char *logname = getlogin (); 3043 home_dir = 0; 3044 if (logname != 0) 3045 { 3046 struct passwd *p = getpwnam (logname); 3047 if (p != 0) 3048 home_dir = p->pw_dir; 3049 } 3050 } 3051 # endif /* !AMIGA && !WINDOWS32 */ 3052 if (home_dir != 0) 3053 { 3054 char *new = xstrdup (concat (home_dir, "", name + 1)); 3055 if (is_variable) 3056 free (home_dir); 3057 return new; 3058 } 3059 } 3060 # if !defined(_AMIGA) && !defined(WINDOWS32) 3061 else 3062 { 3063 struct passwd *pwent; 3064 char *userend = strchr (name + 1, '/'); 3065 if (userend != 0) 3066 *userend = '\0'; 3067 pwent = getpwnam (name + 1); 3068 if (pwent != 0) 3069 { 3070 if (userend == 0) 3071 return xstrdup (pwent->pw_dir); 3072 else 3073 return xstrdup (concat (pwent->pw_dir, "/", userend + 1)); 3074 } 3075 else if (userend != 0) 3076 *userend = '/'; 3077 } 3078 # endif /* !AMIGA && !WINDOWS32 */ 3079 #endif /* !VMS */ 3080 return 0; 3081 } 3082 3083 /* Given a chain of struct nameseq's describing a sequence of filenames, 3084 in reverse of the intended order, return a new chain describing the 3085 result of globbing the filenames. The new chain is in forward order. 3086 The links of the old chain are freed or used in the new chain. 3087 Likewise for the names in the old chain. 3088 3089 SIZE is how big to construct chain elements. 3090 This is useful if we want them actually to be other structures 3091 that have room for additional info. */ 3092 3093 struct nameseq * 3094 multi_glob (struct nameseq *chain, unsigned int size) 3095 { 3096 void dir_setup_glob (glob_t *); 3097 struct nameseq *new = 0; 3098 struct nameseq *old; 3099 struct nameseq *nexto; 3100 glob_t gl; 3101 3102 dir_setup_glob (&gl); 3103 3104 for (old = chain; old != 0; old = nexto) 3105 { 3106 const char *gname; 3107 #ifndef NO_ARCHIVES 3108 char *arname = 0; 3109 char *memname = 0; 3110 #endif 3111 nexto = old->next; 3112 gname = old->name; 3113 3114 if (gname[0] == '~') 3115 { 3116 char *newname = tilde_expand (old->name); 3117 if (newname != 0) 3118 gname = newname; 3119 } 3120 3121 #ifndef NO_ARCHIVES 3122 if (ar_name (gname)) 3123 { 3124 /* OLD->name is an archive member reference. Replace it with the 3125 archive file name, and save the member name in MEMNAME. We will 3126 glob on the archive name and then reattach MEMNAME later. */ 3127 ar_parse_name (gname, &arname, &memname); 3128 gname = arname; 3129 } 3188 else 3130 3189 #endif /* !NO_ARCHIVES */ 3131 3132 switch (glob (gname, GLOB_NOCHECK|GLOB_ALTDIRFUNC, NULL, &gl)) 3133 { 3134 case 0: /* Success. */ 3135 { 3136 int i = gl.gl_pathc; 3137 while (i-- > 0) 3138 { 3139 #ifndef NO_ARCHIVES 3140 if (memname != 0) 3141 { 3142 /* Try to glob on MEMNAME within the archive. */ 3143 struct nameseq *found 3144 = ar_glob (gl.gl_pathv[i], memname, size); 3145 if (! found) 3146 { 3147 /* No matches. Use MEMNAME as-is. */ 3148 unsigned int alen = strlen (gl.gl_pathv[i]); 3149 unsigned int mlen = strlen (memname); 3150 char *name; 3151 struct nameseq *elt = xmalloc (size); 3152 memset (elt, '\0', size); 3153 3154 name = alloca (alen + 1 + mlen + 2); 3155 memcpy (name, gl.gl_pathv[i], alen); 3156 name[alen] = '('; 3157 memcpy (name+alen+1, memname, mlen); 3158 name[alen + 1 + mlen] = ')'; 3159 name[alen + 1 + mlen + 1] = '\0'; 3160 elt->name = strcache_add (name); 3161 elt->next = new; 3162 new = elt; 3163 } 3164 else 3165 { 3166 /* Find the end of the FOUND chain. */ 3167 struct nameseq *f = found; 3168 while (f->next != 0) 3169 f = f->next; 3170 3171 /* Attach the chain being built to the end of the FOUND 3172 chain, and make FOUND the new NEW chain. */ 3173 f->next = new; 3174 new = found; 3175 } 3176 } 3177 else 3178 #endif /* !NO_ARCHIVES */ 3179 { 3180 struct nameseq *elt = xmalloc (size); 3181 memset (elt, '\0', size); 3182 elt->name = strcache_add (gl.gl_pathv[i]); 3183 elt->next = new; 3184 new = elt; 3185 } 3186 } 3187 globfree (&gl); 3188 free (old); 3189 break; 3190 } 3191 3192 case GLOB_NOSPACE: 3193 fatal (NILF, _("virtual memory exhausted")); 3194 break; 3195 3196 default: 3197 old->next = new; 3198 new = old; 3199 break; 3200 } 3190 NEWELT (concat (2, prefix, nlist[i])); 3191 3192 globfree (&gl); 3201 3193 3202 3194 #ifndef NO_ARCHIVES … … 3204 3196 free (arname); 3205 3197 #endif 3198 3199 if (tildep) 3200 free (tildep); 3206 3201 } 3207 3202 3203 *stringp = p; 3208 3204 return new; 3209 3205 } -
vendor/gnumake/current/readme.vms
r1989 r2596 1 1 This is the VMS version of GNU Make, updated by Hartmut Becker 2 2 3 Changes are based on GNU make 3.80. Latest changes are for OpenVMS/I64 4 and new VMS CRTLs. 5 6 This version was tested on OpenVMS/I64 V8.2 (field test) with hp C 7 X7.1-024 OpenVMS/Alpha V7.3-2 with Compaq C V6.5-001 and OpenVMS/VAX 7.1 8 with Compaq C V6.2-003 There are still some warning and informational 9 message issued by the compilers. 3 Changes are based on GNU make 3.82. 4 5 This version was built and tested on OpenVMS V7.3 (VAX), V7.3-2 (Alpha) and 6 V8.3-1H1 (I64). 10 7 11 8 Build instructions 12 9 Make a 1st version 13 $ @makefile.com 10 $ @makefile.com ! ignore any compiler and/or linker warning 14 11 $ rena make.exe 1st-make.exe 15 12 Use the 1st version to generate a 2nd version … … 21 18 $ mc sys$disk:[]2nd-make 22 19 23 Changes: 20 Changes (3.81.90) 21 22 Michael Gehre (at VISTEC-SEMI dot COM) supplied a fix for a problem with 23 timestamps of object modules in OLBs. The timestamps were not correctly 24 adjusted to GMT based time, if the local VMS time was using a daylight saving 25 algorithm and if daylight saving was switched off. 26 27 John Eisenbraun (at HP dot COM) supplied fixes and and an enhancement to append 28 output redirection in action lines. 29 30 Rework of ctrl+c and ctrl+y handling. 31 32 Fix a problem with cached strings, which showed on case-insensitive file 33 systems. 34 35 Build fixes for const-ified code in VMS specific sources. 36 37 Build notes: 38 - Try to avoid HP C V7.2-001, which has an incompatible change 39 how __STDC__ is defined. This results at least in compile time warnings. 40 41 - On V8.3-1H1, if you press Ctrl+C you may see a traceback, starting with 42 %SYSTEM-F-CONTROLC, operation completed under CTRL/C 43 %TRACE-F-TRACEBACK, symbolic stack dump follows 44 image module routine line rel PC abs PC 45 46 DECC$SHR C$SIGNAL gsignal 27991 0000000000001180 47 FFFFFFFF84AB2DA0 48 DECC$SHR C$SIGNAL raise 28048 0000000000001280 49 FFFFFFFF84AB2EA0 50 DECC$SHR C$SIGPENDING decc$$deliver_signals 51 12475 0000000000000890 52 FFFFFFFF84C13690 53 ... 54 This looks like an incompatibility to the Alpha and VAX behavior, so it looks 55 like a problem in I64 VMS version(s). 56 57 - There is no clean build on VAX. In the environment I tested, I had to use GNU 58 make's alloca which produced a couple of compile time warnings. It seems too 59 much effort to work on a clean build on VAX. 60 61 A note on appending the redirected output. With this change, a simple mechanism 62 is implemented to make ">>" work in action lines. In VMS there is no simple 63 feature like ">>" to have DCL command or program output redirected and appended 64 to a file. GNU make for VMS already implements the redirection of output. If 65 such a redirection is detected, an ">" on the action line, GNU make creates a 66 DCL command procedure to execute the action and to redirect its output. Based 67 on that, now ">>" is also recognized and a similar but different command 68 procedure is created to implement the append. The main idea here is to create a 69 temporary file which collects the output and which is appended to the wanted 70 output file. Then the temporary file is deleted. This is all done in the 71 command procedure to keep changes in make small and simple. This obviously has 72 some limitations but it seems good enough compared with the current ">" 73 implementation. (And in my opinion, redirection is not really what GNU make has 74 to do.) With this approach, it may happen that the temporary file is not yet 75 appended and is left in SYS$SCRATCH. The temporary file names look like 76 "CMDxxxxx.". Any time the created command procedure can not complete, this 77 happens. Pressing Ctrl+Y to abort make is one case. In case of Ctrl+Y the 78 associated command procedure is left in SYS$SCRATCH as well. Its name is 79 CMDxxxxx.COM. 80 81 Change in the Ctrl+Y handling 82 83 Ctrl+Y was: The CtrlY handler called $forcex for the current child. 84 85 Ctrl+Y changed: The CtrlY handler uses $delprc to delete all children. This way 86 also actions with DCL commands will be stopped. As before Ctrl+Y then sends 87 SIGQUIT to itself, which is handled in common code. 88 89 Change in deleteing temporary command files 90 91 Temporary command files were deleted in the main line, after returning from the 92 vms child termination handler. If Ctrl+C was pressed, the handler is called but 93 did not return to main line. 94 95 Now, temporary command files are deleted in the vms child termination 96 handler. That deletes the them even if a Ctrl+C was pressed. 97 98 The behavior of pressing Ctrl+C is not changed. It still has only an effect, 99 after the current action is terminated. If that doesn't happen or takes too 100 long, Ctrl+Y should be used instead. 101 102 103 Changes (3.80) 24 104 25 105 . In default.c define variable ARCH as IA64 for VMS on Itanium systems. … … 300 380 ------------------------------------------------------------------------------- 301 381 Copyright (C) 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005, 302 2006, 2007 Free Software Foundation, Inc.382 2006, 2007, 2008, 2009, 2010 Free Software Foundation, Inc. 303 383 This file is part of GNU Make. 304 384 -
vendor/gnumake/current/remake.c
r1989 r2596 1 1 /* Basic dependency engine for GNU Make. 2 2 Copyright (C) 1988, 1989, 1990, 1991, 1992, 1993, 1994, 1995, 1996, 1997, 3 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007 Free Software4 Foundation, Inc.3 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 4 2010 Free Software Foundation, Inc. 5 5 This file is part of GNU Make. 6 6 … … 84 84 { 85 85 int t = touch_flag, q = question_flag, n = just_print_flag; 86 unsigned int j = job_slots;87 86 int status = -1; 88 87 … … 136 135 unsigned int ocommands_started; 137 136 int x; 137 138 file->dontcare = g->dontcare; 139 138 140 check_renamed (file); 139 141 if (rebuilding_makefiles) … … 209 211 any_not_updated |= !file->updated; 210 212 213 file->dontcare = 0; 214 211 215 if (stop) 212 216 break; … … 265 269 question_flag = q; 266 270 just_print_flag = n; 267 job_slots = j;268 271 } 269 272 … … 298 301 if (f->considered == considered) 299 302 { 300 DBF (DB_VERBOSE, _("Pruning file `%s'.\n")); 301 return f->command_state == cs_finished ? f->update_status : 0; 303 /* Check for the case where a target has been tried and failed but 304 the diagnostics hasn't been issued. If we need the diagnostics 305 then we will have to continue. */ 306 if (!(f->updated && f->update_status > 0 && !f->dontcare && f->no_diag)) 307 { 308 DBF (DB_VERBOSE, _("Pruning file `%s'.\n")); 309 return f->command_state == cs_finished ? f->update_status : 0; 310 } 302 311 } 303 312 … … 316 325 /* If we got an error, don't bother with double_colon etc. */ 317 326 if (status != 0 && !keep_going_flag) 318 327 return status; 319 328 320 329 if (f->command_state == cs_running … … 348 357 349 358 static void 350 complain ( conststruct file *file)359 complain (struct file *file) 351 360 { 352 361 const char *msg_noparent … … 355 364 = _("%sNo rule to make target `%s', needed by `%s'%s"); 356 365 357 if (!keep_going_flag) 358 { 366 /* If this file has no_diag set then it means we tried to update it 367 before in the dontcare mode and failed. The target that actually 368 failed is not necessarily this file but could be one of its direct 369 or indirect dependencies. So traverse this file's dependencies and 370 find the one that actually caused the failure. */ 371 372 struct dep *d; 373 374 for (d = file->deps; d != 0; d = d->next) 375 { 376 if (d->file->updated && d->file->update_status > 0 && file->no_diag) 377 { 378 complain (d->file); 379 break; 380 } 381 } 382 383 if (d == 0) 384 { 385 /* Didn't find any dependencies to complain about. */ 386 if (!keep_going_flag) 387 { 388 if (file->parent == 0) 389 fatal (NILF, msg_noparent, "", file->name, ""); 390 391 fatal (NILF, msg_parent, "", file->name, file->parent->name, ""); 392 } 393 359 394 if (file->parent == 0) 360 fatal (NILF, msg_noparent, "", file->name, ""); 361 362 fatal (NILF, msg_parent, "", file->name, file->parent->name, ""); 363 } 364 365 if (file->parent == 0) 366 error (NILF, msg_noparent, "*** ", file->name, "."); 367 else 368 error (NILF, msg_parent, "*** ", file->name, file->parent->name, "."); 395 error (NILF, msg_noparent, "*** ", file->name, "."); 396 else 397 error (NILF, msg_parent, "*** ", file->name, file->parent->name, "."); 398 399 file->no_diag = 0; 400 } 369 401 } 370 402 … … 374 406 update_file_1 (struct file *file, unsigned int depth) 375 407 { 376 registerFILE_TIMESTAMP this_mtime;408 FILE_TIMESTAMP this_mtime; 377 409 int noexist, must_make, deps_changed; 378 410 int dep_status = 0; 379 register struct dep *d, *lastd; 411 struct file *ofile; 412 struct dep *d, *ad; 413 struct dep amake; 380 414 int running = 0; 381 415 … … 389 423 _("Recently tried and failed to update file `%s'.\n")); 390 424 391 /* If the file we tried to make is marked dontcarethen no message425 /* If the file we tried to make is marked no_diag then no message 392 426 was printed about it when it failed during the makefile rebuild. 393 427 If we're trying to build it again in the normal rebuild, print a 394 428 message now. */ 395 if (file->dontcare && !rebuilding_makefiles) 396 { 397 file->dontcare = 0; 429 if (file->no_diag && !file->dontcare) 398 430 complain (file); 399 }400 431 401 432 return file->update_status; … … 421 452 } 422 453 454 /* Determine whether the diagnostics will be issued should this update 455 fail. */ 456 file->no_diag = file->dontcare; 457 423 458 ++depth; 424 459 425 460 /* Notice recursive update of the same file. */ 426 461 start_updating (file); 462 463 /* We might change file if we find a different one via vpath; 464 remember this one to turn off updating. */ 465 ofile = file; 427 466 428 467 /* Looking at the file's modtime beforehand allows the possibility … … 468 507 } 469 508 470 /* Update all non-intermediate files we depend on, if necessary, 471 and see whether any of them is more recent than this file. */ 472 473 lastd = 0; 474 d = file->deps; 475 while (d != 0) 476 { 477 FILE_TIMESTAMP mtime; 478 int maybe_make; 479 int dontcare = 0; 480 481 check_renamed (d->file); 482 483 mtime = file_mtime (d->file); 484 check_renamed (d->file); 485 486 if (is_updating (d->file)) 487 { 488 error (NILF, _("Circular %s <- %s dependency dropped."), 489 file->name, d->file->name); 490 /* We cannot free D here because our the caller will still have 491 a reference to it when we were called recursively via 492 check_dep below. */ 493 if (lastd == 0) 494 file->deps = d->next; 495 else 496 lastd->next = d->next; 497 d = d->next; 498 continue; 499 } 500 501 d->file->parent = file; 502 maybe_make = must_make; 503 504 /* Inherit dontcare flag from our parent. */ 505 if (rebuilding_makefiles) 509 /* Update all non-intermediate files we depend on, if necessary, and see 510 whether any of them is more recent than this file. We need to walk our 511 deps, AND the deps of any also_make targets to ensure everything happens 512 in the correct order. */ 513 514 amake.file = file; 515 amake.next = file->also_make; 516 ad = &amake; 517 while (ad) 518 { 519 struct dep *lastd = 0; 520 521 /* Find the deps we're scanning */ 522 d = ad->file->deps; 523 ad = ad->next; 524 525 while (d) 506 526 { 507 dontcare = d->file->dontcare; 508 d->file->dontcare = file->dontcare; 527 FILE_TIMESTAMP mtime; 528 int maybe_make; 529 int dontcare = 0; 530 531 check_renamed (d->file); 532 533 mtime = file_mtime (d->file); 534 check_renamed (d->file); 535 536 if (is_updating (d->file)) 537 { 538 error (NILF, _("Circular %s <- %s dependency dropped."), 539 file->name, d->file->name); 540 /* We cannot free D here because our the caller will still have 541 a reference to it when we were called recursively via 542 check_dep below. */ 543 if (lastd == 0) 544 file->deps = d->next; 545 else 546 lastd->next = d->next; 547 d = d->next; 548 continue; 549 } 550 551 d->file->parent = file; 552 maybe_make = must_make; 553 554 /* Inherit dontcare flag from our parent. */ 555 if (rebuilding_makefiles) 556 { 557 dontcare = d->file->dontcare; 558 d->file->dontcare = file->dontcare; 559 } 560 561 dep_status |= check_dep (d->file, depth, this_mtime, &maybe_make); 562 563 /* Restore original dontcare flag. */ 564 if (rebuilding_makefiles) 565 d->file->dontcare = dontcare; 566 567 if (! d->ignore_mtime) 568 must_make = maybe_make; 569 570 check_renamed (d->file); 571 572 { 573 register struct file *f = d->file; 574 if (f->double_colon) 575 f = f->double_colon; 576 do 577 { 578 running |= (f->command_state == cs_running 579 || f->command_state == cs_deps_running); 580 f = f->prev; 581 } 582 while (f != 0); 583 } 584 585 if (dep_status != 0 && !keep_going_flag) 586 break; 587 588 if (!running) 589 /* The prereq is considered changed if the timestamp has changed while 590 it was built, OR it doesn't exist. */ 591 d->changed = ((file_mtime (d->file) != mtime) 592 || (mtime == NONEXISTENT_MTIME)); 593 594 lastd = d; 595 d = d->next; 509 596 } 510 511 512 dep_status |= check_dep (d->file, depth, this_mtime, &maybe_make);513 514 /* Restore original dontcare flag. */515 if (rebuilding_makefiles)516 d->file->dontcare = dontcare;517 518 if (! d->ignore_mtime)519 must_make = maybe_make;520 521 check_renamed (d->file);522 523 {524 register struct file *f = d->file;525 if (f->double_colon)526 f = f->double_colon;527 do528 {529 running |= (f->command_state == cs_running530 || f->command_state == cs_deps_running);531 f = f->prev;532 }533 while (f != 0);534 }535 536 if (dep_status != 0 && !keep_going_flag)537 break;538 539 if (!running)540 /* The prereq is considered changed if the timestamp has changed while541 it was built, OR it doesn't exist. */542 d->changed = ((file_mtime (d->file) != mtime)543 || (mtime == NONEXISTENT_MTIME));544 545 lastd = d;546 d = d->next;547 597 } 548 598 … … 600 650 601 651 finish_updating (file); 652 finish_updating (ofile); 602 653 603 654 DBF (DB_VERBOSE, _("Finished prerequisites of target file `%s'.\n")); … … 859 910 would have been updated. */ 860 911 861 if ( question_flag || just_print_flag || touch_flag)912 if ((question_flag || just_print_flag || touch_flag) && file->cmds) 862 913 { 863 914 for (i = file->cmds->ncommand_lines; i > 0; --i) … … 937 988 FILE_TIMESTAMP this_mtime, int *must_make_ptr) 938 989 { 990 struct file *ofile; 939 991 struct dep *d; 940 992 int dep_status = 0; … … 942 994 ++depth; 943 995 start_updating (file); 996 997 /* We might change file if we find a different one via vpath; 998 remember this one to turn off updating. */ 999 ofile = file; 944 1000 945 1001 if (file->phony || !file->intermediate) … … 987 1043 necessary, and see whether any of them is more recent than the 988 1044 file on whose behalf we are checking. */ 989 struct dep *l astd;1045 struct dep *ld; 990 1046 int deps_running = 0; 991 1047 992 /* Reset this target's state so that we check it fresh. It could be993 that it's already beenchecked as part of an order-only1048 /* If this target is not running, set it's state so that we check it 1049 fresh. It could be it was checked as part of an order-only 994 1050 prerequisite and so wasn't rebuilt then, but should be now. */ 995 set_command_state (file, cs_not_started); 996 997 lastd = 0; 1051 if (file->command_state != cs_running) 1052 set_command_state (file, cs_not_started); 1053 1054 ld = 0; 998 1055 d = file->deps; 999 1056 while (d != 0) … … 1005 1062 error (NILF, _("Circular %s <- %s dependency dropped."), 1006 1063 file->name, d->file->name); 1007 if (l astd == 0)1064 if (ld == 0) 1008 1065 { 1009 1066 file->deps = d->next; … … 1013 1070 else 1014 1071 { 1015 l astd->next = d->next;1072 ld->next = d->next; 1016 1073 free_dep (d); 1017 d = l astd->next;1074 d = ld->next; 1018 1075 } 1019 1076 continue; … … 1034 1091 deps_running = 1; 1035 1092 1036 l astd = d;1093 ld = d; 1037 1094 d = d->next; 1038 1095 } … … 1047 1104 1048 1105 finish_updating (file); 1106 finish_updating (ofile); 1107 1049 1108 return dep_status; 1050 1109 } … … 1230 1289 { 1231 1290 /* If name_mtime failed, search VPATH. */ 1232 const char *name = vpath_search (file->name, &mtime );1291 const char *name = vpath_search (file->name, &mtime, NULL, NULL); 1233 1292 if (name 1234 1293 /* Last resort, is it a library (-lxxx)? */ … … 1473 1532 }; 1474 1533 1475 static char *libpatterns = NULL; 1476 1477 const char *libname = lib+2; /* Name without the '-l'. */ 1534 const char *file = 0; 1535 char *libpatterns; 1478 1536 FILE_TIMESTAMP mtime; 1479 1537 … … 1482 1540 const char *p2; 1483 1541 unsigned int len; 1542 unsigned int liblen; 1543 1544 /* Information about the earliest (in the vpath sequence) match. */ 1545 unsigned int best_vpath, best_path; 1546 unsigned int std_dirs = 0; 1484 1547 1485 1548 char **dp; 1486 1549 1487 /* If we don't have libpatterns, get it. */ 1488 if (!libpatterns) 1489 { 1490 int save = warn_undefined_variables_flag; 1491 warn_undefined_variables_flag = 0; 1492 1493 libpatterns = xstrdup (variable_expand ("$(strip $(.LIBPATTERNS))")); 1494 1495 warn_undefined_variables_flag = save; 1496 } 1497 1498 /* Loop through all the patterns in .LIBPATTERNS, and search on each one. */ 1550 libpatterns = xstrdup (variable_expand ("$(.LIBPATTERNS)")); 1551 1552 /* Skip the '-l'. */ 1553 lib += 2; 1554 liblen = strlen (lib); 1555 1556 /* Loop through all the patterns in .LIBPATTERNS, and search on each one. 1557 To implement the linker-compatible behavior we have to search through 1558 all entries in .LIBPATTERNS and choose the "earliest" one. */ 1499 1559 p2 = libpatterns; 1500 1560 while ((p = find_next_token (&p2, &len)) != 0) … … 1505 1565 char *libbuf = variable_expand (""); 1506 1566 1507 /* Expand the pattern using LIB NAMEas a replacement. */1567 /* Expand the pattern using LIB as a replacement. */ 1508 1568 { 1509 1569 char c = p[len]; … … 1514 1574 if (!p3) 1515 1575 { 1516 /* Give a warning if there is no pattern, then remove the 1517 pattern so it's ignored next time. */ 1576 /* Give a warning if there is no pattern. */ 1518 1577 error (NILF, _(".LIBPATTERNS element `%s' is not a pattern"), p); 1519 for (; len; --len, ++p) 1520 *p = ' '; 1521 *p = c; 1578 p[len] = c; 1522 1579 continue; 1523 1580 } 1524 1581 p4 = variable_buffer_output (libbuf, p, p3-p); 1525 p4 = variable_buffer_output (p4, lib name, strlen (libname));1582 p4 = variable_buffer_output (p4, lib, liblen); 1526 1583 p4 = variable_buffer_output (p4, p3+1, len - (p3-p)); 1527 1584 p[len] = c; … … 1534 1591 if (mtime_ptr != 0) 1535 1592 *mtime_ptr = mtime; 1536 return strcache_add (libbuf); 1593 file = strcache_add (libbuf); 1594 /* This by definition will have the best index, so stop now. */ 1595 break; 1537 1596 } 1538 1597 … … 1540 1599 1541 1600 { 1542 const char *file = vpath_search (libbuf, mtime_ptr); 1543 if (file) 1544 return file; 1601 unsigned int vpath_index, path_index; 1602 const char* f = vpath_search (libbuf, mtime_ptr ? &mtime : NULL, 1603 &vpath_index, &path_index); 1604 if (f) 1605 { 1606 /* If we have a better match, record it. */ 1607 if (file == 0 || 1608 vpath_index < best_vpath || 1609 (vpath_index == best_vpath && path_index < best_path)) 1610 { 1611 file = f; 1612 best_vpath = vpath_index; 1613 best_path = path_index; 1614 1615 if (mtime_ptr != 0) 1616 *mtime_ptr = mtime; 1617 } 1618 } 1545 1619 } 1546 1620 … … 1548 1622 1549 1623 if (!buflen) 1550 { 1551 for (dp = dirs; *dp != 0; ++dp) 1552 { 1553 int l = strlen (*dp); 1554 if (l > libdir_maxlen) 1555 libdir_maxlen = l; 1556 } 1557 buflen = strlen (libbuf); 1558 buf = xmalloc(libdir_maxlen + buflen + 2); 1559 } 1624 { 1625 for (dp = dirs; *dp != 0; ++dp) 1626 { 1627 int l = strlen (*dp); 1628 if (l > libdir_maxlen) 1629 libdir_maxlen = l; 1630 std_dirs++; 1631 } 1632 buflen = strlen (libbuf); 1633 buf = xmalloc(libdir_maxlen + buflen + 2); 1634 } 1560 1635 else if (buflen < strlen (libbuf)) 1561 { 1562 buflen = strlen (libbuf); 1563 buf = xrealloc (buf, libdir_maxlen + buflen + 2); 1564 } 1565 1566 for (dp = dirs; *dp != 0; ++dp) 1567 { 1568 sprintf (buf, "%s/%s", *dp, libbuf); 1569 mtime = name_mtime (buf); 1570 if (mtime != NONEXISTENT_MTIME) 1571 { 1572 if (mtime_ptr != 0) 1573 *mtime_ptr = mtime; 1574 return strcache_add (buf); 1575 } 1576 } 1577 } 1578 1579 return 0; 1636 { 1637 buflen = strlen (libbuf); 1638 buf = xrealloc (buf, libdir_maxlen + buflen + 2); 1639 } 1640 1641 { 1642 /* Use the last std_dirs index for standard directories. This 1643 was it will always be greater than the VPATH index. */ 1644 unsigned int vpath_index = ~((unsigned int)0) - std_dirs; 1645 1646 for (dp = dirs; *dp != 0; ++dp) 1647 { 1648 sprintf (buf, "%s/%s", *dp, libbuf); 1649 mtime = name_mtime (buf); 1650 if (mtime != NONEXISTENT_MTIME) 1651 { 1652 if (file == 0 || vpath_index < best_vpath) 1653 { 1654 file = strcache_add (buf); 1655 best_vpath = vpath_index; 1656 1657 if (mtime_ptr != 0) 1658 *mtime_ptr = mtime; 1659 } 1660 } 1661 1662 vpath_index++; 1663 } 1664 } 1665 1666 } 1667 1668 free (libpatterns); 1669 return file; 1580 1670 } -
vendor/gnumake/current/remote-cstms.c
r1989 r2596 5 5 6 6 Copyright (C) 1988, 1989, 1990, 1991, 1992, 1993, 1994, 1995, 1996, 1997, 7 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007 Free Software8 Foundation, Inc.7 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 8 2010 Free Software Foundation, Inc. 9 9 This file is part of GNU Make. 10 10 -
vendor/gnumake/current/remote-stub.c
r1989 r2596 1 1 /* Template for the remote job exportation interface to GNU Make. 2 2 Copyright (C) 1988, 1989, 1990, 1991, 1992, 1993, 1994, 1995, 1996, 1997, 3 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007 Free Software4 Foundation, Inc.3 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 4 2010 Free Software Foundation, Inc. 5 5 This file is part of GNU Make. 6 6 -
vendor/gnumake/current/rule.c
r1989 r2596 1 1 /* Pattern and suffix rule internals for GNU Make. 2 2 Copyright (C) 1988, 1989, 1990, 1991, 1992, 1993, 1994, 1995, 1996, 1997, 3 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007 Free Software4 Foundation, Inc.3 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 4 2010 Free Software Foundation, Inc. 5 5 This file is part of GNU Make. 6 6 … … 97 97 for (dep = rule->deps; dep != 0; dep = dep->next) 98 98 { 99 unsigned int len = strlen (dep->name); 99 const char *dname = dep_name (dep); 100 unsigned int len = strlen (dname); 100 101 101 102 #ifdef VMS 102 const char *p = strrchr (dep->name, ']');103 const char *p = strrchr (dname, ']'); 103 104 const char *p2; 104 105 if (p == 0) 105 p = strrchr (d ep->name, ':');106 p2 = p != 0 ? strchr (d ep->name, '%') : 0;106 p = strrchr (dname, ':'); 107 p2 = p != 0 ? strchr (dname, '%') : 0; 107 108 #else 108 const char *p = strrchr (dep->name, '/');109 const char *p2 = p != 0 ? strchr (dep->name, '%') : 0;109 const char *p = strrchr (dname, '/'); 110 const char *p2 = p != 0 ? strchr (dname, '%') : 0; 110 111 #endif 111 112 ndeps++; 112 113 113 114 if (len > max_pattern_dep_length) … … 118 119 /* There is a slash before the % in the dep name. 119 120 Extract the directory name. */ 120 if (p == d ep->name)121 if (p == dname) 121 122 ++p; 122 if (p - d ep->name > namelen)123 if (p - dname > namelen) 123 124 { 124 namelen = p - d ep->name;125 namelen = p - dname; 125 126 name = xrealloc (name, namelen + 1); 126 127 } 127 memcpy (name, d ep->name, p - dep->name);128 name[p - d ep->name] = '\0';128 memcpy (name, dname, p - dname); 129 name[p - dname] = '\0'; 129 130 130 131 /* In the deps of an implicit rule the `changed' flag … … 380 381 381 382 ptr = p->dep; 382 r->deps = (struct dep *) multi_glob (parse_file_seq (&ptr, '\0', 383 sizeof (struct dep), 1), 384 sizeof (struct dep)); 383 r->deps = PARSE_FILE_SEQ (&ptr, struct dep, '\0', NULL, 0); 385 384 386 385 if (new_pattern_rule (r, 0)) … … 406 405 { 407 406 struct rule *next = rule->next; 408 struct dep *dep; 409 410 dep = rule->deps; 411 while (dep) 412 { 413 struct dep *t = dep->next; 414 free_dep (dep); 415 dep = t; 416 } 417 418 free (rule->targets); 419 free (rule->suffixes); 407 408 free_dep_chain (rule->deps); 409 410 /* MSVC erroneously warns without a cast here. */ 411 free ((void *)rule->targets); 412 free ((void *)rule->suffixes); 420 413 free (rule->lens); 421 414 … … 488 481 { 489 482 unsigned int i; 490 struct dep *d;491 483 492 484 for (i = 0; i < r->num; ++i) … … 498 490 putchar (':'); 499 491 500 for (d = r->deps; d != 0; d = d->next) 501 printf (" %s", dep_name (d)); 502 putchar ('\n'); 492 print_prereqs (r->deps); 503 493 504 494 if (r->cmds != 0) … … 547 537 makefiles and thus count_implicit_rule_limits wasn't called yet. */ 548 538 if (num_pattern_rules != 0) 549 fatal (NILF, _("BUG: num_pattern_rules wrong! %u != %u"),539 fatal (NILF, _("BUG: num_pattern_rules is wrong! %u != %u"), 550 540 num_pattern_rules, rules); 551 541 } -
vendor/gnumake/current/rule.h
r1989 r2596 1 1 /* Definitions for using pattern rules in GNU Make. 2 2 Copyright (C) 1988, 1989, 1990, 1991, 1992, 1993, 1994, 1995, 1996, 1997, 3 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007 Free Software4 Foundation, Inc.3 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 4 2010 Free Software Foundation, Inc. 5 5 This file is part of GNU Make. 6 6 -
vendor/gnumake/current/signame.c
r1989 r2596 1 1 /* Convert between signal names and numbers. 2 2 Copyright (C) 1990, 1991, 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999, 3 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007 Free Software Foundation, Inc. 3 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010 Free Software 4 Foundation, Inc. 4 5 This file is part of GNU Make. 5 6 … … 229 230 230 231 char * 231 strsignal (int sig nal)232 strsignal (int sig) 232 233 { 233 234 static char buf[] = "Signal 12345678901234567890"; … … 246 247 #endif 247 248 248 if (sig nal > 0 || signal< NSIG)249 return (char *) sys_siglist[sig nal];250 251 sprintf (buf, "Signal %d", sig nal);249 if (sig > 0 || sig < NSIG) 250 return (char *) sys_siglist[sig]; 251 252 sprintf (buf, "Signal %d", sig); 252 253 return buf; 253 254 } -
vendor/gnumake/current/strcache.c
-
Property svn:eol-style
set to
native
r1989 r2596 1 1 /* Constant string caching for GNU Make. 2 Copyright (C) 2006, 2007 Free Software Foundation, Inc.2 Copyright (C) 2006, 2007, 2008, 2009, 2010 Free Software Foundation, Inc. 3 3 This file is part of GNU Make. 4 4 -
Property svn:eol-style
set to
-
vendor/gnumake/current/subproc.bat
r1991 r2596 1 1 @echo off 2 2 rem Copyright (C) 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, 3 rem 2005, 2006, 2007 Free Software Foundation, Inc.3 rem 2005, 2006, 2007, 2008, 2009, 2010 Free Software Foundation, Inc. 4 4 rem This file is part of GNU Make. 5 5 rem -
vendor/gnumake/current/tests
- Property svn:ignore deleted
-
vendor/gnumake/current/tests/ChangeLog
r1989 r2596 1 2010-07-28 Paul Smith <psmith@gnu.org> 2 3 * scripts/targets/POSIX: Compatibility issues with Solaris (and 4 Tru64?); "false" returns different exit codes, and set -x shows 5 output with extra whitespace. Run the commands by hand first to 6 find out what the real shell would do, then compare what make does. 7 * scripts/variables/SHELL: Ditto. 8 9 2010-07-12 Paul Smith <psmith@gnu.org> 10 11 * test_driver.pl: Add a new $perl_name containing the path to Perl. 12 * run_make_tests.pl (run_make_test): Replace the special string 13 #PERL# in a makefile etc. with the path the Perl executable so 14 makefiles can use it. 15 16 * scripts/targets/ONESHELL: Add a new set of regression tests for 17 the .ONESHELL feature. 18 19 2010-07-06 Paul Smith <psmith@gnu.org> 20 21 * scripts/variables/SHELL: Test the new .SHELLFLAGS variable. 22 23 * scripts/targets/POSIX: New file. Test the .POSIX special target. 24 Verify that enabling .POSIX changes the shell flags to set -e. 25 26 2010-07-01 Paul Smith <psmith@gnu.org> 27 28 * scripts/features/recursion: Add a space to separate command-line 29 args. Fixes Savannah bug #29968. 30 31 2009-11-12 Boris Kolpackov <boris@codesynthesis.com> 32 33 * scripts/features/vpath3: Test for the new library search 34 behavior. 35 36 2009-10-06 Boris Kolpackov <boris@codesynthesis.com> 37 38 * scripts/features/se_explicit: Enable the test for now fixed 39 Savannah bug 25780. 40 41 2009-10-06 Boris Kolpackov <boris@codesynthesis.com> 42 43 * scripts/variables/undefine: Tests for the new undefine feature. 44 45 2009-10-03 Paul Smith <psmith@gnu.org> 46 47 * scripts/features/parallelism: Test for open Savannah bug #26846. 48 49 * scripts/variables/MAKE: Rewrite for new run_make_test() format. 50 51 * scripts/variables/MAKEFLAGS: Created. 52 Add test for Savannah bug #2216 (still open). 53 54 * scripts/features/include: Test for Savannah bug #102 (still open). 55 56 2009-09-30 Boris Kolpackov <boris@codesynthesis.com> 57 58 * scripts/features/include: Add diagnostics issuing tests for 59 cases where targets have been updated and failed with the 60 dontcare flag. Savannah bugs #15110, #25493, #12686, #17740. 61 62 2009-09-28 Paul Smith <psmith@gnu.org> 63 64 * scripts/functions/shell: Add regression test for Savannah bug 65 #20513 (still open). 66 67 * scripts/features/se_explicit: Add regression tests for Savannah 68 bug #25780 (still open). 69 70 * run_make_tests.pl (valid_option): Add a new flag, -all([-_]?tests)? 71 that runs tests we know will fail. This allows us to add 72 regression tests to the test suite for bugs that haven't been 73 fixed yet. 74 75 2009-09-28 Boris Kolpackov <boris@codesynthesis.com> 76 77 * scripts/features/patspecific_vars: Add a test for the shortest 78 stem first order. 79 80 * scripts/features/patternrules: Add a test for the shortest stem 81 first order. 82 83 2009-09-24 Paul Smith <psmith@gnu.org> 84 85 * scripts/features/se_implicit: Add a test for order-only 86 secondary expansion prerequisites. 87 88 2009-09-23 Paul Smith <psmith@gnu.org> 89 90 * scripts/features/patternrules: Test that we can remove pattern 91 rules, both single and multiple prerequisites. Savannah bug #18622. 92 93 * scripts/features/echoing: Rework for run_make_test(). 94 95 2009-06-14 Paul Smith <psmith@gnu.org> 96 97 * scripts/features/vpath: Verify we don't get bogus circular 98 dependency warnings if we choose a different file via vpath during 99 update. Savannah bug #13529. 100 101 2009-06-13 Paul Smith <psmith@gnu.org> 102 103 * scripts/variables/MAKEFILES: Verify that MAKEFILES included 104 files (and files included by them) don't set the default goal. 105 Savannah bug #13401. 106 107 * scripts/functions/wildcard: Test that wildcards with 108 non-existent glob matchers return empty. 109 110 2009-06-09 Paul Smith <psmith@gnu.org> 111 112 * scripts/options/dash-B: Test the $? works correctly with -B. 113 Savannah bug #17825. 114 115 * scripts/features/patternrules: Test that dependencies of 116 "also_make" targets are created properly. Savannah bug #19108. 117 118 * test_driver.pl (compare_output): Create a "run" file for failed 119 tests containing the command that was run. 120 (get_runfile): New function. 121 122 * run_make_tests.pl (valid_option): Enhanced support for valgrind: 123 allow memcheck and massif tools. 124 125 * scripts/features/patternrules: Have to comment out a line in the 126 first test due to backing out a change that broke the implicit 127 rule search algorithm. Savannah bug #17752. 128 * scripts/misc/general4: Remove a test that is redundant with 129 patternrules. 130 131 * scripts/features/parallelism: Add a test for re-exec with 132 jobserver master override. Savannah bug #18124. 133 134 2009-06-08 Paul Smith <psmith@gnu.org> 135 136 * scripts/features/targetvars: Add a test for continued target 137 vars after a semicolon. Savannah bug #17521. 138 139 2009-06-07 Paul Smith <psmith@gnu.org> 140 141 * scripts/features/se_explicit: Make sure we catch defining 142 prereqs during snap_deps(). Savannah bug #24622. 143 144 * scripts/variables/automatic: Check prereq ordering when the 145 target with the recipe has no prereqs. Savannah bug #21198. 146 147 * scripts/variables/LIBPATTERNS: Add a new set of test for 148 $(.LIBPATTERNS) (previously untested!) 149 150 2009-06-04 Paul Smith <psmith@gnu.org> 151 152 * scripts/variables/SHELL: The export target-specific SHELL test 153 has an incorrect known-good-value. 154 155 * scripts/misc/general4: Check for whitespace (ffeed, vtab, etc.) 156 157 * scripts/features/se_explicit: Add tests for Savannah bug #24588. 158 159 2009-05-31 Paul Smith <psmith@gnu.org> 160 161 * scripts/variables/DEFAULT_GOAL: Add tests for Savannah bug #25697. 162 163 * scripts/features/targetvars: Add tests of overrides for Savannah 164 bug #26207. 165 * scripts/features/patspecific_vars: Ditto. 166 167 * scripts/features/patternrules: Add a test for Savannah bug #26593. 168 169 2009-05-30 Paul Smith <psmith@gnu.org> 170 171 * scripts/variables/flavors: Update with new variable flavor tests. 172 * scripts/variables/define: Create a new set of tests for 173 define/endef and move those aspects of the flavors suite here. 174 175 2009-05-25 Paul Smith <psmith@gnu.org> 176 177 * scripts/features/targetvars: Ditto. 178 179 * scripts/features/export: Test new variable parsing abilities. 180 181 2009-02-23 Ramon Garcia <ramon.garcia.f@gmail.com> 182 183 * scripts/variables/private: Create a new suite of tests for 'private'. 184 1 185 2007-11-04 Paul Smith <psmith@gnu.org> 2 186 … … 881 1065 882 1066 Copyright (C) 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 883 2002, 2003, 2004, 2005, 2006, 2007 Free Software Foundation, Inc.1067 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009 Free Software Foundation, Inc. 884 1068 This file is part of GNU Make. 885 1069 -
vendor/gnumake/current/tests/NEWS
r1989 r2596 165 165 ------------------------------------------------------------------------------- 166 166 Copyright (C) 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 167 2002, 2003, 2004, 2005, 2006, 2007 Free Software Foundation, Inc.167 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009 Free Software Foundation, Inc. 168 168 This file is part of GNU Make. 169 169 -
vendor/gnumake/current/tests/README
r1989 r2596 9 9 ----------------------------------------------------------------------------- 10 10 Copyright (C) 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 11 2002, 2003, 2004, 2005, 2006, 2007 Free Software Foundation, Inc.11 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009 Free Software Foundation, Inc. 12 12 This file is part of GNU Make. 13 13 -
vendor/gnumake/current/tests/mkshadow
-
Property svn:eol-style
changed from
native
toLF
r1989 r2596 5 5 # 6 6 # Copyright (C) 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 7 # 2002, 2003, 2004, 2005, 2006, 2007 Free Software Foundation, Inc. 7 # 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010 Free Software 8 # Foundation, Inc. 8 9 # This file is part of GNU Make. 9 10 # -
Property svn:eol-style
changed from
-
vendor/gnumake/current/tests/run_make_tests
-
Property svn:eol-style
changed from
native
toLF
-
Property svn:eol-style
changed from
-
vendor/gnumake/current/tests/run_make_tests.pl
r1989 r2596 13 13 14 14 # Copyright (C) 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 15 # 2002, 2003, 2004, 2005, 2006, 2007 Free Software Foundation, Inc. 15 # 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010 Free Software 16 # Foundation, Inc. 16 17 # This file is part of GNU Make. 17 18 # … … 29 30 # this program. If not, see <http://www.gnu.org/licenses/>. 30 31 32 31 33 $valgrind = 0; # invoke make with valgrind 32 $valgrind_args = '--num-callers=15 --tool=memcheck --leak-check=full'; 34 $valgrind_args = ''; 35 $memcheck_args = '--num-callers=15 --tool=memcheck --leak-check=full'; 36 $massif_args = '--num-callers=15 --tool=massif --alloc-fn=xmalloc --alloc-fn=xcalloc --alloc-fn=xrealloc --alloc-fn=xstrdup --alloc-fn=xstrndup'; 33 37 $pure_log = undef; 38 39 $command_string = ''; 40 41 $all_tests = 0; 34 42 35 43 require "test_driver.pl"; … … 44 52 local($option) = @_; 45 53 46 if ($option =~ /^-make([-_]?path)?$/) 47 { 48 $make_path = shift @argv; 49 if (!-f $make_path) 50 { 51 print "$option $make_path: Not found.\n"; 52 exit 0; 53 } 54 return 1; 55 } 56 57 if ($option =~ /^-valgrind$/i) { 58 $valgrind = 1; 59 return 1; 54 if ($option =~ /^-make([-_]?path)?$/i) { 55 $make_path = shift @argv; 56 if (!-f $make_path) { 57 print "$option $make_path: Not found.\n"; 58 exit 0; 59 } 60 return 1; 61 } 62 63 if ($option =~ /^-all([-_]?tests)?$/i) { 64 $all_tests = 1; 65 return 1; 66 } 67 68 if ($option =~ /^-(valgrind|memcheck)$/i) { 69 $valgrind = 1; 70 $valgrind_args = $memcheck_args; 71 return 1; 72 } 73 74 if ($option =~ /^-massif$/i) { 75 $valgrind = 1; 76 $valgrind_args = $massif_args; 77 return 1; 60 78 } 61 79 … … 106 124 $makestring =~ s/#MAKEPATH#/$mkpath/g; 107 125 $makestring =~ s/#MAKE#/$make_name/g; 126 $makestring =~ s/#PERL#/$perl_name/g; 108 127 $makestring =~ s/#PWD#/$pwd/g; 109 128 … … 120 139 $answer =~ s/#MAKEPATH#/$mkpath/g; 121 140 $answer =~ s/#MAKE#/$make_name/g; 141 $answer =~ s/#PERL#/$perl_name/g; 122 142 $answer =~ s/#PWD#/$pwd/g; 123 143 … … 149 169 } 150 170 171 $command_string = "$command\n"; 172 151 173 if ($valgrind) { 152 174 print VALGRIND "\n\nExecuting: $command\n"; … … 156 178 { 157 179 my $old_timeout = $test_timeout; 158 $test_timeout = $timeout if $timeout; 180 $timeout and $test_timeout = $timeout; 181 182 # If valgrind is enabled, turn off the timeout check 183 $valgrind and $test_timeout = 0; 159 184 160 185 $code = &run_command_with_output($logname,$command); … … 184 209 print "Error running $make_path (expected $expected_code; got $code): $command\n"; 185 210 $test_passed = 0; 211 $runf = &get_runfile; 212 &create_file (&get_runfile, $command_string); 186 213 # If it's a SIGINT, stop here 187 214 if ($code & 127) { 188 215 print STDERR "\nCaught signal ".($code & 127)."!\n"; 189 exit($code);216 ($code & 127) == 2 and exit($code); 190 217 } 191 218 return 0; … … 196 223 } 197 224 198 1;225 return 1; 199 226 } 200 227 … … 202 229 { 203 230 &print_standard_usage ("run_make_tests", 204 "[-make_path make_pathname] [- valgrind]",);231 "[-make_path make_pathname] [-memcheck] [-massif]",); 205 232 } 206 233 207 234 sub print_help 208 235 { 209 &print_standard_help ("-make_path", 210 "\tYou may specify the pathname of the copy of make to run."); 236 &print_standard_help ( 237 "-make_path", 238 "\tYou may specify the pathname of the copy of make to run.", 239 "-valgrind", 240 "-memcheck", 241 "\tRun the test suite under valgrind's memcheck tool.", 242 "\tChange the default valgrind args with the VALGRIND_ARGS env var.", 243 "-massif", 244 "\tRun the test suite under valgrind's massif toool.", 245 "\tChange the default valgrind args with the VALGRIND_ARGS env var." 246 ); 211 247 } 212 248 … … 335 371 336 372 if ($valgrind) { 373 my $args = $valgrind_args; 337 374 open(VALGRIND, "> valgrind.out") 338 375 || die "Cannot open valgrind.out: $!\n"; 339 376 # -q --leak-check=yes 340 exists $ENV{VALGRIND_ARGS} and $ valgrind_args = $ENV{VALGRIND_ARGS};341 $make_path = "valgrind --log-fd=".fileno(VALGRIND)." $ valgrind_args $make_path";377 exists $ENV{VALGRIND_ARGS} and $args = $ENV{VALGRIND_ARGS}; 378 $make_path = "valgrind --log-fd=".fileno(VALGRIND)." $args $make_path"; 342 379 # F_SETFD is 2 343 380 fcntl(VALGRIND, 2, 0) or die "fcntl(setfd) failed: $!\n"; -
vendor/gnumake/current/tests/scripts/features/comments
-
Property svn:eol-style
changed from
native
toLF
-
Property svn:eol-style
changed from
-
vendor/gnumake/current/tests/scripts/features/conditionals
-
Property svn:eol-style
changed from
native
toLF
-
Property svn:eol-style
changed from
-
vendor/gnumake/current/tests/scripts/features/default_names
-
Property svn:eol-style
changed from
native
toLF
-
Property svn:eol-style
changed from
-
vendor/gnumake/current/tests/scripts/features/double_colon
-
Property svn:eol-style
changed from
native
toLF
-
Property svn:eol-style
changed from
-
vendor/gnumake/current/tests/scripts/features/echoing
-
Property svn:eol-style
changed from
native
toLF
r280 r2596 1 $description = "The following test creates a makefile to test command \n" 2 ."echoing. It tests that when a command line starts with \n" 3 ."a '\@', the echoing of that line is suppressed. It also \n" 4 ."tests the -n option which tells make to ONLY echo the \n" 5 ."commands and no execution happens. In this case, even \n" 6 ."the commands with '\@' are printed. Lastly, it tests the \n" 7 ."-s flag which tells make to prevent all echoing, as if \n" 8 ."all commands started with a '\@'."; 1 # -*-perl-*- 2 $description = "The following test creates a makefile to test command 3 echoing. It tests that when a command line starts with 4 a '\@', the echoing of that line is suppressed. It also 5 tests the -n option which tells make to ONLY echo the 6 commands and no execution happens. In this case, even 7 the commands with '\@' are printed. Lastly, it tests the 8 -s flag which tells make to prevent all echoing, as if 9 all commands started with a '\@'."; 9 10 10 $details = "This test is similar to the 'clean' test except that a '\@' has \n"11 ."been placed in front of the delete command line. Four tests \n" 12 ."are run here. First, make is run normally and the first echo\n" 13 ."command should be executed. In this case there is no '\@' so \n" 14 ."we should expect make to display the command AND display the \n" 15 ."echoed message. Secondly, make is run with the clean target, \n" 16 ."but since there is a '\@' at the beginning of the command, we\n" 17 ."expect no output; just the deletion of a file which we check \n" 18 ."for. Third, we give the clean target again except this time\n" 19 ."we give make the -n option. We now expect the command to be \n" 20 ."displayed but not to be executed. In this case we need only \n" 21 ."to check the output since an error message would be displayed\n" 22 ."if it actually tried to run the delete command again and the \n" 23 ."file didn't exist. Lastly, we run the first test again with \n" 24 ."the -s option and check that make did not echo the echo \n" 25 ."command before printing the message.";11 $details = "This test is similar to the 'clean' test except that a '\@' has 12 been placed in front of the delete command line. Four tests 13 are run here. First, make is run normally and the first echo 14 command should be executed. In this case there is no '\@' so 15 we should expect make to display the command AND display the 16 echoed message. Secondly, make is run with the clean target, 17 but since there is a '\@' at the beginning of the command, we 18 expect no output; just the deletion of a file which we check 19 for. Third, we give the clean target again except this time 20 we give make the -n option. We now expect the command to be 21 displayed but not to be executed. In this case we need only 22 to check the output since an error message would be displayed 23 if it actually tried to run the delete command again and the 24 file didn't exist. Lastly, we run the first test again with 25 the -s option and check that make did not echo the echo 26 command before printing the message.\n"; 26 27 27 28 $example = "EXAMPLE_FILE"; 28 29 29 open(MAKEFILE,"> $makefile"); 30 31 # The Contents of the MAKEFILE ... 32 33 print MAKEFILE "all: \n"; 34 print MAKEFILE "\techo This makefile did not clean the dir... good\n"; 35 print MAKEFILE "clean: \n"; 36 print MAKEFILE "\t\@$delete_command $example\n"; 37 38 # END of Contents of MAKEFILE 39 40 close(MAKEFILE); 41 42 &touch($example); 30 touch($example); 43 31 44 32 # TEST #1 45 33 # ------- 46 34 47 &run_make_with_options($makefile,"",&get_logfile,0); 48 $answer = "echo This makefile did not clean the dir... good\n" 49 ."This makefile did not clean the dir... good\n"; 50 &compare_output($answer,&get_logfile(1)); 51 35 run_make_test(" 36 all: 37 \techo This makefile did not clean the dir... good 38 clean: 39 \t\@$delete_command $example\n", 40 '', 'echo This makefile did not clean the dir... good 41 This makefile did not clean the dir... good'); 52 42 53 43 # TEST #2 54 44 # ------- 55 45 56 &run_make_with_options($makefile,"clean",&get_logfile,0);46 run_make_test(undef, 'clean', ''); 57 47 if (-f $example) { 58 48 $test_passed = 0; 49 unlink($example); 59 50 } 60 &compare_output('',&get_logfile(1));61 51 62 52 # TEST #3 63 53 # ------- 64 54 65 &run_make_with_options($makefile,"-n clean",&get_logfile,0); 66 $answer = "$delete_command $example\n"; 67 &compare_output($answer,&get_logfile(1)); 55 run_make_test(undef, '-n clean', "$delete_command $example\n"); 68 56 69 57 … … 71 59 # ------- 72 60 73 &run_make_with_options($makefile,"-s",&get_logfile,0); 74 $answer = "This makefile did not clean the dir... good\n"; 75 &compare_output($answer,&get_logfile(1)); 61 run_make_test(undef, '-s', "This makefile did not clean the dir... good\n"); 76 62 77 63 78 64 1; 79 80 81 82 83 84 85 86 87 -
Property svn:eol-style
changed from
-
vendor/gnumake/current/tests/scripts/features/errors
-
Property svn:eol-style
changed from
native
toLF
-
Property svn:eol-style
changed from
-
vendor/gnumake/current/tests/scripts/features/escape
-
Property svn:eol-style
changed from
native
toLF
-
Property svn:eol-style
changed from
-
vendor/gnumake/current/tests/scripts/features/export
-
Property svn:eol-style
changed from
native
toLF
r501 r2596 7 7 # about that here. 8 8 9 open(MAKEFILE,"> $makefile"); 10 11 # The Contents of the MAKEFILE ... 12 13 print MAKEFILE <<'EOMAKE'; 14 9 &run_make_test(' 15 10 FOO = foo 16 11 BAR = bar … … 41 36 @echo "FOO=$(FOO) BAR=$(BAR) BAZ=$(BAZ) BOZ=$(BOZ) BITZ=$(BITZ) BOTZ=$(BOTZ)" 42 37 @echo "FOO=$$FOO BAR=$$BAR BAZ=$$BAZ BOZ=$$BOZ BITZ=$$BITZ BOTZ=$$BOTZ" 43 44 EOMAKE 45 46 close(MAKEFILE); 47 48 # TEST 0: basics 49 50 &run_make_with_options($makefile,"",&get_logfile,0); 51 52 $answer = "FOO=foo BAR=bar BAZ=baz BOZ=boz BITZ=bitz BOTZ=botz 53 FOO= BAR= BAZ=baz BOZ=boz BITZ=bitz BOTZ=\n"; 54 55 &compare_output($answer,&get_logfile(1)); 38 ', 39 '', "FOO=foo BAR=bar BAZ=baz BOZ=boz BITZ=bitz BOTZ=botz 40 FOO= BAR= BAZ=baz BOZ=boz BITZ=bitz BOTZ=\n"); 56 41 57 42 # TEST 1: make sure vars inherited from the parent are exported … … 59 44 $extraENV{FOO} = 1; 60 45 61 &run_make_with_options($makefile,"",&get_logfile,0); 62 63 $answer = "FOO=foo BAR=bar BAZ=baz BOZ=boz BITZ=bitz BOTZ=botz 64 FOO=foo BAR= BAZ=baz BOZ=boz BITZ=bitz BOTZ=\n"; 65 66 &compare_output($answer,&get_logfile(1)); 46 &run_make_test(undef, '', "FOO=foo BAR=bar BAZ=baz BOZ=boz BITZ=bitz BOTZ=botz 47 FOO=foo BAR= BAZ=baz BOZ=boz BITZ=bitz BOTZ=\n"); 67 48 68 49 # TEST 2: global export. Explicit unexport takes precedence. 69 50 70 &run_make_with_options($makefile,"EXPORT_ALL=1",&get_logfile,0); 71 72 $answer = "FOO=foo BAR=bar BAZ=baz BOZ=boz BITZ=bitz BOTZ=botz 73 FOO=foo BAR=bar BAZ=baz BOZ=boz BITZ=bitz BOTZ=\n"; 74 75 &compare_output($answer,&get_logfile(1)); 51 run_make_test(undef, "EXPORT_ALL=1" , 52 "FOO=foo BAR=bar BAZ=baz BOZ=boz BITZ=bitz BOTZ=botz 53 FOO=foo BAR=bar BAZ=baz BOZ=boz BITZ=bitz BOTZ=\n"); 76 54 77 55 # TEST 3: global unexport. Explicit export takes precedence. 78 56 79 &run_make_with_options($makefile,"UNEXPORT_ALL=1",&get_logfile,0); 80 81 $answer = "FOO=foo BAR=bar BAZ=baz BOZ=boz BITZ=bitz BOTZ=botz 82 FOO= BAR= BAZ=baz BOZ=boz BITZ=bitz BOTZ=\n"; 83 84 &compare_output($answer,&get_logfile(1)); 57 &run_make_test(undef, "UNEXPORT_ALL=1", 58 "FOO=foo BAR=bar BAZ=baz BOZ=boz BITZ=bitz BOTZ=botz 59 FOO= BAR= BAZ=baz BOZ=boz BITZ=bitz BOTZ=\n"); 85 60 86 61 # TEST 4: both: in the above makefile the unexport comes last so that rules. 87 62 88 &run_make_with_options($makefile,"EXPORT_ALL=1 UNEXPORT_ALL=1",&get_logfile,0); 89 90 $answer = "FOO=foo BAR=bar BAZ=baz BOZ=boz BITZ=bitz BOTZ=botz 91 FOO= BAR= BAZ=baz BOZ=boz BITZ=bitz BOTZ=\n"; 92 93 &compare_output($answer,&get_logfile(1)); 63 &run_make_test(undef, "EXPORT_ALL=1 UNEXPORT_ALL=1", 64 "FOO=foo BAR=bar BAZ=baz BOZ=boz BITZ=bitz BOTZ=botz 65 FOO= BAR= BAZ=baz BOZ=boz BITZ=bitz BOTZ=\n"); 94 66 95 67 # TEST 5: test the pseudo target. 96 68 97 &run_make_with_options($makefile,"EXPORT_ALL_PSEUDO=1",&get_logfile,0); 98 99 $answer = "FOO=foo BAR=bar BAZ=baz BOZ=boz BITZ=bitz BOTZ=botz 100 FOO=foo BAR=bar BAZ=baz BOZ=boz BITZ=bitz BOTZ=\n"; 101 102 &compare_output($answer,&get_logfile(1)); 103 69 &run_make_test(undef, "EXPORT_ALL_PSEUDO=1", 70 "FOO=foo BAR=bar BAZ=baz BOZ=boz BITZ=bitz BOTZ=botz 71 FOO=foo BAR=bar BAZ=baz BOZ=boz BITZ=bitz BOTZ=\n"); 104 72 105 73 # TEST 6: Test the expansion of variables inside export 106 74 107 $makefile2 = &get_tmpfile; 108 109 open(MAKEFILE, "> $makefile2"); 110 111 print MAKEFILE <<'EOF'; 112 75 &run_make_test(' 113 76 foo = f-ok 114 77 bar = b-ok … … 126 89 @echo foo=$(foo) bar=$(bar) 127 90 @echo foo=$$foo bar=$$bar 128 129 EOF 130 131 close(MAKEFILE); 132 133 &run_make_with_options($makefile2,"",&get_logfile,0); 134 $answer = "foo=f-ok bar=b-ok\nfoo=f-ok bar=b-ok\n"; 135 &compare_output($answer,&get_logfile(1)); 136 91 ', 92 "", "foo=f-ok bar=b-ok\nfoo=f-ok bar=b-ok\n"); 137 93 138 94 # TEST 7: Test the expansion of variables inside unexport 139 95 140 $makefile3 = &get_tmpfile; 141 142 open(MAKEFILE, "> $makefile3"); 143 144 print MAKEFILE <<'EOF'; 145 96 &run_make_test(' 146 97 foo = f-ok 147 98 bar = b-ok … … 161 112 @echo foo=$(foo) bar=$(bar) 162 113 @echo foo=$$foo bar=$$bar 163 164 EOF 165 166 close(MAKEFILE); 167 168 &run_make_with_options($makefile3,"",&get_logfile,0); 169 $answer = "foo=f-ok bar=b-ok\nfoo= bar=\n"; 170 &compare_output($answer,&get_logfile(1)); 171 114 ', 115 '', "foo=f-ok bar=b-ok\nfoo= bar=\n"); 172 116 173 117 # TEST 7: Test exporting multiple variables on the same line 174 118 175 $makefile4 = &get_tmpfile; 176 177 open(MAKEFILE, "> $makefile4"); 178 179 print MAKEFILE <<'EOF'; 180 119 &run_make_test(' 181 120 A = a 182 121 B = b … … 197 136 198 137 all: ; @echo A=$$A B=$$B C=$$C D=$$D E=$$E F=$$F G=$$G H=$$H I=$$I J=$$J 199 EOF 200 201 close(MAKEFILE); 202 203 &run_make_with_options($makefile4,"",&get_logfile,0); 204 $answer = "A=a B=b C=c D=d E=e F=f G=g H=h I=i J=j\n"; 205 &compare_output($answer,&get_logfile(1)); 206 138 ', 139 '', "A=a B=b C=c D=d E=e F=f G=g H=h I=i J=j\n"); 207 140 208 141 # TEST 8: Test unexporting multiple variables on the same line 209 142 210 $makefile5 = &get_tmpfile;143 @extraENV{qw(A B C D E F G H I J)} = qw(1 2 3 4 5 6 7 8 9 10); 211 144 212 open(MAKEFILE, "> $makefile5"); 213 214 print MAKEFILE <<'EOF'; 215 145 &run_make_test(' 216 146 A = a 217 147 B = b … … 232 162 233 163 all: ; @echo A=$$A B=$$B C=$$C D=$$D E=$$E F=$$F G=$$G H=$$H I=$$I J=$$J 234 EOF 164 ', 165 '', "A= B= C= D= E= F= G= H= I= J=\n"); 235 166 236 close(MAKEFILE); 167 # TEST 9: Check setting a variable named "export" 237 168 238 @extraENV{qw(A B C D E F G H I J)} = qw(1 2 3 4 5 6 7 8 9 10); 169 &run_make_test(' 170 export = 123 171 export export 172 export export = 456 173 a: ; @echo "\$$(export)=$(export) / \$$export=$$export" 174 ', 175 '', "\$(export)=456 / \$export=456\n"); 239 176 240 &run_make_with_options($makefile5,"",&get_logfile,0); 241 $answer = "A= B= C= D= E= F= G= H= I= J=\n"; 242 &compare_output($answer,&get_logfile(1)); 177 # TEST 9: Check "export" as a target 243 178 179 &run_make_test(' 180 a: export 181 export: ; @echo "$@" 182 ', 183 '', "export\n"); 244 184 245 185 # This tells the test driver that the perl test script executed properly. -
Property svn:eol-style
changed from
-
vendor/gnumake/current/tests/scripts/features/include
-
Property svn:eol-style
changed from
native
toLF
r501 r2596 91 91 ', '', ''); 92 92 93 1;94 95 93 96 94 # Make sure that we don't die when the command fails but we dontcare. … … 118 116 sinclude', '', ''); 119 117 118 119 # Test that the diagnostics is issued even if the target has been 120 # tried before with the dontcare flag (direct dependency case). 121 # 122 run_make_test(' 123 -include foo 124 125 all: bar 126 127 foo: baz 128 bar: baz 129 ', 130 '', 131 "#MAKE#: *** No rule to make target `baz', needed by `bar'. Stop.\n", 132 512); 133 134 # Test that the diagnostics is issued even if the target has been 135 # tried before with the dontcare flag (indirect dependency case). 136 # 137 run_make_test(' 138 -include foo 139 140 all: bar 141 142 foo: baz 143 bar: baz 144 baz: end 145 ', 146 '', 147 "#MAKE#: *** No rule to make target `end', needed by `baz'. Stop.\n", 148 512); 149 150 # Test that the diagnostics is issued even if the target has been 151 # tried before with the dontcare flag (include/-include case). 152 # 153 run_make_test(' 154 include bar 155 -include foo 156 157 all: 158 159 foo: baz 160 bar: baz 161 baz: end 162 ', 163 '', 164 "#MAKEFILE#:2: bar: No such file or directory 165 #MAKE#: *** No rule to make target `end', needed by `baz'. Stop.\n", 166 512); 167 168 if ($all_tests) { 169 # Test that include of a rebuild-able file doesn't show a warning 170 # Savannah bug #102 171 run_make_test(q! 172 include foo 173 foo: ; @echo foo = bar > $@ 174 !, 175 '', "#MAKE#: `foo' is up to date.\n"); 176 rmfiles('foo'); 177 } 178 120 179 1; -
Property svn:eol-style
changed from
-
vendor/gnumake/current/tests/scripts/features/mult_rules
-
Property svn:eol-style
changed from
native
toLF
-
Property svn:eol-style
changed from
-
vendor/gnumake/current/tests/scripts/features/mult_targets
-
Property svn:eol-style
changed from
native
toLF
-
Property svn:eol-style
changed from
-
vendor/gnumake/current/tests/scripts/features/order_only
-
Property svn:eol-style
changed from
native
toLF
-
Property svn:eol-style
changed from
-
vendor/gnumake/current/tests/scripts/features/override
-
Property svn:eol-style
changed from
native
toLF
r53 r2596 1 $description = "The following test creates a makefile to ..."; 1 # -*-perl-*- 2 3 $description = "Test the override directive on variable assignments."; 2 4 3 5 $details = ""; 4 6 5 open(MAKEFILE,"> $makefile"); 7 # TEST 0: Basic override 6 8 7 # The Contents of the MAKEFILE ... 9 run_make_test(' 10 X = start 11 override recur = $(X) 12 override simple := $(X) 13 X = end 14 all: ; @echo "$(recur) $(simple)" 15 ', 16 'recur=I simple=J', "end start\n"); 8 17 9 print MAKEFILE "override define foo\n" 10 ."\@echo First comes the definition.\n" 11 ."\@echo Then comes the override.\n" 12 ."endef\n" 13 ."all: \n" 14 ."\t\$(foo)\n"; 18 # TEST 1: Override with append 15 19 16 # END of Contents of MAKEFILE 20 run_make_test(' 21 X += X1 22 override X += X2 23 override Y += Y1 24 Y += Y2 25 all: ; @echo "$(X) $(Y)" 26 ', 27 '', "X1 X2 Y1\n"); 17 28 18 close(MAKEFILE); 29 # TEST 2: Override with append to the command line 19 30 20 &run_make_with_options($makefile,"foo=Hello",&get_logfile);31 run_make_test(undef, 'X=C Y=C', "C X2 C Y1\n"); 21 32 22 # Create the answer to what should be produced by this Makefile 23 $answer = "First comes the definition.\n" 24 ."Then comes the override.\n"; 33 # Test override of define/endef 25 34 26 &compare_output($answer,&get_logfile(1)); 35 run_make_test(' 36 override define foo 37 @echo First comes the definition. 38 @echo Then comes the override. 39 endef 40 all: ; $(foo) 41 ', 42 'foo=Hello', "First comes the definition.\nThen comes the override.\n"); 43 27 44 28 45 1; 29 30 31 32 33 34 -
Property svn:eol-style
changed from
-
vendor/gnumake/current/tests/scripts/features/parallelism
-
Property svn:eol-style
changed from
native
toLF
r1989 r2596 44 44 "ONE.inc\nTHREE.inc\nTWO.inc\nONE\nTHREE\nTWO\nsuccess\n"); 45 45 46 unlink('1.inc', '2.inc');46 rmfiles(qw(1.inc 2.inc)); 47 47 48 48 … … 63 63 "ONE.inc\nTHREE.inc\nTWO.inc\nONE\nTHREE\nTWO\nsuccess\n"); 64 64 65 unlink('1.inc', '2.inc');65 rmfiles(qw(1.inc 2.inc)); 66 66 67 67 # Grant Taylor reports a problem where tokens can be lost (not written back … … 139 139 .PHONY: phony 140 140 phony: ; : phony', '-rR -j', ': phony'); 141 unlink('target'); 142 141 rmfiles('target'); 142 143 # TEST #10: Don't put --jobserver-fds into a re-exec'd MAKEFLAGS. 144 # We can't test this directly because there's no way a makefile can 145 # show the value of MAKEFLAGS we were re-exec'd with. We can intuit it 146 # by looking for "disabling jobserver mode" warnings; we should only 147 # get one from the original invocation and none from the re-exec. 148 # See Savannah bug #18124 149 150 run_make_test(q! 151 -include inc.mk 152 recur: 153 # @echo 'MAKEFLAGS = $(MAKEFLAGS)' 154 @rm -f inc.mk 155 @$(MAKE) -j2 -f #MAKEFILE# all 156 all: 157 # @echo 'MAKEFLAGS = $(MAKEFLAGS)' 158 @echo $@ 159 inc.mk: 160 # @echo 'MAKEFLAGS = $(MAKEFLAGS)' 161 @echo 'FOO = bar' > $@ 162 !, 163 '--no-print-directory -j2', "#MAKE#[1]: warning: -jN forced in submake: disabling jobserver mode.\nall\n"); 164 165 rmfiles('inc.mk'); 166 167 if ($all_tests) { 168 # Implicit files aren't properly recreated during parallel builds 169 # Savannah bug #26864 170 171 # The first run works fine 172 run_make_test(q! 173 %.bar: %.x foo.y ; cat $^ > $@ 174 %.x: ; touch $@ 175 foo.y: foo.y.in ; cp $< $@ 176 foo.y.in: ; touch $@ 177 !, 178 '-j2 main.bar', 179 "touch foo.y.in 180 touch main.x 181 cp foo.y.in foo.y 182 cat main.x foo.y > main.bar 183 rm main.x"); 184 185 # Now we touch the .in file and make sure it still works 186 touch('foo.y.in'); 187 188 run_make_test(undef, '-j2 main.bar', "cp foo.y.in foo.y 189 touch main.x 190 cat main.x foo.y > main.bar 191 rm main.x"); 192 193 # Clean up 194 rmfiles(qw(foo.y foo.y.in main.bar)); 195 } 196 197 if ($all_tests) { 198 # Jobserver FD handling is messed up in some way. 199 # Savannah bug #28189 200 # It doesn't look like that bug anymore but this is the code it runs 201 202 run_make_test(q! 203 ifdef EXTRA 204 vpath %.dst / 205 xxx.dst: ; true 206 yyy.dst: ; true 207 endif 208 209 M := $(MAKE) 210 xx: ; $M --no-print-directory -j2 -f $(MAKEFILE_LIST) xxx.dst yyy.dst EXTRA=1 211 !, 212 '-j2', 213 '#MAKE#[1]: warning: -jN forced in submake: disabling jobserver mode. 214 true 215 true 216 '); 217 } 143 218 144 219 # Make sure that all jobserver FDs are closed if we need to re-exec the … … 169 244 # 'bar'); 170 245 171 # unlink('dependfile', 'output');246 # rmfiles(qw(dependfile output)); 172 247 173 248 … … 175 250 # run_make_test(undef, '-j2 recurse INCL=false', 'bar'); 176 251 177 # unlink('dependfile', 'output');252 # rmfiles(qw(dependfile output)); 178 253 179 254 1; -
Property svn:eol-style
changed from
-
vendor/gnumake/current/tests/scripts/features/patspecific_vars
-
Property svn:eol-style
changed from
native
toLF
r501 r2596 121 121 pattrn: global: new $t pattern: good $t inherit: good $t;'); 122 122 123 # TEST #8: override in pattern-specific variables 124 125 run_make_test(' 126 a%: override FOO += f1 127 a%: FOO += f2 128 ab: ; @echo "$(FOO)" 129 ', 130 '', "f1\n"); 131 132 run_make_test(undef, 'FOO=C', "C f1\n"); 133 134 # TEST #9: Test shortest stem selection in pattern-specific variables. 135 136 run_make_test(' 137 %-mt.x: x := two 138 %.x: x := one 139 140 all: foo.x foo-mt.x 141 142 foo.x: ;@echo $x 143 foo-mt.x: ;@echo $x 144 ', 145 '', 146 "one\ntwo"); 123 147 124 148 1; -
Property svn:eol-style
changed from
-
vendor/gnumake/current/tests/scripts/features/patternrules
-
Property svn:eol-style
changed from
native
toLF
- Property svn:keywords deleted
r900 r2596 16 16 # 17 17 18 run_make_test( '18 run_make_test(q! 19 19 .PHONY: all 20 20 21 21 all: case.1 case.2 case.3 22 a: void 22 23 # We can't have this, due to "Implicit Rule Search Algorithm" step 5c 24 #xxx: void 23 25 24 26 # 1 - existing file … … 42 44 43 45 3.implicit-phony: 44 ', 45 '', 46 ''); 46 !, '', ''); 47 47 48 48 # TEST #1: make sure files that are built via implicit rules are marked … … 146 146 unlink('foo.in', 'foo.h', 'foo.c', 'foo.o'); 147 147 148 # TEST #5: make sure both prefix and suffix patterns work with multiple 149 # target patterns (Savannah bug #26593). 150 # 151 run_make_test(' 152 all: foo.s1 foo.s2 p1.foo p2.foo 153 154 p1.% p2.%: %.orig 155 @echo $@ 156 %.s1 %.s2: %.orig 157 @echo $@ 158 159 .PHONY: foo.orig 160 ', 161 '', "foo.s1\np1.foo\n"); 162 163 # TEST 6: Make sure that non-target files are still eligible to be created 164 # as part of implicit rule chaining. Savannah bug #17752. 165 166 run_make_test(q! 167 BIN = xyz 168 COPY = $(BIN).cp 169 SRC = $(BIN).c 170 allbroken: $(COPY) $(BIN) ; @echo ok 171 $(SRC): ; @echo 'main(){}' > $@ 172 %.cp: % ; @cp $< $@ 173 % : %.c ; @cp $< $@ 174 clean: ; @rm -rf $(SRC) $(COPY) $(BIN) 175 !, 176 '', "ok\n"); 177 178 unlink(qw(xyz xyz.cp xyz.c)); 179 180 # TEST 7: Make sure that all prereqs of all "also_make" targets get created 181 # before any of the things that depend on any of them. Savannah bug #19108. 182 183 run_make_test(q! 184 final: x ; @echo $@ 185 x: x.t1 x.t2 ; @echo $@ 186 x.t2: dep 187 dep: ; @echo $@ 188 %.t1 %.t2: ; @echo $*.t1 ; echo $*.t2 189 !, 190 '', "dep\nx.t1\nx.t2\nx\nfinal\n"); 191 192 193 # TEST 8: Verify we can remove pattern rules. Savannah bug #18622. 194 195 my @f = (qw(foo.w foo.ch)); 196 touch(@f); 197 198 run_make_test(q! 199 CWEAVE := : 200 201 # Disable builtin rules 202 %.tex : %.w 203 %.tex : %.w %.ch 204 !, 205 'foo.tex', 206 "#MAKE#: *** No rule to make target `foo.tex'. Stop.", 512); 207 208 unlink(@f); 209 210 # TEST #9: Test shortest stem selection in pattern rules. 211 212 run_make_test(' 213 %.x: ;@echo one 214 %-mt.x: ;@echo two 215 216 all: foo.x foo-mt.x 217 ', 218 '', 219 "one\ntwo"); 220 221 1; 222 148 223 # This tells the test driver that the perl test script executed properly. 149 224 1; -
Property svn:eol-style
changed from
-
vendor/gnumake/current/tests/scripts/features/quoting
-
Property svn:eol-style
changed from
native
toLF
-
Property svn:eol-style
changed from
-
vendor/gnumake/current/tests/scripts/features/recursion
-
Property svn:eol-style
changed from
native
toLF
r284 r2596 17 17 @echo THE END 18 18 ', 19 ('CFLAGS=-O -w' . ($parallel_jobs ? ' -j 2' : '')),19 ('CFLAGS=-O -w' . ($parallel_jobs ? ' -j 2' : '')), 20 20 ($vos 21 21 ? "#MAKE#: Entering directory `#PWD#' -
Property svn:eol-style
changed from
-
vendor/gnumake/current/tests/scripts/features/reinvoke
-
Property svn:eol-style
changed from
native
toLF
-
Property svn:eol-style
changed from
-
vendor/gnumake/current/tests/scripts/features/se_explicit
-
Property svn:eol-style
changed from
native
toLF
- Property svn:keywords deleted
r501 r2596 25 25 # TEST #1: automatic variables. 26 26 # 27 run_make_test( '27 run_make_test(q! 28 28 .SECONDEXPANSION: 29 .DEFAULT: ; @echo $@29 .DEFAULT: ; @echo '$@' 30 30 31 31 foo: bar baz … … 40 40 $$*.6 41 41 42 ',42 !, 43 43 '', 44 44 'bar … … 61 61 # Test #2: target/pattern -specific variables. 62 62 # 63 run_make_test( '63 run_make_test(q! 64 64 .SECONDEXPANSION: 65 .DEFAULT: ; @echo $@65 .DEFAULT: ; @echo '$@' 66 66 67 67 foo.x: $$a $$b … … 70 70 71 71 %.x: b := baz 72 73 ', 72 !, 74 73 '', 75 74 'bar … … 80 79 # Test #3: order of prerequisites. 81 80 # 82 run_make_test( '81 run_make_test(q! 83 82 .SECONDEXPANSION: 84 .DEFAULT: ; @echo $@83 .DEFAULT: ; @echo '$@' 85 84 86 85 all: foo bar baz 87 86 88 87 # Subtest #1 89 #90 88 foo: foo.1; @: 91 92 89 foo: foo.2 93 94 90 foo: foo.3 95 91 96 97 92 # Subtest #2 98 #99 93 bar: bar.2 100 101 94 bar: bar.1; @: 102 103 95 bar: bar.3 104 96 105 106 97 # Subtest #3 107 #108 98 baz: baz.1 109 110 99 baz: baz.2 111 112 100 baz: ; @: 113 114 ', 101 !, 115 102 '', 116 103 'foo.1 … … 124 111 '); 125 112 113 # TEST #4: eval in a context where there is no reading_file 114 run_make_test(q! 115 .SECONDEXPANSION: 116 all : $$(eval $$(info test)) 117 !, 118 '', "test\n#MAKE#: Nothing to be done for `all'.\n"); 119 120 # TEST #5: (NEGATIVE) catch eval in a prereq list trying to create new 121 # target/prereq relationships. 122 123 run_make_test(q! 124 .SECONDEXPANSION: 125 proj1.exe : proj1.o $$(eval $$(test)) 126 define test 127 proj1.o : proj1.c 128 proj1.c: proj1.h 129 endef 130 !, 131 '', "#MAKE#: *** prerequisites cannot be defined in recipes. Stop.\n", 512); 132 133 134 # Automatic $$+ variable expansion issue. Savannah bug #25780 135 run_make_test(q! 136 all : foo foo 137 .SECONDEXPANSION: 138 all : $$+ ; @echo '$+' 139 foo : ; 140 !, 141 '', "foo foo foo foo\n"); 142 143 144 # Automatic $$+ variable expansion issue. Savannah bug #25780 145 run_make_test(q! 146 all : bar bar 147 bar : ; 148 q%x : ; 149 .SECONDEXPANSION: 150 a%l: q1x $$+ q2x ; @echo '$+' 151 !, 152 '', "q1x bar bar q2x bar bar\n"); 153 154 126 155 # This tells the test driver that the perl test script executed properly. 127 156 1; -
Property svn:eol-style
changed from
-
vendor/gnumake/current/tests/scripts/features/se_implicit
-
Property svn:eol-style
changed from
native
toLF
- Property svn:keywords deleted
r501 r2596 12 12 # Test #1: automatic variables. 13 13 # 14 run_make_test( '15 .SECONDEXPANSION: 16 .DEFAULT: ; @echo $@14 run_make_test(q! 15 .SECONDEXPANSION: 16 .DEFAULT: ; @echo '$@' 17 17 18 18 foo.a: bar baz … … 38 38 5.buz \ 39 39 6.a: 40 @echo $@41 42 ',40 @echo '$@' 41 42 !, 43 43 '', 44 44 '1.foo.a … … 61 61 # Test #2: target/pattern -specific variables. 62 62 # 63 run_make_test( '63 run_make_test(q! 64 64 .SECONDEXPANSION: 65 65 foo.x: … … 72 72 %.x: x_b := baz 73 73 74 bar baz: ; @echo $@ 75 76 ', 77 '', 78 'bar 79 baz 80 '); 74 bar baz: ; @echo '$@' 75 !, 76 '', "bar\nbaz\n"); 81 77 82 78 83 79 # Test #3: order of prerequisites. 84 80 # 85 run_make_test( '86 .SECONDEXPANSION: 87 .DEFAULT: ; @echo $@81 run_make_test(q! 82 .SECONDEXPANSION: 83 .DEFAULT: ; @echo '$@' 88 84 89 85 all: foo bar baz … … 98 94 foo: foo.3 99 95 100 foo.1: ; @echo $@96 foo.1: ; @echo '$@' 101 97 102 98 … … 109 105 bar: bar.3 110 106 111 bar.1: ; @echo $@107 bar.1: ; @echo '$@' 112 108 113 109 … … 119 115 120 116 %az: ; @: 121 122 ', 123 '', 117 !, 118 '', 124 119 'foo.1 125 120 foo.2 … … 135 130 # Test #4: stem splitting logic. 136 131 # 137 run_make_test( '132 run_make_test(q! 138 133 .SECONDEXPANSION: 139 134 $(dir)/tmp/bar.o: 140 135 141 $(dir)/tmp/foo/bar.c: ; @echo $@142 $(dir)/tmp/bar/bar.c: ; @echo $@143 foo.h: ; @echo $@136 $(dir)/tmp/foo/bar.c: ; @echo '$@' 137 $(dir)/tmp/bar/bar.c: ; @echo '$@' 138 foo.h: ; @echo '$@' 144 139 145 140 %.o: $$(addsuffix /%.c,foo bar) foo.h 146 @echo $@: {$<} $^ 147 148 ', 149 "dir=$dir", 150 "$dir/tmp/foo/bar.c 141 @echo '$@: {$<} $^' 142 !, 143 "dir=$dir", "$dir/tmp/foo/bar.c 151 144 $dir/tmp/bar/bar.c 152 145 foo.h … … 157 150 # Test #5: stem splitting logic and order-only prerequisites. 158 151 # 159 run_make_test( '152 run_make_test(q! 160 153 .SECONDEXPANSION: 161 154 $(dir)/tmp/foo.o: $(dir)/tmp/foo.c 162 $(dir)/tmp/foo.c: ; @echo $@163 bar.h: ; @echo $@155 $(dir)/tmp/foo.c: ; @echo '$@' 156 bar.h: ; @echo '$@' 164 157 165 158 %.o: %.c|bar.h 166 @echo $@: {$<} {$|} $^ 167 168 ', 169 "dir=$dir", 170 "$dir/tmp/foo.c 159 @echo '$@: {$<} {$|} $^' 160 161 !, 162 "dir=$dir", "$dir/tmp/foo.c 171 163 bar.h 172 164 $dir/tmp/foo.o: {$dir/tmp/foo.c} {bar.h} $dir/tmp/foo.c … … 176 168 # Test #6: lack of implicit prerequisites. 177 169 # 178 run_make_test( '170 run_make_test(q! 179 171 .SECONDEXPANSION: 180 172 foo.o: foo.c 181 foo.c: ; @echo $@173 foo.c: ; @echo '$@' 182 174 183 175 %.o: 184 @echo $@: {$<} $^ 185 186 ', 187 '', 188 'foo.c 189 foo.o: {foo.c} foo.c 190 '); 176 @echo '$@: {$<} $^' 177 !, 178 '', "foo.c\nfoo.o: {foo.c} foo.c\n"); 179 191 180 192 181 # Test #7: Test stem from the middle of the name. 193 182 # 194 run_make_test( '183 run_make_test(q! 195 184 .SECONDEXPANSION: 196 185 foobarbaz: 197 186 198 187 foo%baz: % $$*.1 199 @echo $*188 @echo '$*' 200 189 201 190 bar bar.1: 202 @echo $@ 203 204 ', 205 '', 206 'bar 207 bar.1 208 bar 209 '); 191 @echo '$@' 192 !, 193 '', "bar\nbar.1\nbar\n"); 194 210 195 211 196 # Test #8: Make sure stem triple-expansion does not happen. 212 197 # 213 run_make_test( '198 run_make_test(q! 214 199 .SECONDEXPANSION: 215 200 foo$$bar: 216 201 217 202 f%r: % $$*.1 218 @echo \'$*\'203 @echo '$*' 219 204 220 205 oo$$ba oo$$ba.1: 221 @echo \'$@\' 222 223 ', 224 '', 225 'oo$ba 206 @echo '$@' 207 !, 208 '', 'oo$ba 226 209 oo$ba.1 227 210 oo$ba 228 211 '); 229 212 213 # Test #9: Check the value of $^ 214 run_make_test(q! 215 .SECONDEXPANSION: 216 217 %.so: | $$(extra) ; @echo $^ 218 219 foo.so: extra := foo.o 220 foo.so: 221 foo.o: 222 !, 223 '', "\n"); 230 224 231 225 # This tells the test driver that the perl test script executed properly. -
Property svn:eol-style
changed from
-
vendor/gnumake/current/tests/scripts/features/se_statpat
-
Property svn:eol-style
changed from
native
toLF
- Property svn:keywords deleted
r501 r2596 6 6 # Test #1: automatic variables. 7 7 # 8 run_make_test( '8 run_make_test(q! 9 9 .SECONDEXPANSION: 10 .DEFAULT: ; @echo $@10 .DEFAULT: ; @echo '$@' 11 11 12 12 foo.a foo.b: foo.%: bar.% baz.% 13 14 13 foo.a foo.b: foo.%: biz.% | buz.% 15 14 … … 20 19 $$|.5 \ 21 20 $$*.6 22 23 ', 24 '', 25 'bar.a 21 !, 22 '', 'bar.a 26 23 baz.a 27 24 biz.a … … 42 39 # Test #2: target/pattern -specific variables. 43 40 # 44 run_make_test( '41 run_make_test(q! 45 42 .SECONDEXPANSION: 46 .DEFAULT: ; @echo $@43 .DEFAULT: ; @echo '$@' 47 44 48 45 foo.x foo.y: foo.%: $$(%_a) $$($$*_b) … … 51 48 52 49 %.x: x_b := baz 53 54 55 ', 56 '', 57 'bar 58 baz 59 '); 50 !, 51 '', "bar\nbaz\n"); 60 52 61 53 62 54 # Test #3: order of prerequisites. 63 55 # 64 run_make_test( '56 run_make_test(q! 65 57 .SECONDEXPANSION: 66 .DEFAULT: ; @echo $@58 .DEFAULT: ; @echo '$@' 67 59 68 60 all: foo.a bar.a baz.a 69 61 70 62 # Subtest #1 71 #72 63 foo.a foo.b: foo.%: foo.%.1; @: 73 74 64 foo.a foo.b: foo.%: foo.%.2 75 76 65 foo.a foo.b: foo.%: foo.%.3 77 66 78 67 79 68 # Subtest #2 80 #81 69 bar.a bar.b: bar.%: bar.%.2 82 83 70 bar.a bar.b: bar.%: bar.%.1; @: 84 85 71 bar.a bar.b: bar.%: bar.%.3 86 72 87 73 88 74 # Subtest #3 89 #90 75 baz.a baz.b: baz.%: baz.%.1 91 92 76 baz.a baz.b: baz.%: baz.%.2 93 94 77 baz.a baz.b: ; @: 95 96 ', 97 '', 98 'foo.a.1 78 !, 79 '', 'foo.a.1 99 80 foo.a.2 100 81 foo.a.3 … … 109 90 # Test #4: Make sure stem triple-expansion does not happen. 110 91 # 111 run_make_test( '92 run_make_test(q! 112 93 .SECONDEXPANSION: 113 94 foo$$bar: f%r: % $$*.1 114 @echo \'$*\'95 @echo '$*' 115 96 116 97 oo$$ba oo$$ba.1: 117 @echo \'$@\' 118 119 ', 120 '', 121 'oo$ba 98 @echo '$@' 99 !, 100 '', 'oo$ba 122 101 oo$ba.1 123 102 oo$ba -
Property svn:eol-style
changed from
-
vendor/gnumake/current/tests/scripts/features/statipattrules
-
Property svn:eol-style
changed from
native
toLF
-
Property svn:eol-style
changed from
-
vendor/gnumake/current/tests/scripts/features/targetvars
-
Property svn:eol-style
changed from
native
toLF
r501 r2596 7 7 rules, semicolon interference, etc."; 8 8 9 open(MAKEFILE,"> $makefile"); 10 11 print MAKEFILE <<'EOF'; 9 run_make_test(' 12 10 SHELL = /bin/sh 13 11 export FOO = foo … … 18 16 three: ; BAR=1000 19 17 @echo $(FOO) $(BAR) 20 # Some things that shouldn 't be target vars18 # Some things that shouldn not be target vars 21 19 funk : override 22 20 funk : override adelic … … 25 23 four:FOO=x 26 24 four:VAR$(FOO)=ok 27 four: ; @echo '$(FOO) $(VAR$(FOO)) $(VAR) $(VARx)'25 four: ; @echo "$(FOO) $(VAR$(FOO)) $(VAR) $(VARx)" 28 26 five:FOO=x 29 27 five six : VAR$(FOO)=good 30 five six: ;@echo '$(FOO) $(VAR$(FOO)) $(VAR) $(VARx) $(VARfoo)'28 five six: ;@echo "$(FOO) $(VAR$(FOO)) $(VAR) $(VARx) $(VARfoo)" 31 29 # Test per-target variable inheritance 32 30 seven: eight … … 42 40 # Test = escaping 43 41 EQ = = 44 ten: one \=two45 ten: one \=two42 ten: one$(EQ)two 43 ten: one $(EQ) two 46 44 ten one$(EQ)two $(EQ):;@echo $@ 47 45 .PHONY: one two three four five six seven eight nine ten $(EQ) one$(EQ)two … … 55 53 foo.r : RVAR += rvar 56 54 foo.t : TVAR := $(QVAR) 57 EOF 58 59 close(MAKEFILE); 60 61 # TEST #1 62 63 &run_make_with_options($makefile, "one two three", &get_logfile); 64 $answer = "one bar\nfoo two\nBAR=1000\nfoo bar\n"; 65 &compare_output($answer,&get_logfile(1)); 55 ', 56 "one two three", "one bar\nfoo two\nBAR=1000\nfoo bar\n"); 66 57 67 58 # TEST #2 68 59 69 &run_make_with_options($makefile, "one two FOO=1 BAR=2", &get_logfile); 70 $answer = "one 2\n1 2\n"; 71 &compare_output($answer,&get_logfile(1)); 60 run_make_test(undef, "one two FOO=1 BAR=2", "one 2\n1 2\n"); 72 61 73 62 # TEST #3 74 63 75 &run_make_with_options($makefile, "four", &get_logfile); 76 $answer = "x ok ok\n"; 77 &compare_output($answer,&get_logfile(1)); 64 run_make_test(undef, "four", "x ok ok\n"); 78 65 79 66 # TEST #4 80 67 81 &run_make_with_options($makefile, "seven", &get_logfile); 82 $answer = "eight: seven eight\nseven: seven seven\n"; 83 &compare_output($answer,&get_logfile(1)); 68 run_make_test(undef, "seven", "eight: seven eight\nseven: seven seven\n"); 84 69 85 70 # TEST #5 86 71 87 &run_make_with_options($makefile, "nine", &get_logfile); 88 $answer = "wallace bar wallace bar\n"; 89 &compare_output($answer,&get_logfile(1)); 72 run_make_test(undef, "nine", "wallace bar wallace bar\n"); 90 73 91 74 # TEST #5-a 92 75 93 &run_make_with_options($makefile, "nine-a", &get_logfile); 94 $answer = "baz\n"; 95 &compare_output($answer,&get_logfile(1)); 76 run_make_test(undef, "nine-a", "baz\n"); 96 77 97 78 # TEST #6 98 79 99 &run_make_with_options($makefile, "ten", &get_logfile); 100 $answer = "one=two\none bar\n=\nfoo two\nten\n"; 101 &compare_output($answer,&get_logfile(1)); 80 run_make_test(undef, "ten", "one=two\none bar\n=\nfoo two\nten\n"); 102 81 103 82 # TEST #6 104 83 105 &run_make_with_options($makefile, "foo.q bar.q", &get_logfile); 106 $answer = "qvar = rvar\nqvar =\n"; 107 &compare_output($answer,&get_logfile(1)); 84 run_make_test(undef, "foo.q bar.q", "qvar = rvar\nqvar =\n"); 108 85 109 86 # TEST #7 110 87 111 &run_make_with_options($makefile, "foo.t bar.s", &get_logfile); 112 $answer = "qvar = qvar\nqvar =\n"; 113 &compare_output($answer,&get_logfile(1)); 88 run_make_test(undef, "foo.t bar.s", "qvar = qvar\nqvar =\n"); 114 89 115 90 … … 117 92 # For PR/1378: Target-specific vars don't inherit correctly 118 93 119 $makefile2 = &get_tmpfile; 120 121 open(MAKEFILE,"> $makefile2"); 122 print MAKEFILE <<'EOF'; 94 run_make_test(' 123 95 foo: FOO = foo 124 96 bar: BAR = bar … … 126 98 bar: baz 127 99 baz: ; @echo $(FOO) $(BAR) 128 EOF 129 close(MAKEFILE); 130 131 &run_make_with_options("$makefile2", "", &get_logfile); 132 $answer = "foo bar\n"; 133 &compare_output($answer, &get_logfile(1)); 100 ', "", "foo bar\n"); 134 101 135 102 # TEST #9 … … 137 104 # Also PR/1831 138 105 139 $makefile3 = &get_tmpfile; 140 141 open(MAKEFILE,"> $makefile3"); 142 print MAKEFILE <<'EOF'; 106 run_make_test(' 143 107 .PHONY: all one 144 108 all: FOO += baz … … 150 114 one: FOO += boz 151 115 one: ; @echo $(FOO) 152 EOF 153 close(MAKEFILE); 154 155 &run_make_with_options("$makefile3", "", &get_logfile); 156 $answer = "bar baz biz boz\nbar baz\n"; 157 &compare_output($answer, &get_logfile(1)); 116 ', 117 '', "bar baz biz boz\nbar baz\n"); 158 118 159 119 # Test #10 160 120 161 &run_make_with_options("$makefile3", "one", &get_logfile); 162 $answer = "bar biz boz\n"; 163 &compare_output($answer, &get_logfile(1)); 121 run_make_test(undef, 'one', "bar biz boz\n"); 164 122 165 123 # Test #11 166 124 # PR/1709: Test semicolons in target-specific variable values 167 125 168 $makefile4 = &get_tmpfile; 169 170 open(MAKEFILE, "> $makefile4"); 171 print MAKEFILE <<'EOF'; 126 run_make_test(' 172 127 foo : FOO = ; ok 173 foo : ; @echo '$(FOO)' 174 EOF 175 close(MAKEFILE); 176 177 &run_make_with_options("$makefile4", "", &get_logfile); 178 $answer = "; ok\n"; 179 &compare_output($answer, &get_logfile(1)); 128 foo : ; @echo "$(FOO)" 129 ', 130 '', "; ok\n"); 180 131 181 132 # Test #12 … … 183 134 # I nailed it this time :-/. 184 135 185 $makefile5 = &get_tmpfile; 186 187 open(MAKEFILE, "> $makefile5"); 188 print MAKEFILE <<'EOF'; 136 run_make_test(' 189 137 .PHONY: a 190 138 … … 196 144 a: BLAH := bar 197 145 a: COMMAND += snafu $(BLAH) 198 EOF 199 close(MAKEFILE); 200 201 &run_make_with_options("$makefile5", "", &get_logfile); 202 $answer = "bar snafu bar\n"; 203 &compare_output($answer, &get_logfile(1)); 146 ', 147 '', "bar snafu bar\n"); 204 148 205 149 # Test #13 206 150 # Test double-colon rules with target-specific variable values 207 151 208 $makefile6 = &get_tmpfile; 209 210 open(MAKEFILE, "> $makefile6"); 211 print MAKEFILE <<'EOF'; 152 run_make_test(' 212 153 W = bad 213 154 X = bad … … 225 166 fo% : Z = pat 226 167 endif 227 228 EOF 229 close(MAKEFILE); 230 231 &run_make_with_options("$makefile6", "foo", &get_logfile); 232 $answer = "ok ok foo nopat\nok ok foo nopat\n"; 233 &compare_output($answer, &get_logfile(1)); 168 ', 169 'foo', "ok ok foo nopat\nok ok foo nopat\n"); 234 170 235 171 # Test #14 … … 237 173 # inheritance 238 174 239 &run_make_with_options("$makefile6", "bar", &get_logfile); 240 $answer = "ok ok bar nopat\nok ok bar nopat\n"; 241 &compare_output($answer, &get_logfile(1)); 175 run_make_test(undef, 'bar', "ok ok bar nopat\nok ok bar nopat\n"); 242 176 243 177 # Test #15 244 178 # Test double-colon rules with pattern-specific variable values 245 179 246 &run_make_with_options("$makefile6", "foo PATTERN=yes", &get_logfile); 247 $answer = "ok ok foo pat\nok ok foo pat\n"; 248 &compare_output($answer, &get_logfile(1)); 249 180 run_make_test(undef, 'foo PATTERN=yes', "ok ok foo pat\nok ok foo pat\n"); 250 181 251 182 # Test #16 … … 253 184 # (> make default buffer length) 254 185 255 $makefile7 = &get_tmpfile; 256 257 open(MAKEFILE, "> $makefile7"); 258 print MAKEFILE <<'EOF'; 186 run_make_test(' 259 187 base_metals_fmd_reports.sun5 base_metals_fmd_reports CreateRealPositions CreateMarginFunds deals_changed_since : BUILD_OBJ=$(shell if [ -f "build_information.generate" ]; then echo "$(OBJ_DIR)/build_information.o"; else echo "no build information"; fi ) 260 188 261 189 deals_changed_since: ; @echo $(BUILD_OBJ) 262 263 EOF 264 close(MAKEFILE); 265 266 &run_make_with_options("$makefile7", '', &get_logfile); 267 $answer = "no build information\n"; 268 &compare_output($answer, &get_logfile(1)); 190 ', 191 '', "no build information\n"); 269 192 270 193 # TEST #17 … … 287 210 .INTERMEDIATE: foo.x rules.mk 288 211 ', 289 '-I t1', 290 'MYVAR= FOOVAR=bar ALLVAR=xxx'); 212 '-I t1', 'MYVAR= FOOVAR=bar ALLVAR=xxx'); 291 213 292 214 rmfiles('t1/rules.mk'); … … 298 220 # double-expansion. See Savannah bug #15913. 299 221 300 run_make_test( "301 VAR := \$\$FOO222 run_make_test(' 223 VAR := $$FOO 302 224 foo: VAR += BAR 303 foo: ; \@echo '\$(VAR)'", 304 '', 305 '$FOO BAR'); 225 foo: ; @echo '."'".'$(VAR)'."'".' 226 ', 227 '', '$FOO BAR'); 228 229 # TEST #19: Override with append variables 230 231 run_make_test(' 232 a: override FOO += f1 233 a: FOO += f2 234 a: ; @echo "$(FOO)" 235 ', 236 '', "f1\n"); 237 238 run_make_test(undef, 'FOO=C', "C f1\n"); 239 240 # TEST #20: Check for continuation after semicolons 241 242 run_make_test(q! 243 a: A = 'hello; \ 244 world' 245 a: ; @echo $(A) 246 !, 247 '', "hello; world\n"); 248 249 # TEST #19: Test define/endef variables as target-specific vars 250 251 # run_make_test(' 252 # define b 253 # @echo global 254 # endef 255 # a: define b 256 # @echo local 257 # endef 258 259 # a: ; $(b) 260 # ', 261 # '', "local\n"); 306 262 307 263 1; -
Property svn:eol-style
changed from
-
vendor/gnumake/current/tests/scripts/features/varnesting
-
Property svn:eol-style
changed from
native
toLF
-
Property svn:eol-style
changed from
-
vendor/gnumake/current/tests/scripts/features/vpath
-
Property svn:eol-style
changed from
native
toLF
r53 r2596 1 # -*-perl-*- 2 1 3 $description = "The following test creates a makefile to test the \n" 2 4 ."vpath directive which allows you to specify a search \n" … … 60 62 } 61 63 64 # TEST 2: after vpath lookup ensure we don't get incorrect circular dependency 65 # warnings due to change of struct file ptr. Savannah bug #13529. 66 67 mkdir('vpath-d', 0777); 68 69 run_make_test(q! 70 vpath %.te vpath-d/ 71 .SECONDARY: 72 default: vpath-d/a vpath-d/b 73 vpath-d/a: fail.te 74 vpath-d/b : fail.te 75 vpath-d/fail.te: 76 !, 77 '', "#MAKE#: Nothing to be done for `default'.\n"); 78 79 rmdir('vpath-d'); 80 62 81 1; -
Property svn:eol-style
changed from
-
vendor/gnumake/current/tests/scripts/features/vpath2
-
Property svn:eol-style
changed from
native
toLF
-
Property svn:eol-style
changed from
-
vendor/gnumake/current/tests/scripts/features/vpathgpath
-
Property svn:eol-style
changed from
native
toLF
-
Property svn:eol-style
changed from
-
vendor/gnumake/current/tests/scripts/features/vpathplus
-
Property svn:eol-style
changed from
native
toLF
-
Property svn:eol-style
changed from
-
vendor/gnumake/current/tests/scripts/functions/abspath
-
Property svn:eol-style
changed from
native
toLF
- Property svn:keywords deleted
-
Property svn:eol-style
changed from
-
vendor/gnumake/current/tests/scripts/functions/addprefix
-
Property svn:eol-style
changed from
native
toLF
-
Property svn:eol-style
changed from
-
vendor/gnumake/current/tests/scripts/functions/addsuffix
-
Property svn:eol-style
changed from
native
toLF
-
Property svn:eol-style
changed from
-
vendor/gnumake/current/tests/scripts/functions/andor
-
Property svn:eol-style
set to
LF
-
Property svn:eol-style
set to
-
vendor/gnumake/current/tests/scripts/functions/basename
-
Property svn:eol-style
changed from
native
toLF
-
Property svn:eol-style
changed from
-
vendor/gnumake/current/tests/scripts/functions/call
-
Property svn:eol-style
changed from
native
toLF
-
Property svn:eol-style
changed from
-
vendor/gnumake/current/tests/scripts/functions/dir
-
Property svn:eol-style
changed from
native
toLF
-
Property svn:eol-style
changed from
-
vendor/gnumake/current/tests/scripts/functions/error
-
Property svn:eol-style
changed from
native
toLF
-
Property svn:eol-style
changed from
-
vendor/gnumake/current/tests/scripts/functions/eval
-
Property svn:eol-style
changed from
native
toLF
-
Property svn:eol-style
changed from
-
vendor/gnumake/current/tests/scripts/functions/filter-out
-
Property svn:eol-style
changed from
native
toLF
-
Property svn:eol-style
changed from
-
vendor/gnumake/current/tests/scripts/functions/findstring
-
Property svn:eol-style
changed from
native
toLF
-
Property svn:eol-style
changed from
-
vendor/gnumake/current/tests/scripts/functions/flavor
-
Property svn:eol-style
set to
LF
-
Property svn:eol-style
set to
-
vendor/gnumake/current/tests/scripts/functions/foreach
-
Property svn:eol-style
changed from
native
toLF
-
Property svn:eol-style
changed from
-
vendor/gnumake/current/tests/scripts/functions/if
-
Property svn:eol-style
changed from
native
toLF
-
Property svn:eol-style
changed from
-
vendor/gnumake/current/tests/scripts/functions/join
-
Property svn:eol-style
changed from
native
toLF
-
Property svn:eol-style
changed from
-
vendor/gnumake/current/tests/scripts/functions/notdir
-
Property svn:eol-style
changed from
native
toLF
-
Property svn:eol-style
changed from
-
vendor/gnumake/current/tests/scripts/functions/origin
-
Property svn:eol-style
changed from
native
toLF
-
Property svn:eol-style
changed from
-
vendor/gnumake/current/tests/scripts/functions/realpath
-
Property svn:eol-style
changed from
native
toLF
- Property svn:keywords deleted
-
Property svn:eol-style
changed from
-
vendor/gnumake/current/tests/scripts/functions/shell
-
Property svn:eol-style
set to
LF
r501 r2596 12 12 13 13 14 # Test unescaped comment characters in shells. Savannah bug #20513 15 if ($all_tests) { 16 run_make_test(q! 17 FOO := $(shell echo '#') 18 foo: ; echo '$(FOO)' 19 !, 20 '', "#\n"); 21 } 22 14 23 # Test shells inside exported environment variables. 15 24 # This is the test that fails if we try to put make exported variables into -
Property svn:eol-style
set to
-
vendor/gnumake/current/tests/scripts/functions/sort
-
Property svn:eol-style
changed from
native
toLF
-
Property svn:eol-style
changed from
-
vendor/gnumake/current/tests/scripts/functions/strip
-
Property svn:eol-style
changed from
native
toLF
-
Property svn:eol-style
changed from
-
vendor/gnumake/current/tests/scripts/functions/substitution
-
Property svn:eol-style
changed from
native
toLF
-
Property svn:eol-style
changed from
-
vendor/gnumake/current/tests/scripts/functions/suffix
-
Property svn:eol-style
changed from
native
toLF
-
Property svn:eol-style
changed from
-
vendor/gnumake/current/tests/scripts/functions/value
-
Property svn:eol-style
changed from
native
toLF
-
Property svn:eol-style
changed from
-
vendor/gnumake/current/tests/scripts/functions/warning
-
Property svn:eol-style
changed from
native
toLF
-
Property svn:eol-style
changed from
-
vendor/gnumake/current/tests/scripts/functions/wildcard
-
Property svn:eol-style
changed from
native
toLF
r501 r2596 82 82 &compare_output($answer,&get_logfile(1)); 83 83 84 # TEST #4: Verify that failed wildcards don't return the pattern 85 86 run_make_test(q! 87 all: ; @echo $(wildcard xz--y*.7) 88 !, 89 '', "\n"); 84 90 85 91 1; 86 87 88 89 90 91 92 93 94 -
Property svn:eol-style
changed from
-
vendor/gnumake/current/tests/scripts/functions/word
-
Property svn:eol-style
changed from
native
toLF
-
Property svn:eol-style
changed from
-
vendor/gnumake/current/tests/scripts/misc/close_stdout
-
Property svn:eol-style
set to
LF
-
Property svn:eol-style
set to
-
vendor/gnumake/current/tests/scripts/misc/general1
-
Property svn:eol-style
changed from
native
toLF
-
Property svn:eol-style
changed from
-
vendor/gnumake/current/tests/scripts/misc/general2
-
Property svn:eol-style
changed from
native
toLF
-
Property svn:eol-style
changed from
-
vendor/gnumake/current/tests/scripts/misc/general3
-
Property svn:eol-style
changed from
native
toLF
-
Property svn:eol-style
changed from
-
vendor/gnumake/current/tests/scripts/misc/general4
-
Property svn:eol-style
changed from
native
toLF
r501 r2596 27 27 cc foo.o -o foo'); 28 28 unlink('foo.c'); 29 30 31 # Test other implicit rule searching32 33 &touch('bar');34 run_make_test('35 test.foo:36 %.foo : baz ; @echo done $<37 %.foo : bar ; @echo done $<38 fox: baz39 ',40 '',41 'done bar');42 unlink('bar');43 29 44 30 … … 81 67 '', "mkdir -p dir/subdir\ntouch dir/subdir/file.\$b\ncp dir/subdir/file.\$b dir/subdir/file.\$a\n"); 82 68 69 # Test odd whitespace at the beginning of a line 70 71 run_make_test(" 72 all: 73 \f 74 75 \\ 76 \f \\ 77 \013 \\ 78 all: ; \@echo hi 79 ", 80 '', "hi\n"); 81 83 82 1; -
Property svn:eol-style
changed from
-
vendor/gnumake/current/tests/scripts/options/dash-B
-
Property svn:eol-style
changed from
native
toLF
r501 r2596 71 71 rmfiles('foo.x', 'blah.x'); 72 72 73 # Test that $? is set properly with -B; all prerequisites will be newer! 74 75 utouch(-10, 'x.b'); 76 touch('x.a'); 77 78 run_make_test(q! 79 x.a: x.b ; @echo $? 80 !, 81 '-B', "x.b\n"); 82 83 unlink(qw(x.a x.b)); 84 73 85 1; -
Property svn:eol-style
changed from
-
vendor/gnumake/current/tests/scripts/options/dash-C
-
Property svn:eol-style
changed from
native
toLF
-
Property svn:eol-style
changed from
-
vendor/gnumake/current/tests/scripts/options/dash-I
-
Property svn:eol-style
changed from
native
toLF
-
Property svn:eol-style
changed from
-
vendor/gnumake/current/tests/scripts/options/dash-W
-
Property svn:eol-style
set to
LF
-
Property svn:eol-style
set to
-
vendor/gnumake/current/tests/scripts/options/dash-e
-
Property svn:eol-style
changed from
native
toLF
-
Property svn:eol-style
changed from
-
vendor/gnumake/current/tests/scripts/options/dash-f
-
Property svn:eol-style
changed from
native
toLF
-
Property svn:eol-style
changed from
-
vendor/gnumake/current/tests/scripts/options/dash-k
-
Property svn:eol-style
changed from
native
toLF
-
Property svn:eol-style
changed from
-
vendor/gnumake/current/tests/scripts/options/dash-l
-
Property svn:eol-style
changed from
native
toLF
-
Property svn:eol-style
changed from
-
vendor/gnumake/current/tests/scripts/options/dash-n
-
Property svn:eol-style
changed from
native
toLF
-
Property svn:eol-style
changed from
-
vendor/gnumake/current/tests/scripts/options/dash-q
-
Property svn:eol-style
changed from
native
toLF
-
Property svn:eol-style
changed from
-
vendor/gnumake/current/tests/scripts/options/dash-t
-
Property svn:eol-style
changed from
native
toLF
-
Property svn:eol-style
changed from
-
vendor/gnumake/current/tests/scripts/options/general
-
Property svn:eol-style
changed from
native
toLF
-
Property svn:eol-style
changed from
-
vendor/gnumake/current/tests/scripts/options/symlinks
-
Property svn:eol-style
changed from
native
toLF
- Property svn:keywords deleted
-
Property svn:eol-style
changed from
-
vendor/gnumake/current/tests/scripts/options/warn-undefined-variables
-
Property svn:eol-style
set to
LF
-
Property svn:eol-style
set to
-
vendor/gnumake/current/tests/scripts/targets/DEFAULT
-
Property svn:eol-style
changed from
native
toLF
-
Property svn:eol-style
changed from
-
vendor/gnumake/current/tests/scripts/targets/FORCE
-
Property svn:eol-style
changed from
native
toLF
-
Property svn:eol-style
changed from
-
vendor/gnumake/current/tests/scripts/targets/INTERMEDIATE
-
Property svn:eol-style
changed from
native
toLF
-
Property svn:eol-style
changed from
-
vendor/gnumake/current/tests/scripts/targets/PHONY
-
Property svn:eol-style
changed from
native
toLF
-
Property svn:eol-style
changed from
-
vendor/gnumake/current/tests/scripts/targets/SECONDARY
-
Property svn:eol-style
changed from
native
toLF
-
Property svn:eol-style
changed from
-
vendor/gnumake/current/tests/scripts/targets/SILENT
-
Property svn:eol-style
changed from
native
toLF
-
Property svn:eol-style
changed from
-
vendor/gnumake/current/tests/scripts/targets/clean
-
Property svn:eol-style
changed from
native
toLF
-
Property svn:eol-style
changed from
-
vendor/gnumake/current/tests/scripts/test_template
-
Property svn:eol-style
changed from
native
toLF
-
Property svn:eol-style
changed from
-
vendor/gnumake/current/tests/scripts/variables/CURDIR
-
Property svn:eol-style
changed from
native
toLF
-
Property svn:eol-style
changed from
-
vendor/gnumake/current/tests/scripts/variables/DEFAULT_GOAL
-
Property svn:eol-style
changed from
native
toLF
- Property svn:keywords deleted
r283 r2596 74 74 'foo'); 75 75 76 # TEST #5: .DEFAULT_GOAL containing just whitespace (Savannah bug #25697) 77 78 run_make_test(' 79 N = 80 .DEFAULT_GOAL = $N $N # Just whitespace 81 82 foo: ; @echo "boo" 83 ', 84 '', "#MAKE#: *** No targets. Stop.\n", 512); 76 85 77 86 # This tells the test driver that the perl test script executed properly. -
Property svn:eol-style
changed from
-
vendor/gnumake/current/tests/scripts/variables/INCLUDE_DIRS
-
Property svn:eol-style
set to
LF
-
Property svn:eol-style
set to
-
vendor/gnumake/current/tests/scripts/variables/MAKE
-
Property svn:eol-style
changed from
native
toLF
r284 r2596 1 1 # -*-perl-*- 2 2 3 $description = "The following test creates a makefile to test MAKE \n" 4 ."(very generic)"; 3 $description = "Test proper behavior of the MAKE variable"; 5 4 6 5 $details = "DETAILS"; 7 6 8 open(MAKEFILE,"> $makefile"); 7 run_make_test(q! 8 TMP := $(MAKE) 9 MAKE := $(subst X=$(X),,$(MAKE)) 10 all: 11 @echo $(TMP) 12 $(MAKE) -f #MAKEFILE# foo 9 13 10 # The Contents of the MAKEFILE ... 14 foo: 15 @echo $(MAKE) 16 !, 17 '', 18 "#MAKEPATH#\n#MAKEPATH# -f #MAKEFILE# foo\n" 19 . "#MAKE#[1]: Entering directory `#PWD#'\n" 20 . "#MAKEPATH#\n#MAKE#[1]: Leaving directory `#PWD#'\n"); 11 21 12 print MAKEFILE "TMP := \$(MAKE)\n"; 13 print MAKEFILE "MAKE := \$(subst X=\$(X),,\$(MAKE))\n\n"; 14 print MAKEFILE "all:\n"; 15 print MAKEFILE "\t\@echo \$(TMP)\n"; 16 print MAKEFILE "\t\$(MAKE) -f $makefile foo\n\n"; 17 print MAKEFILE "foo:\n"; 18 print MAKEFILE "\t\@echo \$(MAKE)\n"; 19 20 # END of Contents of MAKEFILE 21 22 close(MAKEFILE); 23 24 # Create the answer to what should be produced by this Makefile 25 $answer = "$mkpath\n$mkpath -f $makefile foo\n" 26 . "${make_name}[1]: Entering directory `$pwd'\n" 27 . "$mkpath\n${make_name}[1]: Leaving directory `$pwd'\n"; 28 29 &run_make_with_options($makefile,"",&get_logfile,0); 30 31 &rmfiles("foo"); 32 # COMPARE RESULTS 33 &compare_output($answer,&get_logfile(1)); 22 rmfiles("foo"); 34 23 35 24 1; -
Property svn:eol-style
changed from
-
vendor/gnumake/current/tests/scripts/variables/MAKECMDGOALS
-
Property svn:eol-style
changed from
native
toLF
-
Property svn:eol-style
changed from
-
vendor/gnumake/current/tests/scripts/variables/MAKEFILES
-
Property svn:eol-style
changed from
native
toLF
r53 r2596 32 32 &compare_output($answer,&get_logfile(1)); 33 33 34 # TEST 2: Verify that included makefiles don't set the default goal. 35 # See Savannah bug #13401. 36 37 create_file('xx-inc.mk', ' 38 include_goal: ; @echo $@ 39 include xx-ind.mk 40 '); 41 42 create_file('xx-ind.mk', ' 43 indirect_goal: ; @echo $@ 44 '); 45 46 run_make_test(q! 47 top: ; @echo $@ 48 !, 49 'MAKEFILES=xx-inc.mk', "top\n"); 50 51 unlink(qw(xx-inc.mk xx-ind.mk)); 52 34 53 1; -
Property svn:eol-style
changed from
-
vendor/gnumake/current/tests/scripts/variables/MAKELEVEL
-
Property svn:eol-style
changed from
native
toLF
-
Property svn:eol-style
changed from
-
vendor/gnumake/current/tests/scripts/variables/MAKE_RESTARTS
-
Property svn:eol-style
set to
LF
-
Property svn:eol-style
set to
-
vendor/gnumake/current/tests/scripts/variables/MFILE_LIST
-
Property svn:eol-style
changed from
native
toLF
- Property svn:keywords deleted
-
Property svn:eol-style
changed from
-
vendor/gnumake/current/tests/scripts/variables/SHELL
-
Property svn:eol-style
changed from
native
toLF
- Property svn:keywords deleted
r501 r2596 50 50 $extraENV{SHELL} = $mshell; 51 51 52 run_make_test("all: export SHELL := /./$mshell\n".' 53 all:;@echo "$(SHELL) $$SHELL" 54 ', '', "/./$mshell $mshell"); 52 run_make_test(" 53 SHELL := /././$mshell 54 one: two 55 two: export SHELL := /./$mshell\n".' 56 one two:;@echo "$@: $(SHELL) $$SHELL" 57 ', '', "two: /./$mshell /./$mshell\none: /././$mshell $mshell\n"); 58 59 # Test .SHELLFLAGS 60 61 # We don't know the output here: on Solaris for example, every line printed 62 # by the shell in -x mode has a trailing space (!!) 63 my $script = 'true; true'; 64 my $flags = '-xc'; 65 my $out = `/bin/sh $flags '$script' 2>&1`; 66 67 run_make_test(qq! 68 .SHELLFLAGS = $flags 69 all: ; \@$script 70 !, 71 '', $out); 72 73 # We can't just use "false" because on different systems it provides a 74 # different exit code--once again Solaris: false exits with 255 not 1 75 $script = 'true; false; true'; 76 $flags = '-xec'; 77 $out = `/bin/sh $flags '$script' 2>&1`; 78 my $err = $? >> 8; 79 80 run_make_test(qq! 81 .SHELLFLAGS = $flags 82 all: ; \@$script 83 !, 84 '', "$out#MAKE#: *** [all] Error $err\n", 512); 55 85 56 86 1; -
Property svn:eol-style
changed from
-
vendor/gnumake/current/tests/scripts/variables/automatic
-
Property svn:eol-style
changed from
native
toLF
r900 r2596 108 108 unlink('foo'); 109 109 110 # TEST #4: ensure prereq ordering is correct when the commmand target has none 111 # See Savannah bug #21198 112 113 run_make_test(' 114 all : A B 115 all : ; @echo $@ -- $^ -- $< 116 all : C D 117 all : E F 118 A B C D E F G H : ; @: 119 ', 120 '', "all -- A B C D E F -- A\n"); 121 110 122 1; -
Property svn:eol-style
changed from
-
vendor/gnumake/current/tests/scripts/variables/flavors
-
Property svn:eol-style
changed from
native
toLF
r284 r2596 5 5 $details = ""; 6 6 7 open(MAKEFILE, "> $makefile"); 7 # TEST 0: Recursive 8 8 9 # The Contents of the MAKEFILE ... 10 11 print MAKEFILE <<'EOF'; 9 run_make_test(' 10 ugh = Goodbye 12 11 foo = $(bar) 13 12 bar = ${ugh} 14 13 ugh = Hello 14 all: ; @echo $(foo) 15 ', 16 '', "Hello\n"); 15 17 16 all: multi ; @echo $(foo) 17 18 multi: ; $(multi) 19 20 x := foo 21 y := $(x) bar 22 x := later 23 24 nullstring := 25 space := $(nullstring) $(nullstring) 26 27 next: ; @echo $x$(space)$y 28 29 define multi 30 @echo hi 31 echo there 32 endef 33 34 ifdef BOGUS 35 define 36 @echo error 37 endef 38 endif 39 40 define outer 41 define inner 42 A = B 43 endef 44 endef 45 46 $(eval $(outer)) 47 48 outer: ; @echo $(inner) 49 50 EOF 51 52 # END of Contents of MAKEFILE 53 54 close(MAKEFILE); 55 56 # TEST #1 57 # ------- 58 59 &run_make_with_options($makefile, "", &get_logfile); 60 $answer = "hi\necho there\nthere\nHello\n"; 61 &compare_output($answer, &get_logfile(1)); 62 63 # TEST #2 64 # ------- 65 66 &run_make_with_options($makefile, "next", &get_logfile); 67 $answer = "later foo bar\n"; 68 &compare_output($answer, &get_logfile(1)); 69 70 # TEST #3 71 # ------- 72 73 &run_make_with_options($makefile, "BOGUS=true", &get_logfile, 512); 74 $answer = "$makefile:24: *** empty variable name. Stop.\n"; 75 &compare_output($answer, &get_logfile(1)); 76 77 # TEST #4 78 # ------- 79 80 &run_make_with_options($makefile, "outer", &get_logfile); 81 $answer = "A = B\n"; 82 &compare_output($answer, &get_logfile(1)); 83 84 # Clean up from "old style" testing. If all the above tests are converted to 85 # run_make_test() syntax than this line can be removed. 86 $makefile = undef; 87 88 # ------------------------- 89 # Make sure that prefix characters apply properly to define/endef values. 90 # 91 # There's a bit of oddness here if you try to use a variable to hold the 92 # prefix character for a define. Even though something like this: 93 # 94 # define foo 95 # echo bar 96 # endef 97 # 98 # all: ; $(V)$(foo) 99 # 100 # (where V=@) can be seen by the user to be obviously different than this: 101 # 102 # define foo 103 # $(V)echo bar 104 # endef 105 # 106 # all: ; $(foo) 107 # 108 # and the user thinks it should behave the same as when the "@" is literal 109 # instead of in a variable, that can't happen because by the time make 110 # expands the variables for the command line and sees it begins with a "@" it 111 # can't know anymore whether the prefix character came before the variable 112 # reference or was included in the first line of the variable reference. 113 114 # TEST #5 115 # ------- 18 # TEST 1: Simple 116 19 117 20 run_make_test(' 118 define FOO 119 $(V1)echo hello 120 $(V2)echo world 121 endef 122 all: ; @ $(FOO)123 ', '', 'hello124 world');21 bar = Goodbye 22 foo := $(bar) 23 bar = ${ugh} 24 ugh = Hello 25 all: ; @echo $(foo) 26 ', 27 '', "Goodbye\n"); 125 28 126 # TEST #6 127 # ------- 128 129 run_make_test(undef, 'V1=@ V2=@', 'hello 130 world'); 131 132 # TEST #7 133 # ------- 29 # TEST 2: Append to recursive 134 30 135 31 run_make_test(' 136 define FOO 137 $(V1)echo hello 138 $(V2)echo world 139 endef 140 all: ; $(FOO) 141 ', 'V1=@', 'hello 142 echo world 143 world');32 foo = Hello 33 ugh = Goodbye 34 foo += $(bar) 35 bar = ${ugh} 36 ugh = Hello 37 all: ; @echo $(foo) 38 ', 39 '', "Hello Hello\n"); 144 40 145 # TEST #8 146 # ------- 147 148 run_make_test(undef, 'V2=@', 'echo hello 149 hello 150 world'); 151 152 # TEST #9 153 # ------- 154 155 run_make_test(undef, 'V1=@ V2=@', 'hello 156 world'); 157 158 # TEST #10 159 # ------- 160 # Test the basics; a "@" internally to the variable applies to only one line. 161 # A "@" before the variable applies to the entire variable. 41 # TEST 3: Append to simple 162 42 163 43 run_make_test(' 164 define FOO 165 @echo hello 166 echo world 167 endef 168 define BAR 169 echo hello 170 echo world 171 endef 44 foo := Hello 45 ugh = Goodbye 46 bar = ${ugh} 47 foo += $(bar) 48 ugh = Hello 49 all: ; @echo $(foo) 50 ', 51 '', "Hello Goodbye\n"); 172 52 173 all: foo bar 174 foo: ; $(FOO) 175 bar: ; @$(BAR) 176 ', '', 'hello 177 echo world 178 world 179 hello 180 world 181 '); 53 # TEST 4: Conditional pre-set 54 55 run_make_test(' 56 foo = Hello 57 ugh = Goodbye 58 bar = ${ugh} 59 foo ?= $(bar) 60 ugh = Hello 61 all: ; @echo $(foo) 62 ', 63 '', "Hello\n"); 64 65 # TEST 5: Conditional unset 66 67 run_make_test(' 68 ugh = Goodbye 69 bar = ${ugh} 70 foo ?= $(bar) 71 ugh = Hello 72 all: ; @echo $(foo) 73 ', 74 '', "Hello\n"); 182 75 183 76 1; -
Property svn:eol-style
changed from
-
vendor/gnumake/current/tests/scripts/variables/negative
-
Property svn:eol-style
set to
LF
-
Property svn:eol-style
set to
-
vendor/gnumake/current/tests/scripts/variables/special
-
Property svn:eol-style
changed from
native
toLF
-
Property svn:eol-style
changed from
-
vendor/gnumake/current/tests/test_driver.pl
r1989 r2596 7 7 # 8 8 # Copyright (C) 1991, 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999, 2000, 9 # 2001, 2002, 2003, 2004, 2005, 2006, 2007 Free Software Foundation, Inc. 9 # 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010 Free Software 10 # Foundation, Inc. 10 11 # This file is part of GNU Make. 11 12 # … … 30 31 # variables and then calls &toplevel, which does all the real work. 31 32 32 # $Id: test_driver.pl,v 1. 24 2007/11/04 21:54:02psmith Exp $33 # $Id: test_driver.pl,v 1.30 2010/07/28 05:39:50 psmith Exp $ 33 34 34 35 … … 54 55 $test_timeout = 5; 55 56 57 # Path to Perl 58 $perl_name = $^X; 56 59 57 60 # %makeENV is the cleaned-out environment. … … 236 239 { 237 240 # Set up an initial value. In perl5 we can do it the easy way. 238 #239 241 $osname = defined($^O) ? $^O : ''; 242 243 # Find a path to Perl 240 244 241 245 # See if the filesystem supports long file names with multiple … … 273 277 if ($osname =~ /not found/i) 274 278 { 275 $osname = "(something unixy with no uname)";279 $osname = "(something posixy with no uname)"; 276 280 } 277 281 elsif ($@ ne "" || $?) … … 280 284 if ($@ ne "" || $?) 281 285 { 282 $osname = "(something unixy)";286 $osname = "(something posixy)"; 283 287 } 284 288 } … … 436 440 $diffext = 'd'; 437 441 $baseext = 'b'; 442 $runext = 'r'; 438 443 $extext = ''; 439 444 } else { … … 441 446 $diffext = 'diff'; 442 447 $baseext = 'base'; 448 $runext = 'run'; 443 449 $extext = '.'; 444 450 } … … 446 452 $diff_filename = "$testpath.$diffext"; 447 453 $base_filename = "$testpath.$baseext"; 454 $run_filename = "$testpath.$runext"; 448 455 $tmp_filename = "$testpath.$tmpfilesuffix"; 449 456 … … 459 466 $tests_run = 0; 460 467 $tests_passed = 0; 468 461 469 $code = do $perl_testname; 462 470 … … 692 700 693 701 &create_file (&get_basefile, $answer); 702 &create_file (&get_runfile, $command_string); 694 703 695 704 print "\nCreating Difference File ...\n" if $debug; … … 699 708 local($command) = "diff -c " . &get_basefile . " " . $logfile; 700 709 &run_command_with_output(&get_difffile,$command); 710 } else { 711 &rmfiles (); 701 712 } 702 713 … … 792 803 local $SIG{ALRM} = sub { die "timeout\n"; }; 793 804 alarm $test_timeout; 794 $code = system @_;805 $code = system(@_); 795 806 alarm 0; 796 807 }; … … 829 840 my $filename = shift; 830 841 831 print "\nrun_command_with_output($filename ): @_\n" if $debug;842 print "\nrun_command_with_output($filename,$runname): @_\n" if $debug; 832 843 &attach_default_output ($filename); 833 844 my $code = _run_command(@_); … … 1202 1213 } 1203 1214 1215 # This subroutine returns a command filename with a number appended 1216 # to the end corresponding to how many logfiles (and thus command files) 1217 # have been created in the current running test. 1218 1219 sub get_runfile 1220 { 1221 return ($run_filename . &num_suffix ($num_of_logfiles)); 1222 } 1223 1204 1224 # just like logfile, only a generic tmp filename for use by the test. 1205 1225 # they are automatically cleaned up unless -keep was used, or the test fails. -
vendor/gnumake/current/variable.c
r1989 r2596 1 1 /* Internals of variables for GNU Make. 2 2 Copyright (C) 1988, 1989, 1990, 1991, 1992, 1993, 1994, 1995, 1996, 1997, 3 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007 Free Software4 Foundation, Inc.3 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 4 2010 Free Software Foundation, Inc. 5 5 This file is part of GNU Make. 6 6 … … 36 36 static struct pattern_var *pattern_vars; 37 37 38 /* Pointer to last struct in the chain, so we can add onto the end. */ 39 40 static struct pattern_var *last_pattern_var; 41 42 /* Create a new pattern-specific variable struct. */ 38 /* Pointer to the last struct in the pack of a specific size, from 1 to 255.*/ 39 40 static struct pattern_var *last_pattern_vars[256]; 41 42 /* Create a new pattern-specific variable struct. The new variable is 43 inserted into the PATTERN_VARS list in the shortest patterns first 44 order to support the shortest stem matching (the variables are 45 matched in the reverse order so the ones with the longest pattern 46 will be considered first). Variables with the same pattern length 47 are inserted in the definition order. */ 43 48 44 49 struct pattern_var * 45 50 create_pattern_var (const char *target, const char *suffix) 46 51 { 52 register unsigned int len = strlen (target); 47 53 register struct pattern_var *p = xmalloc (sizeof (struct pattern_var)); 48 54 49 if (last_pattern_var != 0) 50 last_pattern_var->next = p; 55 if (pattern_vars != 0) 56 { 57 if (len < 256 && last_pattern_vars[len] != 0) 58 { 59 p->next = last_pattern_vars[len]->next; 60 last_pattern_vars[len]->next = p; 61 } 62 else 63 { 64 /* Find the position where we can insert this variable. */ 65 register struct pattern_var **v; 66 67 for (v = &pattern_vars; ; v = &(*v)->next) 68 { 69 /* Insert at the end of the pack so that patterns with the 70 same length appear in the order they were defined .*/ 71 72 if (*v == 0 || (*v)->len > len) 73 { 74 p->next = *v; 75 *v = p; 76 break; 77 } 78 } 79 } 80 } 51 81 else 52 pattern_vars = p; 53 last_pattern_var = p; 54 p->next = 0; 82 { 83 pattern_vars = p; 84 p->next = 0; 85 } 55 86 56 87 p->target = target; 57 p->len = strlen (target);88 p->len = len; 58 89 p->suffix = suffix + 1; 90 91 if (len < 256) 92 last_pattern_vars[len] = p; 59 93 60 94 return p; … … 140 174 static struct variable_set global_variable_set; 141 175 static struct variable_set_list global_setlist 142 = { 0, &global_variable_set };176 = { 0, &global_variable_set, 0 }; 143 177 struct variable_set_list *current_variable_set_list = &global_setlist; 144 178 … … 209 243 210 244 v = xmalloc (sizeof (struct variable)); 211 v->name = savestring(name, length);245 v->name = xstrndup (name, length); 212 246 v->length = length; 213 247 hash_insert_at (&set->table, v, var_slot); … … 224 258 v->per_target = 0; 225 259 v->append = 0; 260 v->private_var = 0; 226 261 v->export = v_default; 227 262 … … 244 279 } 245 280 281 282 283 /* Undefine variable named NAME in SET. LENGTH is the length of NAME, which 284 does not need to be null-terminated. ORIGIN specifies the origin of the 285 variable (makefile, command line or environment). */ 286 287 static void 288 free_variable_name_and_value (const void *item); 289 290 void 291 undefine_variable_in_set (const char *name, unsigned int length, 292 enum variable_origin origin, 293 struct variable_set *set) 294 { 295 struct variable *v; 296 struct variable **var_slot; 297 struct variable var_key; 298 299 if (set == NULL) 300 set = &global_variable_set; 301 302 var_key.name = (char *) name; 303 var_key.length = length; 304 var_slot = (struct variable **) hash_find_slot (&set->table, &var_key); 305 306 if (env_overrides && origin == o_env) 307 origin = o_env_override; 308 309 v = *var_slot; 310 if (! HASH_VACANT (v)) 311 { 312 if (env_overrides && v->origin == o_env) 313 /* V came from in the environment. Since it was defined 314 before the switches were parsed, it wasn't affected by -e. */ 315 v->origin = o_env_override; 316 317 /* If the definition is from a stronger source than this one, don't 318 undefine it. */ 319 if ((int) origin >= (int) v->origin) 320 { 321 hash_delete_at (&set->table, var_slot); 322 free_variable_name_and_value (v); 323 } 324 } 325 } 246 326 247 327 /* If the variable passed in is "special", handle its special nature. … … 345 425 const struct variable_set_list *setlist; 346 426 struct variable var_key; 427 int is_parent = 0; 347 428 348 429 var_key.name = (char *) name; … … 356 437 357 438 v = (struct variable *) hash_find_item ((struct hash_table *) &set->table, &var_key); 358 if (v )439 if (v && (!is_parent || !v->private_var)) 359 440 return v->special ? lookup_special_var (v) : v; 441 442 is_parent |= setlist->next_is_parent; 360 443 } 361 444 … … 470 553 initialize_file_variables (file->double_colon, reading); 471 554 l->next = file->double_colon->variables; 555 l->next_is_parent = 0; 472 556 return; 473 557 } … … 480 564 l->next = file->parent->variables; 481 565 } 566 l->next_is_parent = 1; 482 567 483 568 /* If we're not reading makefiles and we haven't looked yet, see if … … 525 610 v->per_target = p->variable.per_target; 526 611 v->export = p->variable.export; 612 v->private_var = p->variable.private_var; 527 613 } 528 614 while ((p = lookup_pattern_var (p, file->name)) != 0); … … 538 624 { 539 625 file->pat_variables->next = l->next; 626 file->pat_variables->next_is_parent = l->next_is_parent; 540 627 l->next = file->pat_variables; 628 l->next_is_parent = 0; 541 629 } 542 630 } … … 560 648 setlist->set = set; 561 649 setlist->next = current_variable_set_list; 650 setlist->next_is_parent = 0; 562 651 563 652 return setlist; … … 631 720 global_setlist.set = setlist->set; 632 721 global_setlist.next = setlist->next; 722 global_setlist.next_is_parent = setlist->next_is_parent; 633 723 } 634 724 … … 719 809 720 810 sprintf (buf, "%u", makelevel); 721 (void) define_variable (MAKELEVEL_NAME, MAKELEVEL_LENGTH, buf, o_env, 0);811 define_variable_cname (MAKELEVEL_NAME, buf, o_env, 0); 722 812 723 813 sprintf (buf, "%s%s%s", … … 727 817 (remote_description == 0 || remote_description[0] == '\0') 728 818 ? "" : remote_description); 729 (void) define_variable ("MAKE_VERSION", 12, buf, o_default, 0);819 define_variable_cname ("MAKE_VERSION", buf, o_default, 0); 730 820 731 821 #ifdef __MSDOS__ … … 738 828 struct variable *comp = lookup_variable ("COMSPEC", 7); 739 829 740 /* Make $MAKESHELL override $SHELLeven if -e is in effect. */830 /* $(MAKESHELL) overrides $(SHELL) even if -e is in effect. */ 741 831 if (mshp) 742 832 (void) define_variable (shell_str, shlen, … … 744 834 else if (comp) 745 835 { 746 /* $ COMSPEC shouldn't override $SHELL. */836 /* $(COMSPEC) shouldn't override $(SHELL). */ 747 837 struct variable *shp = lookup_variable (shell_str, shlen); 748 838 … … 803 893 /* This won't override any definition, but it will provide one if there 804 894 isn't one there. */ 805 v = define_variable ("SHELL", 5, default_shell, o_default, 0);895 v = define_variable_cname ("SHELL", default_shell, o_default, 0); 806 896 #ifdef __MSDOS__ 807 897 v->export = v_export; /* Export always SHELL. */ … … 823 913 824 914 /* Make sure MAKEFILES gets exported if it is set. */ 825 v = define_variable ("MAKEFILES", 9, "", o_default, 0);915 v = define_variable_cname ("MAKEFILES", "", o_default, 0); 826 916 v->export = v_ifset; 827 917 … … 830 920 831 921 #ifdef VMS 832 define_variable ("@D", 2, "$(dir $@)", o_automatic, 1);833 define_variable ("%D", 2, "$(dir $%)", o_automatic, 1);834 define_variable ("*D", 2, "$(dir $*)", o_automatic, 1);835 define_variable ("<D", 2, "$(dir $<)", o_automatic, 1);836 define_variable ("?D", 2, "$(dir $?)", o_automatic, 1);837 define_variable ("^D", 2, "$(dir $^)", o_automatic, 1);838 define_variable ("+D", 2, "$(dir $+)", o_automatic, 1);922 define_variable_cname ("@D", "$(dir $@)", o_automatic, 1); 923 define_variable_cname ("%D", "$(dir $%)", o_automatic, 1); 924 define_variable_cname ("*D", "$(dir $*)", o_automatic, 1); 925 define_variable_cname ("<D", "$(dir $<)", o_automatic, 1); 926 define_variable_cname ("?D", "$(dir $?)", o_automatic, 1); 927 define_variable_cname ("^D", "$(dir $^)", o_automatic, 1); 928 define_variable_cname ("+D", "$(dir $+)", o_automatic, 1); 839 929 #else 840 define_variable ("@D", 2, "$(patsubst %/,%,$(dir $@))", o_automatic, 1);841 define_variable ("%D", 2, "$(patsubst %/,%,$(dir $%))", o_automatic, 1);842 define_variable ("*D", 2, "$(patsubst %/,%,$(dir $*))", o_automatic, 1);843 define_variable ("<D", 2, "$(patsubst %/,%,$(dir $<))", o_automatic, 1);844 define_variable ("?D", 2, "$(patsubst %/,%,$(dir $?))", o_automatic, 1);845 define_variable ("^D", 2, "$(patsubst %/,%,$(dir $^))", o_automatic, 1);846 define_variable ("+D", 2, "$(patsubst %/,%,$(dir $+))", o_automatic, 1);930 define_variable_cname ("@D", "$(patsubst %/,%,$(dir $@))", o_automatic, 1); 931 define_variable_cname ("%D", "$(patsubst %/,%,$(dir $%))", o_automatic, 1); 932 define_variable_cname ("*D", "$(patsubst %/,%,$(dir $*))", o_automatic, 1); 933 define_variable_cname ("<D", "$(patsubst %/,%,$(dir $<))", o_automatic, 1); 934 define_variable_cname ("?D", "$(patsubst %/,%,$(dir $?))", o_automatic, 1); 935 define_variable_cname ("^D", "$(patsubst %/,%,$(dir $^))", o_automatic, 1); 936 define_variable_cname ("+D", "$(patsubst %/,%,$(dir $+))", o_automatic, 1); 847 937 #endif 848 define_variable ("@F", 2, "$(notdir $@)", o_automatic, 1);849 define_variable ("%F", 2, "$(notdir $%)", o_automatic, 1);850 define_variable ("*F", 2, "$(notdir $*)", o_automatic, 1);851 define_variable ("<F", 2, "$(notdir $<)", o_automatic, 1);852 define_variable ("?F", 2, "$(notdir $?)", o_automatic, 1);853 define_variable ("^F", 2, "$(notdir $^)", o_automatic, 1);854 define_variable ("+F", 2, "$(notdir $+)", o_automatic, 1);938 define_variable_cname ("@F", "$(notdir $@)", o_automatic, 1); 939 define_variable_cname ("%F", "$(notdir $%)", o_automatic, 1); 940 define_variable_cname ("*F", "$(notdir $*)", o_automatic, 1); 941 define_variable_cname ("<F", "$(notdir $<)", o_automatic, 1); 942 define_variable_cname ("?F", "$(notdir $?)", o_automatic, 1); 943 define_variable_cname ("^F", "$(notdir $^)", o_automatic, 1); 944 define_variable_cname ("+F", "$(notdir $+)", o_automatic, 1); 855 945 } 856 946 … … 979 1069 convert_Path_to_windows32(value, ';'); 980 1070 #endif 981 *result++ = xstrdup (concat ( v->name, "=", value));1071 *result++ = xstrdup (concat (3, v->name, "=", value)); 982 1072 free (value); 983 1073 } … … 989 1079 convert_Path_to_windows32(v->value, ';'); 990 1080 #endif 991 *result++ = xstrdup (concat ( v->name, "=", v->value));1081 *result++ = xstrdup (concat (3, v->name, "=", v->value)); 992 1082 } 993 1083 } … … 1093 1183 unsigned int oldlen, vallen; 1094 1184 const char *val; 1095 char *tp ;1185 char *tp = NULL; 1096 1186 1097 1187 val = value; … … 1106 1196 memory for the expansion as we may still need the rest of the 1107 1197 buffer if we're looking at a target-specific variable. */ 1108 val = alloc_value= allocated_variable_expand (val);1198 val = tp = allocated_variable_expand (val); 1109 1199 1110 1200 oldlen = strlen (v->value); 1111 1201 vallen = strlen (val); 1112 tp = alloca (oldlen + 1 + vallen + 1); 1113 memcpy (tp, v->value, oldlen); 1114 tp[oldlen] = ' '; 1115 memcpy (&tp[oldlen + 1], val, vallen + 1); 1116 p = tp; 1202 p = alloc_value = xmalloc (oldlen + 1 + vallen + 1); 1203 memcpy (alloc_value, v->value, oldlen); 1204 alloc_value[oldlen] = ' '; 1205 memcpy (&alloc_value[oldlen + 1], val, vallen + 1); 1206 1207 if (tp) 1208 free (tp); 1117 1209 } 1118 1210 } … … 1222 1314 else 1223 1315 { 1224 if (alloc_value) 1225 free (alloc_value); 1316 char *tp = alloc_value; 1226 1317 1227 1318 alloc_value = allocated_variable_expand (p); 1319 1228 1320 if (find_and_set_default_shell (alloc_value)) 1229 1321 { … … 1238 1330 else 1239 1331 v = lookup_variable (varname, strlen (varname)); 1332 1333 if (tp) 1334 free (tp); 1240 1335 } 1241 1336 } … … 1264 1359 1265 1360 1266 /* Try to interpret LINE (a null-terminated string) as a variable definition. 1267 1268 ORIGIN may be o_file, o_override, o_env, o_env_override, 1269 or o_command specifying that the variable definition comes 1270 from a makefile, an override directive, the environment with 1271 or without the -e switch, or the command line. 1272 1273 See the comments for parse_variable_definition(). 1274 1275 If LINE was recognized as a variable definition, a pointer to its `struct 1276 variable' is returned. If LINE is not a variable definition, NULL is 1277 returned. */ 1278 1279 struct variable * 1280 parse_variable_definition (struct variable *v, char *line) 1281 { 1282 register int c; 1283 register char *p = line; 1284 register char *beg; 1285 register char *end; 1286 enum variable_flavor flavor = f_bogus; 1287 char *name; 1361 /* Parse P (a null-terminated string) as a variable definition. 1362 1363 If it is not a variable definition, return NULL. 1364 1365 If it is a variable definition, return a pointer to the char after the 1366 assignment token and set *FLAVOR to the type of variable assignment. */ 1367 1368 char * 1369 parse_variable_definition (const char *p, enum variable_flavor *flavor) 1370 { 1371 int wspace = 0; 1372 1373 p = next_token (p); 1288 1374 1289 1375 while (1) 1290 1376 { 1291 c = *p++; 1377 int c = *p++; 1378 1379 /* If we find a comment or EOS, it's not a variable definition. */ 1292 1380 if (c == '\0' || c == '#') 1293 return 0; 1294 if (c == '=') 1381 return NULL; 1382 1383 if (c == '$') 1295 1384 { 1296 end = p - 1; 1297 flavor = f_recursive; 1298 break; 1299 } 1300 else if (c == ':') 1301 if (*p == '=') 1302 { 1303 end = p++ - 1; 1304 flavor = f_simple; 1305 break; 1306 } 1307 else 1308 /* A colon other than := is a rule line, not a variable defn. */ 1309 return 0; 1310 else if (c == '+' && *p == '=') 1311 { 1312 end = p++ - 1; 1313 flavor = f_append; 1314 break; 1315 } 1316 else if (c == '?' && *p == '=') 1317 { 1318 end = p++ - 1; 1319 flavor = f_conditional; 1320 break; 1321 } 1322 else if (c == '$') 1323 { 1324 /* This might begin a variable expansion reference. Make sure we 1325 don't misrecognize chars inside the reference as =, := or +=. */ 1385 /* This begins a variable expansion reference. Make sure we don't 1386 treat chars inside the reference as assignment tokens. */ 1326 1387 char closeparen; 1327 1388 int count; … … 1332 1393 closeparen = '}'; 1333 1394 else 1334 continue; /* Nope. */ 1395 /* '$$' or '$X'. Either way, nothing special to do here. */ 1396 continue; 1335 1397 1336 1398 /* P now points past the opening paren or brace. … … 1347 1409 } 1348 1410 } 1411 continue; 1349 1412 } 1350 } 1351 v->flavor = flavor; 1413 1414 /* If we find whitespace skip it, and remember we found it. */ 1415 if (isblank ((unsigned char)c)) 1416 { 1417 wspace = 1; 1418 p = next_token (p); 1419 c = *p; 1420 if (c == '\0') 1421 return NULL; 1422 ++p; 1423 } 1424 1425 1426 if (c == '=') 1427 { 1428 *flavor = f_recursive; 1429 return (char *)p; 1430 } 1431 1432 /* Match assignment variants (:=, +=, ?=) */ 1433 if (*p == '=') 1434 { 1435 switch (c) 1436 { 1437 case ':': 1438 *flavor = f_simple; 1439 break; 1440 case '+': 1441 *flavor = f_append; 1442 break; 1443 case '?': 1444 *flavor = f_conditional; 1445 break; 1446 default: 1447 /* If we skipped whitespace, non-assignments means no var. */ 1448 if (wspace) 1449 return NULL; 1450 1451 /* Might be assignment, or might be $= or #=. Check. */ 1452 continue; 1453 } 1454 return (char *)++p; 1455 } 1456 else if (c == ':') 1457 /* A colon other than := is a rule line, not a variable defn. */ 1458 return NULL; 1459 1460 /* If we skipped whitespace, non-assignments means no var. */ 1461 if (wspace) 1462 return NULL; 1463 } 1464 1465 return (char *)p; 1466 } 1467 1468 1469 /* Try to interpret LINE (a null-terminated string) as a variable definition. 1470 1471 If LINE was recognized as a variable definition, a pointer to its `struct 1472 variable' is returned. If LINE is not a variable definition, NULL is 1473 returned. */ 1474 1475 struct variable * 1476 assign_variable_definition (struct variable *v, char *line) 1477 { 1478 char *beg; 1479 char *end; 1480 enum variable_flavor flavor; 1481 char *name; 1352 1482 1353 1483 beg = next_token (line); 1484 line = parse_variable_definition (beg, &flavor); 1485 if (!line) 1486 return NULL; 1487 1488 end = line - (flavor == f_recursive ? 1 : 2); 1354 1489 while (end > beg && isblank ((unsigned char)end[-1])) 1355 1490 --end; 1356 p = next_token (p); 1357 v->value = p; 1491 line = next_token (line); 1492 v->value = line; 1493 v->flavor = flavor; 1358 1494 1359 1495 /* Expand the name, so "$(foo)bar = baz" works. */ … … 1377 1513 or without the -e switch, or the command line. 1378 1514 1379 See the comments for parse_variable_definition().1515 See the comments for assign_variable_definition(). 1380 1516 1381 1517 If LINE was recognized as a variable definition, a pointer to its `struct … … 1395 1531 v.fileinfo.filenm = 0; 1396 1532 1397 if (! parse_variable_definition (&v, line))1533 if (!assign_variable_definition (&v, line)) 1398 1534 return 0; 1399 1535 … … 1445 1581 fputs ("# ", stdout); 1446 1582 fputs (origin, stdout); 1583 if (v->private_var) 1584 fputs (" private", stdout); 1447 1585 if (v->fileinfo.filenm) 1448 1586 printf (_(" (from `%s', line %lu)"), … … 1456 1594 else 1457 1595 { 1458 registerchar *p;1596 char *p; 1459 1597 1460 1598 printf ("%s %s= ", v->name, v->recursive ? v->append ? "+" : "" : ":"); … … 1554 1692 */ 1555 1693 convert_Path_to_windows32 (path, ';'); 1556 environ_path = xstrdup (concat ( "PATH", "=", path));1694 environ_path = xstrdup (concat (3, "PATH", "=", path)); 1557 1695 putenv (environ_path); 1558 1696 free (path); -
vendor/gnumake/current/variable.h
r1989 r2596 1 1 /* Definitions for using variables in GNU Make. 2 2 Copyright (C) 1988, 1989, 1990, 1991, 1992, 1993, 1994, 1995, 1996, 1997, 3 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007 Free Software4 Foundation, Inc.3 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 4 2010 Free Software Foundation, Inc. 5 5 This file is part of GNU Make. 6 6 … … 60 60 unsigned int conditional:1; /* Nonzero if set with a ?=. */ 61 61 unsigned int per_target:1; /* Nonzero if a target-specific variable. */ 62 unsigned int special:1; /* Nonzero if this is a special variable. */62 unsigned int special:1; /* Nonzero if this is a special variable. */ 63 63 unsigned int exportable:1; /* Nonzero if the variable _could_ be 64 64 exported. */ 65 65 unsigned int expanding:1; /* Nonzero if currently being expanded. */ 66 unsigned int private_var:1; /* Nonzero avoids inheritance of this 67 target-specific variable. */ 66 68 unsigned int exp_count:EXP_COUNT_BITS; 67 69 /* If >1, allow this many self-referential … … 93 95 struct variable_set_list *next; /* Link in the chain. */ 94 96 struct variable_set *set; /* Variable set. */ 97 int next_is_parent; /* True if next is a parent target. */ 95 98 }; 96 99 … … 108 111 extern char *variable_buffer; 109 112 extern struct variable_set_list *current_variable_set_list; 113 extern struct variable *default_goal_var; 110 114 111 115 /* expand.c */ … … 152 156 enum variable_flavor flavor, 153 157 int target_var); 154 struct variable *parse_variable_definition (struct variable *v, char *line); 158 char *parse_variable_definition (const char *line, 159 enum variable_flavor *flavor); 160 struct variable *assign_variable_definition (struct variable *v, char *line); 155 161 struct variable *try_variable_definition (const struct floc *flocp, char *line, 156 162 enum variable_origin origin, … … 175 181 current_variable_set_list->set,NILF) 176 182 183 /* Define a variable with a constant name in the current variable set. */ 184 185 #define define_variable_cname(n,v,o,r) \ 186 define_variable_in_set((n),(sizeof (n) - 1),(v),(o),(r),\ 187 current_variable_set_list->set,NILF) 188 177 189 /* Define a variable with a location in the current variable set. */ 178 190 … … 190 202 #define define_variable_for_file(n,l,v,o,r,f) \ 191 203 define_variable_in_set((n),(l),(v),(o),(r),(f)->variables->set,NILF) 204 205 void undefine_variable_in_set (const char *name, unsigned int length, 206 enum variable_origin origin, 207 struct variable_set *set); 208 209 /* Remove variable from the current variable set. */ 210 211 #define undefine_variable_global(n,l,o) \ 212 undefine_variable_in_set((n),(l),(o),NULL) 192 213 193 214 /* Warn that NAME is an undefined variable. */ -
vendor/gnumake/current/version.c
r1989 r2596 1 1 /* Record version and build host architecture for GNU make. 2 2 Copyright (C) 1988, 1989, 1990, 1991, 1992, 1993, 1994, 1995, 1996, 1997, 3 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007 Free Software4 Foundation, Inc.3 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 4 2010 Free Software Foundation, Inc. 5 5 This file is part of GNU Make. 6 6 -
vendor/gnumake/current/vmsdir.h
r1989 r2596 1 1 /* dirent.h for vms 2 2 Copyright (C) 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006, 3 2007 Free Software Foundation, Inc.3 2007, 2008, 2009, 2010 Free Software Foundation, Inc. 4 4 This file is part of GNU Make. 5 5 -
vendor/gnumake/current/vmsfunctions.c
r1989 r2596 1 1 /* VMS functions 2 2 Copyright (C) 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006, 3 2007 Free Software Foundation, Inc.3 2007, 2008, 2009, 2010 Free Software Foundation, Inc. 4 4 This file is part of GNU Make. 5 5 … … 35 35 opendir (char *dspec) 36 36 { 37 struct DIR *dir = (struct DIR *)xmalloc (sizeof (struct DIR));38 struct NAM *dnam = (struct NAM *)xmalloc (sizeof (struct NAM));37 struct DIR *dir = xcalloc (sizeof (struct DIR)); 38 struct NAM *dnam = xmalloc (sizeof (struct NAM)); 39 39 struct FAB *dfab = &dir->fab; 40 40 char *searchspec = xmalloc (MAXNAMLEN + 1); 41 42 memset (dir, 0, sizeof *dir);43 41 44 42 *dfab = cc$rms_fab; … … 92 90 if (!((i = sys$search (dfab)) & 1)) 93 91 { 94 DB (DB_VERBOSE, (_("sys$search failed with %d\n"), i));92 DB (DB_VERBOSE, (_("sys$search() failed with %d\n"), i)); 95 93 return (NULL); 96 94 } … … 142 140 } 143 141 142 #if 0 143 /* 144 * Is this used? I don't see any reference, so I suggest to remove it. 145 */ 144 146 int 145 147 vms_stat (char *name, struct stat *buf) … … 238 240 return 0; 239 241 } 242 #endif 240 243 241 244 char * -
vendor/gnumake/current/vmsify.c
r1989 r2596 1 1 /* vmsify.c -- Module for vms <-> unix file name conversion 2 2 Copyright (C) 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006, 3 2007 Free Software Foundation, Inc.3 2007, 2008, 2009, 2010 Free Software Foundation, Inc. 4 4 This file is part of GNU Make. 5 5 … … 121 121 char *s; 122 122 123 INIT_DSC_CSTRING (name_dsc, name); 123 /* 124 * the string isn't changed, but there is no string descriptor with 125 * "const char *dsc$a_pointer" 126 */ 127 INIT_DSC_CSTRING (name_dsc, (char *)name); 124 128 125 129 stat = lib$sys_trnlog (&name_dsc, &resltlen, &reslt_dsc); … … 228 232 int as_dir; 229 233 int count; 234 const char *s; 235 const char *s1; 236 const char *s2; 230 237 231 238 if (name == 0) … … 240 247 if (t != 0) 241 248 { 242 const char *s1;243 const char *s2;249 // const char *s1; 250 // const char *s2; 244 251 245 252 if (type == 1) … … 273 280 if (t != 0) 274 281 { 275 const char *s; 276 const char *s1 = strchr (t+1, '['); 282 // const char *s; 283 // const char *s1 = strchr (t+1, '['); 284 s1 = strchr (t+1, '['); 277 285 if (s1 == 0) 278 286 { … … 389 397 case 3: /* '//' at start */ 390 398 { 391 const char *s;392 const char *s1;399 // const char *s; 400 // const char *s1; 393 401 char *vp; 394 402 while (*fptr == '/') /* collapse all '/' */ -
vendor/gnumake/current/vmsjobs.c
- Property svn:keywords deleted
r1989 r2596 3 3 4 4 Copyright (C) 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006, 5 2007 Free Software Foundation, Inc.5 2007, 2008, 2009, 2010 Free Software Foundation, Inc. 6 6 This file is part of GNU Make. 7 7 … … 111 111 } 112 112 113 /* This is called as an AST when a child process dies (it won't get 114 interrupted by anything except a higher level AST). 113 static int ctrlYPressed= 0; 114 /* This is called at main or AST level. It is at AST level for DONTWAITFORCHILD 115 and at main level otherwise. In any case it is called when a child process 116 terminated. At AST level it won't get interrupted by anything except a 117 inner mode level AST. 115 118 */ 116 119 int … … 124 127 125 128 lib$free_ef(&child->efn); 129 if (child->comname) 130 { 131 if (!ISDB (DB_JOBS)&&!ctrlYPressed) 132 unlink (child->comname); 133 free (child->comname); 134 } 126 135 127 136 (void) sigblock (fatal_signal_mask); … … 220 229 static int oldCtrlMask; 221 230 static int setupYAstTried= 0; 222 static int pidToAbort= 0; 223 static int chan= 0; 231 static unsigned short int chan= 0; 224 232 225 233 static void … … 229 237 } 230 238 231 static void232 ast Handler (void)239 static int 240 astYHandler (void) 233 241 { 234 if (pidToAbort) {235 sys$forcex (&pidToAbort, 0, SS$_ABORT);236 pidToAbort= 0;237 }242 struct child *c; 243 for (c = children; c != 0; c = c->next) 244 sys$delprc (&c->pid, 0, 0); 245 ctrlYPressed= 1; 238 246 kill (getpid(),SIGQUIT); 247 return SS$_NORMAL; 239 248 } 240 249 … … 248 257 int dvi; 249 258 } iosb; 259 unsigned short int loc_chan; 250 260 251 261 setupYAstTried++; 252 262 253 if (!chan) { 254 status= sys$assign(&inputDsc,&chan,0,0); 263 if (chan) 264 loc_chan= chan; 265 else { 266 status= sys$assign(&inputDsc,&loc_chan,0,0); 255 267 if (!(status&SS$_NORMAL)) { 256 268 lib$signal(status); … … 258 270 } 259 271 } 260 status= sys$qiow (0, chan, IO$_SETMODE|IO$M_CTRLYAST,&iosb,0,0, 261 astHandler,0,0,0,0,0); 262 if (status==SS$_NORMAL) 263 status= iosb.status; 264 if (status==SS$_ILLIOFUNC || status==SS$_NOPRIV) { 265 sys$dassgn(chan); 266 #ifdef CTRLY_ENABLED_ANYWAY 267 fprintf (stderr, 268 _("-warning, CTRL-Y will leave sub-process(es) around.\n")); 269 #else 270 return; 271 #endif 272 } 273 else if (!(status&SS$_NORMAL)) { 274 sys$dassgn(chan); 275 lib$signal(status); 272 status= sys$qiow (0, loc_chan, IO$_SETMODE|IO$M_CTRLYAST,&iosb,0,0, 273 astYHandler,0,0,0,0,0); 274 if (status==SS$_NORMAL) 275 status= iosb.status; 276 if (status!=SS$_NORMAL) { 277 if (!chan) 278 sys$dassgn(loc_chan); 279 if (status!=SS$_ILLIOFUNC && status!=SS$_NOPRIV) 280 lib$signal(status); 276 281 return; 277 282 } … … 288 293 return; 289 294 } 295 if (!chan) 296 chan = loc_chan; 290 297 } 291 298 … … 300 307 static struct dsc$descriptor_s efiledsc; 301 308 int have_redirection = 0; 309 int have_append = 0; 302 310 int have_newline = 0; 303 311 … … 306 314 char *cmd = alloca (strlen (argv) + 512), *p, *q; 307 315 char ifile[256], ofile[256], efile[256]; 308 char *comname = 0;316 int comnamelen; 309 317 char procname[100]; 310 318 int in_string; … … 315 323 ofile[0] = 0; 316 324 efile[0] = 0; 325 child->comname = NULL; 317 326 318 327 DB (DB_JOBS, ("child_execute_job (%s)\n", argv)); … … 384 393 else 385 394 { 395 if (*(p+1) == '>') 396 { 397 have_append = 1; 398 p += 1; 399 } 386 400 p = vms_redirect (&ofiledsc, ofile, p); 387 401 } … … 482 496 } 483 497 484 outfile = open_tmpfile (&c omname, "sys$scratch:CMDXXXXXX.COM");498 outfile = open_tmpfile (&child->comname, "sys$scratch:CMDXXXXXX.COM"); 485 499 if (outfile == 0) 486 500 pfatal_with_name (_("fopen (temporary file)")); 501 comnamelen = strlen (child->comname); 487 502 488 503 if (ifile[0]) … … 502 517 if (ofile[0]) 503 518 { 504 fprintf (outfile, "$ define sys$output %s\n", ofile); 505 DB (DB_JOBS, (_("Redirected output to %s\n"), ofile)); 506 ofiledsc.dsc$w_length = 0; 519 if (have_append) 520 { 521 fprintf (outfile, "$ set noon\n"); 522 fprintf (outfile, "$ define sys$output %.*s\n", comnamelen-3, child->comname); 523 DB (DB_JOBS, (_("Append output to %s\n"), ofile)); 524 ofiledsc.dsc$w_length = 0; 525 } 526 else 527 { 528 fprintf (outfile, "$ define sys$output %s\n", ofile); 529 DB (DB_JOBS, (_("Redirected output to %s\n"), ofile)); 530 ofiledsc.dsc$w_length = 0; 531 } 507 532 } 508 533 … … 559 584 } 560 585 561 fwrite (p, 1, q - p, outfile); 586 if (*p) 587 { 588 fwrite (p, 1, --q - p, outfile); 562 589 fputc ('\n', outfile); 590 } 591 592 if (have_append) 593 { 594 fprintf (outfile, "$ deassign sys$output ! 'f$verify(0)\n"); 595 fprintf (outfile, "$ append:=append\n"); 596 fprintf (outfile, "$ delete:=delete\n"); 597 fprintf (outfile, "$ append/new %.*s %s\n", comnamelen-3, child->comname, ofile); 598 fprintf (outfile, "$ delete %.*s;*\n", comnamelen-3, child->comname); 599 DB (DB_JOBS, (_("Append %.*s and cleanup\n"), comnamelen-3, child->comname)); 600 } 563 601 564 602 fclose (outfile); 565 603 566 sprintf (cmd, "$ @%s", c omname);604 sprintf (cmd, "$ @%s", child->comname); 567 605 568 606 DB (DB_JOBS, (_("Executing %s instead\n"), cmd)); … … 579 617 status = lib$get_ef ((unsigned long *)&child->efn); 580 618 if (!(status & 1)) 581 return 0; 619 { 620 if (child->comname) 621 { 622 if (!ISDB (DB_JOBS)) 623 unlink (child->comname); 624 free (child->comname); 625 } 626 return 0; 627 } 582 628 } 583 629 … … 648 694 if (status & 1) 649 695 { 650 pidToAbort= child->pid;651 696 status= sys$waitfr (child->efn); 652 pidToAbort= 0;653 697 vmsHandleChildTerm(child); 654 698 } … … 678 722 } 679 723 680 if (comname && !ISDB (DB_JOBS))681 unlink (comname);682 683 724 return (status & 1); 684 725 } -
vendor/gnumake/current/vpath.c
r1989 r2596 1 1 /* Implementation of pattern-matching file search paths for GNU Make. 2 2 Copyright (C) 1988, 1989, 1990, 1991, 1992, 1993, 1994, 1995, 1996, 1997, 3 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007 Free Software4 Foundation, Inc.3 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 4 2010 Free Software Foundation, Inc. 5 5 This file is part of GNU Make. 6 6 … … 140 140 141 141 142 /* Construct the VPATH listing for the pattern and searchpathgiven.142 /* Construct the VPATH listing for the PATTERN and DIRPATH given. 143 143 144 144 This function is called to generate selective VPATH lists and also for … … 148 148 variable. 149 149 150 If SEARCHPATH is nil, remove all previous listings with the same150 If DIRPATH is nil, remove all previous listings with the same 151 151 pattern. If PATTERN is nil, remove all VPATH listings. Existing 152 and readable directories that are not "." given in the searchpath152 and readable directories that are not "." given in the DIRPATH 153 153 separated by the path element separator (defined in make.h) are 154 154 loaded into the directory hash table if they are not there already … … 195 195 196 196 /* Free its unused storage. */ 197 free (path->searchpath); 197 /* MSVC erroneously warns without a cast here. */ 198 free ((void *)path->searchpath); 198 199 free (path); 199 200 } … … 300 301 else 301 302 /* There were no entries, so free whatever space we allocated. */ 302 free (vpath); 303 /* MSVC erroneously warns without a cast here. */ 304 free ((void *)vpath); 303 305 } 304 306 … … 325 327 FILE exists. If it is found, we return a cached name of the existing file 326 328 and set *MTIME_PTR (if MTIME_PTR is not NULL) to its modtime (or zero if no 327 stat call was done). Otherwise we return NULL. */ 329 stat call was done). Also set the matching directory index in PATH_INDEX 330 if it is not NULL. Otherwise we return NULL. */ 328 331 329 332 static const char * 330 333 selective_vpath_search (struct vpath *path, const char *file, 331 FILE_TIMESTAMP *mtime_ptr )334 FILE_TIMESTAMP *mtime_ptr, unsigned int* path_index) 332 335 { 333 336 int not_target; … … 509 512 /* Store the name we found and return it. */ 510 513 514 if (path_index) 515 *path_index = i; 516 511 517 return strcache_add_len (name, (p + 1 - name) + flen); 512 518 } … … 520 526 exists. If it is found, return the cached name of an existing file, and 521 527 set *MTIME_PTR (if MTIME_PTR is not NULL) to its modtime (or zero if no 522 stat call was done). Otherwise we return 0. */ 528 stat call was done). Also set the matching directory index in VPATH_INDEX 529 and PATH_INDEX if they are not NULL. Otherwise we return 0. */ 523 530 524 531 const char * 525 vpath_search (const char *file, FILE_TIMESTAMP *mtime_ptr) 532 vpath_search (const char *file, FILE_TIMESTAMP *mtime_ptr, 533 unsigned int* vpath_index, unsigned int* path_index) 526 534 { 527 535 struct vpath *v; … … 537 545 return 0; 538 546 547 if (vpath_index) 548 { 549 *vpath_index = 0; 550 *path_index = 0; 551 } 552 539 553 for (v = vpaths; v != 0; v = v->next) 540 if (pattern_matches (v->pattern, v->percent, file)) 541 { 542 const char *p = selective_vpath_search (v, file, mtime_ptr); 543 if (p) 544 return p; 545 } 554 { 555 if (pattern_matches (v->pattern, v->percent, file)) 556 { 557 const char *p = selective_vpath_search ( 558 v, file, mtime_ptr, path_index); 559 if (p) 560 return p; 561 } 562 563 if (vpath_index) 564 ++*vpath_index; 565 } 566 546 567 547 568 if (general_vpath != 0) 548 569 { 549 const char *p = selective_vpath_search (general_vpath, file, mtime_ptr); 570 const char *p = selective_vpath_search ( 571 general_vpath, file, mtime_ptr, path_index); 550 572 if (p) 551 573 return p; … … 554 576 return 0; 555 577 } 578 579 580 556 581 557 582 -
vendor/gnumake/current/w32/Makefile.am
- Property svn:keywords deleted
r1989 r2596 1 1 # Makefile.am to create libw32.a for mingw32 host. 2 2 # Copyright (C) 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006, 3 # 2007 Free Software Foundation, Inc.3 # 2007, 2008, 2009, 2010 Free Software Foundation, Inc. 4 4 # This file is part of GNU Make. 5 5 # -
vendor/gnumake/current/w32/compat/dirent.c
r1989 r2596 1 1 /* Directory entry code for Window platforms. 2 2 Copyright (C) 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005, 3 2006, 2007 Free Software Foundation, Inc.3 2006, 2007, 2008, 2009, 2010 Free Software Foundation, Inc. 4 4 This file is part of GNU Make. 5 5 … … 17 17 18 18 19 #include <config.h> 19 20 #include <sys/types.h> 20 21 #include <sys/stat.h> … … 133 134 134 135 /* fill in struct dirent values */ 135 pDir->dir_sdReturn.d_ino = -1;136 pDir->dir_sdReturn.d_ino = (ino_t)-1; 136 137 strcpy(pDir->dir_sdReturn.d_name, wfdFindData.cFileName); 137 138 -
vendor/gnumake/current/w32/include/dirent.h
r1989 r2596 1 1 /* Windows version of dirent.h 2 2 Copyright (C) 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006, 3 2007 Free Software Foundation, Inc.3 2007, 2008, 2009, 2010 Free Software Foundation, Inc. 4 4 This file is part of GNU Make. 5 5 -
vendor/gnumake/current/w32/include/pathstuff.h
r1989 r2596 1 1 /* Definitions for Windows path manipulation. 2 2 Copyright (C) 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006, 3 2007 Free Software Foundation, Inc.3 2007, 2008, 2009, 2010 Free Software Foundation, Inc. 4 4 This file is part of GNU Make. 5 5 -
vendor/gnumake/current/w32/include/sub_proc.h
r1989 r2596 1 1 /* Definitions for Windows process invocation. 2 2 Copyright (C) 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005, 3 2006, 2007 Free Software Foundation, Inc.3 2006, 2007, 2008, 2009, 2010 Free Software Foundation, Inc. 4 4 This file is part of GNU Make. 5 5 … … 22 22 * Component Name: 23 23 * 24 * $Date: 20 07/10/24 20:06:32$24 * $Date: 2010/07/13 01:20:43 $ 25 25 * 26 26 * $Source: /sources/make/make/w32/include/sub_proc.h,v $ 27 27 * 28 * $Id: sub_proc.h,v 1.1 0 2007/10/24 20:06:32 elizExp $28 * $Id: sub_proc.h,v 1.12 2010/07/13 01:20:43 psmith Exp $ 29 29 */ 30 30 -
vendor/gnumake/current/w32/include/w32err.h
r1989 r2596 1 1 /* Definitions for Windows error handling. 2 2 Copyright (C) 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005, 3 2006, 2007 Free Software Foundation, Inc.3 2006, 2007, 2008, 2009, 2010 Free Software Foundation, Inc. 4 4 This file is part of GNU Make. 5 5 -
vendor/gnumake/current/w32/pathstuff.c
r1989 r2596 1 1 /* Path conversion for Windows pathnames. 2 2 Copyright (C) 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006, 3 2007 Free Software Foundation, Inc.3 2007, 2008, 2009, 2010 Free Software Foundation, Inc. 4 4 This file is part of GNU Make. 5 5 … … 16 16 this program. If not, see <http://www.gnu.org/licenses/>. */ 17 17 18 #include "make.h" 18 19 #include <string.h> 19 20 #include <stdlib.h> 20 #include "make.h"21 21 #include "pathstuff.h" 22 22 … … 50 50 51 51 /* is this a multi-element Path ? */ 52 /* FIXME: Perhaps use ":;\"" in strpbrk to convert all quotes to 53 delimiters as well, as a way to handle quoted directories in 54 PATH? */ 52 55 for (p = Path, etok = strpbrk(p, ":;"); 53 56 etok; … … 75 78 ; 76 79 etok = strpbrk(p, ":;"); /* find next delimiter */ 77 *etok = to_delim; 78 p = ++etok; 80 if (etok) { 81 *etok = to_delim; 82 p = ++etok; 83 } else 84 p += strlen(p); 79 85 } else { 80 86 /* found another one, no drive letter */ -
vendor/gnumake/current/w32/subproc/NMakefile
r1989 r2596 3 3 # 4 4 # Copyright (C) 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005, 5 # 2006, 2007 Free Software Foundation, Inc.5 # 2006, 2007, 2008, 2009, 2010 Free Software Foundation, Inc. 6 6 # This file is part of GNU Make. 7 7 # -
vendor/gnumake/current/w32/subproc/build.bat
r1991 r2596 19 19 @echo off 20 20 rem Copyright (C) 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, 21 rem 2005, 2006, 2007 Free Software Foundation, Inc.21 rem 2005, 2006, 2007, 2008, 2009, 2010 Free Software Foundation, Inc. 22 22 rem This file is part of GNU Make. 23 23 rem -
vendor/gnumake/current/w32/subproc/misc.c
r1989 r2596 1 1 /* Process handling for Windows 2 2 Copyright (C) 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005, 3 2006, 2007 Free Software Foundation, Inc.3 2006, 2007, 2008, 2009, 2010 Free Software Foundation, Inc. 4 4 This file is part of GNU Make. 5 5 … … 16 16 this program. If not, see <http://www.gnu.org/licenses/>. */ 17 17 18 #include <config.h> 18 19 #include <stddef.h> 19 20 #include <stdlib.h> … … 78 79 } 79 80 80 81 free(tmp); 81 82 return TRUE; 82 83 } -
vendor/gnumake/current/w32/subproc/proc.h
r1989 r2596 1 1 /* Definitions for Windows 2 2 Copyright (C) 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005, 3 2006, 2007 Free Software Foundation, Inc.3 2006, 2007, 2008, 2009, 2010 Free Software Foundation, Inc. 4 4 This file is part of GNU Make. 5 5 -
vendor/gnumake/current/w32/subproc/sub_proc.c
r1989 r2596 1 1 /* Process handling for Windows. 2 2 Copyright (C) 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005, 3 2006, 2007 Free Software Foundation, Inc.3 2006, 2007, 2008, 2009, 2010 Free Software Foundation, Inc. 4 4 This file is part of GNU Make. 5 5 … … 16 16 this program. If not, see <http://www.gnu.org/licenses/>. */ 17 17 18 #include <config.h> 18 19 #include <stdlib.h> 19 20 #include <stdio.h> 21 #ifdef _MSC_VER 22 # include <stddef.h> /* for intptr_t */ 23 #else 24 # include <stdint.h> 25 #endif 20 26 #include <process.h> /* for msvc _beginthreadex, _endthreadex */ 21 27 #include <signal.h> … … 25 31 #include "proc.h" 26 32 #include "w32err.h" 27 #include "config.h"28 33 #include "debug.h" 29 34 30 35 static char *make_command_line(char *shell_name, char *exec_path, char **argv); 36 extern char *xmalloc (unsigned int); 31 37 32 38 typedef struct sub_process_t { 33 int sv_stdin[2];34 int sv_stdout[2];35 int sv_stderr[2];39 intptr_t sv_stdin[2]; 40 intptr_t sv_stdout[2]; 41 intptr_t sv_stderr[2]; 36 42 int using_pipes; 37 43 char *inp; … … 41 47 char * volatile errp; 42 48 volatile DWORD errcnt; 43 int pid;49 pid_t pid; 44 50 int exit_code; 45 51 int signal; … … 310 316 return((HANDLE)pproc); 311 317 } 312 pproc->sv_stdin[0] = (int ) stdin_pipes[0];313 pproc->sv_stdin[1] = (int ) stdin_pipes[1];314 pproc->sv_stdout[0] = (int ) stdout_pipes[0];315 pproc->sv_stdout[1] = (int ) stdout_pipes[1];316 pproc->sv_stderr[0] = (int ) stderr_pipes[0];317 pproc->sv_stderr[1] = (int ) stderr_pipes[1];318 pproc->sv_stdin[0] = (intptr_t) stdin_pipes[0]; 319 pproc->sv_stdin[1] = (intptr_t) stdin_pipes[1]; 320 pproc->sv_stdout[0] = (intptr_t) stdout_pipes[0]; 321 pproc->sv_stdout[1] = (intptr_t) stdout_pipes[1]; 322 pproc->sv_stderr[0] = (intptr_t) stderr_pipes[0]; 323 pproc->sv_stderr[1] = (intptr_t) stderr_pipes[1]; 318 324 319 325 pproc->using_pipes = 1; … … 337 343 * pipe, bypassing pipes altogether. 338 344 */ 339 pproc->sv_stdin[1] = (int ) stdinh;340 pproc->sv_stdout[1] = (int ) stdouth;341 pproc->sv_stderr[1] = (int ) stderrh;345 pproc->sv_stdin[1] = (intptr_t) stdinh; 346 pproc->sv_stdout[1] = (intptr_t) stdouth; 347 pproc->sv_stderr[1] = (intptr_t) stderrh; 342 348 343 349 pproc->last_err = pproc->lerrno = 0; … … 348 354 349 355 static HANDLE 350 find_file(char *exec_path, LPOFSTRUCT file_info) 356 find_file(const char *exec_path, const char *path_var, 357 char *full_fname, DWORD full_len) 351 358 { 352 359 HANDLE exec_handle; 353 360 char *fname; 354 361 char *ext; 355 356 fname = malloc(strlen(exec_path) + 5); 362 DWORD req_len; 363 int i; 364 static const char *extensions[] = 365 /* Should .com come before no-extension case? */ 366 { ".exe", ".cmd", ".bat", "", ".com", NULL }; 367 368 fname = xmalloc(strlen(exec_path) + 5); 357 369 strcpy(fname, exec_path); 358 370 ext = fname + strlen(fname); 359 371 360 strcpy(ext, ".exe"); 361 if ((exec_handle = (HANDLE)OpenFile(fname, file_info, 362 OF_READ | OF_SHARE_COMPAT)) != (HANDLE)HFILE_ERROR) { 363 free(fname); 364 return(exec_handle); 365 } 366 367 strcpy(ext, ".cmd"); 368 if ((exec_handle = (HANDLE)OpenFile(fname, file_info, 369 OF_READ | OF_SHARE_COMPAT)) != (HANDLE)HFILE_ERROR) { 370 free(fname); 371 return(exec_handle); 372 } 373 374 strcpy(ext, ".bat"); 375 if ((exec_handle = (HANDLE)OpenFile(fname, file_info, 376 OF_READ | OF_SHARE_COMPAT)) != (HANDLE)HFILE_ERROR) { 377 free(fname); 378 return(exec_handle); 379 } 380 381 /* should .com come before this case? */ 382 if ((exec_handle = (HANDLE)OpenFile(exec_path, file_info, 383 OF_READ | OF_SHARE_COMPAT)) != (HANDLE)HFILE_ERROR) { 384 free(fname); 385 return(exec_handle); 386 } 387 388 strcpy(ext, ".com"); 389 if ((exec_handle = (HANDLE)OpenFile(fname, file_info, 390 OF_READ | OF_SHARE_COMPAT)) != (HANDLE)HFILE_ERROR) { 391 free(fname); 392 return(exec_handle); 372 for (i = 0; extensions[i]; i++) { 373 strcpy(ext, extensions[i]); 374 if (((req_len = SearchPath (path_var, fname, NULL, full_len, 375 full_fname, NULL)) > 0 376 /* For compatibility with previous code, which 377 used OpenFile, and with Windows operation in 378 general, also look in various default 379 locations, such as Windows directory and 380 Windows System directory. Warning: this also 381 searches PATH in the Make's environment, which 382 might not be what the Makefile wants, but it 383 seems to be OK as a fallback, after the 384 previous SearchPath failed to find on child's 385 PATH. */ 386 || (req_len = SearchPath (NULL, fname, NULL, full_len, 387 full_fname, NULL)) > 0) 388 && req_len <= full_len 389 && (exec_handle = 390 CreateFile(full_fname, 391 GENERIC_READ, 392 FILE_SHARE_READ | FILE_SHARE_WRITE, 393 NULL, 394 OPEN_EXISTING, 395 FILE_ATTRIBUTE_NORMAL, 396 NULL)) != INVALID_HANDLE_VALUE) { 397 free(fname); 398 return(exec_handle); 399 } 393 400 } 394 401 395 402 free(fname); 396 return (exec_handle);403 return INVALID_HANDLE_VALUE; 397 404 } 398 405 … … 417 424 int file_not_found=0; 418 425 HANDLE exec_handle; 426 char exec_fname[MAX_PATH]; 427 const char *path_var = NULL; 428 char **ep; 419 429 char buf[256]; 420 430 DWORD bytes_returned; … … 424 434 PROCESS_INFORMATION procInfo; 425 435 char *envblk=NULL; 426 OFSTRUCT file_info;427 428 436 429 437 /* … … 434 442 * assume it's in the path somewhere (generally, the NT tools 435 443 * bin directory) 436 * We use OpenFile here because it is capable of searching the Path. 437 */ 438 439 exec_handle = find_file(exec_path, &file_info); 444 */ 445 446 /* Use the Makefile's value of PATH to look for the program to 447 execute, because it could be different from Make's PATH 448 (e.g., if the target sets its own value. */ 449 if (envp) 450 for (ep = envp; *ep; ep++) { 451 if (strncmp (*ep, "PATH=", 5) == 0 452 || strncmp (*ep, "Path=", 5) == 0) { 453 path_var = *ep + 5; 454 break; 455 } 456 } 457 exec_handle = find_file(exec_path, path_var, 458 exec_fname, sizeof(exec_fname)); 440 459 441 460 /* 442 * If we couldn't open the file, just assume that Windows 32 will be able443 * to find and execute it.444 */ 445 if (exec_handle == (HANDLE)HFILE_ERROR) {461 * If we couldn't open the file, just assume that Windows will be 462 * somehow able to find and execute it. 463 */ 464 if (exec_handle == INVALID_HANDLE_VALUE) { 446 465 file_not_found++; 447 466 } … … 497 516 command_line = make_command_line( shell_name, exec_path, argv); 498 517 else 499 command_line = make_command_line( shell_name, file_info.szPathName, 500 argv); 518 command_line = make_command_line( shell_name, exec_fname, argv); 501 519 502 520 if ( command_line == NULL ) { … … 518 536 exec_path = 0; /* Search for the program in %Path% */ 519 537 } else { 520 exec_path = file_info.szPathName;538 exec_path = exec_fname; 521 539 } 522 540 … … 563 581 } 564 582 565 pproc->pid = ( int)procInfo.hProcess;583 pproc->pid = (pid_t)procInfo.hProcess; 566 584 /* Close the thread handle -- we'll just watch the process */ 567 585 CloseHandle(procInfo.hThread); -
vendor/gnumake/current/w32/subproc/w32err.c
r1989 r2596 1 1 /* Error handling for Windows 2 2 Copyright (C) 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005, 3 2006, 2007 Free Software Foundation, Inc.3 2006, 2007, 2008, 2009, 2010 Free Software Foundation, Inc. 4 4 This file is part of GNU Make. 5 5
Note:
See TracChangeset
for help on using the changeset viewer.