Changeset 2596


Ignore:
Timestamp:
Jun 20, 2012, 12:44:52 AM (13 years ago)
Author:
bird
Message:

gnumake/current -> 3.82-cvs.

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  
    88
    99.*gdbinit
     10.gdb_history
    1011
    1112*.dep *.dvi *.toc *.aux *.log
  • vendor/gnumake/current/AUTHORS

    r1989 r2596  
    6767
    6868-------------------------------------------------------------------------------
    69 Copyright (C) 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007
    70 Free Software Foundation, Inc.
     69Copyright (C) 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007,
     702008, 2009, 2010 Free Software Foundation, Inc.
    7171This file is part of GNU Make.
    7272
  • vendor/gnumake/current/ChangeLog

    r1989 r2596  
     12010-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
     122010-07-24  Eli Zaretskii  <eliz@gnu.org>
     13
     14        * job.c (pid2str) [WINDOWS32]: Fix CPP conditionals for using %Id
     15        format.
     16
     172010-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
     502010-07-16  Boris Kolpackov  <boris@codesynthesis.com>
     51
     52        * misc.c (concat): Fix buffer overrun.
     53
     542010-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
     622010-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
     682010-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
     892010-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
     1192010-07-07  Paul Smith  <psmith@gnu.org>
     120
     121        * configure.in: Bump to a new prerelease version 3.81.91.
     122
     1232010-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
     1332010-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
     1482010-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
     1542010-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
     1602010-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
     1692009-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
     1782009-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
     2082009-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
     2282009-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
     2362009-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
     2642009-10-22  Boris Kolpackov  <boris@codesynthesis.com>
     265
     266        * read.c (read_all_makefiles): Mark the default makefile dependency
     267        dontcare.
     268
     2692009-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
     2762009-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
     2902009-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
     3082009-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
     3132009-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
     3192009-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
     3412009-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
     3472009-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
     3522009-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
     3722009-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
     3772009-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
     4092009-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
     4212009-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
     4262009-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
     4332009-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
     4432009-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
     4962009-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
     5232009-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
     5452009-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
     5502009-08-31  Eli Zaretskii  <eliz@gnu.org>
     551
     552        * function.c (windows32_openpipe): Update envp after calling
     553        sync_Path_environment.
     554
     5552009-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
     5652009-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
     5802009-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
     5852009-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
     5912009-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
     5962006-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
     6032009-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
     6112009-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
     6352009-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
     6542009-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
     6592009-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
     6822009-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
     7032009-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
     7172009-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
     7242009-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
     7332009-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
     7612009-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
     7692009-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
     7842009-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
     7892009-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
     8042009-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
     8092009-02-28  Ralf Wildenhues  <address@hidden>
     810
     811        * doc/make.texi (Instead of Execution): Document interaction of
     812        -t with phony targets.
     813
     8142009-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
     8292008-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
    18402008-09-30  Eli Zaretskii  <eliz@gnu.org>
    2841
     
    8161655
    8171656        * make.1: Fix some display errors and document all existing options.
    818         Patch provided by Mike Frysinger <vapier@gentoo.org>.
     1657        Patch by Mike Frysinger <vapier@gentoo.org>.
    8191658
    82016592005-12-11  Paul D. Smith  <psmith@gnu.org>
     
    31644003
    31654004
    3166 Copyright (C) 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007 Free Software
    3167 Foundation, Inc.
     4005Copyright (C) 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009 Free
     4006Software Foundation, Inc.
    31684007This file is part of GNU Make.
    31694008
  • vendor/gnumake/current/ChangeLog.1

    r1989 r2596  
    49844984
    49854985Copyright (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.
     49861998, 1999, 2000, 2001, 2002, 2003, 2005, 2006, 2007, 2008, 2009 Free
     4987Software Foundation, Inc.
    49884988This file is part of GNU Make.
    49894989
  • vendor/gnumake/current/Makefile.DOS.template

    r1989 r2596  
    33#
    44# 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.
    66# This file is part of GNU Make.
    77#
     
    8686man_MANS =      make.1
    8787
    88 INCLUDES =      -I$(srcdir)/glob -DLIBDIR=\"c:/djgpp/lib\" -DINCLUDEDIR=\"c:/djgpp/include\" -DLOCALEDIR=\"$(localedir)\"
     88INCLUDES =      -I$(srcdir)/glob -DLIBDIR=\"$(prefix)$(libdir)\" -DINCLUDEDIR=\"$(prefix)$(includedir)\" -DLOCALEDIR=\"$(prefix)$(localedir)\"
    8989
    9090BUILT_SOURCES = README build.sh-in
     
    9292EXTRA_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
    9393
    94 SUBDIRS =       glob
     94SUBDIRS =       glob doc
    9595mkinstalldirs = ${exec_prefix}/bin/gmkdir -p
    9696CONFIG_HEADER = config.h
     
    116116TEXI2DVI = texi2dvi
    117117TEXINFO_TEX = $(srcdir)/config/texinfo.tex
    118 INFO_DEPS = make.info
    119 DVIS = make.dvi
     118INFO_DEPS = doc/make.info
     119DVIS = doc/make.dvi
    120120TEXINFOS = doc/make.texi
    121121noinst_TEXINFOS = doc/fdl.texi doc/make-stds.texi
    122122man1dir = $(mandir)/man1
    123123MANS = $(man_MANS)
    124 
    125 TEXI2HTML = texi2html
    126 TEXI2HTML_FLAGS = -split_chapter
    127124
    128125NROFF = nroff
     
    192189# Documentation
    193190
    194 make.info: doc/make.texi
    195 make.dvi: doc/make.texi
     191make.info: make.texi
     192make.dvi: make.texi
     193make.ps: make.dvi make.texi
     194make.html: make.texi
    196195
    197196
     
    201200        @command.com /c if exist make.info* del make.info*
    202201        @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 ./$@
    204203
    205204.texi:
    206205        @command.com /c if exist make.info* del make.info*
    207206        @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 ./$@
    209208
    210209.texi.dvi:
    211         TEXINPUTS="$(srcdir)/doc;$$TEXINPUTS"    MAKEINFO='$(MAKEINFO) -I $(srcdir)/doc' $(TEXI2DVI) $<
     210        TEXINPUTS="$(srcdir);$$TEXINPUTS"    MAKEINFO='$(MAKEINFO) -I $(srcdir)' $(TEXI2DVI) $<
    212211
    213212.dvi.ps:
     
    216215# Other documentation formats
    217216
    218 html: make_1.html
    219 
    220 make_1.html: $(TEXINFOS) $(noinst_TEXINFOS)
    221         $(TEXI2HTML) $(TEXI2HTML_FLAGS) $(srcdir)/doc/make.texi
     217html: 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 ./$@
    222222
    223223install-info-am: $(INFO_DEPS)
    224224        @$(NORMAL_INSTALL)
    225225        $(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;  done
     226        @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
    227227        @$(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 : ; fi
     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    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
    229229
    230230uninstall-info:
     
    238238
    239239mostlyclean-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
    243246
    244247clean-aminfo:
     
    292295# a single directory, yell bloody murder.
    293296all-recursive:
    294 ifeq ($(words $(SUBDIRS)), 1)
     297ifeq ($(findstring glob, $(SUBDIRS)), glob)
    295298        @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
    301301endif
    302302
     
    311311mostlyclean-recursive clean-recursive distclean-recursive \
    312312maintainer-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
     313ifeq ($(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
    316318else
    317         @echo FATAL: There is more than one directory in "($(SUBDIRS))"
     319        @echo FATAL: There is more than two directory in "($(SUBDIRS))"
    318320        @$(EXIT_FAIL)
    319321endif
     
    323325
    324326tags-recursive:
    325 ifeq ($(words $(SUBDIRS)), 1)
     327ifeq ($(words $(SUBDIRS)), 2)
    326328        $(MAKE) tags-in-glob
    327329else
    328         @echo FATAL: There is more than one directory in "($(SUBDIRS))"
     330        @echo FATAL: There is more than two directory in "($(SUBDIRS))"
    329331        @$(EXIT_FAIL)
    330332endif
     
    377379        $(MAKE) top_distdir="$(top_distdir)" distdir="$(distdir)" dist-hook
    378380
    379 info: $(INFO_DEPS) info-recursive
    380 dvi: $(DVIS) dvi-recursive
     381info: info-recursive
     382info-recursive:
     383ifeq ($(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
     387endif
     388
     389dvi: dvi-recursive
     390dvi-recursive:
     391ifeq ($(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
     395endif
     396
     397ps: ps-recursive
     398ps-recursive:
     399ifeq ($(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
     403endif
     404
     405html-recursive:
     406ifeq ($(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
     410endif
     411
    381412check: all-am check-recursive check-local
    382413        @:
     
    385416        $(MAKE) all-recursive
    386417
    387 all-am: Makefile $(INFO_DEPS) $(PROGRAMS) config.h
     418all-am: Makefile $(PROGRAMS) config.h info
    388419
    389420install-exec-am: install-binPROGRAMS
  • vendor/gnumake/current/Makefile.am

    r1989 r2596  
    22#
    33# 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.
    55# This file is part of GNU Make.
    66#
  • vendor/gnumake/current/Makefile.ami

    r1989 r2596  
    55#
    66# 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.
    88# This file is part of GNU Make.
    99#
  • vendor/gnumake/current/NEWS

    r1989 r2596  
    11GNU make NEWS                                               -*-indented-text-*-
    22  History of user-visible changes.
    3   1 April 2006
     3  28 July 2010
    44
    55See the end of this file for copyrights and conditions.
     
    1111
    1212
    13 Version 3.81.90
     13Version 3.82
     14
     15A complete list of bugs fixed in this version is available here:
     16
     17http://sv.gnu.org/bugs/index.php?group=make&report_id=111&fix_release_id=104&set=custom
    1418
    1519* Compiling GNU make now requires a conforming ISO C 1989 compiler and
    1620  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.
    1776
    1877* New special variable: .RECIPEPREFIX allows you to reset the recipe
    1978  introduction character from the default (TAB) to something else.  The
    2079  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.
    24117
    25118
     
    60153
    61154* WARNING: Backward-incompatibility!
    62 
    63155  In order to comply with POSIX, the way in which GNU make processes
    64156  backslash-newline sequences in recipes has changed.  If your makefiles
     
    10591151-------------------------------------------------------------------------------
    10601152Copyright (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.
     11531998, 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009,
     11542010 Free Software Foundation, Inc.  This file is part of GNU Make.
    10641155
    10651156GNU Make is free software; you can redistribute it and/or modify it under the
  • vendor/gnumake/current/NMakefile.template

    r1989 r2596  
    55#
    66# 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.
    88# This file is part of GNU Make.
    99#
     
    3434
    3535LDFLAGS_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
    3837LDFLAGS_release = w32\subproc\WinRel\subproc.lib /NOLOGO /SUBSYSTEM:console\
    39         /INCREMENTAL:no /MACHINE:I386 /OUT:WinRel/make.exe
     38        /INCREMENTAL:no /OUT:WinRel/make.exe
    4039
    4140all: config.h subproc Release Debug
  • vendor/gnumake/current/README.Amiga

    r1989 r2596  
    6464-------------------------------------------------------------------------------
    6565Copyright (C) 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004,
    66 2005, 2006, 2007 Free Software Foundation, Inc.
     662005, 2006, 2007, 2008, 2009, 2010 Free Software Foundation, Inc.
    6767This file is part of GNU Make.
    6868
  • vendor/gnumake/current/README.DOS.template

    r1989 r2596  
    327327-------------------------------------------------------------------------------
    328328Copyright (C) 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005,
    329 2006, 2007 Free Software Foundation, Inc.
     3292006, 2007, 2008, 2009, 2010 Free Software Foundation, Inc.
    330330This file is part of GNU Make.
    331331
  • vendor/gnumake/current/README.OS2.template

    r1989 r2596  
    162162
    163163-------------------------------------------------------------------------------
    164 Copyright (C) 2003, 2004, 2005, 2006, 2007 Free Software Foundation, Inc.
     164Copyright (C) 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010 Free Software
     165Foundation, Inc.
    165166This file is part of GNU Make.
    166167
  • vendor/gnumake/current/README.W32.template

    r1989 r2596  
    275275-------------------------------------------------------------------------------
    276276Copyright (C) 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005,
    277 2006, 2007, 2008 Free Software Foundation, Inc.
     2772006, 2007, 2008, 2009, 2010 Free Software Foundation, Inc.
    278278This file is part of GNU Make.
    279279
  • vendor/gnumake/current/README.customs

    r1989 r2596  
    9898
    9999-------------------------------------------------------------------------------
    100 Copyright (C) 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007 Free
    101 Software Foundation, Inc.
     100Copyright (C) 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008,
     1012009, 2010 Free Software Foundation, Inc.
    102102This file is part of GNU Make.
    103103
  • vendor/gnumake/current/README.cvs

    r1989 r2596  
    22
    33-------------------------------------------------------------------------------
    4 Copyright (C) 2002, 2003, 2004, 2005, 2006, 2007 Free Software Foundation, Inc.
    5 This file is part of GNU Make.
     4Copyright (C) 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010 Free
     5Software Foundation, Inc.  This file is part of GNU Make.
    66
    77GNU Make is free software; you can redistribute it and/or modify it under the
     
    211211make check
    212212
     213Or, for a debugging version:
     214
     215autoreconf -i && ./configure CFLAGS=-g && make update && make && make check
     216
    213217Or, all-in-one:
    214218
  • vendor/gnumake/current/README.template

    r1989 r2596  
    174174-------------------------------------------------------------------------------
    175175Copyright (C) 1988, 1989, 1990, 1991, 1992, 1993, 1994, 1995, 1996, 1997,
    176 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007 Free Software
    177 Foundation, Inc.
     1761998, 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009,
     1772010 Free Software Foundation, Inc.
    178178This file is part of GNU Make.
    179179
  • vendor/gnumake/current/SMakefile.template

    r1989 r2596  
    55#
    66# 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.
    88# This file is part of GNU Make.
    99#
  • vendor/gnumake/current/TODO.private

    r1989 r2596  
    6666
    6767 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?
    7269
    7370 4) Provide a .TARGETS variable, containing the names of the targets
     
    130127
    131128-------------------------------------------------------------------------------
    132 Copyright (C) 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007
    133 Free Software Foundation, Inc.
     129Copyright (C) 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006,
     1302007, 2008, 2009, 2010 Free Software Foundation, Inc.
    134131This file is part of GNU Make.
    135132
  • vendor/gnumake/current/acinclude.m4

    r1989 r2596  
    22dnl
    33dnl 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.
     4dnl Copyright (C) 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007,
     5dnl 2008, 2009, 2010 Free Software Foundation, Inc.
    66dnl This file is part of GNU Make.
    77dnl
  • vendor/gnumake/current/amiga.c

    r1989 r2596  
    11/* Running commands on Amiga
    22Copyright (C) 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004,
    3 2005, 2006, 2007 Free Software Foundation, Inc.
     32005, 2006, 2007, 2008, 2009, 2010 Free Software Foundation, Inc.
    44This file is part of GNU Make.
    55
  • vendor/gnumake/current/amiga.h

    r1989 r2596  
    11/* Definitions for amiga specific things
    22Copyright (C) 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004,
    3 2005, 2006, 2007 Free Software Foundation, Inc.
     32005, 2006, 2007, 2008, 2009, 2010 Free Software Foundation, Inc.
    44This file is part of GNU Make.
    55
  • vendor/gnumake/current/ar.c

    r1989 r2596  
    11/* Interface to `ar' archives for GNU Make.
    22Copyright (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.
     31998, 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009,
     42010 Free Software Foundation, Inc.
     5
    56This file is part of GNU Make.
    67
     
    2526#include <fnmatch.h>
    2627
    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.
    2931   If a name like `lib((entry))' is used, a fatal error is signaled at
    3032   the attempt to use this unsupported feature.  */
     
    4042
    4143  end = p + strlen (p) - 1;
    42   if (*end != ')')
     44  if (*end != ')' || end == p + 1)
    4345    return 0;
    4446
     
    199201    {
    200202      /* 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, ")"));
    204205      new->next = state->chain;
    205206      state->chain = new;
     
    216217{
    217218  const char *p;
    218   int open = 0;
     219  int opened = 0;
    219220
    220221  for (p = pattern; *p != '\0'; ++p)
     
    231232
    232233      case '[':
    233         open = 1;
     234        opened = 1;
    234235        break;
    235236
    236237      case ']':
    237         if (open)
     238        if (opened)
    238239          return 1;
    239240        break;
     
    252253  struct nameseq *n;
    253254  const char **names;
    254   char *name;
    255255  unsigned int i;
    256256
     
    260260  /* Scan the archive for matches.
    261261     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;
    268263  state.pattern = member_pattern;
    269264  state.size = size;
     
    282277
    283278  /* 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);
    285281
    286282  /* Put them back into the chain in the sorted order.  */
  • vendor/gnumake/current/arscan.c

    r1989 r2596  
    11/* Library function for scanning an archive file.
    22Copyright (C) 1987, 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.
     31998, 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009,
     42010 Free Software Foundation, Inc.
    55This file is part of GNU Make.
    66
     
    6767  if (! (status & 1))
    6868    {
    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"),
    7070             status);
    7171
     
    8282   * know if this causes problems in other VMS environments.
    8383   */
    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  }
    85106#endif
    86107
     
    152173  if (! (status & 1))
    153174    {
    154       error (NILF, _("lbr$ini_control failed with status = %d"),status);
     175      error (NILF, _("lbr$ini_control() failed with status = %d"), status);
    155176      return -2;
    156177    }
    157178
    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;
    159181  libdesc.dsc$w_length = strlen (archive);
    160182
     
    251273  };
    252274# endif
     275# define TOCHAR(_m)     (_m)
    253276#else
    254277/* These should allow us to read Windows (VC++) libraries (according to Frank
     
    267290# define ar_uid     UserID
    268291# define ar_gid     GroupID
     292/* In Windows the member names have type BYTE so we must cast them.  */
     293# define TOCHAR(_m)     ((char *)(_m))
    269294#endif
    270295
     
    610635
    611636#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));
    614639#else   /* Xenix.  */
    615640        eltmode = (unsigned short int) member_header.ar_mode;
     
    621646                       member_offset + AR_HDR_SIZE, eltsize,
    622647#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)),
    626651#else   /* Xenix.  */
    627652                       member_header.ar_date,
     
    794819  for (ui = 0; ui < sizeof ar_hdr.ar_date; ui++)
    795820    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);
    797822#ifdef AIAMAG
    798823  ar_hdr.ar_date[strlen(ar_hdr.ar_date)] = ' ';
  • vendor/gnumake/current/build.template

    r1989 r2596  
    44
    55# 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.
    77# This file is part of GNU Make.
    88#
  • vendor/gnumake/current/build_w32.bat

    r1991 r2596  
    11@echo off
    22rem Copyright (C) 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005,
    3 rem 2006, 2007 Free Software Foundation, Inc.
     3rem 2006, 2007, 2008, 2009, 2010 Free Software Foundation, Inc.
    44rem This file is part of GNU Make.
    55rem
     
    9595echo off
    9696echo "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.obj
     97rem 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
    9898echo 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.dbg
     99link.exe /NOLOGO /SUBSYSTEM:console /INCREMENTAL:yes /PDB:.\WinDebug/%make%.pdb /DEBUG /OUT:.\WinDebug/%make%.exe @link.dbg
    100100if not exist .\WinDebug/%make%.exe echo "WinDebug build failed"
    101101if exist .\WinDebug/%make%.exe echo "WinDebug build succeeded!"
     
    162162echo off
    163163echo "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.obj
     164rem 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
    165165echo 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.rel
     166link.exe /NOLOGO /SUBSYSTEM:console /INCREMENTAL:no /PDB:.\WinRel/%make%.pdb /OUT:.\WinRel/%make%.exe @link.rel
    167167if not exist .\WinRel/%make%.exe echo "WinRel build failed"
    168168if exist .\WinRel/%make%.exe echo "WinRel build succeeded!"
  • vendor/gnumake/current/commands.c

    r1989 r2596  
    11/* Command processing for GNU Make.
    22Copyright (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.
     31998, 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009,
     42010 Free Software Foundation, Inc.
    55This file is part of GNU Make.
    66
     
    4141
    4242
     43
     44static unsigned long
     45dep_hash_1 (const void *key)
     46{
     47  const struct dep *d = key;
     48  return_STRING_HASH_1 (dep_name (d));
     49}
     50
     51static unsigned long
     52dep_hash_2 (const void *key)
     53{
     54  const struct dep *d = key;
     55  return_STRING_HASH_2 (dep_name (d));
     56}
     57
     58static int
     59dep_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
    4366/* Set FILE's automatic variables up.  */
    4467
     
    4669set_file_variables (struct file *file)
    4770{
    48   const struct dep *d;
     71  struct dep *d;
    4972  const char *at, *percent, *star, *less;
    5073
     
    118141    if (!d->ignore_mtime)
    119142      {
    120         less = dep_name (d);
     143        if (!d->need_2nd_expansion)
     144          less = dep_name (d);
    121145        break;
    122146      }
     
    150174    unsigned int len;
    151175
     176    struct hash_table dep_hash;
     177    void **slot;
     178
    152179    /* Compute first the value for $+, which is supposed to contain
    153180       duplicate dependencies as they were listed in the makefile.  */
    154181
    155182    plus_len = 0;
     183    bar_len = 0;
    156184    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
    159198    if (plus_len == 0)
    160199      plus_len++;
     
    162201    if (plus_len > plus_max)
    163202      plus_value = xrealloc (plus_value, plus_max = plus_len);
     203
    164204    cp = plus_value;
    165205
    166206    qmark_len = plus_len + 1;   /* Will be this or less.  */
    167207    for (d = file->deps; d != 0; d = d->next)
    168       if (! d->ignore_mtime)
     208      if (! d->ignore_mtime && ! d->need_2nd_expansion)
    169209        {
    170210          const char *c = dep_name (d);
     
    183223          cp += len;
    184224          *cp++ = FILE_LIST_SEPARATOR;
    185           if (! d->changed)
     225          if (! (d->changed || always_make_flag))
    186226            qmark_len -= len + 1;       /* Don't space in $? for this one.  */
    187227        }
     
    191231    cp[cp > plus_value ? -1 : 0] = '\0';
    192232    DEFINE_VARIABLE ("+", 1, plus_value);
    193 
    194     /* Make sure that no dependencies are repeated.  This does not
    195        really matter for the purpose of updating targets, but it
    196        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++;
    206233
    207234    /* Compute the values for $^, $?, and $|.  */
     
    217244    bp = bar_value;
    218245
     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
    219253    for (d = file->deps; d != 0; d = d->next)
    220254      {
    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);
    223281#ifndef NO_ARCHIVES
    224         if (ar_name (c))
     282        if (ar_name (c))
    225283          {
    226284            c = strchr (c, '(') + 1;
     
    233291        if (d->ignore_mtime)
    234292          {
    235             memcpy (bp, c, len);
     293            memcpy (bp, c, len);
    236294            bp += len;
    237295            *bp++ = FILE_LIST_SEPARATOR;
    238296          }
    239297        else
    240           {
     298          {
    241299            memcpy (cp, c, len);
    242300            cp += len;
    243301            *cp++ = FILE_LIST_SEPARATOR;
    244             if (d->changed)
     302            if (d->changed || always_make_flag)
    245303              {
    246304                memcpy (qp, c, len);
     
    251309      }
    252310
     311    hash_free (&dep_hash, 0);
     312
    253313    /* Kill the last spaces and define the variables.  */
    254314
     
    273333chop_commands (struct commands *cmds)
    274334{
    275   const char *p;
    276335  unsigned int nlines, idx;
    277336  char **lines;
     
    283342    return;
    284343
    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')
    301367        {
    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] == '\\')
    307374            {
    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                }
    310384            }
     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;
    311395        }
    312396
    313       if (idx == nlines)
     397      if (idx != nlines)
    314398        {
    315           nlines += 2;
     399          nlines = idx;
    316400          lines = xrealloc (lines, nlines * sizeof (char *));
    317401        }
    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.  */
    329406
    330407  cmds->ncommand_lines = nlines;
     
    333410  cmds->any_recurse = 0;
    334411  cmds->lines_flags = xmalloc (nlines);
     412
    335413  for (idx = 0; idx < nlines; ++idx)
    336414    {
    337415      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++))
    343420          {
    344421          case '+':
  • vendor/gnumake/current/commands.h

    r1989 r2596  
    11/* Definition of data structures describing shell commands for GNU Make.
    22Copyright (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.
     31998, 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009,
     42010 Free Software Foundation, Inc.
    55This file is part of GNU Make.
    66
  • vendor/gnumake/current/config

    • Property svn:ignore deleted
  • vendor/gnumake/current/config.ami.template

    r1989 r2596  
    11/* config.h -- hand-massaged for Amiga                                  -*-C-*-
    22Copyright (C) 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004,
    3 2005, 2006, 2007 Free Software Foundation, Inc.
     32005, 2006, 2007, 2008, 2009, 2010 Free Software Foundation, Inc.
    44This file is part of GNU Make.
    55
  • vendor/gnumake/current/config.h-vms.template

    r1989 r2596  
    22
    33Copyright (C) 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005,
    4 2006, 2007 Free Software Foundation, Inc.
     42006, 2007, 2008, 2009, 2010 Free Software Foundation, Inc.
    55This file is part of GNU Make.
    66
     
    7676/* Define to 1 if you don't have vprintf but do have _doprnt.  */
    7777/* #undef HAVE_DOPRNT */
     78
     79/* Define to 1 if you have the fdopen function.  */
     80#define HAVE_FDOPEN 1
    7881
    7982/* Define to 1 if your system has a working fnmatch function.  */
     
    290293
    291294/* Define to 1 if you have the strcasecmp function.  */
    292 /* #undef HAVE_STRCASECMP */
     295#define HAVE_STRCASECMP 1
    293296
    294297/* Define to 1 if you have the strcmpi function.  */
  • vendor/gnumake/current/config.h.W32.template

    r1989 r2596  
    22
    33Copyright (C) 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005,
    4 2006, 2007 Free Software Foundation, Inc.
     42006, 2007, 2008, 2009, 2010 Free Software Foundation, Inc.
    55This file is part of GNU Make.
    66
     
    2525# pragma warning(disable:4131) /* uses old-style declarator */
    2626# 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 */
    2729#endif
    2830
     
    228230
    229231/* Define to 1 if you have the `strcmpi' function. */
    230 #define HAVE_STRCMPI 1
     232/* #undef HAVE_STRCMPI */
    231233
    232234/* 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
    234245
    235246/* Define to 1 if you have the `strchr' function. */
     
    427438/* GCC 4.x reportedly defines pid_t.  */
    428439#ifndef _PID_T_
     440#ifdef _WIN64
     441#define pid_t __int64
     442#else
    429443#define pid_t int
     444#endif
    430445#endif
    431446
  • vendor/gnumake/current/config/ChangeLog

    r1989 r2596  
    3030
    3131
    32 Copyright (C) 2002, 2003, 2004, 2005, 2006, 2007 Free Software Foundation, Inc.
     32Copyright (C) 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009 Free Software
     33Foundation, Inc.
    3334This file is part of GNU Make.
    3435
  • vendor/gnumake/current/config/Makefile.am

    r1989 r2596  
    11# -*-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.
    44# This file is part of GNU Make.
    55#
  • vendor/gnumake/current/config/dospaths.m4

    r1989 r2596  
    33#
    44# 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.
    66# This file is part of GNU Make.
    77#
  • vendor/gnumake/current/configh.dos.template

    r1989 r2596  
    22
    33Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003,
    4 2004, 2005, 2006, 2007 Free Software Foundation, Inc.
     42004, 2005, 2006, 2007, 2008, 2009, 2010 Free Software Foundation, Inc.
    55This file is part of GNU Make.
    66
     
    1717this program.  If not, see <http://www.gnu.org/licenses/>.  */
    1818
     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
    1923/* Many things are defined already by a system header.  */
    2024#include <sys/config.h>
     
    2226#if __DJGPP__ > 2 || __DJGPP_MINOR__ > 1
    2327
    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>. */
    2529# define SYS_SIGLIST_DECLARED 1
    2630
     
    108112#define PROTOTYPES 1
    109113
    110 /* Define to 1 if `sys_siglist' is declared by <signal.h> or <unistd.h>. */
    111 #define SYS_SIGLIST_DECLARED 1
    112 
    113114/* Version number of package */
    114115#define VERSION "%VERSION%"
  • vendor/gnumake/current/configure.bat

    r1991 r2596  
    11@echo off
    22rem Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003,
    3 rem 2004, 2005, 2006, 2007 Free Software Foundation, Inc.
     3rem 2004, 2005, 2006, 2007, 2008, 2009, 2010 Free Software Foundation, Inc.
    44rem This file is part of GNU Make.
    55rem
  • vendor/gnumake/current/configure.in

    r1989 r2596  
    22#
    33# 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.
    55# This file is part of GNU Make.
    66#
     
    1818# this program.  If not, see <http://www.gnu.org/licenses/>.
    1919
    20 AC_INIT([GNU make],[3.81.90],[bug-make@gnu.org])
     20AC_INIT([GNU make],[3.82],[bug-make@gnu.org])
    2121
    2222AC_PREREQ(2.59)
    23 AC_REVISION([[$Id: configure.in,v 1.148 2007/07/04 19:35:17 psmith Exp $]])
     23AC_REVISION([[$Id: configure.in,v 1.156 2010/07/28 05:39:50 psmith Exp $]])
    2424
    2525# Autoconf setup
     
    148148fi
    149149
    150 AC_CHECK_FUNCS( strdup mkstemp mktemp fdopen \
    151                 bsd_signal dup2 getcwd realpath sigsetmask sigaction \
     150AC_CHECK_FUNCS( strdup strndup mkstemp mktemp fdopen fileno \
     151                dup2 getcwd realpath sigsetmask sigaction \
    152152                getgroups seteuid setegid setlinebuf setreuid setregid \
    153153                getrlimit setrlimit setvbuf pipe strerror strsignal \
    154154                lstat readlink atexit)
    155155
     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.
     159AC_CHECK_DECLS([bsd_signal], [], [], [[#include <signal.h>]])
     160
    156161AC_FUNC_SETVBUF_REVERSED
    157162
     
    159164# It doesn't hurt much to use our own if we can't find it so I don't
    160165# make the effort here.
    161 AC_CHECK_FUNCS(strcasecmp strcmpi stricmp)
     166AC_CHECK_FUNCS(strcasecmp strncasecmp strcmpi strncmpi stricmp strnicmp)
    162167
    163168# strcoll() is used by the GNU glob library
     
    348353# Check the system to see if it provides GNU glob.  If not, use our
    349354# local version.
    350 
    351355AC_MSG_CHECKING(if system libc has GNU glob)
    352356AC_CACHE_VAL(make_cv_sys_gnu_glob, [
     
    365369 ], [AC_MSG_RESULT(yes)
    366370make_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.a
    369371make_cv_sys_gnu_glob=no])])
     372if test "$make_cv_sys_gnu_glob" = no; then
     373  GLOBINC='-I$(srcdir)/glob'
     374  GLOBLIB=glob/libglob.a
     375fi
     376AC_SUBST(GLOBINC)
     377AC_SUBST(GLOBLIB)
     378
    370379# Tell automake about this, so it can build the right .c files.
    371380AM_CONDITIONAL(USE_LOCAL_GLOB, test "$make_cv_sys_gnu_glob" = no)
  • vendor/gnumake/current/debug.h

    r1989 r2596  
    11/* Debugging macros and interface.
    2 Copyright (C) 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007 Free
    3 Software Foundation, Inc.
     2Copyright (C) 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008,
     32009, 2010 Free Software Foundation, Inc.
    44This file is part of GNU Make.
    55
  • vendor/gnumake/current/default.c

    r1989 r2596  
    11/* Data base of default implicit rules for GNU Make.
    22Copyright (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.
     31998, 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009,
     42010 Free Software Foundation, Inc.
    55This file is part of GNU Make.
    66
     
    540540
    541541  if (no_builtin_rules_flag)
    542     define_variable ("SUFFIXES", 8, "", o_default, 0);
     542    define_variable_cname ("SUFFIXES", "", o_default, 0);
    543543  else
    544544    {
    545545      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);
    550550    }
    551551}
  • vendor/gnumake/current/dep.h

    r1989 r2596  
    11/* Definitions of dependency data structures for GNU Make.
    22Copyright (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.
     31998, 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009,
     42010 Free Software Foundation, Inc.
    55This file is part of GNU Make.
    66
     
    4444    unsigned int staticpattern : 1;
    4545    unsigned int need_2nd_expansion : 1;
     46    unsigned int dontcare : 1;
    4647  };
    4748
     
    5657
    5758
    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
    5969#ifdef VMS
    60 struct nameseq *parse_file_seq ();
     70void *parse_file_seq ();
    6171#else
    62 struct nameseq *parse_file_seq (char **stringp, int stopchar, unsigned int size, int strip);
     72void *parse_file_seq (char **stringp, unsigned int size,
     73                      int stopchar, const char *prefix, int flags);
    6374#endif
     75
    6476char *tilde_expand (const char *name);
    6577
     
    6880#endif
    6981
    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)
    7183
    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
    7488struct dep *copy_dep_chain (const struct dep *d);
    7589void free_dep_chain (struct dep *d);
    7690void free_ns_chain (struct nameseq *n);
    7791struct dep *read_all_makefiles (const char **makefiles);
    78 int eval_buffer (char *buffer);
     92void eval_buffer (char *buffer);
    7993int update_goal_chain (struct dep *goals);
    80 void uniquize_deps (struct dep *);
  • vendor/gnumake/current/dir.c

    r1989 r2596  
    11/* Directory hashing for GNU Make.
    22Copyright (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.
     31998, 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009,
     42010 Free Software Foundation, Inc.
    55This file is part of GNU Make.
    66
     
    2424# define NAMLEN(dirent) strlen((dirent)->d_name)
    2525# ifdef VMS
    26 char *vmsify (char *name, int type);
     26/* its prototype is in vmsdir.h, which is not needed for HAVE_DIRENT_H */
     27const char *vmsify (const char *name, int type);
    2728# endif
    2829#else
     
    124125  static PATH_VAR (new_filename);
    125126  char *df;
    126   int i;
    127127
    128128  if (filename == 0)
     
    130130
    131131  df = new_filename;
    132 
    133   /* First, transform the name part.  */
    134132  while (*filename != '\0')
    135133    {
     
    147145
    148146static int
    149 vms_hash (char *name)
     147vms_hash (const char *name)
    150148{
    151149  int h = 0;
     
    173171/* fake stat entry for a directory */
    174172static int
    175 vmsstat_dir (char *name, struct stat *st)
     173vmsstat_dir (const char *name, struct stat *st)
    176174{
    177175  char *s;
     
    186184  if (s)
    187185    {
     186      /* to keep the compiler happy we said "const char *name", now we cheat */
    188187      *s++ = 0;
    189188      st->st_dev = (char *)vms_hash (name);
     
    194193    {
    195194      st->st_dev = 0;
    196       s = name;
    197       h = vms_hash (s);
     195      h = vms_hash (name);
    198196    }
    199197
     
    453451      p = name + strlen (name);
    454452      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
    455456      dir->name = strcache_add_len (name, p - name);
     457#endif
    456458      hash_insert_at (&directories, dir, dir_slot);
    457459      /* The directory is not in the name hash table.
     
    711713        {
    712714          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
    713718          df->name = strcache_add_len (d->d_name, len);
     719#endif
    714720          df->length = len;
    715721          df->impossible = 0;
     
    717723        }
    718724      /* 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))
    720726        return 1;
    721727    }
     
    870876
    871877  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));
    878881
    879882  if (dir->contents->dirfiles.ht_vec == 0)
     
    887890  new = xmalloc (sizeof (struct dirfile));
    888891  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
    889895  new->name = strcache_add_len (filename, new->length);
     896#endif
    890897  new->impossible = 1;
    891898  hash_insert (&dir->contents->dirfiles, new);
  • vendor/gnumake/current/doc

    • Property svn:ignore deleted
  • vendor/gnumake/current/doc/Makefile.am

    r1989 r2596  
    11# -*-Makefile-*-, or close enough
    2 # Copyright (C) 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007 Free Software
    3 # Foundation, Inc.
     2# Copyright (C) 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009,
     3# 2010 Free Software Foundation, Inc.
    44# This file is part of GNU Make.
    55#
  • vendor/gnumake/current/doc/make.texi

    r1989 r2596  
    44
    55@include version.texi
    6 @set EDITION 0.70
    7 @set RCSID $Id: make.texi,v 1.52 2008/05/18 15:11:40 psmith Exp $
     6@set EDITION 0.71
     7@set RCSID $Id: make.texi,v 1.66 2010/07/19 07:10:54 psmith Exp $
    88
    99@settitle GNU @code{make}
     
    1414@syncodeindex pg cp
    1515@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 2004
    17 @set ISBN 1-882114-83-5
     16@c ISBN confirmed by Jasimin Huang <jasimin@fsf.org> on 25 Mar 2009
     17@set ISBN 1-882114-83-3
    1818@c %**end of header
    1919
     
    2727
    2828Copyright @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.
     291996, 1997, 1998, 1999, 2000, 2002, 2003, 2004, 2005, 2006, 2007,
     302008, 2009, 2010 Free Software Foundation, Inc.
    3131
    3232@quotation
     
    3939License.''
    4040
    41 (a) The FSF's Back-Cover Text is: ``You are free to copy and modify
    42 this GNU Manual. Buying copies from GNU Press supports the FSF in
     41(a) The FSF's Back-Cover Text is: ``You have the freedom to copy and
     42modify this GNU manual.  Buying copies from the FSF supports it in
    4343developing GNU and promoting software freedom.''
    4444@end quotation
     
    202202* Interrupts::                  What happens when a recipe is interrupted.
    203203* Recursion::                   Invoking @code{make} from makefiles.
    204 * Sequences::                   Defining canned recipes.
     204* Canned Recipes::              Defining canned recipes.
    205205* Empty Recipes::               Defining useful, do-nothing recipes.
    206206
     
    234234* Override Directive::          How to set a variable in the makefile even if
    235235                                  the user has set it with a command argument.
    236 * Defining::                    An alternate way to set a variable
    237                                   to a verbatim string.
     236* Multi-Line::                  An alternate way to set a variable
     237                                  to a multi-line string.
    238238* Environment::                 Variable values can come from the environment.
    239239* Target-specific::             Variable values can be defined on a per-target
     
    241241* Pattern-specific::            Target-specific variable values can be applied
    242242                                  to a group of targets that match a pattern.
     243* Suppressing Inheritance::     Suppress inheritance of variables.
    243244* Special Variables::           Variables with special meaning or behavior.
    244245
     
    524525
    525526@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}).
     527A @dfn{recipe} is an action that @code{make} carries out.  A recipe
     528may have more than one command, either on the same line or each on its
     529own line.  @strong{Please note:} you need to put a tab character at
     530the beginning of every recipe line!  This is an obscurity that catches
     531the unwary.  If you prefer to prefix your recipes with a character
     532other than tab, you can set the @code{.RECIPEPREFIX} variable to an
     533alternate character (@pxref{Special Variables}).
    533534
    534535Usually a recipe is in a rule with prerequisites and serves to create a
     
    629630prerequisites.  These recipes say how to update the target file.  A
    630631tab character (or whatever character is specified by the
    631 @code{.CMDPREFIX} variable; @pxref{Special Variables}) must come at
     632@code{.RECIPEPREFIX} variable; @pxref{Special Variables}) must come at
    632633the beginning of every line in the recipe to distinguish recipes from
    633634other lines in the makefile.  (Bear in mind that @code{make} does not
    634635know anything about how the recipes work.  It is up to you to supply
    635636recipes that will update the target file properly.  All @code{make}
    636 does is execute the commands in the recipe you have specified when the
    637 target file needs to be updated.)@refill
     637does is execute the recipe you have specified when the target file
     638needs to be updated.)@refill
    638639@cindex recipe
    639640
     
    996997@item
    997998Defining a variable from a verbatim string containing multiple lines
    998 (@pxref{Defining, ,Defining Variables Verbatim}).
     999(@pxref{Multi-Line, ,Defining Multi-Line Variables}).
    9991000@end itemize
    10001001
     
    10971098Extra spaces are allowed and ignored at the beginning of the line, but
    10981099the first character must not be a tab (or the value of
    1099 @code{.CMDPREFIX})---if the line begins with a tab, it will be
     1100@code{.RECIPEPREFIX})---if the line begins with a tab, it will be
    11001101considered a recipe line.  Whitespace is required between
    11011102@code{include} and the file names, and between file names; extra
     
    11711172
    11721173If you want @code{make} to simply ignore a makefile which does not exist
    1173 and cannot be remade, with no error message, use the @w{@code{-include}}
     1174or cannot be remade, with no error message, use the @w{@code{-include}}
    11741175directive instead of @code{include}, like this:
    11751176
     
    11791180
    11801181This 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.
     1182error (not even a warning) if any of the @var{filenames} (or any
     1183prerequisites of any of the @var{filenames}) do not exist or cannot be
     1184remade.
     1185
    11821186For compatibility with some other @code{make} implementations,
    11831187@code{sinclude} is another name for @w{@code{-include}}.
     
    11911195If the environment variable @code{MAKEFILES} is defined, @code{make}
    11921196considers 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
     1197additional makefiles to be read before the others.  This works much
     1198like the @code{include} directive: various directories are searched
     1199for those files (@pxref{Include, ,Including Other Makefiles}).  In
     1200addition, 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
     1202listed in @code{MAKEFILES} are not found.@refill
    11981203
    11991204@cindex recursion, and @code{MAKEFILES} variable
     
    12691274
    12701275When 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}),
    12721277you would not want to use an out-of-date makefile to decide which
    12731278targets to touch.  So the @samp{-t} option has no effect on updating
     
    13871392define @var{immediate}
    13881393  @var{deferred}
     1394endef
     1395
     1396define @var{immediate} =
     1397  @var{deferred}
     1398endef
     1399
     1400define @var{immediate} ?=
     1401  @var{deferred}
     1402endef
     1403
     1404define @var{immediate} :=
     1405  @var{immediate}
     1406endef
     1407
     1408define @var{immediate} +=
     1409  @var{deferred} or @var{immediate}
    13891410endef
    13901411@end example
     
    17481769@cindex tab character (in commands)
    17491770The @var{recipe} lines start with a tab character (or the first
    1750 character in the value of the @code{.CMDPREFIX} variable;
     1771character in the value of the @code{.RECIPEPREFIX} variable;
    17511772@pxref{Special Variables}).  The first recipe line may appear on the line
    17521773after the prerequisites, with a tab character, or may appear on the
     
    18021823GNU @code{make}: normal prerequisites such as described in the
    18031824previous section, and @dfn{order-only} prerequisites.  A normal
    1804 prerequisite makes two statements: first, it imposes an order of
    1805 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 the
    1809 target is considered out-of-date and must be rebuilt.
     1825prerequisite makes two statements: first, it imposes an order in which
     1826recipes will be invoked: the recipes for all prerequisites of a target
     1827will be completed before the recipe for the target is run.  Second, it
     1828imposes a dependency relationship: if any prerequisite is newer than
     1829the target, then the target is considered out-of-date and must be
     1830rebuilt.
    18101831
    18111832Normally, this is exactly what you want: if a target's prerequisite is
     
    19491970@noindent
    19501971then 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
     1973target or prerequisite, wildcard expansion will take place there.  If
     1974you use the value of @code{objects} in a recipe, the shell may perform
     1975wildcard expansion when the recipe runs.  To set @code{objects} to the
     1976expansion, instead use:
    19541977
    19551978@example
     
    24032426
    24042427When 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}
     2428handles it specially by searching for the file @file{lib@var{name}.so},
     2429and, if it is not found, for the file @file{lib@var{name}.a} in the current
     2430directory, in directories specified by matching @code{vpath}
    24072431search paths and the @code{VPATH} search path, and then in the
    24082432directories @file{/lib}, @file{/usr/lib}, and @file{@var{prefix}/lib}
     
    24102434@code{make} behave as if @var{prefix} is defined to be the root of the
    24112435DJGPP installation tree).
    2412 
    2413 If that file is not found, then the file @file{lib@var{name}.a} is
    2414 searched for, in the same directories as above.
    24152436
    24162437For example, if there is a @file{/usr/lib/libcurses.a} library on your
     
    24352456@samp{-l@var{name}} is seen, @code{make} will replace the percent in
    24362457each 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.
     2458searches using each library filename.
    24392459
    24402460The default value for @code{.LIBPATTERNS} is @samp{lib%.so lib%.a},
     
    28542874recipes in parallel (unless its makefile also contains this target).
    28552875Any prerequisites on this target are ignored.
     2876
     2877@findex .ONESHELL
     2878@item .ONESHELL
     2879@cindex recipe execution, single invocation
     2880
     2881If @code{.ONESHELL} is mentioned as a target, then when a target is
     2882built all lines of the recipe will be given to a single invocation of
     2883the 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
     2890If @code{.POSIX} is mentioned as a target, then the makefile will be
     2891parsed and run in POSIX-conforming mode.  This does @emph{not} mean
     2892that only POSIX-conforming makefiles will be accepted: all advanced
     2893GNU @code{make} features are still available.  Rather, this target
     2894causes @code{make} to behave as required by POSIX in those areas
     2895where @code{make}'s default behavior differs.
     2896
     2897In particular, if this target is mentioned then recipes will be
     2898invoked as if the shell had been passed the @code{-e} flag: the first
     2899failing command in a recipe will cause the recipe to fail immediately.
    28562900@end table
    28572901
     
    31683212@cindex @code{::} rules (double-colon)
    31693213
    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{::}
     3215instead of @samp{:} after the target names.  They are handled
     3216differently from ordinary rules when the same target appears in more
     3217than one rule.  Pattern rules with double-colons have an entirely
     3218different meaning (@pxref{Match-Anything Rules}).
    31733219
    31743220When a target appears in multiple rules, all the rules must be the same
     
    33513397Users use many different shell programs, but recipes in makefiles are
    33523398always interpreted by @file{/bin/sh} unless the makefile specifies
    3353 otherwise.  @xref{Execution, ,Command Execution}.
     3399otherwise.  @xref{Execution, ,Recipe Execution}.
    33543400
    33553401@menu
     
    33613407* Interrupts::                  What happens when a recipe is interrupted.
    33623408* Recursion::                   Invoking @code{make} from makefiles.
    3363 * Sequences::                   Defining canned recipes.
     3409* Canned Recipes::              Defining canned recipes.
    33643410* Empty Recipes::               Defining useful, do-nothing recipes.
    33653411@end menu
     
    33793425
    33803426Each line in the recipe must start with a tab (or the first character
    3381 in the value of the @code{.CMDPREFIX} variable; @pxref{Special
     3427in the value of the @code{.RECIPEPREFIX} variable; @pxref{Special
    33823428Variables}), except that the first recipe line may be attached to the
    33833429target-and-prerequisites line with a semicolon in between.  @emph{Any}
     
    36293675@cindex @code{--dry-run}
    36303676@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 actually doing them.
     3677When @code{make} is given the flag @samp{-n} or @samp{--just-print} it
     3678only echoes most recipes, without executing them.  @xref{Options
     3679Summary, ,Summary of Options}.  In this case even the recipe lines
     3680starting with @samp{@@} are printed.  This flag is useful for finding
     3681out which recipes @code{make} thinks are necessary without actually
     3682doing them.
    36373683
    36383684@cindex @code{-s}
     
    36543700
    36553701When 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.)
     3702executed by invoking a new subshell for each line of the recipe,
     3703unless the @code{.ONESHELL} special target is in effect
     3704(@pxref{One Shell, ,Using One Shell})  (In practice, @code{make} may
     3705take shortcuts that do not affect the results.)
    36593706
    36603707@cindex @code{cd} (shell command)
     
    36843731
    36853732@menu
     3733* One Shell::                   One shell for all lines in a recipe
    36863734* Choosing the Shell::          How @code{make} chooses the shell used
    36873735                                  to run recipes.
    36883736@end menu
    36893737
    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
     3744Sometimes you would prefer that all the lines in the recipe be passed
     3745to a single invocation of the shell.  There are generally two
     3746situations where this is useful: first, it can improve performance in
     3747makefiles where recipes consist of many command lines, by avoiding
     3748extra processes.  Second, you might want newlines to be included in
     3749your recipe command (for example perhaps you are using a very
     3750different interpreter as your @code{SHELL}).  If the @code{.ONESHELL}
     3751special target appears anywhere in the makefile then @emph{all}
     3752recipe lines for each target will be provided to a single invocation
     3753of the shell.  Newlines between recipe lines will be preserved.  For
     3754example:
     3755
     3756@example
     3757.ONESHELL:
     3758foo : bar/lose
     3759        cd $(@@D)
     3760        gobble $(@@F) > ../$@@
     3761@end example
     3762
     3763@noindent
     3764would now work as expected even though the commands are on different
     3765recipe lines.
     3766
     3767If @code{.ONESHELL} is provided, then only the first line of the
     3768recipe will be checked for the special prefix characters (@samp{@@},
     3769@samp{-}, and @samp{+}).  Subsequent lines will include the special
     3770characters in the recipe line when the @code{SHELL} is invoked.  If
     3771you want your recipe to start with one of these special characters
     3772you'll need to arrange for them to not be the first characters on the
     3773first line, perhaps by adding a comment or similar.  For example, this
     3774would be a syntax error in Perl because the first @samp{@@} is removed
     3775by make:
     3776
     3777@example
     3778.ONESHELL:
     3779SHELL = /usr/bin/perl
     3780.SHELLFLAGS = -e
     3781show :
     3782        @@f = qw(a b c);
     3783        print "@@f\n";
     3784@end example
     3785
     3786@noindent
     3787However, either of these alternatives would work properly:
     3788
     3789@example
     3790.ONESHELL:
     3791SHELL = /usr/bin/perl
     3792.SHELLFLAGS = -e
     3793show :
     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
     3800or
     3801
     3802@example
     3803.ONESHELL:
     3804SHELL = /usr/bin/perl
     3805.SHELLFLAGS = -e
     3806show :
     3807        my @@f = qw(a b c);
     3808        print "@@f\n";
     3809@end example
     3810
     3811As a special feature, if @code{SHELL} is determined to be a
     3812POSIX-style shell, the special prefix characters in ``internal''
     3813recipe lines will @emph{removed} before the recipe is processed.  This
     3814feature is intended to allow existing makefiles to add the
     3815@code{.ONESHELL} special target and still run properly without
     3816extensive modifications.  Since the special prefix characters are not
     3817legal at the beginning of a line in a POSIX shell script this is not a
     3818loss in functionality.  For example, this works as expected:
     3819
     3820@example
     3821.ONESHELL:
     3822foo : bar/lose
     3823        @@cd $(@@D)
     3824        @@gobble $(@@F) > ../$@@
     3825@end example
     3826
     3827Even with this special feature, however, makefiles with
     3828@code{.ONESHELL} will behave differently in ways that could be
     3829noticeable.  For example, normally if any line in the recipe fails,
     3830that causes the rule to fail and no more recipe lines are processed.
     3831Under @code{.ONESHELL} a failure of any but the final recipe line will
     3832not be noticed by @code{make}.  You can modify @code{.SHELLFLAGS} to
     3833add the @code{-e} option to the shell which will cause any failure
     3834anywhere in the command line to cause the shell to fail, but this
     3835could itself cause your recipe to behave differently.  Ultimately you
     3836may need to harden your recipe lines to allow them to work with
     3837@code{.ONESHELL}.
     3838
     3839@node Choosing the Shell,  , One Shell, Execution
    36913840@subsection Choosing the Shell
    36923841@cindex shell, choosing the
    36933842@cindex @code{SHELL}, value of
     3843@cindex @code{.SHELLFLAGS}, value of
    36943844
    36953845@vindex SHELL
     3846@vindex .SHELLFLAGS
    36963847The program used as the shell is taken from the variable @code{SHELL}.
    36973848If 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
     3850shell are taken from the variable @code{.SHELLFLAGS}.  The default
     3851value of @code{.SHELLFLAGS} is @code{-c} normally, or @code{-ec} in
     3852POSIX-conforming mode.
    36993853
    37003854@cindex environment, @code{SHELL} in
     
    37863940on MS-DOS unaltered if you have e.g.@: @file{sh.exe} installed in some
    37873941directory along your @code{PATH}.
     3942
     3943@vindex SHELL
     3944@vindex .SHELLFLAGS
    37883945
    37893946@node Parallel, Errors, Execution, Recipes
     
    40144171times to prevent other sorts of trouble.
    40154172
    4016 @node Recursion, Sequences, Interrupts, Recipes
     4173@node Recursion, Canned Recipes, Interrupts, Recipes
    40174174@section Recursive Use of @code{make}
    40184175@cindex recursion
     
    43604517ensure that there are only @samp{N} jobs running at the same time
    43614518between them all.  Note that any job that is marked recursive
    4362 (@pxref{Instead of Execution, ,Instead of Executing the Recipes})
     4519(@pxref{Instead of Execution, ,Instead of Executing Recipes})
    43634520doesn't count against the total jobs (otherwise we could get @samp{N}
    43644521sub-@code{make}s running and have no slots left over for any real work!)
     
    44964653disable it.
    44974654
    4498 @node Sequences, Empty Recipes, Recursion, Recipes
     4655@node Canned Recipes, Empty Recipes, Recursion, Recipes
    44994656@section Defining Canned Recipes
    45004657@cindex canned recipes
     
    45094666not conflict with other variable names.
    45104667
    4511 Here is an example of defining a canned recipes:
    4512 
    4513 @example
    4514 define run-yacc
     4668Here is an example of defining a canned recipe:
     4669
     4670@example
     4671define run-yacc =
    45154672yacc $(firstword $^)
    45164673mv y.tab.c $@@
     
    45264683parentheses, variable names, and so on, all become part of the value of the
    45274684variable you are defining.
    4528 @xref{Defining, ,Defining Variables Verbatim},
     4685@xref{Multi-Line, ,Defining Multi-Line Variables},
    45294686for a complete explanation of @code{define}.
    45304687
     
    45674724
    45684725@example
    4569 define frobnicate
     4726define frobnicate =
    45704727@@echo "frobnicating target $@@"
    45714728frob-step-1 $< -o $@@-step-1
     
    45904747(@xref{Echoing, ,Recipe Echoing}, for a full explanation of @samp{@@}.)
    45914748
    4592 @node Empty Recipes,  , Sequences, Recipes
     4749@node Empty Recipes,  , Canned Recipes, Recipes
    45934750@section Using Empty Recipes
    45944751@cindex empty recipes
     
    46854842* Override Directive::          How to set a variable in the makefile even if
    46864843                                  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.
    46894848* Environment::                 Variable values can come from the environment.
    46904849* Target-specific::             Variable values can be defined on a per-target
     
    46924851* Pattern-specific::            Target-specific variable values can be applied
    46934852                                  to a group of targets that match a pattern.
     4853* Suppressing Inheritance::     Suppress inheritance of variables.
    46944854* Special Variables::           Variables with special meaning or behavior.
    46954855@end menu
     
    47614921Variables of this sort are defined by lines using @samp{=}
    47624922(@pxref{Setting, ,Setting Variables}) or by the @code{define} directive
    4763 (@pxref{Defining, ,Defining Variables Verbatim}).  The value you specify
     4923(@pxref{Multi-Line, ,Defining Multi-Line Variables}).  The value you specify
    47644924is installed verbatim; if it contains references to other variables,
    47654925these references are expanded whenever this variable is substituted (in
     
    51885348dir = foo
    51895349$(dir)_sources := $(wildcard $(dir)/*.c)
    5190 define $(dir)_print
     5350define $(dir)_print =
    51915351lpr $($(dir)_sources)
    51925352endef
     
    52175377You can specify a value in the makefile, either
    52185378with an assignment (@pxref{Setting, ,Setting Variables}) or with a
    5219 verbatim definition (@pxref{Defining, ,Defining Variables Verbatim}).@refill
     5379verbatim definition (@pxref{Multi-Line, ,Defining Multi-Line Variables}).@refill
    52205380
    52215381@item
     
    54255585value.
    54265586
    5427 @node Override Directive, Defining, Appending, Using Variables
     5587@node Override Directive, Multi-Line, Appending, Using Variables
    54285588@section The @code{override} Directive
    54295589@findex override
     
    54585618@xref{Appending, ,Appending More Text to Variables}.
    54595619
     5620Variable assignments marked with the @code{override} flag have a
     5621higher priority than all other assignments, except another
     5622@code{override}.  Subsequent assignments or appends to this variable
     5623which are not marked @code{override} will be ignored.
     5624
    54605625The @code{override} directive was not invented for escalation in the war
    54615626between makefiles and command arguments.  It was invented so you can alter
     
    54755640
    54765641@example
    5477 override define foo
     5642override define foo =
    54785643bar
    54795644endef
     
    54855650@end iftex
    54865651@ifnottex
    5487 @xref{Defining, ,Defining Variables Verbatim}.
     5652@xref{Multi-Line, ,Defining Multi-Line Variables}.
    54885653@end ifnottex
    54895654
    5490 @node Defining, Environment, Override Directive, Using Variables
    5491 @section Defining Variables Verbatim
     5655@node Multi-Line, Undefine Directive, Override Directive, Using Variables
     5656@section Defining Multi-Line Variables
    54925657@findex define
    54935658@findex endef
     5659@cindex multi-line variable definition
     5660@cindex variables, multi-line
    54945661@cindex verbatim variable definition
    54955662@cindex defining variables verbatim
     
    54985665Another way to set the value of a variable is to use the @code{define}
    54995666directive.  This directive has an unusual syntax which allows newline
    5500 characters to be included in the value, which is convenient for defining
    5501 both canned sequences of commands
    5502 (@pxref{Sequences, ,Defining Canned Command Sequences}), and also
    5503 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 the
    5506 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 are expanded when the directive is read to find the actual variable name
     5667characters to be included in the value, which is convenient for
     5668defining both canned sequences of commands (@pxref{Canned Recipes,
     5669,Defining Canned Recipes}), and also sections of makefile syntax to
     5670use with @code{eval} (@pxref{Eval Function}).@refill
     5671
     5672The @code{define} directive is followed on the same line by the name
     5673of the variable being defined and an (optional) assignment operator,
     5674and nothing more.  The value to give the variable appears on the
     5675following lines.  The end of the value is marked by a line containing
     5676just the word @code{endef}.  Aside from this difference in syntax,
     5677@code{define} works just like any other variable definition.  The
     5678variable name may contain function and variable references, which are
     5679expanded when the directive is read to find the actual variable name
    55135680to use.
     5681
     5682You may omit the variable assignment operator if you prefer.  If
     5683omitted, @code{make} assumes it to be @samp{=} and creates a
     5684recursively-expanded variable (@pxref{Flavors, ,The Two Flavors of Variables}).
     5685When using a @samp{+=} operator, the value is appended to the previous
     5686value as with any other append operation: with a single space
     5687separating the old and new values.
    55145688
    55155689You may nest @code{define} directives: @code{make} will keep track of
     
    55185692prefix character are considered part of a recipe, so any @code{define}
    55195693or @code{endef} strings appearing on such a line will not be
    5520 considered @code{make} operators.
    5521 
    5522 @example
    5523 define two-lines
     5694considered @code{make} directives.
     5695
     5696@example
     5697define two-lines =
    55245698echo foo
    55255699echo $(bar)
     
    55515725
    55525726@example
    5553 override define two-lines
     5727override define two-lines =
    55545728foo
    55555729$(bar)
     
    55605734@xref{Override Directive, ,The @code{override} Directive}.
    55615735
    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
     5741If you want to clear a variable, setting its value to empty is usually
     5742sufficient. Expanding such a variable will yield the same result (empty
     5743string) regardless of whether it was set or not. However, if you are
     5744using the @code{flavor} (@pxref{Flavor Function}) and
     5745@code{origin} (@pxref{Origin Function}) functions, there is a difference
     5746between a variable that was never set and a variable with an empty value.
     5747In such situations you may want to use the @code{undefine} directive to
     5748make a variable appear as if it was never set. For example:
     5749
     5750@example
     5751foo := foo
     5752bar = bar
     5753
     5754undefine foo
     5755undefine bar
     5756
     5757$(info $(origin foo))
     5758$(info $(flavor bar))
     5759@end example
     5760
     5761This example will print ``undefined'' for both variables.
     5762
     5763If you want to undefine a command-line variable definition, you can use
     5764the @code{override} directive together with @code{undefine}, similar to
     5765how this is done for variable definitions:
     5766
     5767@example
     5768override undefine CFLAGS
     5769@end example
     5770
     5771@node Environment, Target-specific, Undefine Directive, Using Variables
    55635772@section Variables from the Environment
    55645773
     
    56265835@end example
    56275836
    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
     5837Target-specific variable assignments can be prefixed with any or all of the
     5838special keywords @code{export}, @code{override}, or @code{private};
     5839these apply their normal behavior to this instance of the variable only.
    56415840
    56425841Multiple @var{target} values create a target-specific variable value for
     
    56845883ignore the target-specific values from any other targets.
    56855884
    5686 @node Pattern-specific, Special Variables, Target-specific, Using Variables
     5885@node Pattern-specific, Suppressing Inheritance, Target-specific, Using Variables
    56875886@section Pattern-specific Variable Values
    56885887@cindex pattern-specific variables
     
    56935892@code{make} supports pattern-specific variable values.  In this form,
    56945893the 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.
     5894specified.
    57015895
    57025896Set a pattern-specific variable value like this:
     
    57055899@var{pattern} @dots{} : @var{variable-assignment}
    57065900@end example
    5707 
    5708 @noindent
    5709 or like this:
    5710 
    5711 @example
    5712 @var{pattern} @dots{} : override @var{variable-assignment}
    5713 @end example
    5714 
    5715 @noindent
    57165901where @var{pattern} is a %-pattern.  As with target-specific variable
    57175902values, multiple @var{pattern} values create a pattern-specific variable
     
    57305915matching the pattern @code{%.o}.
    57315916
    5732 @node Special Variables,  , Pattern-specific, Using Variables
     5917If a target matches more than one pattern, the matching pattern-specific
     5918variables with longer stems are interpreted first. This results in more
     5919specific variables taking precedence over the more generic ones, for
     5920example:
     5921
     5922@example
     5923%.o: %.c
     5924        $(CC) -c $(CFLAGS) $(CPPFLAGS) $< -o $@@
     5925
     5926lib/%.o: CFLAGS := -fPIC -g
     5927%.o: CFLAGS := -g
     5928
     5929all: foo.o lib/bar.o
     5930@end example
     5931
     5932In this example the first definition of the @code{CFLAGS} variable
     5933will be used to update @file{lib/bar.o} even though the second one
     5934also applies to this target. Pattern-specific variables which result
     5935in the same stem length are considered in the order in which they
     5936were defined in the makefile.
     5937
     5938Pattern-specific variables are searched after any target-specific
     5939variables defined explicitly for that target, and before target-specific
     5940variables 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
     5948As described in previous sections, @code{make} variables are inherited
     5949by prerequisites.  This capability allows you to modify the behavior
     5950of a prerequisite based on which targets caused it to be rebuilt.  For
     5951example, you might set a target-specific variable on a @code{debug}
     5952target, then running @samp{make debug} will cause that variable to be
     5953inherited by all prerequisites of @code{debug}, while just running
     5954@samp{make all} (for example) would not have that assignment.
     5955
     5956Sometimes, however, you may not want a variable to be inherited.  For
     5957these situations, @code{make} provides the @code{private} modifier.
     5958Although this modifier can be used with any variable assignment, it
     5959makes the most sense with target- and pattern-specific variables.  Any
     5960variable marked @code{private} will be visible to its local target but
     5961will not be inherited by prerequisites of that target.  A global
     5962variable marked @code{private} will be visible in the global scope but
     5963will not be inherited by any target, and hence will not be visible
     5964in any recipe.
     5965
     5966As an example, consider this makefile:
     5967@example
     5968EXTRA_CFLAGS =
     5969
     5970prog: private EXTRA_CFLAGS = -L/usr/local/lib
     5971prog: a.o b.o
     5972@end example
     5973
     5974Due to the @code{private} modifier, @code{a.o} and @code{b.o} will not
     5975inherit the @code{EXTRA_CFLAGS} variable assignment from the
     5976@code{progs} target.
     5977
     5978@node Special Variables,  , Suppressing Inheritance, Using Variables
    57335979@comment  node-name,  next,  previous,  up
    57345980@section Other Special Variables
     
    58346080variable).  You should not set, modify, or export this variable.
    58356081
    5836 @vindex .CMDPREFIX @r{(change the recipe prefix character)}
    5837 @item .CMDPREFIX
     6082@vindex .RECIPEPREFIX @r{(change the recipe prefix character)}
     6083@item .RECIPEPREFIX
    58386084The first character of the value of this variable is used as the
    58396085character make assumes is introducing a recipe line.  If the variable
     
    58436089@example
    58446090@group
    5845 .CMDPREFIX = >
     6091.RECIPEPREFIX = >
    58466092all:
    58476093> @@echo Hello, world
     
    58496095@end example
    58506096
    5851 The value of @code{.CMDPREFIX} can be changed multiple times; once set
     6097The value of @code{.RECIPEPREFIX} can be changed multiple times; once set
    58526098it stays in effect for all rules parsed until it is modified.
    58536099
     
    71757421all: $(PROGRAMS)
    71767422
    7177 define PROGRAM_template
     7423define PROGRAM_template =
    71787424 $(1): $$($(1)_OBJS) $$($(1)_LIBS:%=-l%)
    71797425 ALL_OBJS   += $$($(1)_OBJS)
     
    72287474@item environment
    72297475
    7230 if @var{variable} was defined as an environment variable and the
    7231 @samp{-e} option is @emph{not} turned on (@pxref{Options Summary, ,Summary of Options}).
     7476if @var{variable} was inherited from the environment provided to
     7477@code{make}.
    72327478
    72337479@item environment override
    72347480
    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
     7481if @var{variable} was inherited from the environment provided to
     7482@code{make}, and is overriding a setting for @var{variable} in the
     7483makefile as a result of the @w{@samp{-e}} option (@pxref{Options
     7484Summary, ,Summary of Options}).@refill
    72387485
    72397486@item file
     
    74767723The exit status is one if you use the @samp{-q} flag and @code{make}
    74777724determines that some target is not already up to date.
    7478 @xref{Instead of Execution, ,Instead of Executing the Recipes}.
     7725@xref{Instead of Execution, ,Instead of Executing Recipes}.
    74797726@end table
    74807727
     
    76537900
    76547901@node Instead of Execution, Avoiding Compilation, Goals, Running
    7655 @section Instead of Executing the Recipes
     7902@section Instead of Executing Recipes
    76567903@cindex execution, instead of
    76577904@cindex recipes, instead of executing
     
    76737920
    76747921``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.
     7922the targets up to date, but not actually execute it.  Some recipes are
     7923still executed, even with this flag (@pxref{MAKE Variable, ,How the @code{MAKE} Variable Works}).
    76767924
    76777925@item -t
     
    77157963
    77167964With the @samp{-n} flag, @code{make} prints the recipe that it would
    7717 normally execute but does not execute it.
     7965normally execute but usually does not execute it.
    77187966
    77197967With the @samp{-t} flag, @code{make} ignores the recipes in the rules
     
    77417989not run unless they too begin with @samp{+} or contain @samp{$(MAKE)} or
    77427990@samp{$@{MAKE@}} (@xref{MAKE Variable, ,How the @code{MAKE} Variable Works}.)
     7991
     7992@cindex phony targets and recipe execution
     7993The @samp{-t} flag prevents phony targets (@pxref{Phony Targets}) from
     7994being updated, unless there are recipe lines beginning with @samp{+}
     7995or containing @samp{$(MAKE)} or @samp{$@{MAKE@}}.
    77437996
    77447997The @samp{-W} flag provides two features:
     
    80078260@xref{Environment, ,Variables from the Environment}.
    80088261
     8262@item --eval=@var{string}
     8263@cindex @code{--eval}
     8264@c Extra blank line here makes the table look better.
     8265
     8266Evaluate @var{string} as makefile syntax.  This is a command-line
     8267version of the @code{eval} function (@pxref{Eval Function}).  The
     8268evaluation is performed after the default rules and variables have
     8269been defined, but before any makefiles are read.
     8270
    80098271@item -f @var{file}
    80108272@cindex @code{-f}
     
    80908352@c Extra blank line here makes the table look better.
    80918353
    8092 Print the recipe that would be executed, but do not execute it.
    8093 @xref{Instead of Execution, ,Instead of Executing the Recipes}.
     8354Print the recipe that would be executed, but do not execute it (except
     8355in certain circumstances).
     8356@xref{Instead of Execution, ,Instead of Executing Recipes}.
    80948357
    80958358@item -o @var{file}
     
    81288391return an exit status that is zero if the specified targets are already
    81298392up to date, one if any remaking is required, or two if an error is
    8130 encountered.  @xref{Instead of Execution, ,Instead of Executing the
     8393encountered.  @xref{Instead of Execution, ,Instead of Executing
    81318394Recipes}.@refill
    81328395
     
    81908453instead of running their recipes.  This is used to pretend that the
    81918454recipes were done, in order to fool future invocations of
    8192 @code{make}.  @xref{Instead of Execution, ,Instead of Executing the Recipes}.
     8455@code{make}.  @xref{Instead of Execution, ,Instead of Executing Recipes}.
    81938456
    81948457@item -v
     
    82318494@code{make}, except that the modification time is changed only in the
    82328495imagination of @code{make}.
    8233 @xref{Instead of Execution, ,Instead of Executing the Recipes}.
     8496@xref{Instead of Execution, ,Instead of Executing Recipes}.
    82348497
    82358498@item --warn-undefined-variables
     
    84218684@pindex .c
    84228685@file{@var{n}.o} is made automatically from @file{@var{n}.c} with
    8423 a recipe of the form @samp{$(CC) -c $(CPPFLAGS) $(CFLAGS)}.@refill
     8686a recipe of the form @samp{$(CC) $(CPPFLAGS) $(CFLAGS) -c}.@refill
    84248687
    84258688@item Compiling C++ programs
     
    84318694@file{@var{n}.o} is made automatically from @file{@var{n}.cc},
    84328695@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 the
     8696@samp{$(CXX) $(CPPFLAGS) $(CXXFLAGS) -c}.  We encourage you to use the
    84348697suffix @samp{.cc} for C++ source files instead of @samp{.C}.@refill
    84358698
     
    84398702@pindex .p
    84408703@file{@var{n}.o} is made automatically from @file{@var{n}.p}
    8441 with the recipe @samp{$(PC) -c $(PFLAGS)}.@refill
     8704with the recipe @samp{$(PC) $(PFLAGS) -c}.@refill
    84428705
    84438706@item Compiling Fortran and Ratfor programs
     
    84548717@table @samp
    84558718@item .f
    8456 @samp{$(FC) -c $(FFLAGS)}.
     8719@samp{$(FC) $(FFLAGS) -c}.
    84578720@item .F
    8458 @samp{$(FC) -c $(FFLAGS) $(CPPFLAGS)}.
     8721@samp{$(FC) $(FFLAGS) $(CPPFLAGS) -c}.
    84598722@item .r
    8460 @samp{$(FC) -c $(FFLAGS) $(RFLAGS)}.
     8723@samp{$(FC) $(FFLAGS) $(RFLAGS) -c}.
    84618724@end table
    84628725
     
    84698732@table @samp
    84708733@item .F
    8471 @samp{$(FC) -F $(CPPFLAGS) $(FFLAGS)}.
     8734@samp{$(FC) $(CPPFLAGS) $(FFLAGS) -F}.
    84728735@item .r
    8473 @samp{$(FC) -F $(FFLAGS) $(RFLAGS)}.
     8736@samp{$(FC) $(FFLAGS) $(RFLAGS) -F}.
    84748737@end table
    84758738
     
    90669329pattern.  @xref{Last Resort}.
    90679330
     9331More 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
    90689335@c !!! The end of of this paragraph should be rewritten.  --bob
    90699336Pattern rules may have more than one target.  Unlike normal rules,
     
    90819348@cindex target, multiple in pattern rule
    90829349
    9083 The order in which pattern rules appear in the makefile is important
    9084 since this is the order in which they are considered.
    9085 Of equally applicable
    9086 rules, only the first one found is used.  The rules you write take precedence
    9087 over those that are built in.  Note however, that a rule whose
    9088 prerequisites actually exist or are mentioned always takes priority over a
    9089 rule with prerequisites that must be made by chaining other implicit rules.
    9090 @cindex pattern rules, order of
    9091 @cindex order of pattern rules
    9092 
    90939350@node Pattern Examples, Automatic Variables, Pattern Intro, Pattern Rules
    90949351@subsection Pattern Rule Examples
     
    94039660@file{src/car}.@refill
    94049661
     9662@cindex pattern rules, order of
     9663@cindex order of pattern rules
     9664A pattern rule can be used to build a given file only if there is a
     9665target pattern that matches the file name, @emph{and} all
     9666prerequisites in that rule either exist or can be built.  The rules
     9667you write take precedence over those that are built in. Note however,
     9668that a rule whose prerequisites actually exist or are mentioned always
     9669takes priority over a rule with prerequisites that must be made by
     9670chaining other implicit rules.
     9671
     9672@cindex stem, shortest
     9673It is possible that more than one pattern rule will meet these
     9674criteria.  In that case, @code{make} will choose the rule with the
     9675shortest stem (that is, the pattern that matches most specifically).
     9676If more than one pattern rule has the shortest stem, @code{make} will
     9677choose the first one found in the makefile.
     9678
     9679This algorithm results in more specific rules being preferred over
     9680more 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
     9689lib/%.o: lib/%.c
     9690        $(CC) -fPIC -c $(CFLAGS) $(CPPFLAGS) $< -o $@@
     9691@end example
     9692
     9693Given 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
     9695rule and compile @file{bar.c} into @file{bar.o}.  In the same
     9696situation where @file{bar.c} does not exist, then @code{make} will
     9697choose the second rule and compile @file{bar.f} into @file{bar.o}.
     9698
     9699If @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
     9701be chosen since the stem for this rule (@samp{bar}) is shorter than
     9702the stem for the first rule (@samp{lib/bar}).  If @file{lib/bar.c}
     9703does not exist then the third rule is not eligible and the second rule
     9704will be used, even though the stem is longer.
     9705
    94059706@node Match-Anything Rules, Canceling Rules, Pattern Match, Pattern Rules
    94069707@subsection Match-Anything Pattern Rules
     
    1008410385The ``what if'' flag (@samp{-W} in GNU @code{make}) was (as far as we know)
    1008510386invented by Andrew Hume in @code{mk}.
    10086 @xref{Instead of Execution, ,Instead of Executing the Recipes}.
     10387@xref{Instead of Execution, ,Instead of Executing Recipes}.
    1008710388
    1008810389@item
     
    1010210403@item
    1010310404The special significance of @samp{+} characters preceding recipe lines
    10104 (@pxref{Instead of Execution, ,Instead of Executing the Recipes}) is
     10405(@pxref{Instead of Execution, ,Instead of Executing Recipes}) is
    1010510406mandated by @cite{IEEE Standard 1003.2-1992} (POSIX.2).
    1010610407
     
    1014710448@item
    1014810449Make verbatim variable definitions with @code{define}.
    10149 @xref{Defining, ,Defining Variables Verbatim}.
     10450@xref{Multi-Line, ,Defining Multi-Line Variables}.
    1015010451
    1015110452@item
     
    1035510656@table @code
    1035610657@item define @var{variable}
     10658@itemx define @var{variable} =
     10659@itemx define @var{variable} :=
     10660@itemx define @var{variable} +=
     10661@itemx define @var{variable} ?=
    1035710662@itemx endef
    10358 
    10359 Define a multi-line, recursively-expanded variable.@*
    10360 @xref{Sequences}.
     10663Define multi-line variables.@*
     10664@xref{Multi-Line}.
     10665
     10666@item undefine @var{variable}
     10667Undefining variables.@*
     10668@xref{Undefine Directive}.
    1036110669
    1036210670@item ifdef @var{variable}
     
    1037010678@itemx else
    1037110679@itemx endif
    10372 
    1037310680Conditionally evaluate part of the makefile.@*
    1037410681@xref{Conditionals}.
     
    1037710684@itemx -include @var{file}
    1037810685@itemx sinclude @var{file}
    10379 
    1038010686Include another makefile.@*
    1038110687@xref{Include, ,Including Other Makefiles}.
    1038210688
    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}
    1039010690Define a variable, overriding any previous definition, even one from
    1039110691the command line.@*
     
    1039310693
    1039410694@item export
    10395 
    1039610695Tell @code{make} to export all variables to child processes by default.@*
    1039710696@xref{Variables/Recursion, , Communicating Variables to a Sub-@code{make}}.
    1039810697
    1039910698@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}
    1040410700@itemx unexport @var{variable}
    1040510701Tell @code{make} whether or not to export a particular variable to child
    1040610702processes.@*
    1040710703@xref{Variables/Recursion, , Communicating Variables to a Sub-@code{make}}.
     10704
     10705@item private @var{variable-assignment}
     10706Do not allow this variable assignment to be inherited by prerequisites.@*
     10707@xref{Suppressing Inheritance}.
    1040810708
    1040910709@item vpath @var{pattern} @var{path}
     
    1051510815
    1051610816@item $(error @var{text}@dots{})
    10517 
    1051810817When this function is evaluated, @code{make} generates a fatal error
    1051910818with the message @var{text}.@*
     
    1052110820
    1052210821@item $(warning @var{text}@dots{})
    10523 
    1052410822When this function is evaluated, @code{make} generates a warning with
    1052510823the message @var{text}.@*
     
    1052710825
    1052810826@item $(shell @var{command})
    10529 
    1053010827Execute a shell command and return its output.@*
    1053110828@xref{Shell Function, , The @code{shell} Function}.
    1053210829
    1053310830@item $(origin @var{variable})
    10534 
    1053510831Return a string describing how the @code{make} variable @var{variable} was
    1053610832defined.@*
     
    1053810834
    1053910835@item $(flavor @var{variable})
    10540 
    1054110836Return a string describing the flavor of the @code{make} variable
    1054210837@var{variable}.@*
     
    1054410839
    1054510840@item $(foreach @var{var},@var{words},@var{text})
    10546 
    1054710841Evaluate @var{text} with @var{var} bound to each word in @var{words},
    1054810842and concatenate the results.@*
    1054910843@xref{Foreach Function, ,The @code{foreach} Function}.
    1055010844
     10845@item $(if @var{condition},@var{then-part}[,@var{else-part}])
     10846Evaluate the condition @var{condition}; if it's non-empty substitute
     10847the expansion of the @var{then-part} otherwise substitute the
     10848expansion of the @var{else-part}.@*
     10849@xref{Conditional Functions, ,Functions for Conditionals}.
     10850
     10851@item $(or @var{condition1}[,@var{condition2}[,@var{condition3}@dots{}]])
     10852Evaluate each condition @var{conditionN} one at a time; substitute the
     10853first non-empty expansion.  If all expansions are empty, substitute
     10854the empty string.@*
     10855@xref{Conditional Functions, ,Functions for Conditionals}.
     10856
     10857@item $(and @var{condition1}[,@var{condition2}[,@var{condition3}@dots{}]])
     10858Evaluate each condition @var{conditionN} one at a time; if any
     10859expansion results in the empty string substitute the empty string.  If
     10860all expansions result in a non-empty string, substitute the expansion
     10861of the last @var{condition}.@*
     10862@xref{Conditional Functions, ,Functions for Conditionals}.
     10863
    1055110864@item $(call @var{var},@var{param},@dots{})
    10552 
    1055310865Evaluate the variable @var{var} replacing any references to @code{$(1)},
    1055410866@code{$(2)} with the first, second, etc.@: @var{param} values.@*
     
    1055610868
    1055710869@item $(eval @var{text})
    10558 
    1055910870Evaluate @var{text} then read the results as makefile commands.
    1056010871Expands to the empty string.@*
     
    1056210873
    1056310874@item $(value @var{var})
    10564 
    1056510875Evaluates to the contents of the variable @var{var}, with no expansion
    1056610876performed on it.@*
     
    1074711057second form of the error above.  Remember that every line in the
    1074811058recipe must begin with a tab character (unless you set
    10749 @code{.CMDPREFIX}; @pxref{Special Variables}).  Eight spaces do not
     11059@code{.RECIPEPREFIX}; @pxref{Special Variables}).  Eight spaces do not
    1075011060count.  @xref{Rule Syntax}.
    1075111061
     
    1100711317#### End of system configuration section. ####
    1100811318
    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
     11320SRCS_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
     11325SRCS_Y  = getdate.y
     11326SRCS    = $(SRCS_C) $(SRCS_Y)
     11327OBJS    = $(SRCS_C:.c=.o) $(SRCS_Y:.y=.o) $(RTAPELIB)
     11328@end group
    1102111329@group
    1102211330AUX =   README COPYING ChangeLog Makefile.in  \
  • vendor/gnumake/current/dosbuild.bat

    r1991 r2596  
    11@echo off
    2 rem Copyright (C) 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007
    3 rem Free Software Foundation, Inc.
     2rem Copyright (C) 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007,
     3rem 2008, 2009, 2010 Free Software Foundation, Inc.
    44rem This file is part of GNU Make.
    55rem
  • vendor/gnumake/current/expand.c

    r1989 r2596  
    11/* Variable expansion functions for GNU Make.
    22Copyright (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.
     31998, 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009,
     42010 Free Software Foundation, Inc.
    55This file is part of GNU Make.
    66
     
    410410      if (*p == '\0')
    411411        break;
    412       else
    413         ++p;
     412
     413      ++p;
    414414    }
    415415
     
    443443expand_argument (const char *str, const char *end)
    444444{
    445   char *tmp;
     445  char *tmp, *alloc = NULL;
     446  char *r;
    446447
    447448  if (str == end)
     
    451452    return allocated_variable_expand (str);
    452453
    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
    454459  memcpy (tmp, str, end - str);
    455460  tmp[end - str] = '\0';
    456461
    457   return allocated_variable_expand (tmp);
     462  r = allocated_variable_expand (tmp);
     463
     464  if (alloc)
     465    free (alloc);
     466
     467  return r;
    458468}
    459469
     
    570580  value = variable_expand_for_file (line, file);
    571581
    572 #if 0
    573   /* Waste a little memory and save time.  */
    574   value = xrealloc (value, strlen (value))
    575 #endif
    576 
    577582  variable_buffer = obuf;
    578583  variable_buffer_length = olen;
  • vendor/gnumake/current/file.c

    r1989 r2596  
    11/* Target file management for GNU Make.
    22Copyright (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.
     31998, 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009,
     42010 Free Software Foundation, Inc.
    55This file is part of GNU Make.
    66
     
    104104      name += 2;
    105105#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')
    107113    {
    108114      name += 2;
    109       while (*name == '/')
     115      while (*name == '/'
     116#ifdef HAVE_DOS_PATHS
     117             || *name == '\\'
     118#endif
     119             )
    110120        /* Skip following slashes: ".//foo" is "foo", not "/foo".  */
    111121        ++name;
     
    172182    return f;
    173183
    174   new = xmalloc (sizeof (struct file));
    175   memset (new, '\0', sizeof (struct file));
     184  new = xcalloc (sizeof (struct file));
    176185  new->name = new->hname = name;
    177186  new->update_status = -1;
     
    415424
    416425
     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 */
    417429struct 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));
     430split_prereqs (char *p)
     431{
     432  struct dep *new = PARSE_FILE_SEQ (&p, struct dep, '|', NULL, 0);
    423433
    424434  if (*p)
     
    429439
    430440      ++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);
    434442
    435443      if (! new)
     
    450458}
    451459
     460/* Given a list of prerequisites, enter them into the file database.
     461   If STEM is set then first expand patterns using STEM.  */
     462struct dep *
     463enter_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
    452539/* Set the intermediate flag.  */
    453540
     
    464551{
    465552  struct dep *d;
    466   struct dep *old = f->deps;
     553  struct dep **dp;
    467554  const char *file_stem = f->stem;
    468   unsigned int last_dep_has_cmds = f->updating;
    469555  int initialized = 0;
    470556
    471557  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    {
    477565      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)
    486570        {
    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;
    490575        }
    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)
    492580        {
    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;
    527588        }
    528589
    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)
    536594        {
    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;
    582597        }
    583598
    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)
    586617        {
    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;
    593622        }
    594623
    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
     636static void
     637reset_updating (const void *item)
     638{
     639  struct file *f = (struct file *) item;
     640  f->updating = 0;
    626641}
    627642
     
    638653  struct file *f2;
    639654  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)
    658680        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);
    660693
    661694  /* Now manage all the special targets.  */
     
    738771  /* This needs more work: what if the user sets this in the makefile?
    739772  if (posix_pedantic)
    740     define_variable (STRING_SIZE_TUPLE("OUTPUT_OPTION"), "", o_default, 1);
     773    define_variable_cname ("OUTPUT_OPTION", "", o_default, 1);
    741774  */
    742775#endif
    743 
    744   /* Remember that we've done this. */
    745   snapped_deps = 1;
    746776}
    747777
     
    868898/* Print the data base of files.  */
    869899
     900void
     901print_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
    870924static void
    871925print_file (const void *item)
    872926{
    873927  const struct file *f = item;
    874   struct dep *d;
    875   struct dep *ood = 0;
    876928
    877929  putchar ('\n');
     
    879931    puts (_("# Not a target:"));
    880932  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);
    899934
    900935  if (f->precious)
     
    915950  if (f->also_make != 0)
    916951    {
     952      const struct dep *d;
    917953      fputs (_("#  Also makes:"), stdout);
    918954      for (d = f->also_make; d != 0; d = d->next)
     
    9991035    do{\
    10001036        if (_p->_n && _p->_n[0] && !strcache_iscached (_p->_n)) \
    1001           printf ("%s: Field %s not cached: %s\n", _p->name, # _n, _p->_n); \
     1037          error (NULL, "%s: Field '%s' not cached: %s\n", _p->name, # _n, _p->_n); \
    10021038    }while(0)
    10031039
     
    10161052  for (d = f->deps; d != 0; d = d->next)
    10171053    {
    1018       VERIFY_CACHED (d, name);
     1054      if (! d->need_2nd_expansion)
     1055        VERIFY_CACHED (d, name);
    10191056      VERIFY_CACHED (d, stem);
    10201057    }
  • vendor/gnumake/current/filedef.h

    r1989 r2596  
    11/* Definition of target file data structures for GNU Make.
    22Copyright (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.
     31998, 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009,
     42010 Free Software Foundation, Inc.
    55This file is part of GNU Make.
    66
     
    9595    unsigned int considered:1;  /* equal to 'considered' if file has been
    9696                                   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). */
    9799  };
    98100
    99101
    100 extern struct file *default_goal_file, *suffix_file, *default_file;
    101 extern char **default_goal_name;
     102extern struct file *suffix_file, *default_file;
    102103
    103104
    104105struct file *lookup_file (const char *name);
    105106struct file *enter_file (const char *name);
    106 struct dep *parse_prereqs (char *prereqs);
     107struct dep *split_prereqs (char *prereqstr);
     108struct dep *enter_prereqs (struct dep *prereqs, const char *stem);
    107109void remove_intermediates (int sig);
    108110void snap_deps (void);
     
    113115void init_hash_files (void);
    114116char *build_target_list (char *old_list);
     117void print_prereqs (const struct dep *deps);
     118void print_file_data_base (void);
    115119
    116120#if FILE_TIMESTAMP_HI_RES
  • vendor/gnumake/current/function.c

    r1989 r2596  
    11/* Builtin function expansion for GNU Make.
    22Copyright (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.
     31998, 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009,
     42010 Free Software Foundation, Inc.
    55This file is part of GNU Make.
    66
     
    362362  unsigned int idx;
    363363
    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);
    371369
    372370  if (result == 0)
     
    379377  while (chain != 0)
    380378    {
    381       const char *name = chain->name;
    382       unsigned int len = strlen (name);
    383 
    384379      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);
    385393      free (chain);
    386394      chain = next;
    387 
    388       /* multi_glob will pass names without globbing metacharacters
    389          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         }
    401395    }
    402396
     
    861855
    862856      free (var->value);
    863       var->value = savestring (p, len);
     857      var->value = xstrndup (p, len);
    864858
    865859      result = allocated_variable_expand (body);
     
    14481442
    14491443void
    1450 windows32_openpipe (int *pipedes, int *pid_p, char **command_argv, char **envp)
     1444windows32_openpipe (int *pipedes, pid_t *pid_p, char **command_argv, char **envp)
    14511445{
    14521446  SECURITY_ATTRIBUTES saAttr;
     
    14691463                      TRUE,
    14701464                      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"),
    14721466           GetLastError());
    14731467
     
    14801474                      TRUE,
    14811475                      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"),
    14831477           GetLastError());
    14841478  }
     
    14901484
    14911485  if (!hProcess)
    1492     fatal (NILF, _("windows32_openpipe (): process_init_fd() failed\n"));
     1486    fatal (NILF, _("windows32_openpipe(): process_init_fd() failed\n"));
    14931487
    14941488  /* make sure that CreateProcess() has Path it needs */
    14951489  sync_Path_environment();
     1490  /* `sync_Path_environment' may realloc `environ', so take note of
     1491     the new value.  */
     1492  envp = environ;
    14961493
    14971494  if (!process_begin(hProcess, command_argv, envp, command_argv[0], NULL)) {
     
    15001497
    15011498    /* set the pid for returning to caller */
    1502     *pid_p = (int) hProcess;
     1499    *pid_p = (pid_t) hProcess;
    15031500
    15041501  /* 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);
    15061503
    15071504  /* 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);
    15091506  } else {
    15101507    /* reap/cleanup the failed process */
     
    15211518    /* set status for return */
    15221519    pipedes[0] = pipedes[1] = -1;
    1523     *pid_p = -1;
     1520    *pid_p = (pid_t)-1;
    15241521  }
    15251522}
     
    16051602  char **envp;
    16061603  int pipedes[2];
    1607   int pid;
     1604  pid_t pid;
    16081605
    16091606#ifndef __MSDOS__
     
    16951692      free (command_argv);
    16961693
    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]);
    16991699#endif
    17001700
     
    18871887
    18881888
     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
    18891897/* Return the absolute name of file NAME which does not contain any `.',
    18901898   `..' components nor any repeated path separators ('/').   */
     
    18951903  char *dest;
    18961904  const char *start, *end, *apath_limit;
     1905  unsigned long root_len = ROOT_LEN;
    18971906
    18981907  if (name[0] == '\0' || apath == NULL)
     
    19011910  apath_limit = apath + GET_PATH_MAX;
    19021911
    1903   if (name[0] != '/')
     1912  if (!IS_ABSOLUTE(name))
    19041913    {
    19051914      /* It is unlikely we would make it until here but just to make sure. */
     
    19091918      strcpy (apath, starting_directory);
    19101919
     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
    19111938      dest = strchr (apath, '\0');
    19121939    }
    19131940  else
    19141941    {
    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
    19171961    }
    19181962
     
    19221966
    19231967      /* Skip sequence of multiple path-separators.  */
    1924       while (*start == '/')
     1968      while (IS_PATHSEP(*start))
    19251969        ++start;
    19261970
    19271971      /* Find end of path component.  */
    1928       for (end = start; *end != '\0' && *end != '/'; ++end)
     1972      for (end = start; *end != '\0' && !IS_PATHSEP(*end); ++end)
    19291973        ;
    19301974
     
    19381982        {
    19391983          /* 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);
    19421986        }
    19431987      else
    19441988        {
    1945           if (dest[-1] != '/')
     1989          if (!IS_PATHSEP(dest[-1]))
    19461990            *dest++ = '/';
    19471991
     
    19562000
    19572001  /* Unless it is root strip trailing separator.  */
    1958   if (dest > apath + 1 && dest[-1] == '/')
     2002  if (dest > apath + root_len && IS_PATHSEP(dest[-1]))
    19592003    --dest;
    19602004
     
    19732017  int doneany = 0;
    19742018  unsigned int len = 0;
     2019#ifndef HAVE_REALPATH
     2020  struct stat st;
     2021#endif
    19752022  PATH_VAR (in);
    19762023  PATH_VAR (out);
     
    19872034              realpath (in, out)
    19882035#else
    1989               abspath (in, out)
     2036              abspath (in, out) && stat (out, &st) == 0
    19902037#endif
    19912038             )
  • vendor/gnumake/current/getloadavg.c

    r1989 r2596  
    11/* Get the system load averages.
    22Copyright (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.
     31995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007,
     42008, 2009, 2010 Free Software Foundation, Inc.
    55
    66GNU Make is free software; you can redistribute it and/or modify it under the
  • vendor/gnumake/current/getopt.c

    r1989 r2596  
    55
    66Copyright (C) 1987, 1988, 1989, 1990, 1991, 1992, 1993, 1994, 1995, 1996,
    7 1997, 1998, 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007 Free Software
    8 Foundation, Inc.
     71997, 1998, 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009,
     82010 Free Software Foundation, Inc.
    99
    1010NOTE: The canonical source of this file is maintained with the GNU C Library.
  • vendor/gnumake/current/getopt.h

    r1989 r2596  
    11/* Declarations for getopt.
    22Copyright (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.
     31999, 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010 Free
     4Software Foundation, Inc.
    55
    66NOTE: The canonical source of this file is maintained with the GNU C Library.
  • vendor/gnumake/current/getopt1.c

    r1989 r2596  
    11/* getopt_long and getopt_long_only entry points for GNU getopt.
    22Copyright (C) 1987, 1988, 1989, 1990, 1991, 1992, 1993, 1994, 1996, 1997,
    3 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007 Free Software
    4 Foundation, Inc.
     31998, 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009,
     42010 Free Software Foundation, Inc.
    55
    66NOTE: The canonical source of this file is maintained with the GNU C Library.
  • vendor/gnumake/current/gettext.h

    r1989 r2596  
    11/* Convenience header for conditional use of GNU <libintl.h>.
    22Copyright (C) 1995, 1996, 1997, 1998, 2000, 2001, 2002, 2003, 2004, 2005,
    3 2006, 2007 Free Software Foundation, Inc.
     32006, 2007, 2008, 2009, 2010 Free Software Foundation, Inc.
    44This file is part of GNU Make.
    55
  • vendor/gnumake/current/glob

    • Property svn:ignore deleted
  • vendor/gnumake/current/glob/ChangeLog

    r1989 r2596  
     12008-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
    172007-12-22  Juan Manuel Guerrero  <juan.guerrero@gmx.de>  (tiny change)
    28
    3         * glob/glob.c [__GNU_LIBRARY__ && __DJGPP__]: Add a realloc
     9        * glob.c [__GNU_LIBRARY__ && __DJGPP__]: Add a realloc
    410        declaration that matches the one in the DJGPP libc.
    511
  • vendor/gnumake/current/glob/glob.c

    r1989 r2596  
    183183#endif
    184184
    185 #ifndef __GNU_LIBRARY__
     185#if !defined __GNU_LIBRARY__ && !defined __DJGPP__
    186186# ifdef __GNUC__
    187187__inline
     
    191191static void *
    192192my_realloc (void *p, unsigned int n)
    193 #  elif defined(__DJGPP__)
    194 static void *
    195 my_realloc (void *p, size_t n)
    196193#  else
    197194static char *
     
    209206# define        realloc my_realloc
    210207# endif /* __SASC */
    211 #endif /* __GNU_LIBRARY__ */
     208#endif /* __GNU_LIBRARY__ || __DJGPP__ */
    212209
    213210
  • vendor/gnumake/current/hash.c

    r1989 r2596  
    11/* hash.c -- hash table maintenance
    2 Copyright (C) 1995, 1999, 2002 Free Software Foundation, Inc.
     2Copyright (C) 1995, 1999, 2002, 2010 Free Software Foundation, Inc.
    33Written by Greg McGary <gkm@gnu.org> <greg@mcgary.org>
    44
     
    4747  if (ht->ht_vec == 0)
    4848    {
    49       fprintf (stderr, _("can't allocate %ld bytes 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 *));
    5151      exit (1);
    5252    }
     
    127127{
    128128  void **slot = hash_find_slot (ht, item);
    129   const void *old_item = slot ? *slot : 0;
     129  const void *old_item = *slot;
    130130  hash_insert_at (ht, item, slot);
    131131  return (void *)((HASH_VACANT (old_item)) ? 0 : old_item);
  • vendor/gnumake/current/hash.h

    r1989 r2596  
    11/* hash.h -- decls for hash table
    2 Copyright (C) 1995, 1999, 2002 Free Software Foundation, Inc.
     2Copyright (C) 1995, 1999, 2002, 2010 Free Software Foundation, Inc.
    33Written by Greg McGary <gkm@gnu.org> <greg@mcgary.org>
    44
     
    8181/* hash and comparison macros for case-sensitive string keys. */
    8282
     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
    8386#define STRING_HASH_1(KEY, RESULT) do { \
    8487  unsigned char const *_key_ = (unsigned char const *) (KEY) - 1; \
     
    104107
    105108#define STRING_COMPARE(X, Y, RESULT) do { \
    106   RESULT = strcmp ((X), (Y)); \
     109    RESULT = (X) == (Y) ? 0 : strcmp ((X), (Y)); \
    107110} while (0)
    108111#define return_STRING_COMPARE(X, Y) do { \
    109   return strcmp ((X), (Y)); \
     112  return (X) == (Y) ? 0 : strcmp ((X), (Y)); \
    110113} while (0)
    111114
     
    140143
    141144#define STRING_N_COMPARE(X, Y, N, RESULT) do { \
    142   RESULT = strncmp ((X), (Y), (N)); \
     145  RESULT = (X) == (Y) ? 0 : strncmp ((X), (Y), (N)); \
    143146} while (0)
    144147#define return_STRING_N_COMPARE(X, Y, N) do { \
    145   return strncmp ((X), (Y), (N)); \
     148  return (X) == (Y) ? 0 : strncmp ((X), (Y), (N)); \
    146149} while (0)
    147150
     
    173176
    174177#define ISTRING_COMPARE(X, Y, RESULT) do { \
    175   RESULT = strcasecmp ((X), (Y)); \
     178  RESULT = (X) == (Y) ? 0 : strcasecmp ((X), (Y)); \
    176179} while (0)
    177180#define return_ISTRING_COMPARE(X, Y) do { \
    178   return strcasecmp ((X), (Y)); \
     181  return (X) == (Y) ? 0 : strcasecmp ((X), (Y)); \
    179182} while (0)
    180183
  • vendor/gnumake/current/implicit.c

    r1989 r2596  
    11/* Implicit rule searching for GNU Make.
    22Copyright (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.
     31998, 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009,
     42010 Free Software Foundation, Inc.
    55This file is part of GNU Make.
    66
     
    4949    return 1;
    5050
    51 #ifndef NO_ARCHIVES
     51#ifndef NO_ARCHIVES
    5252  /* If this is an archive member reference, use just the
    5353     archive member name to search for implicit rules.  */
     
    5757           _("Looking for archive-member implicit rule for `%s'.\n"));
    5858      if (pattern_search (file, 1, depth, 0))
    59         return 1;
     59        return 1;
    6060    }
    6161#endif
     
    6464}
    6565
    66 
    67 
    68 /* Struct idep captures information about implicit prerequisites
    69    that come from implicit rules. */
    70 struct idep
    71 {
    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 void
    81 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 }
    9166
    9267
     
    9570   length of the word.  */
    9671
    97 static char *
     72static const char *
    9873get_next_word (const char *buffer, unsigned int *length)
    9974{
     
    169144    *length = p - beg;
    170145
    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 */
     154struct 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*/
     165struct 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
     182int
     183stemlen_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);
    172189}
    173190
     
    197214
    198215  /* The last slash in FILENAME (or nil if there is none).  */
    199   char *lastslash;
     216  const char *lastslash;
    200217
    201218  /* This is a file-object used as an argument in
    202219     recursive calls.  It never contains any data
    203220     except during a recursive call.  */
    204   struct file *intermediate_file = 0;
    205 
    206   /* This linked list records all the prerequisites actually
    207      found for a rule along with some other useful information
    208      (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;
    213230
    214231  /* Names of possible dependencies are constructed in this buffer.  */
     
    221238
    222239  /* Buffer in which we store all the rules that are possibly applicable.  */
    223   struct rule **tryrules = xmalloc (num_pattern_rules * max_pattern_targets
    224                                     * sizeof (struct rule *));
     240  struct tryrule *tryrules = xmalloc (num_pattern_rules * max_pattern_targets
     241                                      * sizeof (struct tryrule));
    225242
    226243  /* Number of valid elements in TRYRULES.  */
    227244  unsigned int nrules;
    228245
    229   /* The numbers of the rule targets of each rule
    230      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 in
    234      matching the corresponding element of TRYRULES.  */
    235   char *checked_lastslash = alloca (num_pattern_rules * sizeof (char));
    236 
    237246  /* The index in TRYRULES of the rule we found.  */
    238247  unsigned int foundrule;
     
    240249  /* Nonzero if should consider intermediate files as dependencies.  */
    241250  int intermed_ok;
     251
     252  /* Nonzero if we have initialized file variables for this target.  */
     253  int file_vars_initialized = 0;
    242254
    243255  /* Nonzero if we have matched a pattern-rule target
     
    245257  int specific_rule_matched = 0;
    246258
     259  struct dep dep_simple;
     260
    247261  unsigned int ri;  /* uninit checks OK */
    248262  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;
    254266
    255267  PATH_VAR (stem_str); /* @@ Need to get rid of stem, stemlen, etc. */
    256268
    257 #ifndef NO_ARCHIVES
     269#ifndef NO_ARCHIVES
    258270  if (archive || ar_name (filename))
    259271    lastslash = 0;
     
    262274    {
    263275      /* Set LASTSLASH to point at the last slash in FILENAME
    264         but not counting any slash at the end.  (foo/bar/ counts as
    265         bar/ in directory foo/, not empty in directory foo/bar/.)  */
     276        but not counting any slash at the end.  (foo/bar/ counts as
     277        bar/ in directory foo/, not empty in directory foo/bar/.)  */
    266278#ifdef VMS
    267279      lastslash = strrchr (filename, ']');
    268280      if (lastslash == 0)
    269         lastslash = strrchr (filename, ':');
     281        lastslash = strrchr (filename, ':');
    270282#else
    271283      lastslash = strrchr (filename, '/');
    272284#ifdef HAVE_DOS_PATHS
    273285      /* Handle backslashes (possibly mixed with forward slashes)
    274         and the case of "d:file".  */
     286        and the case of "d:file".  */
    275287      {
    276         char *bslash = strrchr (filename, '\\');
    277         if (lastslash == 0 || bslash > lastslash)
    278           lastslash = bslash;
    279         if (lastslash == 0 && filename[0] && filename[1] == ':')
    280           lastslash = filename + 1;
     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;
    281293      }
    282294#endif
    283295#endif
    284296      if (lastslash != 0 && lastslash[1] == '\0')
    285         lastslash = 0;
     297        lastslash = 0;
    286298    }
    287299
    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.  */
    290304
    291305  nrules = 0;
     
    295309
    296310      /* If the pattern rule has deps but no commands, ignore it.
    297         Users cancel built-in rules by redefining them without commands.  */
     311        Users cancel built-in rules by redefining them without commands.  */
    298312      if (rule->deps != 0 && rule->cmds == 0)
    299         continue;
     313        continue;
    300314
    301315      /* If this rule is in use by a parent pattern_search,
    302         don't use it here.  */
     316        don't use it here.  */
    303317      if (rule->in_use)
    304         {
    305           DBS (DB_IMPLICIT, (_("Avoiding implicit rule recursion.\n")));
    306           continue;
    307         }
     318        {
     319          DBS (DB_IMPLICIT, (_("Avoiding implicit rule recursion.\n")));
     320          continue;
     321        }
    308322
    309323      for (ti = 0; ti < rule->num; ++ti)
    310         {
    311           const char *target = rule->targets[ti];
    312           const char *suffix = rule->suffixes[ti];
    313           int check_lastslash;
    314 
    315           /* Rules that can match any filename and are not terminal
    316              are ignored if we're recursing, so that they cannot be
    317              intermediate files.  */
    318           if (recursions > 0 && target[1] == '\0' && !rule->terminal)
    319             continue;
    320 
    321           if (rule->lens[ti] > namelen)
    322             /* It can't possibly match.  */
    323             continue;
    324 
    325           /* From the lengths of the filename and the pattern parts,
    326              find the stem: the part of the filename that matches the %.  */
    327           stem = filename + (suffix - target - 1);
    328           stemlen = namelen - rule->lens[ti] + 1;
    329 
    330           /* Set CHECK_LASTSLASH if FILENAME contains a directory
    331              prefix and the target pattern does not contain a slash.  */
     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.  */
    332346
    333347          check_lastslash = 0;
     
    349363#endif
    350364            }
    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        }
    398413    }
     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);
    399423
    400424  /* If we have found a matching rule that won't match all filenames,
     
    402426  if (specific_rule_matched)
    403427    for (ri = 0; ri < nrules; ++ri)
    404       if (!tryrules[ri]->terminal)
    405         {
    406           unsigned int j;
    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')
    409433              {
    410                 tryrules[ri] = 0;
     434                tryrules[ri].rule = 0;
    411435                break;
    412436              }
    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        }
    418438
    419439  /* 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)
    421441    {
    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.  */
    426446      for (ri = 0; ri < nrules; ri++)
    427         {
    428           struct file *f;
     447        {
     448          struct dep *dep;
     449          int check_lastslash;
    429450          unsigned int failed = 0;
    430           int check_lastslash;
    431451          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"),
    464494                             (int) stemlen, stem));
    465495
    466496          strncpy (stem_str, stem, stemlen);
    467497          stem_str[stemlen] = '\0';
     498
     499          /* If there are no prerequisites, then this rule matches.  */
     500          if (rule->deps == 0)
     501            break;
    468502
    469503          /* Temporary assign STEM to file->stem (needed to set file
     
    471505          file->stem = stem_str;
    472506
    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;
    478521              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
    489570                 resulting prerequisite.  */
    490 
    491               p = get_next_word (dep->name, &len);
    492 
    493               while (1)
     571              else
    494572                {
    495573                  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, '%');
    498600                  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';
    551604                    }
    552605                  else
    553606                    {
    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)
    619728                      {
    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;
    622733                        continue;
    623734                      }
    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.  */
    656777                  failed = 1;
    657778                  break;
    658779                }
    659780
    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;
    742787            }
    743788
     789          /* Reset the stem in FILE. */
     790
     791          file->stem = 0;
     792
    744793          /* 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.  */
    762808      if (ri < nrules)
    763         break;
     809        break;
    764810
    765811      rule = 0;
    766812    }
    767813
    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.  */
    770815  if (rule == 0)
    771816    goto done;
     
    773818  foundrule = ri;
    774819
    775   /* If we are recursing, store the pattern that matched
    776      FILENAME 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.  */
    777822
    778823  if (recursions > 0)
    779824    /* 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-chain of 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)
    787832    {
    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)
    793837        {
    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);
    819846
    820847          /* We don't want to delete an intermediate file that happened
     
    824851            f->precious = 1;
    825852          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;
    831861          f->also_make = imf->also_make;
    832862          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)
    835871            {
    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;
    839875            }
    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        }
    850877
    851878      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;
    861883      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;
    879905    }
    880906
    881   *d_ptr = expl_d;
    882 
    883   if (!checked_lastslash[foundrule])
     907  if (!tryrules[foundrule].checked_lastslash)
    884908    {
    885       /* Always allocate new storage, since STEM might be
    886          on the stack for an intermediate file.  */
     909      /* Always allocate new storage, since STEM might be on the stack for an
     910         intermediate file.  */
    887911      file->stem = strcache_add_len (stem, stemlen);
    888912      fullstemlen = stemlen;
     
    894918
    895919      /* We want to prepend the directory from
    896         the original FILENAME onto the stem.  */
     920        the original FILENAME onto the stem.  */
    897921      fullstemlen = dirlen + stemlen;
    898922      sp = alloca (fullstemlen + 1);
     
    908932  /* Set precious flag. */
    909933  {
    910     struct file *f = lookup_file (rule->targets[matches[foundrule]]);
     934    struct file *f = lookup_file (rule->targets[tryrules[foundrule].matches]);
    911935    if (f && f->precious)
    912936      file->precious = 1;
     
    918942  if (rule->num > 1)
    919943    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],
    928953                  rule->suffixes[ri] - rule->targets[ri] - 1);
    929           p += rule->suffixes[ri] - rule->targets[ri] - 1;
    930           memcpy (p, file->stem, fullstemlen);
    931           p += fullstemlen;
    932           memcpy (p, rule->suffixes[ri],
     954          p += rule->suffixes[ri] - rule->targets[ri] - 1;
     955          memcpy (p, file->stem, fullstemlen);
     956          p += fullstemlen;
     957          memcpy (p, rule->suffixes[ri],
    933958                  rule->lens[ri] - (rule->suffixes[ri] - rule->targets[ri])+1);
    934           new->name = strcache_add (p);
    935           new->file = enter_file (new->name);
    936           new->next = file->also_make;
    937 
    938           /* Set precious flag. */
    939           f = lookup_file (rule->targets[ri]);
    940           if (f && f->precious)
     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)
    941966            new->file->precious = 1;
    942967
    943           /* Set the is_target flag so that this file is not treated
    944              as intermediate by the pattern rule search algorithm and
     968          /* Set the is_target flag so that this file is not treated as
     969             intermediate by the pattern rule search algorithm and
    945970             file_exists_p cannot pick it up yet.  */
    946971          new->file->is_target = 1;
    947972
    948           file->also_make = new;
    949         }
     973          file->also_make = new;
     974        }
    950975
    951976 done:
    952   free_idep_chain (deps);
    953977  free (tryrules);
     978  free (deplist);
    954979
    955980  return rule != 0;
  • vendor/gnumake/current/job.c

    r1989 r2596  
    11/* Job execution and handling for GNU Make.
    22Copyright (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.
     31998, 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009,
     42010 Free Software Foundation, Inc.
    55This file is part of GNU Make.
    66
     
    175175#endif  /* Don't have `union wait'.  */
    176176
    177 #ifndef HAVE_UNISTD_H
     177#if !defined(HAVE_UNISTD_H) && !defined(WINDOWS32)
    178178int dup2 ();
    179179int execve ();
     
    187187#endif
    188188
     189/* Different systems have different requirements for pid_t.
     190   Plus we have to support gettext string translation... Argh.  */
     191static const char *
     192pid2str (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
    189205int getloadavg (double loadavg[], int nelem);
    190206int start_remote_job (char **argv, char **envp, int stdin_fd, int *is_remote,
     
    236252 */
    237253int
    238 w32_kill(int pid, int sig)
     254w32_kill(pid_t pid, int sig)
    239255{
    240256  return ((process_kill((HANDLE)pid, sig) == TRUE) ? 0 : -1);
     
    249265{
    250266  const char *const ext = unixy ? "sh" : "bat";
    251   const char *error = NULL;
     267  const char *error_string = NULL;
    252268  char temp_path[MAXPATHLEN]; /* need to know its length */
    253269  unsigned path_size = GetTempPath(sizeof temp_path, temp_path);
     
    295311          else
    296312            {
    297               error = map_windows32_error_to_string (er);
     313              error_string = map_windows32_error_to_string (er);
    298314              break;
    299315            }
     
    304320          char *const path = xmalloc (final_size);
    305321          memcpy (path, temp_path, final_size);
    306           *fd = _open_osfhandle ((long)h, 0);
     322          *fd = _open_osfhandle ((intptr_t)h, 0);
    307323          if (unixy)
    308324            {
     
    318334
    319335  *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);
    323339
    324340  /* not reached */
     
    371387#endif /* __EMX__ */
    372388
     389/* determines whether path looks to be a Bourne-like shell. */
     390int
     391is_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
    373436
    374437
     
    518581          any_remote |= c->remote;
    519582          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)") : ""));
    523586#ifdef VMS
    524587          break;
     
    556619              else
    557620#endif
    558                 pid = wait (&status);
     621                EINTRLOOP(pid, wait (&status));
    559622#endif /* !VMS */
    560623            }
     
    641704                  }
    642705                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));
    645707              }
    646708
     
    698760
    699761      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)") : ""));
    704765
    705766      if (c->sh_batch_file) {
     
    802863        notice_finished_file (c->file);
    803864
    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)") : ""));
    807867
    808868      /* Block fatal signals while frobnicating the list, so that
     
    848908{
    849909  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);
    852912
    853913  /* If we're using the jobserver and this child is not the only outstanding
     
    865925        pfatal_with_name (_("write jobserver"));
    866926
    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));
    869929    }
    870930
     
    9741034  static int bad_stdin = -1;
    9751035#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;
    9781039#ifdef VMS
    9791040  char *argv;
     
    11121173      unixy_shell       /* the test is complicated and we already did it */
    11131174#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')))
    11181182      && (argv[2] && argv[2][0] == ':' && argv[2][1] == '\0')
    11191183      && argv[3] == NULL)
     
    12821346            close (job_rfd);
    12831347
     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
    12841354          child_execute_job (child->good_stdin ? 0 : bad_stdin, 1,
    12851355                             argv, child->environment);
     
    13821452
    13831453      if (hPID != INVALID_HANDLE_VALUE)
    1384         child->pid = (int) hPID;
     1454        child->pid = (pid_t) hPID;
    13851455      else {
    13861456        int i;
     
    14591529    case cs_running:
    14601530      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)") : ""));
    14641534      children = c;
    14651535      /* One more job slot is in use.  */
     
    16011671         Copy the remaining uninteresting text to the output.  */
    16021672      if (out != in)
    1603         strcpy (out, in);
     1673        memmove (out, in, strlen (in) + 1);
    16041674
    16051675      /* Finally, expand the line.  */
     
    16111681     `struct child', and add that to the chain.  */
    16121682
    1613   c = xmalloc (sizeof (struct child));
    1614   memset (c, '\0', sizeof (struct child));
     1683  c = xcalloc (sizeof (struct child));
    16151684  c->file = file;
    16161685  c->command_lines = lines;
     
    17131782        if (got_token == 1)
    17141783          {
    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));
    17171786            break;
    17181787          }
     
    20322101      int i;
    20332102      fprintf(stderr,
    2034               _("process_easy() failed failed to launch process (e=%ld)\n"),
     2103              _("process_easy() failed to launch process (e=%ld)\n"),
    20352104              process_last_err(hPID));
    20362105      for (i = 0; argv[i]; i++)
     
    20612130          break;
    20622131      else
     2132        {
     2133          char *pidstr = xstrdup (pid2str ((pid_t)hWaitPID));
     2134
    20632135          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        }
    20662140    }
    20672141
     
    22222296static char **
    22232297construct_command_argv_internal (char *line, char **restp, char *shell,
    2224                                  char *ifs, int flags,
     2298                                 char *shellflags, char *ifs, int flags,
    22252299                                 char **batch_filename_ptr)
    22262300{
     
    22632337                                 "continue", "export", "read", "readonly",
    22642338                                 "shift", "times", "trap", "switch", "unset",
    2265                                  0 };
     2339                                 "ulimit", 0 };
    22662340
    22672341  char *sh_chars;
     
    23052379#elif defined (WINDOWS32)
    23062380  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 };
    23132390  static char sh_chars_sh[] = "#;\"*?[]&|<>(){}$`^";
    23142391  static char *sh_cmds_sh[] = { "cd", "eval", "exec", "exit", "login",
     
    23322409                             "login", "logout", "read", "readonly", "set",
    23332410                             "shift", "switch", "test", "times", "trap",
    2334                              "umask", "wait", "while", 0 };
     2411                             "ulimit", "umask", "unset", "wait", "while", 0 };
    23352412# ifdef HAVE_DOS_PATHS
    23362413  /* This is required if the MSYS/Cygwin ports (which do not define
     
    24262503      if (*ap != ' ' && *ap != '\t' && *ap != '\n')
    24272504        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;
    24282511
    24292512  i = strlen (line) + 1;
     
    24912574        /* Not inside a string, but it's a special char.  */
    24922575        goto slow;
     2576      else if (one_shell && *p == '\n')
     2577        /* In .ONESHELL mode \n is a separator like ; or && */
     2578        goto slow;
    24932579#ifdef  __MSDOS__
    24942580      else if (*p == '.' && p[1] == '.' && p[2] == '.' && p[3] != '.')
     
    27082794    return 0;
    27092795#endif /* WINDOWS32 */
     2796
    27102797  {
    27112798    /* SHELL may be a multi-word command.  Construct a command line
    2712        "SHELL -c LINE", with all special chars in LINE escaped.
     2799       "$(SHELL) $(.SHELLFLAGS) LINE", with all special chars in LINE escaped.
    27132800       Then recurse, expanding this command line to get the final
    27142801       argument list.  */
    27152802
    27162803    unsigned int shell_len = strlen (shell);
    2717 #ifndef VMS
    2718     static char minus_c[] = " -c ";
    2719 #else
    2720     static char minus_c[] = "";
    2721 #endif
    27222804    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);
    27262806    char *command_ptr = NULL; /* used for batch_mode_shell mode */
     2807    char *new_line;
    27272808
    27282809# ifdef __EMX__ /* is this necessary? */
    27292810    if (!unixy_shell)
    2730       minus_c[1] = '/'; /* " /c " */
     2811      shellflags[0] = '/'; /* "/c" */
    27312812# endif
    27322813
     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);
    27332880    ap = new_line;
    27342881    memcpy (ap, shell, shell_len);
    27352882    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++) = ' ';
    27382887    command_ptr = ap;
    27392888    for (p = line; *p != '\0'; ++p)
     
    27852934        *ap++ = *p;
    27862935      }
    2787     if (ap == new_line + shell_len + sizeof (minus_c) - 1)
     2936    if (ap == new_line + shell_len + sflags_len + 2)
    27882937      /* Line was empty.  */
    27892938      return 0;
     
    28372986    } else
    28382987#endif /* WINDOWS32 */
     2988
    28392989    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
    28412992#ifdef __EMX__
    28422993    else if (!unixy_shell)
     
    28493000        char *q = new_line;
    28503001        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')
    28533007          {
    28543008            if (q[0] == '\\' && q[1] == '\n')
     
    29113065           cannot backslash-escape the special characters (see above).  */
    29123066        new_argv = xmalloc (sizeof (char *));
    2913         line_len = strlen (new_line) - shell_len - sizeof (minus_c) + 1;
     3067        line_len = strlen (new_line) - shell_len - sflags_len - 2;
    29143068        new_argv[0] = xmalloc (line_len + 1);
    29153069        strncpy (new_argv[0],
    2916                  new_line + shell_len + sizeof (minus_c) - 1, line_len);
     3070                 new_line + shell_len + sflags_len + 2, line_len);
    29173071        new_argv[0][line_len] = '\0';
    29183072      }
     
    29463100                        int cmd_flags, char **batch_filename_ptr)
    29473101{
    2948   char *shell, *ifs;
     3102  char *shell, *ifs, *shellflags;
    29493103  char **argv;
    29503104
     
    30513205#endif /* __EMX__ */
    30523206
     3207    shellflags = allocated_variable_expand_for_file ("$(.SHELLFLAGS)", file);
    30533208    ifs = allocated_variable_expand_for_file ("$(IFS)", file);
    30543209
     
    30563211  }
    30573212
    3058   argv = construct_command_argv_internal (line, restp, shell, ifs,
     3213  argv = construct_command_argv_internal (line, restp, shell, shellflags, ifs,
    30593214                                          cmd_flags, batch_filename_ptr);
    30603215
    30613216  free (shell);
     3217  free (shellflags);
    30623218  free (ifs);
    30633219#endif /* !VMS */
     
    30833239  return fd;
    30843240}
    3085 #endif /* !HAPE_DUP2 && !_AMIGA */
     3241#endif /* !HAVE_DUP2 && !_AMIGA */
    30863242
    30873243/* On VMS systems, include special VMS functions.  */
  • vendor/gnumake/current/job.h

    r1989 r2596  
    11/* Definitions for managing subprocesses in GNU Make.
    22Copyright (C) 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001,
    3 2002, 2003, 2004, 2005, 2006, 2007 Free Software Foundation, Inc.
     32002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010 Free Software
     4Foundation, Inc.
    45This file is part of GNU Make.
    56
     
    5455    int efn;                    /* Completion event flag number */
    5556    int cstatus;                /* Completion status */
     57    char *comname;              /* Temporary command file name */
    5658#endif
    5759    char *sh_batch_file;        /* Script file for shell commands */
     
    6769extern struct child *children;
    6870
     71int is_bourne_compatible_shell(const char *path);
    6972void new_job (struct file *file);
    7073void reap_children (int block, int err);
  • vendor/gnumake/current/main.c

    r1989 r2596  
    11/* Argument parsing and main program of GNU Make.
    22Copyright (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.
     31998, 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009,
     42010 Free Software Foundation, Inc.
    55This file is part of GNU Make.
    66
     
    4545#endif
    4646
    47 #if defined(HAVE_SYS_RESOURCE_H) && defined(HAVE_GETRLIMIT) && defined(HAVE_SETRLIMIT)
    48 # define SET_STACK_SIZE
    49 #endif
    50 
    51 #ifdef SET_STACK_SIZE
    52 # include <sys/resource.h>
    53 #endif
    54 
    5547#ifdef _AMIGA
    5648int __stack = 20000; /* Make sure we have 20K of stack space */
     
    6557void print_dir_data_base (void);
    6658void print_rule_data_base (void);
    67 void print_file_data_base (void);
    6859void print_vpath_data_base (void);
    6960
     
    8980static void decode_switches (int argc, char **argv, int env);
    9081static void decode_env_switches (char *envar, unsigned int len);
    91 static void define_makeflags (int all, int makefile);
     82static const char *define_makeflags (int all, int makefile);
    9283static char *quote_for_env (char *out, const char *in);
    9384static void initialize_global_hash_tables (void);
     
    222213static struct stringlist *makefiles = 0;
    223214
     215/* Size of the stack when we started.  */
     216
     217#ifdef SET_STACK_SIZE
     218struct rlimit stack_limit;
     219#endif
     220
     221
    224222/* Number of job slots (commands that can be run at once).  */
    225223
     
    266264
    267265static struct stringlist *new_files = 0;
     266
     267/* List of strings to be eval'd.  */
     268static struct stringlist *eval_strings = 0;
    268269
    269270/* If nonzero, we should just print usage and exit.  */
     
    317318  -e, --environment-overrides\n\
    318319                              Environment variables override makefiles.\n"),
     320    N_("\
     321  --eval=STRING               Evaluate STRING as a makefile statement.\n"),
    319322    N_("\
    320323  -f FILE, --file=FILE, --makefile=FILE\n\
     
    423426    { CHAR_MAX+5, flag, &warn_undefined_variables_flag, 1, 1, 0, 0, 0,
    424427      "warn-undefined-variables" },
     428    { CHAR_MAX+6, string, &eval_strings, 1, 0, 0, 0, 0, "eval" },
    425429    { 0, 0, 0, 0, 0, 0, 0, 0, 0 }
    426430  };
     
    472476unsigned int makelevel;
    473477
    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
     484struct variable * default_goal_var;
    483485
    484486/* Pointer to structure for the file .DEFAULT
     
    497499
    498500int 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
     506int one_shell;
    499507
    500508/* Nonzero if we have seen the `.NOTPARALLEL' target.
     
    520528#endif
    521529
    522 #if !defined HAVE_BSD_SIGNAL && !defined bsd_signal
     530#if !HAVE_DECL_BSD_SIGNAL && !defined bsd_signal
    523531# if !defined HAVE_SIGACTION
    524532#  define bsd_signal signal
    525533# else
    526 typedef RETSIGTYPE (*bsd_signal_ret_t) ();
     534typedef RETSIGTYPE (*bsd_signal_ret_t) (int);
    527535
    528536static bsd_signal_ret_t
     
    684692    {
    685693      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);
    688696      fprintf(stderr, errmsg);
    689697      exit(255);
     
    691699
    692700  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"),
    694702          prg, exrec->ExceptionCode, exrec->ExceptionFlags,
    695           (DWORD)exrec->ExceptionAddress);
     703          exrec->ExceptionAddress);
    696704
    697705  if (exrec->ExceptionCode == EXCEPTION_ACCESS_VIOLATION
     
    699707    sprintf(&errmsg[strlen(errmsg)],
    700708            (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]);
    704712
    705713  /* turn this on if we want to put stuff in the event log too */
     
    775783    sprintf (sh_path, "%s", search_token);
    776784    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));
    779787    sh_found = 1;
    780788  } else if (!no_default_sh_exe &&
     
    786794    sprintf (sh_path, "%s", search_token);
    787795    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));
    790798    sh_found = 1;
    791799  } else {
     
    828836      if (sh_found)
    829837        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"),
    831839             default_shell));
    832840    }
     
    935943
    936944    /* 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)
    938947      {
     948        stack_limit = rlim;
    939949        rlim.rlim_cur = rlim.rlim_max;
    940950        setrlimit (RLIMIT_STACK, &rlim);
    941951      }
     952    else
     953      stack_limit.rlim_cur = 0;
    942954  }
    943955#endif
     
    950962  initialize_main(&argc, &argv);
    951963
    952   default_goal_file = 0;
    953964  reading_file = 0;
    954965
     
    967978  /* Set up gettext/internationalization support.  */
    968979  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);
    971984
    972985#ifdef  POSIX
     
    978991#define ADD_SIG(sig)    fatal_signal_mask |= sigmask (sig)
    979992#else
    980 #define ADD_SIG(sig)
     993#define ADD_SIG(sig)    (void)sig      /* Needed to avoid warnings in MSVC.  */
    981994#endif
    982995#endif
     
    11201133
    11211134  /* 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"
    11301146#ifndef NO_ARCHIVES
    1131   do_variable_definition (NILF, ".FEATURES", "archives",
    1132                           o_default, f_append, 0);
     1147                           " archives"
    11331148#endif
    11341149#ifdef MAKE_JOBSERVER
    1135   do_variable_definition (NILF, ".FEATURES", "jobserver",
    1136                           o_default, f_append, 0);
     1150                           " jobserver"
    11371151#endif
    11381152#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  }
    11421159
    11431160  /* Read in variables from the environment.  It is important that this be
     
    11911208#endif
    11921209                shell_var.name = "SHELL";
     1210                shell_var.length = 5;
    11931211                shell_var.value = xstrdup (ep + 1);
    11941212              }
     
    12081226     */
    12091227    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;
    12131230#endif
    12141231#else /* For Amiga, read the ENV: device, ignoring all dirs */
     
    12521269  decode_env_switches (STRING_SIZE_TUPLE ("MFLAGS"));
    12531270#endif
     1271
    12541272  decode_switches (argc, argv, 0);
     1273
    12551274#ifdef WINDOWS32
    12561275  if (suspend_flag) {
     
    13161335# endif
    13171336      )
    1318     argv[0] = xstrdup (concat (current_directory, "/", argv[0]));
     1337    argv[0] = xstrdup (concat (3, current_directory, "/", argv[0]));
    13191338#else  /* !__MSDOS__ */
    13201339  if (current_directory[0] != '\0'
     
    13251344#endif
    13261345      )
    1327     argv[0] = xstrdup (concat (current_directory, "/", argv[0]));
     1346    argv[0] = xstrdup (concat (3, current_directory, "/", argv[0]));
    13281347#endif /* !__MSDOS__ */
    13291348#endif /* WINDOWS32 */
     
    13321351  /* The extra indirection through $(MAKE_COMMAND) is done
    13331352     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);
    13361355
    13371356  if (command_variables != 0)
     
    13711390      /* Define an unchangeable variable with a name that no POSIX.2
    13721391         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);
    13751393
    13761394      /* Define the variable; this will not override any user definition.
     
    13801398         allow the user's setting of MAKEOVERRIDES to affect MAKEFLAGS, so
    13811399         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);
    13841402    }
    13851403
     
    13951413             But allow -C/ just in case someone wants that.  */
    13961414          {
    1397             char *p = dir + strlen (dir) - 1;
     1415            char *p = (char *)dir + strlen (dir) - 1;
    13981416            while (p > dir && (p[0] == '/' || p[0] == '\\'))
    13991417              --p;
     
    14681486    }
    14691487
    1470   (void) define_variable ("CURDIR", 6, current_directory, o_file, 0);
     1488  define_variable_cname ("CURDIR", current_directory, o_file, 0);
    14711489
    14721490  /* Read any stdin makefiles into temporary files.  */
     
    16081626  default_file = enter_file (strcache_add (".DEFAULT"));
    16091627
    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    }
    16141659
    16151660  /* Read all the makefiles.  */
     
    16701715
    16711716  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)
    17111743        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    }
    17261771
    17271772  /* If we have >1 slot but no jobserver-fds, then we're a top-level make.
     
    18411886      FILE_TIMESTAMP *makefile_mtimes = 0;
    18421887      unsigned int mm_idx = 0;
    1843       char **nargv = argv;
    1844       int nargc = argc;
     1888      char **nargv;
     1889      int nargc;
    18451890      int orig_db_level = db_level;
    18461891      int status;
     
    20112056                if (strneq (argv[i], "-f", 2)) /* XXX */
    20122057                  {
    2013                     char *p = &argv[i][2];
    2014                     if (*p == '\0')
     2058                    if (argv[i][2] == '\0')
    20152059                      /* This cast is OK since we never modify argv.  */
    20162060                      argv[++i] = (char *) makefiles->list[j];
    20172061                    else
    2018                       argv[i] = xstrdup (concat ("-f", makefiles->list[j], ""));
     2062                      argv[i] = xstrdup (concat (2, "-f", makefiles->list[j]));
    20192063                    ++j;
    20202064                  }
     
    20222066
    20232067          /* Add -o option for the stdin temporary file, if necessary.  */
     2068          nargc = argc;
    20242069          if (stdin_nm)
    20252070            {
    20262071              nargv = xmalloc ((nargc + 2) * sizeof (char *));
    20272072              memcpy (nargv, argv, argc * sizeof (char *));
    2028               nargv[nargc++] = xstrdup (concat ("-o", stdin_nm, ""));
     2073              nargv[nargc++] = xstrdup (concat (2, "-o", stdin_nm));
    20292074              nargv[nargc] = 0;
    20302075            }
     2076          else
     2077            nargv = argv;
    20312078
    20322079          if (directories != 0 && directories->idx > 0)
     
    20452092
    20462093          ++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          }
    20472102
    20482103          if (ISDB (DB_BASIC))
     
    21642219    perror_with_name (_("unlink (temporary file): "), stdin_nm);
    21652220
     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
    21662283  {
    21672284    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 target
    2180                    name let's just enter this name into the table and let
    2181                    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     else
    2207       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")));
    22212285
    22222286    switch (update_goal_chain (goals))
     
    23912455            value = vp;
    23922456          }
    2393         define_variable ("MAKECMDGOALS", 12, value, o_default, 0);
     2457        define_variable_cname ("MAKECMDGOALS", value, o_default, 0);
    23942458      }
    23952459    }
     
    24932557                  else if (*optarg == '\0')
    24942558                    {
    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);
    24972569                      bad = 1;
    24982570                    }
     
    25112583                    {
    25122584                      sl->max += 5;
    2513                       sl->list = xrealloc (sl->list,
     2585                      /* MSVC erroneously warns without a cast here.  */
     2586                      sl->list = xrealloc ((void *)sl->list,
    25142587                                           sl->max * sizeof (char *));
    25152588                    }
     
    26582731       need permanent storage for this in case decode_switches saves
    26592732       pointers into the value.  */
    2660     argv[1] = xstrdup (concat ("-", argv[1], ""));
     2733    argv[1] = xstrdup (concat (2, "-", argv[1]));
    26612734
    26622735  /* Parse those words.  */
     
    26902763   Don't include options with the `no_makefile' flag set if MAKEFILE.  */
    26912764
    2692 static void
     2765static const char *
    26932766define_makeflags (int all, int makefile)
    26942767{
    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;
    26982772  char *flagstring;
    26992773  register char *p;
     
    27162790#define ADD_FLAG(ARG, LEN) \
    27172791  do {                                                                        \
    2718     struct flag *new = alloca (sizeof (struct flag));                         \
     2792    struct flag *new = alloca (sizeof (struct flag));                         \
    27192793    new->cs = cs;                                                             \
    27202794    new->arg = (ARG);                                                         \
     
    27242798      ++flagslen;               /* Just a single flag letter.  */             \
    27252799    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));                                \
    27272802    if (!short_option (cs->c))                                                \
    27282803      /* This switch has no single-letter version, so we use the long.  */    \
     
    28112886        }
    28122887
    2813   flagslen += 4 + sizeof posixref; /* Four more for the possible " -- ".  */
     2888  /* Four more for the possible " -- ".  */
     2889  flagslen += 4 + sizeof (posixref) + sizeof (evalref);
    28142890
    28152891#undef  ADD_FLAG
     
    28832959  /* Since MFLAGS is not parsed for flags, there is no reason to
    28842960     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    }
    28862975
    28872976  if (all && command_variables != 0)
     
    29102999      if (posix_pedantic)
    29113000        {
    2912           memcpy (p, posixref, sizeof posixref - 1);
    2913           p += sizeof posixref - 1;
     3001          memcpy (p, posixref, sizeof (posixref) - 1);
     3002          p += sizeof (posixref) - 1;
    29143003        }
    29153004      else
    29163005        {
    2917           memcpy (p, ref, sizeof ref - 1);
    2918           p += sizeof ref - 1;
     3006          memcpy (p, ref, sizeof (ref) - 1);
     3007          p += sizeof (ref) - 1;
    29193008        }
    29203009    }
     
    29303019  *p = '\0';
    29313020
    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 set
    2941                           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
    29463035  if (! all)
    29473036    /* The first time we are called, set MAKEFLAGS to always be exported.
     
    29493038       after reading makefiles which might have done `unexport MAKEFLAGS'. */
    29503039    v->export = v_export;
     3040
     3041  return v->value;
    29513042}
    29523043
     
    29783069     word "Copyright", so it hardly seems worth it.  */
    29793070
    2980   printf ("%sCopyright (C) 2007  Free Software Foundation, Inc.\n", precede);
     3071  printf ("%sCopyright (C) 2010  Free Software Foundation, Inc.\n", precede);
    29813072
    29823073  printf (_("%sLicense GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html>\n\
     
    30603151
    30613152      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        }
    30623165    }
    30633166}
     
    31043207         of relative pathnames fail.  */
    31053208      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        }
    31073214
    31083215      log_working_directory (0);
  • vendor/gnumake/current/maintMakefile

    r1989 r2596  
    144144          && (cd "$$tmppo" \
    145145                && $(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"
    147147        cd po && $(MAKE) update-po
    148148        $(MAKE) po-check
    149149
    150150po-update:
    151         if test -d "po"; then \
    152           $(MAKE) do-po-update; \
    153         fi
     151        [ -d "po" ] && $(MAKE) do-po-update
    154152
    155153# -------------------------- #
     
    161159# regularly updated from the specified URL.
    162160
    163 savannah-url = http://savannah.gnu.org/cgi-bin/viewcvs/~checkout~
     161cvs-url = http://savannah.gnu.org/cgi-bin/viewcvs/~checkout~
     162git-url = http://git.savannah.gnu.org/cgit
    164163target = $(patsubst get-%,%,$@)
    165164
    166 config-url = $(savannah-url)/config/config/$(patsubst get-config/%,%,$@)
     165config-url = $(git-url)/config.git/plain/$(patsubst get-config/%,%,$@)
    167166get-config/config.guess get-config/config.sub:
    168167        @echo $(WGET) $(config-url) -O $(target) \
     
    170169          && $(move_if_change)
    171170
    172 gnulib-url = $(savannah-url)/gnulib/gnulib/build-aux/$(patsubst get-config/%,%,$@)
     171gnulib-url = $(git-url)/gnulib.git/plain/build-aux/$(patsubst get-config/%,%,$@)
    173172get-config/texinfo.tex:
    174173        @echo $(WGET) $(gnulib-url) -O $(target) \
     
    176175          && $(move_if_change)
    177176
    178 gnustandards-url = $(savannah-url)/gnustandards/gnustandards/$(patsubst get-doc/%,%,$@)
     177gnustandards-url = $(cvs-url)/gnustandards/gnustandards/$(patsubst get-doc/%,%,$@)
    179178get-doc/make-stds.texi get-doc/fdl.texi:
    180179        @echo $(WGET) $(gnustandards-url) -O $(target) \
     
    182181          && $(move_if_change)
    183182
    184 .PHONY: cvs-update
    185 cvs-update: get-config/texinfo.tex get-config/config.guess get-config/config.sub get-doc/make-stds.texi get-doc/fdl.texi
     183.PHONY: scm-update
     184scm-update: get-config/texinfo.tex get-config/config.guess get-config/config.sub get-doc/make-stds.texi get-doc/fdl.texi
    186185
    187186
     
    191190
    192191.PHONY: update
    193 update: po-update cvs-update
     192update: po-update scm-update
    194193
    195194
     
    205204
    206205changelog-check:
    207         if head ChangeLog | grep 'Version $(VERSION)' >/dev/null; then \
     206        if head $(top_srcdir)/ChangeLog | grep 'Version $(VERSION)' >/dev/null; then \
    208207          :; \
    209208        else \
     
    247246        @echo "Creating directive file '$@':"
    248247        @( \
    249            echo 'verstion: 1.1'; \
     248           echo 'version: 1.1'; \
    250249           echo 'directory: make'; \
    251250           echo 'filename: $*'; \
     
    258257
    259258FTPPUT = ncftpput
    260 gnu-url = ftp-upload.gnu.org /incoming
     259gnu-upload-host = ftp-upload.gnu.org
     260gnu-upload-dir  = /incoming
     261
    261262
    262263UPLOADS = upload-alpha upload-ftp
    263264.PHONY: $(UPLOADS)
    264265$(UPLOADS): $(DIST_ARCHIVES) $(DIST_ARCHIVES_SIG) $(DIST_ARCHIVES_DIRECTIVE)
    265         $(FTPPUT) "$(gnu-url)/$(@:upload-%=%)" $^
     266        $(FTPPUT) "$(gnu-upload-host)" "$(gnu-upload-dir)/$(@:upload-%=%)" $^
    266267
    267268
    268269# 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.
    270271# This file is part of GNU Make.
    271272#
  • vendor/gnumake/current/make.1

    r1989 r2596  
    224224.TP 0.5i
    225225.BR \-n , " \-\-just\-print" , " \-\-dry\-run" , " \-\-recon"
    226 Print the commands that would be executed, but do not execute them.
     226Print the commands that would be executed, but do not execute them (except in
     227certain circumstances).
    227228.TP 0.5i
    228229\fB\-o\fR \fIfile\fR, \fB\-\-old\-file\fR=\fIfile\fR, \fB\-\-assume\-old\fR=\fIfile\fR
  • vendor/gnumake/current/make.h

    r1989 r2596  
    11/* Miscellaneous global declarations and portability cruft for GNU Make.
    22Copyright (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.
     31998, 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009,
     42010 Free Software Foundation, Inc.
    55This file is part of GNU Make.
    66
     
    2424#define HAVE_CONFIG_H 1
    2525
     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
    2631/* 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
    3236 #pragma alloca
    33 #  else
     37# else
     38#  if !defined(__GNUC__) && !defined(WINDOWS32)
    3439#   ifndef alloca /* predefined by HP cc +Olibcalls */
    3540char *alloca ();
     
    3843# endif
    3944#endif
    40 
    41 
    42 /* Specify we want GNU source code.  This must be defined before any
    43    system headers are included.  */
    44 
    45 #define _GNU_SOURCE 1
    4645
    4746
     
    268267#define ISDIGIT(c) ((unsigned) (c) - '0' <= 9)
    269268
    270 #ifndef iAPX286
    271 # define streq(a, b) \
     269/* Test if two strings are equal. Is this worthwhile?  Should be profiled.  */
     270#define streq(a, b) \
    272271   ((a) == (b) || \
    273272    (*(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) \
    276279    ((a) == (b) \
    277280     || (tolower((unsigned char)*(a)) == tolower((unsigned char)*(b)) \
    278281         && (*(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
    287286#define strneq(a, b, l) (strncmp ((a), (b), (l)) == 0)
    288287
     
    330329
    331330void sync_Path_environment (void);
    332 int w32_kill (int pid, int sig);
     331int w32_kill (pid_t pid, int sig);
    333332char *end_of_token_w32 (const char *s, char stopchar);
    334333int find_and_set_default_shell (const char *token);
     
    340339extern int unixy_shell;
    341340#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>
     347struct rlimit stack_limit;
     348#endif
    342349
    343350struct floc
     
    362369
    363370#if HAVE_ANSI_COMPILER && USE_VARIADIC && HAVE_STDARG_H
     371const char *concat (unsigned int, ...);
    364372void message (int prefix, const char *fmt, ...)
    365373              __attribute__ ((__format__ (__printf__, 2, 3)));
     
    369377                   __attribute__ ((noreturn, __format__ (__printf__, 2, 3)));
    370378#else
     379const char *concat ();
    371380void message ();
    372381void error ();
     
    378387void pfatal_with_name (const char *) __attribute__ ((noreturn));
    379388void perror_with_name (const char *, const char *);
    380 char *savestring (const char *, unsigned int);
    381 char *concat (const char *, const char *, const char *);
    382389void *xmalloc (unsigned int);
     390void *xcalloc (unsigned int);
    383391void *xrealloc (void *, unsigned int);
    384392char *xstrdup (const char *);
     393char *xstrndup (const char *, unsigned int);
    385394char *find_next_token (const char **, unsigned int *);
    386395char *next_token (const char *);
     
    426435void build_vpath_lists (void);
    427436void construct_vpath_list (char *pattern, char *dirpath);
    428 const char *vpath_search (const char *file, FILE_TIMESTAMP *mtime_ptr);
     437const char *vpath_search (const char *file, FILE_TIMESTAMP *mtime_ptr,
     438                          unsigned int* vpath_index, unsigned int* path_index);
    429439int gpath_search (const char *file, unsigned int len);
    430440
     
    483493#endif
    484494
     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 */
     502int strncasecmp (const char *s1, const char *s2, int n);
     503# endif
     504#endif
     505
    485506extern const struct floc *reading_file;
    486507extern const struct floc **expanding_var;
     
    494515extern int warn_undefined_variables_flag, posix_pedantic, not_parallel;
    495516extern int second_expansion, clock_skew_detected, rebuilding_makefiles;
     517extern int one_shell;
    496518
    497519/* can we run commands via 'sh -c xxx' or must we use batch files? */
  • vendor/gnumake/current/makefile.com

    r1989 r2596  
    140140$!-----------------------------------------------------------------------------
    141141$!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.
    143143$!This file is part of GNU Make.
    144144$!
  • vendor/gnumake/current/makefile.vms

    r1989 r2596  
    22#
    33# 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.
    55# This file is part of GNU Make.
    66#
  • vendor/gnumake/current/misc.c

    r1989 r2596  
    11/* Miscellaneous generic support functions for GNU Make.
    22Copyright (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.
     31998, 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009,
     42010 Free Software Foundation, Inc.
    55This file is part of GNU Make.
    66
     
    114114      ++in;
    115115
    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.  */
    118119      if (backslash)
    119120        {
    120121          in = next_token (in);
     122          /* Removing this loop will fix Savannah bug #16670: do we want to? */
    121123          while (out > line && isblank ((unsigned char)out[-1]))
    122124            --out;
     
    162164
    163165
    164 /* Return a string whose contents concatenate those of s1, s2, s3.
     166/* Return a string whose contents concatenate the NUM strings provided
    165167   This string lives in static, re-used memory.  */
    166168
    167 char *
    168 concat (const char *s1, const char *s2, const char *s3)
    169 {
    170   unsigned int len1, len2, len3;
     169const char *
     170#if HAVE_ANSI_COMPILER && USE_VARIADIC && HAVE_STDARG_H
     171concat (unsigned int num, ...)
     172#else
     173concat (num, va_alist)
     174     unsigned int num;
     175     va_dcl
     176#endif
     177{
    171178  static unsigned int rlen = 0;
    172179  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';
    189217
    190218  return result;
     
    341369
    342370#undef xmalloc
     371#undef xcalloc
    343372#undef xrealloc
    344373#undef xstrdup
     
    347376xmalloc (unsigned int size)
    348377{
    349   /* Make sure we don't allocate 0, for pre-ANSI libraries.  */
     378  /* Make sure we don't allocate 0, for pre-ISO implementations.  */
    350379  void *result = malloc (size ? size : 1);
    351380  if (result == 0)
     
    356385
    357386void *
     387xcalloc (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
     397void *
    358398xrealloc (void *ptr, unsigned int size)
    359399{
    360400  void *result;
    361401
    362   /* Some older implementations of realloc() don't conform to ANSI.  */
     402  /* Some older implementations of realloc() don't conform to ISO.  */
    363403  if (! size)
    364404    size = 1;
     
    394434
    395435char *
    396 savestring (const char *str, unsigned int length)
    397 {
    398   char *out = xmalloc (length + 1);
     436xstrndup (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);
    399446  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;
    403452}
    404453
     
    493542
    494543
    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.  */
    516545
    517546struct dep *
     
    525554      struct dep *c = xmalloc (sizeof (struct dep));
    526555      memcpy (c, d, sizeof (struct dep));
     556
     557      if (c->need_2nd_expansion)
     558        c->name = xstrdup (c->name);
    527559
    528560      c->next = 0;
     
    590622      return (c1 - c2);
    591623    }
     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
     632int
     633strncasecmp (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;
    592652}
    593653#endif
  • vendor/gnumake/current/po

    • Property svn:ignore deleted
  • vendor/gnumake/current/po/ChangeLog

    r1989 r2596  
     12009-09-16  Paul Smith  <psmith@gnu.org>
     2
     3        * LINGUAS: Added new translation for Italian (it).
     4
    152008-05-17  Paul Smith  <psmith@gnu.org>
    26
     
    6367
    6468
    65 Copyright (C) 2002, 2003, 2004, 2005, 2006, 2007 Free Software Foundation, Inc.
     69Copyright (C) 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009 Free Software
     70Foundation, Inc.
    6671This file is part of GNU Make.
    6772
  • vendor/gnumake/current/po/LINGUAS

    r1989 r2596  
    1 # Set of available languages: 23 languages
     1# Set of available languages: 24 languages
    22
    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_CN
     3be 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
    44
    55# Can't seem to get en@quot and en@boldquot to build properly?
  • vendor/gnumake/current/po/Makevars

    r1989 r2596  
    11# 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.
    44# This file is part of GNU Make.
    55#
  • vendor/gnumake/current/po/POTFILES.in

    r1989 r2596  
    11# List of source files containing translatable strings.
    2 # Copyright (C) 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007 Free Software
    3 # Foundation, Inc.
     2# Copyright (C) 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009,
     3# 2010 Free Software Foundation, Inc.
    44# This file is part of GNU Make.
    55#
  • vendor/gnumake/current/read.c

    r1989 r2596  
    11/* Reading and parsing of makefiles for GNU Make.
    22Copyright (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.
     31998, 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009,
     42010 Free Software Foundation, Inc.
    55This file is part of GNU Make.
    66
     
    5555    FILE *fp;           /* File, or NULL if this is an internal buffer.  */
    5656    struct floc floc;   /* Info on the file in fp (if any).  */
     57  };
     58
     59/* Track the modifiers we can have on variable assignments */
     60
     61struct 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;
    5769  };
    5870
     
    123135
    124136static int eval_makefile (const char *filename, int flags);
    125 static int eval (struct ebuffer *buffer, int flags);
     137static void eval (struct ebuffer *buffer, int flags);
    126138
    127139static long readline (struct ebuffer *ebuf);
    128 static void do_define (char *name, unsigned int namelen,
    129                        enum variable_origin origin, struct ebuffer *ebuf);
     140static void do_undefine (char *name, enum variable_origin origin,
     141                         struct ebuffer *ebuf);
     142static struct variable *do_define (char *name, enum variable_origin origin,
     143                                   struct ebuffer *ebuf);
    130144static int conditional_line (char *line, int len, const struct floc *flocp);
    131145static void record_files (struct nameseq *filenames, const char *pattern,
    132                           const char *pattern_percent, struct dep *deps,
     146                          const char *pattern_percent, char *depstr,
    133147                          unsigned int cmds_started, char *commands,
    134148                          unsigned int commands_idx, int two_colon,
    135149                          const struct floc *flocp);
    136150static 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,
    138153                               const struct floc *flocp);
    139154static enum make_word_type get_next_mword (char *buffer, char *delim,
     
    144159
    145160
     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
    146168/* Read in all the makefiles and return the chain of their names.  */
    147169
     
    154176     we will be reading. */
    155177
    156   define_variable ("MAKEFILE_LIST", sizeof ("MAKEFILE_LIST")-1, "", o_file, 0);
     178  define_variable_cname ("MAKEFILE_LIST", "", o_file, 0);
    157179
    158180  DB (DB_BASIC, (_("Reading makefiles...\n")));
     
    249271              struct dep *d = alloc_dep ();
    250272              d->file = enter_file (strcache_add (*p));
    251               d->file->dontcare = 1;
     273              d->dontcare = 1;
    252274              /* Tell update_goal_chain to bail out as soon as this file is
    253275                 made, and main not to die if we can't make this file.  */
     
    305327  char *expanded = 0;
    306328  int makefile_errno;
    307   int r;
    308329
    309330  filename = strcache_add (filename);
     
    348369      for (i = 0; include_directories[i] != 0; ++i)
    349370        {
    350           const char *included = concat (include_directories[i], "/", filename);
     371          const char *included = concat (3, include_directories[i],
     372                                         "/", filename);
    351373          ebuf.fp = fopen (included, "r");
    352374          if (ebuf.fp)
     
    368390  deps->changed = flags;
    369391  if (flags & RM_DONTCARE)
    370     deps->file->dontcare = 1;
     392    deps->dontcare = 1;
    371393
    372394  if (expanded)
     
    384406    }
    385407
     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
    386414  /* Add this makefile to the list. */
    387415  do_variable_definition (&ebuf.floc, "MAKEFILE_LIST", filename, o_file,
     
    396424  reading_file = &ebuf.floc;
    397425
    398   r = eval (&ebuf, !(flags & RM_NO_DEFAULT_GOAL));
     426  eval (&ebuf, !(flags & RM_NO_DEFAULT_GOAL));
    399427
    400428  reading_file = curfile;
     
    404432  free (ebuf.bufstart);
    405433  alloca (0);
    406   return r;
     434
     435  return 1;
    407436}
    408437
    409 int
     438void
    410439eval_buffer (char *buffer)
    411440{
     
    414443  struct conditionals new;
    415444  const struct floc *curfile;
    416   int r;
    417445
    418446  /* Evaluate the buffer */
     
    422450  ebuf.fp = NULL;
    423451
    424   ebuf.floc = *reading_file;
     452  if (reading_file)
     453    ebuf.floc = *reading_file;
     454  else
     455    ebuf.floc.filenm = NULL;
    425456
    426457  curfile = reading_file;
     
    429460  saved = install_conditionals (&new);
    430461
    431   r = eval (&ebuf, 1);
     462  eval (&ebuf, 1);
    432463
    433464  restore_conditionals (saved);
     
    436467
    437468  alloca (0);
    438   return r;
    439469}
    440470
    441471
     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 */
     483static char *
     484parse_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
    442547
    443548/* Read file FILENAME as a makefile and add its contents to the data base.
     
    445550   SET_DEFAULT is true if we are allowed to set the default goal.  */
    446551
    447 
    448 static int
     552static void
    449553eval (struct ebuffer *ebuf, int set_default)
    450554{
     
    458562  int no_targets = 0;           /* Set when reading a rule without targets.  */
    459563  struct nameseq *filenames = 0;
    460   struct dep *deps = 0;
     564  char *depstr = 0;
    461565  long nlines = 0;
    462566  int two_colon = 0;
     
    472576        {                                                                     \
    473577          fi.lineno = tgts_started;                                           \
    474           record_files (filenames, pattern, pattern_percent, deps          \
     578          record_files (filenames, pattern, pattern_percent, depstr,          \
    475579                        cmds_started, commands, commands_idx, two_colon,      \
    476580                        &fi);                                                 \
     581          filenames = 0;                                                      \
    477582        }                                                                     \
    478       filenames = 0;                                                          \
    479583      commands_idx = 0;                                                       \
    480584      no_targets = 0;                                                         \
     
    507611      char *p;
    508612      char *p2;
    509 
     613      struct vmodifiers vmod;
     614
     615      /* At the top of this loop, we are starting a brand new line.  */
    510616      /* Grab the next line to be evaluated */
    511617      ebuf->floc.lineno += nlines;
     
    532638
    533639          /* 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.
    535641             SunOS 4 make appears to behave this way.  */
    536642
     
    571677        }
    572678
    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.
    574680         Get more space if we need it; we don't need to preserve the current
    575681         contents of the buffer.  */
     
    580686          if (collapsed)
    581687            free (collapsed);
     688          /* Don't need xrealloc: we don't need to preserve the content.  */
    582689          collapsed = xmalloc (collapsed_length);
    583690        }
     
    587694      remove_comments (collapsed);
    588695
    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.)  */
    591697      p = collapsed;
    592698      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)
    614705        {
    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)
    630711            {
    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;
    635714              continue;
    636715            }
    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)
    640750        {
    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
    644755          continue;
    645756        }
    646757
    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"))
    648778        {
    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. */
    670782          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;
    747784          else
    748785            {
    749786              unsigned int l;
    750               struct variable *v;
    751787              const char *cp;
    752788              char *ap;
    753789
    754790              /* 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.  */
    756792              cp = ap = allocated_variable_expand (p2);
    757793
     
    759795                   p = find_next_token (&cp, &l))
    760796                {
    761                   v = lookup_variable (p, l);
     797                  struct variable *v = lookup_variable (p, l);
    762798                  if (v == 0)
    763799                    v = define_variable_loc (p, l, "", o_file, 0, fstart);
    764 
    765                   v->export = v_noexport;
     800                  v->export = exporting ? v_export : v_noexport;
    766801                }
    767802
     
    771806        }
    772807
    773  skip_conditionals:
     808      /* Handle the special syntax for vpath.  */
    774809      if (word1eq ("vpath"))
    775810        {
     
    781816          if (p != 0)
    782817            {
    783               vpat = savestring (p, l);
     818              vpat = xstrndup (p, l);
    784819              p = find_next_token (&cp, &l);
    785820              /* No searchpath means remove all previous
     
    796831        }
    797832
     833      /* Handle include and variants.  */
    798834      if (word1eq ("include") || word1eq ("-include") || word1eq ("sinclude"))
    799835        {
     
    816852            }
    817853
    818           /* Parse the list of file names.  */
     854          /* Parse the list of file names.  Don't expand archive references!  */
    819855          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);
    824858          free (p);
    825859
     
    839873              int r;
    840874
    841               free (files);
     875              free_ns (files);
    842876              files = next;
    843877
    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)));
    846882              if (!r && !noerror)
    847883                error (fstart, "%s: %s", name, strerror (errno));
     
    853889          goto rule_complete;
    854890        }
    855 
    856       if (try_variable_definition (fstart, p, o_file, 0))
    857         /* This line has been dealt with.  */
    858         goto rule_complete;
    859891
    860892      /* This line starts with a tab but was not caught above because there
     
    876908      {
    877909        enum make_word_type wtype;
    878         enum variable_origin v_origin;
    879         int exported;
    880910        char *cmdleft, *semip, *lb_next;
    881911        unsigned int plen = 0;
     
    10091039           looking for targets.  */
    10101040        *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);
    10151042        *p2 = ':';
    10161043
     
    10431070          }
    10441071
    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)
    10701074          {
    10711075            /* If there was a semicolon found, add it back, plus anything
     
    10751079                unsigned int l = p - variable_buffer;
    10761080                *(--semip) = ';';
     1081                collapse_continuations (semip);
    10771082                variable_buffer_output (p2 + strlen (p2),
    10781083                                        semip, strlen (semip)+1);
    10791084                p = variable_buffer + l;
    10801085              }
    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);
    10821089            filenames = 0;
    10831090            continue;
     
    11111118        while (p != 0 && p[-1] == '\\')
    11121119          {
    1113             register char *q = &p[-1];
    1114             register int backslash = 0;
     1120            char *q = &p[-1];
     1121            int backslash = 0;
    11151122            while (*q-- == '\\')
    11161123              backslash = !backslash;
     
    11551162          {
    11561163            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);
    11581166            ++p2;
    11591167            if (target == 0)
     
    11651173            if (pattern_percent == 0)
    11661174              fatal (fstart, _("target pattern contains no `%%'"));
    1167             free (target);
     1175            free_ns (target);
    11681176          }
    11691177        else
     
    11751183        strip_whitespace (&beg, &end);
    11761184
     1185        /* Put all the prerequisites here; they'll be parsed later.  */
    11771186        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);
    11831188        else
    1184           deps = 0;
     1189          depstr = 0;
    11851190
    11861191        commands_idx = 0;
     
    12161221           Because the target is not recorded until after ifeq directive is
    12171222           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')
    12221226          {
    12231227            const char *name;
     
    13001304    free (collapsed);
    13011305  free (commands);
    1302 
    1303   return 1;
    13041306}
    13051307
     
    13211323}
    13221324
     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
     1329static void
     1330do_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
    13231348/* Execute a `define' directive.
    13241349   The first line has already been read, and NAME is the name of
    13251350   the variable to be defined.  The following lines remain to be read.  */
    13261351
    1327 static void
    1328 do_define (char *name, unsigned int namelen,
    1329            enum variable_origin origin, struct ebuffer *ebuf)
     1352static struct variable *
     1353do_define (char *name, enum variable_origin origin, struct ebuffer *ebuf)
    13301354{
     1355  struct variable *v;
     1356  enum variable_flavor flavor;
    13311357  struct floc defstart;
    1332   long nlines = 0;
    13331358  int nlevels = 1;
    13341359  unsigned int length = 100;
    13351360  char *definition = xmalloc (length);
    13361361  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;
    13441363
    13451364  defstart = ebuf->floc;
    13461365
     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.  */
    13471390  while (1)
    13481391    {
    13491392      unsigned int len;
    13501393      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
    13531400      ebuf->floc.lineno += nlines;
    1354 
    1355       /* If there is nothing left to eval, we're done. */
    1356       if (nlines < 0)
    1357         break;
    1358 
    13591401      line = ebuf->buffer;
    13601402
     
    13621404
    13631405      /* 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' */
    13671407      if (line[0] != cmd_prefix)
    13681408        {
     
    13821422              p += 5;
    13831423              remove_comments (p);
    1384               if (*next_token (p) != '\0')
     1424              if (*(next_token (p)) != '\0')
    13851425                error (&ebuf->floc,
    1386                        _("Extraneous text after `endef' directive"));
     1426                       _("extraneous text after `endef' directive"));
    13871427
    13881428              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;
    14021430            }
    14031431        }
    14041432
    1405       /* Otherwise add this line to the variable definition.  */
     1433      /* Add this line to the variable definition.  */
    14061434      len = strlen (line);
    14071435      if (idx + len + 1 > length)
     
    14171445    }
    14181446
    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);
    14241457}
    14251458
     
    16951728
    16961729
    1697 /* Remove duplicate dependencies in CHAIN.  */
    1698 
    1699 static unsigned long
    1700 dep_hash_1 (const void *key)
    1701 {
    1702   return_STRING_HASH_1 (dep_name ((struct dep const *) key));
    1703 }
    1704 
    1705 static unsigned long
    1706 dep_hash_2 (const void *key)
    1707 {
    1708   return_STRING_HASH_2 (dep_name ((struct dep const *) key));
    1709 }
    1710 
    1711 static int
    1712 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 these
    1719      is an order-only prerequisite and one isn't.  That means that we should
    1720      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 void
    1730 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 not
    1738      really matter for the purpose of updating targets, but it
    1739      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       else
    1752         {
    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 
    17621730
    17631731/* Record target-specific variable values for files FILENAMES.
     
    17721740static void
    17731741record_target_var (struct nameseq *filenames, char *defn,
    1774                    enum variable_origin origin, int exported,
     1742                   enum variable_origin origin, struct vmodifiers *vmod,
    17751743                   const struct floc *flocp)
    17761744{
     
    17921760
    17931761      nextf = filenames->next;
    1794       free (filenames);
     1762      free_ns (filenames);
    17951763
    17961764      /* If it's a pattern target, then add it to the pattern-specific
     
    18041772          /* I don't think this can fail since we already determined it was a
    18051773             variable definition.  */
    1806           v = parse_variable_definition (&p->variable, defn);
     1774          v = assign_variable_definition (&p->variable, defn);
    18071775          assert (v != 0);
    18081776
     1777          v->origin = origin;
    18091778          if (v->flavor == f_simple)
    18101779            v->value = allocated_variable_expand (v->value);
     
    18341803          v = try_variable_definition (flocp, defn, origin, 1);
    18351804          if (!v)
    1836             error (flocp, _("Malformed target-specific variable definition"));
     1805            fatal (flocp, _("Malformed target-specific variable definition"));
    18371806          current_variable_set_list = global;
    18381807        }
    18391808
    18401809      /* Set up the variable to be *-specific.  */
    1841       v->origin = origin;
    18421810      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;
    18441813
    18451814      /* If it's not an override, check to see if there was a command-line
    18461815         setting.  If so, reset the value.  */
    1847       if (origin != o_override)
     1816      if (v->origin != o_override)
    18481817        {
    18491818          struct variable *gv;
     
    18781847static void
    18791848record_files (struct nameseq *filenames, const char *pattern,
    1880               const char *pattern_percent, struct dep *deps,
     1849              const char *pattern_percent, char *depstr,
    18811850              unsigned int cmds_started, char *commands,
    18821851              unsigned int commands_idx, int two_colon,
    18831852              const struct floc *flocp)
    18841853{
    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;
    18891854  struct commands *cmds;
     1855  struct dep *deps;
     1856  const char *implicit_percent;
     1857  const char *name;
    18901858
    18911859  /* If we've already snapped deps, that means we're in an eval being
     
    18961864    fatal (flocp, _("prerequisites cannot be defined in recipes"));
    18971865
     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.  */
    18981871  if (commands_idx > 0)
    18991872    {
     
    19011874      cmds->fileinfo.filenm = flocp->filenm;
    19021875      cmds->fileinfo.lineno = cmds_started;
    1903       cmds->commands = savestring (commands, commands_idx);
     1876      cmds->commands = xstrndup (commands, commands_idx);
    19041877      cmds->command_lines = 0;
    19051878    }
    19061879  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, '$'))
    19101887    {
    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;
    19121962      struct file *f;
    19131963      struct dep *this = 0;
    1914       const char *implicit_percent;
    1915 
    1916       nextf = filenames->next;
    1917       free (filenames);
     1964
     1965      free_ns (filenames);
    19181966
    19191967      /* Check for special targets.  Do it here instead of, say, snap_deps()
    19201968         so that we can immediately use the value.  */
    1921 
    19221969      if (streq (name, ".POSIX"))
    1923         posix_pedantic = 1;
     1970        {
     1971          posix_pedantic = 1;
     1972          define_variable_cname (".SHELLFLAGS", "-ec", o_default, 0);
     1973        }
    19241974      else if (streq (name, ".SECONDEXPANSION"))
    19251975        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
    19571980
    19581981      /* If this is a static pattern rule:
    1959          `targets: target%pattern: dep%pattern; cmds',
     1982         `targets: target%pattern: prereq%pattern; recipe',
    19601983         make sure the pattern matches this target name.  */
    19611984      if (pattern && !pattern_matches (pattern, pattern_percent, name))
    19621985        error (flocp, _("target `%s' doesn't match the target pattern"), name);
    19631986      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.  */
    19731993      if (!two_colon)
    19741994        {
    1975           /* Single-colon.  Combine these dependencies
    1976              with others in file's existing record, if any.  */
     1995          /* Single-colon.  Combine this rule with the file's existing record,
     1996             if any.  */
    19771997          f = enter_file (strcache_add (name));
    1978 
    19791998          if (f->double_colon)
    19801999            fatal (flocp,
     
    20012020            }
    20022021
    2003           f->is_target = 1;
    2004 
    20052022          /* Defining .DEFAULT with no deps or cmds clears it.  */
    20062023          if (f == default_file && this == 0 && cmds == 0)
     
    20162033              f->deps = 0;
    20172034            }
    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 deps
    2031                        last. The rationale behind this is that $< expands to
    2032                        the first dep in the chain, and commands use $<
    2033                        expecting to get the dep that rule specifies.  However
    2034                        the second expansion algorithm reverses the order thus
    2035                        we need to make it last here.  */
    2036                     (*d_ptr)->next = this;
    2037                   else
    2038                     {
    2039                       /* This is the rule without commands. Put its
    2040                          dependencies at the end but before dependencies from
    2041                          the rule with commands (if any). This way everything
    2042                          appears in makefile order.  */
    2043 
    2044                       if (f->cmds != 0)
    2045                         {
    2046                           this->next = *d_ptr;
    2047                           *d_ptr = this;
    2048                         }
    2049                       else
    2050                         (*d_ptr)->next = this;
    2051                     }
    2052                 }
    2053               else
    2054                 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 commands
    2058                  (so that logic in snap_deps() can put it in front and all
    2059                  this $< -logic works). I cannot simply rely on file->cmds
    2060                  being not 0 because of the cases like the following:
    2061 
    2062                  foo: bar
    2063                  foo:
    2064                      ...
    2065 
    2066                  I am going to temporarily "borrow" UPDATING member in
    2067                  `struct file' for this.   */
    2068 
    2069               if (cmds != 0)
    2070                 f->updating = 1;
    2071             }
    20722035        }
    20732036      else
     
    20762039          f = lookup_file (name);
    20772040
    2078           /* Check for both : and :: rules.  Check is_target so
    2079              we don't lose on 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.  */
    20802043          if (f != 0 && f->is_target && !f->double_colon)
    20812044            fatal (flocp,
    20822045                   _("target file `%s' has both : and :: entries"), f->name);
     2046
    20832047          f = enter_file (strcache_add (name));
    20842048          /* If there was an existing entry and it was a double-colon entry,
     
    20902054               double_colon pointer to itself.  */
    20912055            f->double_colon = f;
    2092           f->is_target = 1;
    2093           f->deps = this;
     2056
    20942057          f->cmds = cmds;
    20952058        }
    20962059
     2060      f->is_target = 1;
     2061
    20972062      /* If this is a static pattern rule, set the stem to the part of its
    20982063         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.  */
    21002065      if (pattern)
    21012066        {
     
    21072072          if (this)
    21082073            {
    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;
    21112078            }
    21122079        }
    21132080
     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
    21142110      name = f->name;
    21152111
    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"));
    21292122    }
    21302123}
     
    22502243  const char *p = *string;
    22512244  char *new = 0;
    2252   int slen;
     2245  int slen = 0;
    22532246
    22542247  /* If the first char is a % return now.  This lets us avoid extra tests
     
    23162309
    23172310
    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
     2324static unsigned long
     2325readstring (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
     2367static long
     2368readline (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
     2491static enum make_word_type
     2492get_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
     2656void
     2657construct_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
     2771char *
     2772tilde_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().
    23202846
    23212847   The string is passed as STRINGP, the address of a string pointer.
     
    23272853   that have room for additional info.
    23282854
    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
     2866void *
     2867parse_file_seq (char **stringp, unsigned int size, int stopchar,
     2868                const char *prefix, int flags)
    23332869{
     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
    23342879  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;
    23372891
    23382892#ifdef VMS
     
    23422896#endif
    23432897
     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;
    23442917  while (1)
    23452918    {
    23462919      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.  */
    23502931      p = next_token (p);
    2351       if (*p == '\0')
     2932      if (*p == '\0' || *p == stopchar)
    23522933        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);
    23592939#ifdef VMS
    23602940        /* convert comma separated list to space separated */
     
    23792959#endif
    23802960      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))
    23842965#ifdef VMS
    23852966        /* Skip leading `[]'s.  */
    2386         while (p - q > 2 && q[0] == '[' && q[1] == ']')
     2967        while (p - s > 2 && s[0] == '[' && s[1] == ']')
    23872968#else
    23882969        /* Skip leading `./'s.  */
    2389         while (p - q > 2 && q[0] == '.' && q[1] == '/')
     2970        while (p - s > 2 && s[0] == '.' && s[1] == '/')
    23902971#endif
    23912972          {
    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;
    23962977          }
    23972978
    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 ("./"). */
    24022985#if defined(VMS)
    2403         continue;
     2986          continue;
    24042987#elif defined(_AMIGA)
    2405         name = "";
     2988          /* PDS-- This cannot be right!! */
     2989          tp[0] = '\0';
     2990          nlen = 0;
    24062991#else
    2407         name = "./";
     2992          tp[0] = '.';
     2993          tp[1] = '/';
     2994          tp[2] = '\0';
     2995          nlen = 2;
    24082996#endif
     2997        }
    24092998      else
     2999        {
    24103000#ifdef VMS
    24113001/* VMS filenames can have a ':' in them but they have to be '\'ed but we need
    24123002 *  to remove this '\' before we can use the filename.
    2413  * Savestring called because q may be read-only string constant.
     3003 * xstrdup called because S may be read-only string constant.
    24143004 */
    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)
    24233007            {
    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++);
    24303011            }
    2431           name = strcache_add_len (qbase, p1 - qbase);
    2432           free (qbase);
    2433         }
     3012          n[0] = '\0';
     3013          nlen = strlen (tp);
    24343014#else
    2435         name = strcache_add_len (q, p - q);
     3015          nlen = p - s;
     3016          memcpy (tp, s, nlen);
     3017          tp[nlen] = '\0';
    24363018#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.  */
    24453022
    24463023#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] != ')')
    25883040        {
    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            }
    25913075        }
    25923076
    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)
    26643079        {
    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            }
    26673095        }
    26683096#endif
    26693097
    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] == '~')
    26723113        {
    2673           if (*p2 != '\\')
    2674             break;
    2675           backslash = !backslash;
     3114          tildep = tilde_expand (tp);
     3115          if (tildep != 0)
     3116            name = tildep;
    26763117        }
    26773118
    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))
    26793124        {
    2680           p[-1] = '\0';
    2681           break;
     3125          ar_parse_name (name, &arname, &memname);
     3126          name = arname;
    26823127        }
    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;
    27663139          break;
    27673140
    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)
    28453144            {
    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;
    28703146              break;
    28713147            }
     3148          /* FALLTHROUGH */
     3149
     3150        default:
     3151          /* By default keep this name.  */
     3152          i = 1;
     3153          nlist = &name;
    28723154          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)
    29443161          {
    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              }
    29523187          }
    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
    31303189#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);
    32013193
    32023194#ifndef NO_ARCHIVES
     
    32043196        free (arname);
    32053197#endif
     3198
     3199      if (tildep)
     3200        free (tildep);
    32063201    }
    32073202
     3203  *stringp = p;
    32083204  return new;
    32093205}
  • vendor/gnumake/current/readme.vms

    r1989 r2596  
    11This is the VMS version of GNU Make, updated by Hartmut Becker
    22
    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.
     3Changes are based on GNU make 3.82.
     4
     5This version was built and tested on OpenVMS V7.3 (VAX), V7.3-2 (Alpha) and
     6V8.3-1H1 (I64).
    107
    118Build instructions
    129Make a 1st version
    13        $ @makefile.com
     10       $ @makefile.com  ! ignore any compiler and/or linker warning
    1411       $ rena make.exe 1st-make.exe
    1512Use the 1st version to generate a 2nd version
     
    2118       $ mc sys$disk:[]2nd-make
    2219
    23 Changes:
     20Changes (3.81.90)
     21
     22Michael Gehre (at VISTEC-SEMI dot COM) supplied a fix for a problem with
     23timestamps of object modules in OLBs. The timestamps were not correctly
     24adjusted to GMT based time, if the local VMS time was using a daylight saving
     25algorithm and if daylight saving was switched off.
     26
     27John Eisenbraun (at HP dot COM) supplied fixes and and an enhancement to append
     28output redirection in action lines.
     29
     30Rework of ctrl+c and ctrl+y handling.
     31
     32Fix a problem with cached strings, which showed on case-insensitive file
     33systems.
     34
     35Build fixes for const-ified code in VMS specific sources.
     36
     37Build notes:
     38- Try to avoid HP C V7.2-001, which has an incompatible change
     39how __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
     44image     module    routine               line      rel PC           abs PC
     45
     46DECC$SHR  C$SIGNAL  gsignal              27991 0000000000001180
     47FFFFFFFF84AB2DA0
     48DECC$SHR  C$SIGNAL  raise                28048 0000000000001280
     49FFFFFFFF84AB2EA0
     50DECC$SHR  C$SIGPENDING  decc$$deliver_signals
     51                                         12475 0000000000000890
     52FFFFFFFF84C13690
     53...
     54This looks like an incompatibility to the Alpha and VAX behavior, so it looks
     55like 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
     58make's alloca which produced a couple of compile time warnings. It seems too
     59much effort to work on a clean build on VAX.
     60
     61A note on appending the redirected output. With this change, a simple mechanism
     62is implemented to make ">>" work in action lines. In VMS there is no simple
     63feature like ">>" to have DCL command or program output redirected and appended
     64to a file. GNU make for VMS already implements the redirection of output. If
     65such a redirection is detected, an ">" on the action line, GNU make creates a
     66DCL command procedure to execute the action and to redirect its output. Based
     67on that, now ">>" is also recognized and a similar but different command
     68procedure is created to implement the append. The main idea here is to create a
     69temporary file which collects the output and which is appended to the wanted
     70output file. Then the temporary file is deleted. This is all done in the
     71command procedure to keep changes in make small and simple. This obviously has
     72some limitations but it seems good enough compared with the current ">"
     73implementation. (And in my opinion, redirection is not really what GNU make has
     74to do.) With this approach, it may happen that the temporary file is not yet
     75appended and is left in SYS$SCRATCH. The temporary file names look like
     76"CMDxxxxx.". Any time the created command procedure can not complete, this
     77happens. Pressing Ctrl+Y to abort make is one case. In case of Ctrl+Y the
     78associated command procedure is left in SYS$SCRATCH as well. Its name is
     79CMDxxxxx.COM.
     80
     81Change in the Ctrl+Y handling
     82
     83Ctrl+Y was: The CtrlY handler called $forcex for the current child.
     84
     85Ctrl+Y changed: The CtrlY handler uses $delprc to delete all children. This way
     86also actions with DCL commands will be stopped. As before Ctrl+Y then sends
     87SIGQUIT to itself, which is handled in common code.
     88
     89Change in deleteing temporary command files
     90
     91Temporary command files were deleted in the main line, after returning from the
     92vms child termination handler. If Ctrl+C was pressed, the handler is called but
     93did not return to main line.
     94
     95Now, temporary command files are deleted in the vms child termination
     96handler. That deletes the them even if a Ctrl+C was pressed.
     97
     98The behavior of pressing Ctrl+C is not changed. It still has only an effect,
     99after the current action is terminated. If that doesn't happen or takes too
     100long, Ctrl+Y should be used instead.
     101
     102
     103Changes (3.80)
    24104
    25105. In default.c define variable ARCH as IA64 for VMS on Itanium systems.
     
    300380-------------------------------------------------------------------------------
    301381Copyright (C) 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005,
    302 2006, 2007 Free Software Foundation, Inc.
     3822006, 2007, 2008, 2009, 2010 Free Software Foundation, Inc.
    303383This file is part of GNU Make.
    304384
  • vendor/gnumake/current/remake.c

    r1989 r2596  
    11/* Basic dependency engine for GNU Make.
    22Copyright (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.
     31998, 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009,
     42010 Free Software Foundation, Inc.
    55This file is part of GNU Make.
    66
     
    8484{
    8585  int t = touch_flag, q = question_flag, n = just_print_flag;
    86   unsigned int j = job_slots;
    8786  int status = -1;
    8887
     
    136135              unsigned int ocommands_started;
    137136              int x;
     137
     138              file->dontcare = g->dontcare;
     139
    138140              check_renamed (file);
    139141              if (rebuilding_makefiles)
     
    209211              any_not_updated |= !file->updated;
    210212
     213              file->dontcare = 0;
     214
    211215              if (stop)
    212216                break;
     
    265269      question_flag = q;
    266270      just_print_flag = n;
    267       job_slots = j;
    268271    }
    269272
     
    298301  if (f->considered == considered)
    299302    {
    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        }
    302311    }
    303312
     
    316325      /* If we got an error, don't bother with double_colon etc.  */
    317326      if (status != 0 && !keep_going_flag)
    318         return status;
     327        return status;
    319328
    320329      if (f->command_state == cs_running
     
    348357
    349358static void
    350 complain (const struct file *file)
     359complain (struct file *file)
    351360{
    352361  const char *msg_noparent
     
    355364    = _("%sNo rule to make target `%s', needed by `%s'%s");
    356365
    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
    359394      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    }
    369401}
    370402
     
    374406update_file_1 (struct file *file, unsigned int depth)
    375407{
    376   register FILE_TIMESTAMP this_mtime;
     408  FILE_TIMESTAMP this_mtime;
    377409  int noexist, must_make, deps_changed;
    378410  int dep_status = 0;
    379   register struct dep *d, *lastd;
     411  struct file *ofile;
     412  struct dep *d, *ad;
     413  struct dep amake;
    380414  int running = 0;
    381415
     
    389423               _("Recently tried and failed to update file `%s'.\n"));
    390424
    391           /* If the file we tried to make is marked dontcare then no message
     425          /* If the file we tried to make is marked no_diag then no message
    392426             was printed about it when it failed during the makefile rebuild.
    393427             If we're trying to build it again in the normal rebuild, print a
    394428             message now.  */
    395           if (file->dontcare && !rebuilding_makefiles)
    396             {
    397               file->dontcare = 0;
     429          if (file->no_diag && !file->dontcare)
    398430              complain (file);
    399             }
    400431
    401432          return file->update_status;
     
    421452    }
    422453
     454  /* Determine whether the diagnostics will be issued should this update
     455     fail. */
     456  file->no_diag = file->dontcare;
     457
    423458  ++depth;
    424459
    425460  /* Notice recursive update of the same file.  */
    426461  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;
    427466
    428467  /* Looking at the file's modtime beforehand allows the possibility
     
    468507    }
    469508
    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)
    506526        {
    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;
    509596        }
    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         do
    528           {
    529             running |= (f->command_state == cs_running
    530                         || 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 while
    541            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;
    547597    }
    548598
     
    600650
    601651  finish_updating (file);
     652  finish_updating (ofile);
    602653
    603654  DBF (DB_VERBOSE, _("Finished prerequisites of target file `%s'.\n"));
     
    859910         would have been updated. */
    860911
    861       if (question_flag || just_print_flag || touch_flag)
     912      if ((question_flag || just_print_flag || touch_flag) && file->cmds)
    862913        {
    863914          for (i = file->cmds->ncommand_lines; i > 0; --i)
     
    937988           FILE_TIMESTAMP this_mtime, int *must_make_ptr)
    938989{
     990  struct file *ofile;
    939991  struct dep *d;
    940992  int dep_status = 0;
     
    942994  ++depth;
    943995  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;
    9441000
    9451001  if (file->phony || !file->intermediate)
     
    9871043             necessary, and see whether any of them is more recent than the
    9881044             file on whose behalf we are checking.  */
    989           struct dep *lastd;
     1045          struct dep *ld;
    9901046          int deps_running = 0;
    9911047
    992           /* Reset this target's state so that we check it fresh.  It could be
    993              that it's already been checked as part of an order-only
     1048          /* 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
    9941050             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;
    9981055          d = file->deps;
    9991056          while (d != 0)
     
    10051062                  error (NILF, _("Circular %s <- %s dependency dropped."),
    10061063                         file->name, d->file->name);
    1007                   if (lastd == 0)
     1064                  if (ld == 0)
    10081065                    {
    10091066                      file->deps = d->next;
     
    10131070                  else
    10141071                    {
    1015                       lastd->next = d->next;
     1072                      ld->next = d->next;
    10161073                      free_dep (d);
    1017                       d = lastd->next;
     1074                      d = ld->next;
    10181075                    }
    10191076                  continue;
     
    10341091                deps_running = 1;
    10351092
    1036               lastd = d;
     1093              ld = d;
    10371094              d = d->next;
    10381095            }
     
    10471104
    10481105  finish_updating (file);
     1106  finish_updating (ofile);
     1107
    10491108  return dep_status;
    10501109}
     
    12301289        {
    12311290          /* 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);
    12331292          if (name
    12341293              /* Last resort, is it a library (-lxxx)?  */
     
    14731532    };
    14741533
    1475   static char *libpatterns = NULL;
    1476 
    1477   const char *libname = lib+2;  /* Name without the '-l'.  */
     1534  const char *file = 0;
     1535  char *libpatterns;
    14781536  FILE_TIMESTAMP mtime;
    14791537
     
    14821540  const char *p2;
    14831541  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;
    14841547
    14851548  char **dp;
    14861549
    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.  */
    14991559  p2 = libpatterns;
    15001560  while ((p = find_next_token (&p2, &len)) != 0)
     
    15051565      char *libbuf = variable_expand ("");
    15061566
    1507       /* Expand the pattern using LIBNAME as a replacement.  */
     1567      /* Expand the pattern using LIB as a replacement.  */
    15081568      {
    15091569        char c = p[len];
     
    15141574        if (!p3)
    15151575          {
    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.  */
    15181577            error (NILF, _(".LIBPATTERNS element `%s' is not a pattern"), p);
    1519             for (; len; --len, ++p)
    1520               *p = ' ';
    1521             *p = c;
     1578            p[len] = c;
    15221579            continue;
    15231580          }
    15241581        p4 = variable_buffer_output (libbuf, p, p3-p);
    1525         p4 = variable_buffer_output (p4, libname, strlen (libname));
     1582        p4 = variable_buffer_output (p4, lib, liblen);
    15261583        p4 = variable_buffer_output (p4, p3+1, len - (p3-p));
    15271584        p[len] = c;
     
    15341591          if (mtime_ptr != 0)
    15351592            *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;
    15371596        }
    15381597
     
    15401599
    15411600      {
    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          }
    15451619      }
    15461620
     
    15481622
    15491623      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        }
    15601635      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;
    15801670}
  • vendor/gnumake/current/remote-cstms.c

    r1989 r2596  
    55
    66Copyright (C) 1988, 1989, 1990, 1991, 1992, 1993, 1994, 1995, 1996, 1997,
    7 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007 Free Software
    8 Foundation, Inc.
     71998, 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009,
     82010 Free Software Foundation, Inc.
    99This file is part of GNU Make.
    1010
  • vendor/gnumake/current/remote-stub.c

    r1989 r2596  
    11/* Template for the remote job exportation interface to GNU Make.
    22Copyright (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.
     31998, 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009,
     42010 Free Software Foundation, Inc.
    55This file is part of GNU Make.
    66
  • vendor/gnumake/current/rule.c

    r1989 r2596  
    11/* Pattern and suffix rule internals for GNU Make.
    22Copyright (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.
     31998, 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009,
     42010 Free Software Foundation, Inc.
    55This file is part of GNU Make.
    66
     
    9797      for (dep = rule->deps; dep != 0; dep = dep->next)
    9898        {
    99           unsigned int len = strlen (dep->name);
     99          const char *dname = dep_name (dep);
     100          unsigned int len = strlen (dname);
    100101
    101102#ifdef VMS
    102           const char *p = strrchr (dep->name, ']');
     103          const char *p = strrchr (dname, ']');
    103104          const char *p2;
    104105          if (p == 0)
    105             p = strrchr (dep->name, ':');
    106           p2 = p != 0 ? strchr (dep->name, '%') : 0;
     106            p = strrchr (dname, ':');
     107          p2 = p != 0 ? strchr (dname, '%') : 0;
    107108#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;
    110111#endif
    111           ndeps++;
     112          ndeps++;
    112113
    113114          if (len > max_pattern_dep_length)
     
    118119              /* There is a slash before the % in the dep name.
    119120                 Extract the directory name.  */
    120               if (p == dep->name)
     121              if (p == dname)
    121122                ++p;
    122               if (p - dep->name > namelen)
     123              if (p - dname > namelen)
    123124                {
    124                   namelen = p - dep->name;
     125                  namelen = p - dname;
    125126                  name = xrealloc (name, namelen + 1);
    126127                }
    127               memcpy (name, dep->name, p - dep->name);
    128               name[p - dep->name] = '\0';
     128              memcpy (name, dname, p - dname);
     129              name[p - dname] = '\0';
    129130
    130131              /* In the deps of an implicit rule the `changed' flag
     
    380381
    381382  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);
    385384
    386385  if (new_pattern_rule (r, 0))
     
    406405{
    407406  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);
    420413  free (rule->lens);
    421414
     
    488481{
    489482  unsigned int i;
    490   struct dep *d;
    491483
    492484  for (i = 0; i < r->num; ++i)
     
    498490    putchar (':');
    499491
    500   for (d = r->deps; d != 0; d = d->next)
    501     printf (" %s", dep_name (d));
    502   putchar ('\n');
     492  print_prereqs (r->deps);
    503493
    504494  if (r->cmds != 0)
     
    547537         makefiles and thus count_implicit_rule_limits wasn't called yet.  */
    548538      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"),
    550540               num_pattern_rules, rules);
    551541    }
  • vendor/gnumake/current/rule.h

    r1989 r2596  
    11/* Definitions for using pattern rules in GNU Make.
    22Copyright (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.
     31998, 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009,
     42010 Free Software Foundation, Inc.
    55This file is part of GNU Make.
    66
  • vendor/gnumake/current/signame.c

    r1989 r2596  
    11/* Convert between signal names and numbers.
    22Copyright (C) 1990, 1991, 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999,
    3 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007 Free Software Foundation, Inc.
     32000, 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010 Free Software
     4Foundation, Inc.
    45This file is part of GNU Make.
    56
     
    229230
    230231char *
    231 strsignal (int signal)
     232strsignal (int sig)
    232233{
    233234  static char buf[] = "Signal 12345678901234567890";
     
    246247#endif
    247248
    248   if (signal > 0 || signal < NSIG)
    249     return (char *) sys_siglist[signal];
    250 
    251   sprintf (buf, "Signal %d", signal);
     249  if (sig > 0 || sig < NSIG)
     250    return (char *) sys_siglist[sig];
     251
     252  sprintf (buf, "Signal %d", sig);
    252253  return buf;
    253254}
  • vendor/gnumake/current/strcache.c

    • Property svn:eol-style set to native
    r1989 r2596  
    11/* Constant string caching for GNU Make.
    2 Copyright (C) 2006, 2007 Free Software Foundation, Inc.
     2Copyright (C) 2006, 2007, 2008, 2009, 2010 Free Software Foundation, Inc.
    33This file is part of GNU Make.
    44
  • vendor/gnumake/current/subproc.bat

    r1991 r2596  
    11@echo off
    22rem Copyright (C) 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004,
    3 rem 2005, 2006, 2007 Free Software Foundation, Inc.
     3rem 2005, 2006, 2007, 2008, 2009, 2010 Free Software Foundation, Inc.
    44rem This file is part of GNU Make.
    55rem
  • vendor/gnumake/current/tests

    • Property svn:ignore deleted
  • vendor/gnumake/current/tests/ChangeLog

    r1989 r2596  
     12010-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
     92010-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
     192010-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
     262010-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
     312009-11-12  Boris Kolpackov  <boris@codesynthesis.com>
     32
     33        * scripts/features/vpath3: Test for the new library search
     34        behavior.
     35
     362009-10-06  Boris Kolpackov  <boris@codesynthesis.com>
     37
     38        * scripts/features/se_explicit: Enable the test for now fixed
     39        Savannah bug 25780.
     40
     412009-10-06  Boris Kolpackov  <boris@codesynthesis.com>
     42
     43        * scripts/variables/undefine: Tests for the new undefine feature.
     44
     452009-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
     562009-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
     622009-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
     752009-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
     832009-09-24  Paul Smith  <psmith@gnu.org>
     84
     85        * scripts/features/se_implicit: Add a test for order-only
     86        secondary expansion prerequisites.
     87
     882009-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
     952009-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
     1012009-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
     1102009-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
     1342009-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
     1392009-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
     1502009-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
     1592009-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
     1692009-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
     1752009-05-25  Paul Smith  <psmith@gnu.org>
     176
     177        * scripts/features/targetvars: Ditto.
     178
     179        * scripts/features/export: Test new variable parsing abilities.
     180
     1812009-02-23  Ramon Garcia  <ramon.garcia.f@gmail.com>
     182
     183        * scripts/variables/private: Create a new suite of tests for 'private'.
     184
    11852007-11-04  Paul Smith  <psmith@gnu.org>
    2186
     
    8811065
    8821066Copyright (C) 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001,
    883 2002, 2003, 2004, 2005, 2006, 2007 Free Software Foundation, Inc.
     10672002, 2003, 2004, 2005, 2006, 2007, 2008, 2009 Free Software Foundation, Inc.
    8841068This file is part of GNU Make.
    8851069
  • vendor/gnumake/current/tests/NEWS

    r1989 r2596  
    165165-------------------------------------------------------------------------------
    166166Copyright (C) 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001,
    167 2002, 2003, 2004, 2005, 2006, 2007 Free Software Foundation, Inc.
     1672002, 2003, 2004, 2005, 2006, 2007, 2008, 2009 Free Software Foundation, Inc.
    168168This file is part of GNU Make.
    169169
  • vendor/gnumake/current/tests/README

    r1989 r2596  
    99 -----------------------------------------------------------------------------
    1010 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.
    1212 This file is part of GNU Make.
    1313
  • vendor/gnumake/current/tests/mkshadow

    • Property svn:eol-style changed from native to LF
    r1989 r2596  
    55#
    66# 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.
    89# This file is part of GNU Make.
    910#
  • vendor/gnumake/current/tests/run_make_tests

    • Property svn:eol-style changed from native to LF
  • vendor/gnumake/current/tests/run_make_tests.pl

    r1989 r2596  
    1313
    1414# 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.
    1617# This file is part of GNU Make.
    1718#
     
    2930# this program.  If not, see <http://www.gnu.org/licenses/>.
    3031
     32
    3133$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';
    3337$pure_log = undef;
     38
     39$command_string = '';
     40
     41$all_tests = 0;
    3442
    3543require "test_driver.pl";
     
    4452   local($option) = @_;
    4553
    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;
    6078   }
    6179
     
    106124    $makestring =~ s/#MAKEPATH#/$mkpath/g;
    107125    $makestring =~ s/#MAKE#/$make_name/g;
     126    $makestring =~ s/#PERL#/$perl_name/g;
    108127    $makestring =~ s/#PWD#/$pwd/g;
    109128
     
    120139  $answer =~ s/#MAKEPATH#/$mkpath/g;
    121140  $answer =~ s/#MAKE#/$make_name/g;
     141  $answer =~ s/#PERL#/$perl_name/g;
    122142  $answer =~ s/#PWD#/$pwd/g;
    123143
     
    149169  }
    150170
     171  $command_string = "$command\n";
     172
    151173  if ($valgrind) {
    152174    print VALGRIND "\n\nExecuting: $command\n";
     
    156178  {
    157179      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;
    159184
    160185      $code = &run_command_with_output($logname,$command);
     
    184209    print "Error running $make_path (expected $expected_code; got $code): $command\n";
    185210    $test_passed = 0;
     211    $runf = &get_runfile;
     212    &create_file (&get_runfile, $command_string);
    186213    # If it's a SIGINT, stop here
    187214    if ($code & 127) {
    188215      print STDERR "\nCaught signal ".($code & 127)."!\n";
    189       exit($code);
     216      ($code & 127) == 2 and exit($code);
    190217    }
    191218    return 0;
     
    196223  }
    197224
    198   1;
     225  return 1;
    199226}
    200227
     
    202229{
    203230   &print_standard_usage ("run_make_tests",
    204                           "[-make_path make_pathname] [-valgrind]",);
     231                          "[-make_path make_pathname] [-memcheck] [-massif]",);
    205232}
    206233
    207234sub print_help
    208235{
    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       );
    211247}
    212248
     
    335371
    336372   if ($valgrind) {
     373     my $args = $valgrind_args;
    337374     open(VALGRIND, "> valgrind.out")
    338375       || die "Cannot open valgrind.out: $!\n";
    339376     #  -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";
    342379     # F_SETFD is 2
    343380     fcntl(VALGRIND, 2, 0) or die "fcntl(setfd) failed: $!\n";
  • vendor/gnumake/current/tests/scripts/features/comments

    • Property svn:eol-style changed from native to LF
  • vendor/gnumake/current/tests/scripts/features/conditionals

    • Property svn:eol-style changed from native to LF
  • vendor/gnumake/current/tests/scripts/features/default_names

    • Property svn:eol-style changed from native to LF
  • vendor/gnumake/current/tests/scripts/features/double_colon

    • Property svn:eol-style changed from native to LF
  • vendor/gnumake/current/tests/scripts/features/echoing

    • Property svn:eol-style changed from native to LF
    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
     3echoing.  It tests that when a command line starts with
     4a '\@', the echoing of that line is suppressed.  It also
     5tests the -n option which tells make to ONLY echo the
     6commands and no execution happens.  In this case, even
     7the commands with '\@' are printed. Lastly, it tests the
     8-s flag which tells make to prevent all echoing, as if
     9all commands started with a '\@'.";
    910
    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
     12been placed in front of the delete command line.  Four tests
     13are run here.  First, make is run normally and the first echo
     14command should be executed.  In this case there is no '\@' so
     15we should expect make to display the command AND display the
     16echoed message.  Secondly, make is run with the clean target,
     17but since there is a '\@' at the beginning of the command, we
     18expect no output; just the deletion of a file which we check
     19for.  Third, we give the clean target again except this time
     20we give make the -n option.  We now expect the command to be
     21displayed but not to be executed.  In this case we need only
     22to check the output since an error message would be displayed
     23if it actually tried to run the delete command again and the
     24file didn't exist. Lastly, we run the first test again with
     25the -s option and check that make did not echo the echo
     26command before printing the message.\n";
    2627
    2728$example = "EXAMPLE_FILE";
    2829
    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);
     30touch($example);
    4331
    4432# TEST #1
    4533# -------
    4634
    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 
     35run_make_test("
     36all:
     37\techo This makefile did not clean the dir... good
     38clean:
     39\t\@$delete_command $example\n",
     40              '', 'echo This makefile did not clean the dir... good
     41This makefile did not clean the dir... good');
    5242
    5343# TEST #2
    5444# -------
    5545
    56 &run_make_with_options($makefile,"clean",&get_logfile,0);
     46run_make_test(undef, 'clean', '');
    5747if (-f $example) {
    5848  $test_passed = 0;
     49  unlink($example);
    5950}
    60 &compare_output('',&get_logfile(1));
    6151
    6252# TEST #3
    6353# -------
    6454
    65 &run_make_with_options($makefile,"-n clean",&get_logfile,0);
    66 $answer = "$delete_command $example\n";
    67 &compare_output($answer,&get_logfile(1));
     55run_make_test(undef, '-n clean', "$delete_command $example\n");
    6856
    6957
     
    7159# -------
    7260
    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));
     61run_make_test(undef, '-s', "This makefile did not clean the dir... good\n");
    7662
    7763
    78641;
    79 
    80 
    81 
    82 
    83 
    84 
    85 
    86 
    87 
  • vendor/gnumake/current/tests/scripts/features/errors

    • Property svn:eol-style changed from native to LF
  • vendor/gnumake/current/tests/scripts/features/escape

    • Property svn:eol-style changed from native to LF
  • vendor/gnumake/current/tests/scripts/features/export

    • Property svn:eol-style changed from native to LF
    r501 r2596  
    77# about that here.
    88
    9 open(MAKEFILE,"> $makefile");
    10 
    11 # The Contents of the MAKEFILE ...
    12 
    13 print MAKEFILE <<'EOMAKE';
    14 
     9&run_make_test('
    1510FOO = foo
    1611BAR = bar
     
    4136        @echo "FOO=$(FOO) BAR=$(BAR) BAZ=$(BAZ) BOZ=$(BOZ) BITZ=$(BITZ) BOTZ=$(BOTZ)"
    4237        @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
     40FOO= BAR= BAZ=baz BOZ=boz BITZ=bitz BOTZ=\n");
    5641
    5742# TEST 1: make sure vars inherited from the parent are exported
     
    5944$extraENV{FOO} = 1;
    6045
    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
     47FOO=foo BAR= BAZ=baz BOZ=boz BITZ=bitz BOTZ=\n");
    6748
    6849# TEST 2: global export.  Explicit unexport takes precedence.
    6950
    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));
     51run_make_test(undef, "EXPORT_ALL=1" ,
     52              "FOO=foo BAR=bar BAZ=baz BOZ=boz BITZ=bitz BOTZ=botz
     53FOO=foo BAR=bar BAZ=baz BOZ=boz BITZ=bitz BOTZ=\n");
    7654
    7755# TEST 3: global unexport.  Explicit export takes precedence.
    7856
    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
     59FOO= BAR= BAZ=baz BOZ=boz BITZ=bitz BOTZ=\n");
    8560
    8661# TEST 4: both: in the above makefile the unexport comes last so that rules.
    8762
    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
     65FOO= BAR= BAZ=baz BOZ=boz BITZ=bitz BOTZ=\n");
    9466
    9567# TEST 5: test the pseudo target.
    9668
    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
     71FOO=foo BAR=bar BAZ=baz BOZ=boz BITZ=bitz BOTZ=\n");
    10472
    10573# TEST 6: Test the expansion of variables inside export
    10674
    107 $makefile2 = &get_tmpfile;
    108 
    109 open(MAKEFILE, "> $makefile2");
    110 
    111 print MAKEFILE <<'EOF';
    112 
     75&run_make_test('
    11376foo = f-ok
    11477bar = b-ok
     
    12689        @echo foo=$(foo) bar=$(bar)
    12790        @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");
    13793
    13894# TEST 7: Test the expansion of variables inside unexport
    13995
    140 $makefile3 = &get_tmpfile;
    141 
    142 open(MAKEFILE, "> $makefile3");
    143 
    144 print MAKEFILE <<'EOF';
    145 
     96&run_make_test('
    14697foo = f-ok
    14798bar = b-ok
     
    161112        @echo foo=$(foo) bar=$(bar)
    162113        @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");
    172116
    173117# TEST 7: Test exporting multiple variables on the same line
    174118
    175 $makefile4 = &get_tmpfile;
    176 
    177 open(MAKEFILE, "> $makefile4");
    178 
    179 print MAKEFILE <<'EOF';
    180 
     119&run_make_test('
    181120A = a
    182121B = b
     
    197136
    198137all: ; @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");
    207140
    208141# TEST 8: Test unexporting multiple variables on the same line
    209142
    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);
    211144
    212 open(MAKEFILE, "> $makefile5");
    213 
    214 print MAKEFILE <<'EOF';
    215 
     145&run_make_test('
    216146A = a
    217147B = b
     
    232162
    233163all: ; @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");
    235166
    236 close(MAKEFILE);
     167# TEST 9: Check setting a variable named "export"
    237168
    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('
     170export = 123
     171export export
     172export export = 456
     173a: ; @echo "\$$(export)=$(export) / \$$export=$$export"
     174',
     175               '', "\$(export)=456 / \$export=456\n");
    239176
    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
    243178
     179&run_make_test('
     180a: export
     181export: ; @echo "$@"
     182',
     183               '', "export\n");
    244184
    245185# This tells the test driver that the perl test script executed properly.
  • vendor/gnumake/current/tests/scripts/features/include

    • Property svn:eol-style changed from native to LF
    r501 r2596  
    9191', '', '');
    9292
    93 1;
    94 
    9593
    9694# Make sure that we don't die when the command fails but we dontcare.
     
    118116sinclude', '', '');
    119117
     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#
     122run_make_test('
     123-include foo
     124
     125all: bar
     126
     127foo: baz
     128bar: baz
     129',
     130'',
     131"#MAKE#: *** No rule to make target `baz', needed by `bar'.  Stop.\n",
     132512);
     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#
     137run_make_test('
     138-include foo
     139
     140all: bar
     141
     142foo: baz
     143bar: baz
     144baz: end
     145',
     146'',
     147"#MAKE#: *** No rule to make target `end', needed by `baz'.  Stop.\n",
     148512);
     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#
     153run_make_test('
     154include bar
     155-include foo
     156
     157all:
     158
     159foo: baz
     160bar: baz
     161baz: 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",
     166512);
     167
     168if ($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!
     172include foo
     173foo: ; @echo foo = bar > $@
     174!,
     175                  '', "#MAKE#: `foo' is up to date.\n");
     176    rmfiles('foo');
     177}
     178
    1201791;
  • vendor/gnumake/current/tests/scripts/features/mult_rules

    • Property svn:eol-style changed from native to LF
  • vendor/gnumake/current/tests/scripts/features/mult_targets

    • Property svn:eol-style changed from native to LF
  • vendor/gnumake/current/tests/scripts/features/order_only

    • Property svn:eol-style changed from native to LF
  • vendor/gnumake/current/tests/scripts/features/override

    • Property svn:eol-style changed from native to LF
    r53 r2596  
    1 $description = "The following test creates a makefile to ...";
     1#                                                                    -*-perl-*-
     2
     3$description = "Test the override directive on variable assignments.";
    24
    35$details = "";
    46
    5 open(MAKEFILE,"> $makefile");
     7# TEST 0: Basic override
    68
    7 # The Contents of the MAKEFILE ...
     9run_make_test('
     10X = start
     11override recur = $(X)
     12override simple := $(X)
     13X = end
     14all: ; @echo "$(recur) $(simple)"
     15',
     16              'recur=I simple=J', "end start\n");
    817
    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
    1519
    16 # END of Contents of MAKEFILE
     20run_make_test('
     21X += X1
     22override X += X2
     23override Y += Y1
     24Y += Y2
     25all: ; @echo "$(X) $(Y)"
     26',
     27              '', "X1 X2 Y1\n");
    1728
    18 close(MAKEFILE);
     29# TEST 2: Override with append to the command line
    1930
    20 &run_make_with_options($makefile,"foo=Hello",&get_logfile);
     31run_make_test(undef, 'X=C Y=C', "C X2 C Y1\n");
    2132
    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
    2534
    26 &compare_output($answer,&get_logfile(1));
     35run_make_test('
     36override define foo
     37@echo First comes the definition.
     38@echo Then comes the override.
     39endef
     40all: ; $(foo)
     41',
     42              'foo=Hello', "First comes the definition.\nThen comes the override.\n");
     43
    2744
    28451;
    29 
    30 
    31 
    32 
    33 
    34 
  • vendor/gnumake/current/tests/scripts/features/parallelism

    • Property svn:eol-style changed from native to LF
    r1989 r2596  
    4444              "ONE.inc\nTHREE.inc\nTWO.inc\nONE\nTHREE\nTWO\nsuccess\n");
    4545
    46 unlink('1.inc', '2.inc');
     46rmfiles(qw(1.inc 2.inc));
    4747
    4848
     
    6363              "ONE.inc\nTHREE.inc\nTWO.inc\nONE\nTHREE\nTWO\nsuccess\n");
    6464
    65 unlink('1.inc', '2.inc');
     65rmfiles(qw(1.inc 2.inc));
    6666
    6767# Grant Taylor reports a problem where tokens can be lost (not written back
     
    139139.PHONY: phony
    140140phony: ; : phony', '-rR -j', ': phony');
    141 unlink('target');
    142 
     141rmfiles('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
     150run_make_test(q!
     151-include inc.mk
     152recur:
     153#       @echo 'MAKEFLAGS = $(MAKEFLAGS)'
     154        @rm -f inc.mk
     155        @$(MAKE) -j2 -f #MAKEFILE# all
     156all:
     157#       @echo 'MAKEFLAGS = $(MAKEFLAGS)'
     158        @echo $@
     159inc.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
     165rmfiles('inc.mk');
     166
     167if ($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 $@
     175foo.y: foo.y.in ; cp $< $@
     176foo.y.in: ; touch $@
     177!,
     178                  '-j2 main.bar',
     179                  "touch foo.y.in
     180touch main.x
     181cp foo.y.in foo.y
     182cat main.x foo.y > main.bar
     183rm 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
     189touch main.x
     190cat main.x foo.y > main.bar
     191rm main.x");
     192
     193    # Clean up
     194    rmfiles(qw(foo.y foo.y.in main.bar));
     195}
     196
     197if ($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!
     203ifdef EXTRA
     204vpath %.dst /
     205xxx.dst: ; true
     206yyy.dst: ; true
     207endif
     208
     209M := $(MAKE)
     210xx: ; $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.
     214true
     215true
     216');
     217}
    143218
    144219# Make sure that all jobserver FDs are closed if we need to re-exec the
     
    169244#               'bar');
    170245
    171 # unlink('dependfile', 'output');
     246# rmfiles(qw(dependfile output));
    172247
    173248
     
    175250# run_make_test(undef, '-j2 recurse INCL=false', 'bar');
    176251
    177 # unlink('dependfile', 'output');
     252# rmfiles(qw(dependfile output));
    178253
    1792541;
  • vendor/gnumake/current/tests/scripts/features/patspecific_vars

    • Property svn:eol-style changed from native to LF
    r501 r2596  
    121121pattrn: global: new $t pattern: good $t inherit: good $t;');
    122122
     123# TEST #8: override in pattern-specific variables
     124
     125run_make_test('
     126a%: override FOO += f1
     127a%: FOO += f2
     128ab: ; @echo "$(FOO)"
     129',
     130              '', "f1\n");
     131
     132run_make_test(undef, 'FOO=C', "C f1\n");
     133
     134# TEST #9: Test shortest stem selection in pattern-specific variables.
     135
     136run_make_test('
     137%-mt.x: x := two
     138%.x: x := one
     139
     140all: foo.x foo-mt.x
     141
     142foo.x: ;@echo $x
     143foo-mt.x: ;@echo $x
     144',
     145'',
     146"one\ntwo");
    123147
    1241481;
  • vendor/gnumake/current/tests/scripts/features/patternrules

    • Property svn:eol-style changed from native to LF
    • Property svn:keywords deleted
    r900 r2596  
    1616#
    1717
    18 run_make_test('
     18run_make_test(q!
    1919.PHONY: all
    2020
    2121all: 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
    2325
    2426# 1 - existing file
     
    4244
    43453.implicit-phony:
    44 ',
    45 '',
    46 '');
     46!, '', '');
    4747
    4848# TEST #1: make sure files that are built via implicit rules are marked
     
    146146unlink('foo.in', 'foo.h', 'foo.c', 'foo.o');
    147147
     148# TEST #5: make sure both prefix and suffix patterns work with multiple
     149#          target patterns (Savannah bug #26593).
     150#
     151run_make_test('
     152all: foo.s1 foo.s2 p1.foo p2.foo
     153
     154p1.% 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
     166run_make_test(q!
     167BIN = xyz
     168COPY = $(BIN).cp
     169SRC = $(BIN).c
     170allbroken: $(COPY) $(BIN) ; @echo ok
     171$(SRC): ; @echo 'main(){}' > $@
     172%.cp: % ; @cp $< $@
     173% : %.c ; @cp $< $@
     174clean: ; @rm -rf $(SRC) $(COPY) $(BIN)
     175!,
     176              '', "ok\n");
     177
     178unlink(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
     183run_make_test(q!
     184final: x ; @echo $@
     185x: x.t1 x.t2 ; @echo $@
     186x.t2: dep
     187dep: ; @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
     195my @f = (qw(foo.w foo.ch));
     196touch(@f);
     197
     198run_make_test(q!
     199CWEAVE := :
     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
     208unlink(@f);
     209
     210# TEST #9: Test shortest stem selection in pattern rules.
     211
     212run_make_test('
     213%.x: ;@echo one
     214%-mt.x: ;@echo two
     215
     216all: foo.x foo-mt.x
     217',
     218'',
     219"one\ntwo");
     220
     2211;
     222
    148223# This tells the test driver that the perl test script executed properly.
    1492241;
  • vendor/gnumake/current/tests/scripts/features/quoting

    • Property svn:eol-style changed from native to LF
  • vendor/gnumake/current/tests/scripts/features/recursion

    • Property svn:eol-style changed from native to LF
    r284 r2596  
    1717        @echo THE END
    1818',
    19               ('CFLAGS=-O -w' . ($parallel_jobs ? '-j 2' : '')),
     19              ('CFLAGS=-O -w' . ($parallel_jobs ? ' -j 2' : '')),
    2020              ($vos
    2121               ? "#MAKE#: Entering directory `#PWD#'
  • vendor/gnumake/current/tests/scripts/features/reinvoke

    • Property svn:eol-style changed from native to LF
  • vendor/gnumake/current/tests/scripts/features/se_explicit

    • Property svn:eol-style changed from native to LF
    • Property svn:keywords deleted
    r501 r2596  
    2525# TEST #1: automatic variables.
    2626#
    27 run_make_test('
     27run_make_test(q!
    2828.SECONDEXPANSION:
    29 .DEFAULT: ; @echo $@
     29.DEFAULT: ; @echo '$@'
    3030
    3131foo: bar baz
     
    4040     $$*.6
    4141
    42 ',
     42!,
    4343'',
    4444'bar
     
    6161# Test #2: target/pattern -specific variables.
    6262#
    63 run_make_test('
     63run_make_test(q!
    6464.SECONDEXPANSION:
    65 .DEFAULT: ; @echo $@
     65.DEFAULT: ; @echo '$@'
    6666
    6767foo.x: $$a $$b
     
    7070
    7171%.x: b := baz
    72 
    73 ',
     72!,
    7473'',
    7574'bar
     
    8079# Test #3: order of prerequisites.
    8180#
    82 run_make_test('
     81run_make_test(q!
    8382.SECONDEXPANSION:
    84 .DEFAULT: ; @echo $@
     83.DEFAULT: ; @echo '$@'
    8584
    8685all: foo bar baz
    8786
    8887# Subtest #1
    89 #
    9088foo: foo.1; @:
    91 
    9289foo: foo.2
    93 
    9490foo: foo.3
    9591
    96 
    9792# Subtest #2
    98 #
    9993bar: bar.2
    100 
    10194bar: bar.1; @:
    102 
    10395bar: bar.3
    10496
    105 
    10697# Subtest #3
    107 #
    10898baz: baz.1
    109 
    11099baz: baz.2
    111 
    112100baz: ; @:
    113 
    114 ',
     101!,
    115102'',
    116103'foo.1
     
    124111');
    125112
     113# TEST #4: eval in a context where there is no reading_file
     114run_make_test(q!
     115.SECONDEXPANSION:
     116all : $$(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
     123run_make_test(q!
     124.SECONDEXPANSION:
     125proj1.exe : proj1.o $$(eval $$(test))
     126define test
     127proj1.o : proj1.c
     128proj1.c: proj1.h
     129endef
     130!,
     131              '', "#MAKE#: *** prerequisites cannot be defined in recipes.  Stop.\n", 512);
     132
     133
     134# Automatic $$+ variable expansion issue.  Savannah bug #25780
     135run_make_test(q!
     136all : foo foo
     137.SECONDEXPANSION:
     138all : $$+ ; @echo '$+'
     139foo : ;
     140!,
     141                  '', "foo foo foo foo\n");
     142
     143
     144# Automatic $$+ variable expansion issue.  Savannah bug #25780
     145run_make_test(q!
     146all : bar bar
     147bar : ;
     148q%x : ;
     149.SECONDEXPANSION:
     150a%l: q1x $$+ q2x ; @echo '$+'
     151!,
     152                  '', "q1x bar bar q2x bar bar\n");
     153
     154
    126155# This tells the test driver that the perl test script executed properly.
    1271561;
  • vendor/gnumake/current/tests/scripts/features/se_implicit

    • Property svn:eol-style changed from native to LF
    • Property svn:keywords deleted
    r501 r2596  
    1212# Test #1: automatic variables.
    1313#
    14 run_make_test('
    15 .SECONDEXPANSION:
    16 .DEFAULT: ; @echo $@
     14run_make_test(q!
     15.SECONDEXPANSION:
     16.DEFAULT: ; @echo '$@'
    1717
    1818foo.a: bar baz
     
    38385.buz \
    39396.a:
    40         @echo $@
    41 
    42 ',
     40        @echo '$@'
     41
     42!,
    4343'',
    4444'1.foo.a
     
    6161# Test #2: target/pattern -specific variables.
    6262#
    63 run_make_test('
     63run_make_test(q!
    6464.SECONDEXPANSION:
    6565foo.x:
     
    7272%.x: x_b := baz
    7373
    74 bar baz: ; @echo $@
    75 
    76 ',
    77 '',
    78 'bar
    79 baz
    80 ');
     74bar baz: ; @echo '$@'
     75!,
     76              '', "bar\nbaz\n");
    8177
    8278
    8379# Test #3: order of prerequisites.
    8480#
    85 run_make_test('
    86 .SECONDEXPANSION:
    87 .DEFAULT: ; @echo $@
     81run_make_test(q!
     82.SECONDEXPANSION:
     83.DEFAULT: ; @echo '$@'
    8884
    8985all: foo bar baz
     
    9894foo: foo.3
    9995
    100 foo.1: ; @echo $@
     96foo.1: ; @echo '$@'
    10197
    10298
     
    109105bar: bar.3
    110106
    111 bar.1: ; @echo $@
     107bar.1: ; @echo '$@'
    112108
    113109
     
    119115
    120116%az: ; @:
    121 
    122 ',
    123 '',
     117!,
     118              '',
    124119'foo.1
    125120foo.2
     
    135130# Test #4: stem splitting logic.
    136131#
    137 run_make_test('
     132run_make_test(q!
    138133.SECONDEXPANSION:
    139134$(dir)/tmp/bar.o:
    140135
    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 '$@'
     138foo.h: ; @echo '$@'
    144139
    145140%.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
    151144$dir/tmp/bar/bar.c
    152145foo.h
     
    157150# Test #5: stem splitting logic and order-only prerequisites.
    158151#
    159 run_make_test('
     152run_make_test(q!
    160153.SECONDEXPANSION:
    161154$(dir)/tmp/foo.o: $(dir)/tmp/foo.c
    162 $(dir)/tmp/foo.c: ; @echo $@
    163 bar.h: ; @echo $@
     155$(dir)/tmp/foo.c: ; @echo '$@'
     156bar.h: ; @echo '$@'
    164157
    165158%.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
    171163bar.h
    172164$dir/tmp/foo.o: {$dir/tmp/foo.c} {bar.h} $dir/tmp/foo.c
     
    176168# Test #6: lack of implicit prerequisites.
    177169#
    178 run_make_test('
     170run_make_test(q!
    179171.SECONDEXPANSION:
    180172foo.o: foo.c
    181 foo.c: ; @echo $@
     173foo.c: ; @echo '$@'
    182174
    183175%.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
    191180
    192181# Test #7: Test stem from the middle of the name.
    193182#
    194 run_make_test('
     183run_make_test(q!
    195184.SECONDEXPANSION:
    196185foobarbaz:
    197186
    198187foo%baz: % $$*.1
    199         @echo $*
     188        @echo '$*'
    200189
    201190bar 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
    210195
    211196# Test #8: Make sure stem triple-expansion does not happen.
    212197#
    213 run_make_test('
     198run_make_test(q!
    214199.SECONDEXPANSION:
    215200foo$$bar:
    216201
    217202f%r: % $$*.1
    218         @echo \'$*\'
     203        @echo '$*'
    219204
    220205oo$$ba oo$$ba.1:
    221         @echo \'$@\'
    222 
    223 ',
    224 '',
    225 'oo$ba
     206        @echo '$@'
     207!,
     208              '', 'oo$ba
    226209oo$ba.1
    227210oo$ba
    228211');
    229212
     213# Test #9: Check the value of $^
     214run_make_test(q!
     215.SECONDEXPANSION:
     216
     217%.so: | $$(extra) ; @echo $^
     218
     219foo.so: extra := foo.o
     220foo.so:
     221foo.o:
     222!,
     223              '', "\n");
    230224
    231225# This tells the test driver that the perl test script executed properly.
  • vendor/gnumake/current/tests/scripts/features/se_statpat

    • Property svn:eol-style changed from native to LF
    • Property svn:keywords deleted
    r501 r2596  
    66# Test #1: automatic variables.
    77#
    8 run_make_test('
     8run_make_test(q!
    99.SECONDEXPANSION:
    10 .DEFAULT: ; @echo $@
     10.DEFAULT: ; @echo '$@'
    1111
    1212foo.a foo.b: foo.%: bar.% baz.%
    13 
    1413foo.a foo.b: foo.%: biz.% | buz.%
    1514
     
    2019                    $$|.5 \
    2120                    $$*.6
    22 
    23 ',
    24 '',
    25 'bar.a
     21!,
     22              '', 'bar.a
    2623baz.a
    2724biz.a
     
    4239# Test #2: target/pattern -specific variables.
    4340#
    44 run_make_test('
     41run_make_test(q!
    4542.SECONDEXPANSION:
    46 .DEFAULT: ; @echo $@
     43.DEFAULT: ; @echo '$@'
    4744
    4845foo.x foo.y: foo.%: $$(%_a) $$($$*_b)
     
    5148
    5249%.x: x_b := baz
    53 
    54 
    55 ',
    56 '',
    57 'bar
    58 baz
    59 ');
     50!,
     51              '', "bar\nbaz\n");
    6052
    6153
    6254# Test #3: order of prerequisites.
    6355#
    64 run_make_test('
     56run_make_test(q!
    6557.SECONDEXPANSION:
    66 .DEFAULT: ; @echo $@
     58.DEFAULT: ; @echo '$@'
    6759
    6860all: foo.a bar.a baz.a
    6961
    7062# Subtest #1
    71 #
    7263foo.a foo.b: foo.%: foo.%.1; @:
    73 
    7464foo.a foo.b: foo.%: foo.%.2
    75 
    7665foo.a foo.b: foo.%: foo.%.3
    7766
    7867
    7968# Subtest #2
    80 #
    8169bar.a bar.b: bar.%: bar.%.2
    82 
    8370bar.a bar.b: bar.%: bar.%.1; @:
    84 
    8571bar.a bar.b: bar.%: bar.%.3
    8672
    8773
    8874# Subtest #3
    89 #
    9075baz.a baz.b: baz.%: baz.%.1
    91 
    9276baz.a baz.b: baz.%: baz.%.2
    93 
    9477baz.a baz.b: ; @:
    95 
    96 ',
    97 '',
    98 'foo.a.1
     78!,
     79             '', 'foo.a.1
    9980foo.a.2
    10081foo.a.3
     
    10990# Test #4: Make sure stem triple-expansion does not happen.
    11091#
    111 run_make_test('
     92run_make_test(q!
    11293.SECONDEXPANSION:
    11394foo$$bar: f%r: % $$*.1
    114         @echo \'$*\'
     95        @echo '$*'
    11596
    11697oo$$ba oo$$ba.1:
    117         @echo \'$@\'
    118 
    119 ',
    120 '',
    121 'oo$ba
     98        @echo '$@'
     99!,
     100              '', 'oo$ba
    122101oo$ba.1
    123102oo$ba
  • vendor/gnumake/current/tests/scripts/features/statipattrules

    • Property svn:eol-style changed from native to LF
  • vendor/gnumake/current/tests/scripts/features/targetvars

    • Property svn:eol-style changed from native to LF
    r501 r2596  
    77rules, semicolon interference, etc.";
    88
    9 open(MAKEFILE,"> $makefile");
    10 
    11 print MAKEFILE <<'EOF';
     9run_make_test('
    1210SHELL = /bin/sh
    1311export FOO = foo
     
    1816three: ; BAR=1000
    1917        @echo $(FOO) $(BAR)
    20 # Some things that shouldn't be target vars
     18# Some things that shouldn not be target vars
    2119funk : override
    2220funk : override adelic
     
    2523four:FOO=x
    2624four:VAR$(FOO)=ok
    27 four: ; @echo '$(FOO) $(VAR$(FOO)) $(VAR) $(VARx)'
     25four: ; @echo "$(FOO) $(VAR$(FOO)) $(VAR) $(VARx)"
    2826five:FOO=x
    2927five six : VAR$(FOO)=good
    30 five six: ;@echo '$(FOO) $(VAR$(FOO)) $(VAR) $(VARx) $(VARfoo)'
     28five six: ;@echo "$(FOO) $(VAR$(FOO)) $(VAR) $(VARx) $(VARfoo)"
    3129# Test per-target variable inheritance
    3230seven: eight
     
    4240# Test = escaping
    4341EQ = =
    44 ten: one\=two
    45 ten: one \= two
     42ten: one$(EQ)two
     43ten: one $(EQ) two
    4644ten one$(EQ)two $(EQ):;@echo $@
    4745.PHONY: one two three four five six seven eight nine ten $(EQ) one$(EQ)two
     
    5553foo.r : RVAR += rvar
    5654foo.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");
    6657
    6758# TEST #2
    6859
    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));
     60run_make_test(undef, "one two FOO=1 BAR=2", "one 2\n1 2\n");
    7261
    7362# TEST #3
    7463
    75 &run_make_with_options($makefile, "four", &get_logfile);
    76 $answer = "x ok  ok\n";
    77 &compare_output($answer,&get_logfile(1));
     64run_make_test(undef, "four", "x ok  ok\n");
    7865
    7966# TEST #4
    8067
    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));
     68run_make_test(undef, "seven", "eight: seven eight\nseven: seven seven\n");
    8469
    8570# TEST #5
    8671
    87 &run_make_with_options($makefile, "nine", &get_logfile);
    88 $answer = "wallace bar wallace bar\n";
    89 &compare_output($answer,&get_logfile(1));
     72run_make_test(undef, "nine", "wallace bar wallace bar\n");
    9073
    9174# TEST #5-a
    9275
    93 &run_make_with_options($makefile, "nine-a", &get_logfile);
    94 $answer = "baz\n";
    95 &compare_output($answer,&get_logfile(1));
     76run_make_test(undef, "nine-a", "baz\n");
    9677
    9778# TEST #6
    9879
    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));
     80run_make_test(undef, "ten", "one=two\none bar\n=\nfoo two\nten\n");
    10281
    10382# TEST #6
    10483
    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));
     84run_make_test(undef, "foo.q bar.q", "qvar = rvar\nqvar =\n");
    10885
    10986# TEST #7
    11087
    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));
     88run_make_test(undef, "foo.t bar.s", "qvar = qvar\nqvar =\n");
    11489
    11590
     
    11792# For PR/1378: Target-specific vars don't inherit correctly
    11893
    119 $makefile2 = &get_tmpfile;
    120 
    121 open(MAKEFILE,"> $makefile2");
    122 print MAKEFILE <<'EOF';
     94run_make_test('
    12395foo: FOO = foo
    12496bar: BAR = bar
     
    12698bar: baz
    12799baz: ; @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");
    134101
    135102# TEST #9
     
    137104# Also PR/1831
    138105
    139 $makefile3 = &get_tmpfile;
    140 
    141 open(MAKEFILE,"> $makefile3");
    142 print MAKEFILE <<'EOF';
     106run_make_test('
    143107.PHONY: all one
    144108all: FOO += baz
     
    150114one: FOO += boz
    151115one: ; @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");
    158118
    159119# Test #10
    160120
    161 &run_make_with_options("$makefile3", "one", &get_logfile);
    162 $answer = "bar biz boz\n";
    163 &compare_output($answer, &get_logfile(1));
     121run_make_test(undef, 'one', "bar biz boz\n");
    164122
    165123# Test #11
    166124# PR/1709: Test semicolons in target-specific variable values
    167125
    168 $makefile4 = &get_tmpfile;
    169 
    170 open(MAKEFILE, "> $makefile4");
    171 print MAKEFILE <<'EOF';
     126run_make_test('
    172127foo : 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));
     128foo : ; @echo "$(FOO)"
     129',
     130              '', "; ok\n");
    180131
    181132# Test #12
     
    183134# I nailed it this time :-/.
    184135
    185 $makefile5 = &get_tmpfile;
    186 
    187 open(MAKEFILE, "> $makefile5");
    188 print MAKEFILE <<'EOF';
     136run_make_test('
    189137.PHONY: a
    190138
     
    196144a: BLAH := bar
    197145a: 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");
    204148
    205149# Test #13
    206150# Test double-colon rules with target-specific variable values
    207151
    208 $makefile6 = &get_tmpfile;
    209 
    210 open(MAKEFILE, "> $makefile6");
    211 print MAKEFILE <<'EOF';
     152run_make_test('
    212153W = bad
    213154X = bad
     
    225166  fo% : Z = pat
    226167endif
    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");
    234170
    235171# Test #14
     
    237173# inheritance
    238174
    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));
     175run_make_test(undef, 'bar', "ok ok bar nopat\nok ok bar nopat\n");
    242176
    243177# Test #15
    244178# Test double-colon rules with pattern-specific variable values
    245179
    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 
     180run_make_test(undef, 'foo PATTERN=yes', "ok ok foo pat\nok ok foo pat\n");
    250181
    251182# Test #16
     
    253184# (> make default buffer length)
    254185
    255 $makefile7 = &get_tmpfile;
    256 
    257 open(MAKEFILE, "> $makefile7");
    258 print MAKEFILE <<'EOF';
     186run_make_test('
    259187base_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  )
    260188
    261189deals_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");
    269192
    270193# TEST #17
     
    287210.INTERMEDIATE: foo.x rules.mk
    288211',
    289               '-I t1',
    290               'MYVAR= FOOVAR=bar ALLVAR=xxx');
     212              '-I t1', 'MYVAR= FOOVAR=bar ALLVAR=xxx');
    291213
    292214rmfiles('t1/rules.mk');
     
    298220# double-expansion.  See Savannah bug #15913.
    299221
    300 run_make_test("
    301 VAR := \$\$FOO
     222run_make_test('
     223VAR := $$FOO
    302224foo: VAR += BAR
    303 foo: ; \@echo '\$(VAR)'",
    304               '',
    305               '$FOO BAR');
     225foo: ; @echo '."'".'$(VAR)'."'".'
     226',
     227              '', '$FOO BAR');
     228
     229# TEST #19: Override with append variables
     230
     231run_make_test('
     232a: override FOO += f1
     233a: FOO += f2
     234a: ; @echo "$(FOO)"
     235',
     236              '', "f1\n");
     237
     238run_make_test(undef, 'FOO=C', "C f1\n");
     239
     240# TEST #20: Check for continuation after semicolons
     241
     242run_make_test(q!
     243a: A = 'hello; \
     244world'
     245a: ; @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");
    306262
    3072631;
  • vendor/gnumake/current/tests/scripts/features/varnesting

    • Property svn:eol-style changed from native to LF
  • vendor/gnumake/current/tests/scripts/features/vpath

    • Property svn:eol-style changed from native to LF
    r53 r2596  
     1#                                                                     -*-perl-*-
     2
    13$description = "The following test creates a makefile to test the \n"
    24              ."vpath directive which allows you to specify a search \n"
     
    6062}
    6163
     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
     67mkdir('vpath-d', 0777);
     68
     69run_make_test(q!
     70vpath %.te vpath-d/
     71.SECONDARY:
     72default: vpath-d/a vpath-d/b
     73vpath-d/a: fail.te
     74vpath-d/b : fail.te
     75vpath-d/fail.te:
     76!,
     77              '', "#MAKE#: Nothing to be done for `default'.\n");
     78
     79rmdir('vpath-d');
     80
    62811;
  • vendor/gnumake/current/tests/scripts/features/vpath2

    • Property svn:eol-style changed from native to LF
  • vendor/gnumake/current/tests/scripts/features/vpathgpath

    • Property svn:eol-style changed from native to LF
  • vendor/gnumake/current/tests/scripts/features/vpathplus

    • Property svn:eol-style changed from native to LF
  • vendor/gnumake/current/tests/scripts/functions/abspath

    • Property svn:eol-style changed from native to LF
    • Property svn:keywords deleted
  • vendor/gnumake/current/tests/scripts/functions/addprefix

    • Property svn:eol-style changed from native to LF
  • vendor/gnumake/current/tests/scripts/functions/addsuffix

    • Property svn:eol-style changed from native to LF
  • vendor/gnumake/current/tests/scripts/functions/andor

    • Property svn:eol-style set to LF
  • vendor/gnumake/current/tests/scripts/functions/basename

    • Property svn:eol-style changed from native to LF
  • vendor/gnumake/current/tests/scripts/functions/call

    • Property svn:eol-style changed from native to LF
  • vendor/gnumake/current/tests/scripts/functions/dir

    • Property svn:eol-style changed from native to LF
  • vendor/gnumake/current/tests/scripts/functions/error

    • Property svn:eol-style changed from native to LF
  • vendor/gnumake/current/tests/scripts/functions/eval

    • Property svn:eol-style changed from native to LF
  • vendor/gnumake/current/tests/scripts/functions/filter-out

    • Property svn:eol-style changed from native to LF
  • vendor/gnumake/current/tests/scripts/functions/findstring

    • Property svn:eol-style changed from native to LF
  • vendor/gnumake/current/tests/scripts/functions/flavor

    • Property svn:eol-style set to LF
  • vendor/gnumake/current/tests/scripts/functions/foreach

    • Property svn:eol-style changed from native to LF
  • vendor/gnumake/current/tests/scripts/functions/if

    • Property svn:eol-style changed from native to LF
  • vendor/gnumake/current/tests/scripts/functions/join

    • Property svn:eol-style changed from native to LF
  • vendor/gnumake/current/tests/scripts/functions/notdir

    • Property svn:eol-style changed from native to LF
  • vendor/gnumake/current/tests/scripts/functions/origin

    • Property svn:eol-style changed from native to LF
  • vendor/gnumake/current/tests/scripts/functions/realpath

    • Property svn:eol-style changed from native to LF
    • Property svn:keywords deleted
  • vendor/gnumake/current/tests/scripts/functions/shell

    • Property svn:eol-style set to LF
    r501 r2596  
    1212
    1313
     14# Test unescaped comment characters in shells.  Savannah bug #20513
     15if ($all_tests) {
     16    run_make_test(q!
     17FOO := $(shell echo '#')
     18foo: ; echo '$(FOO)'
     19!,
     20              '', "#\n");
     21}
     22
    1423# Test shells inside exported environment variables.
    1524# This is the test that fails if we try to put make exported variables into
  • vendor/gnumake/current/tests/scripts/functions/sort

    • Property svn:eol-style changed from native to LF
  • vendor/gnumake/current/tests/scripts/functions/strip

    • Property svn:eol-style changed from native to LF
  • vendor/gnumake/current/tests/scripts/functions/substitution

    • Property svn:eol-style changed from native to LF
  • vendor/gnumake/current/tests/scripts/functions/suffix

    • Property svn:eol-style changed from native to LF
  • vendor/gnumake/current/tests/scripts/functions/value

    • Property svn:eol-style changed from native to LF
  • vendor/gnumake/current/tests/scripts/functions/warning

    • Property svn:eol-style changed from native to LF
  • vendor/gnumake/current/tests/scripts/functions/wildcard

    • Property svn:eol-style changed from native to LF
    r501 r2596  
    8282&compare_output($answer,&get_logfile(1));
    8383
     84# TEST #4: Verify that failed wildcards don't return the pattern
     85
     86run_make_test(q!
     87all: ; @echo $(wildcard xz--y*.7)
     88!,
     89              '', "\n");
    8490
    85911;
    86 
    87 
    88 
    89 
    90 
    91 
    92 
    93 
    94 
  • vendor/gnumake/current/tests/scripts/functions/word

    • Property svn:eol-style changed from native to LF
  • vendor/gnumake/current/tests/scripts/misc/close_stdout

    • Property svn:eol-style set to LF
  • vendor/gnumake/current/tests/scripts/misc/general1

    • Property svn:eol-style changed from native to LF
  • vendor/gnumake/current/tests/scripts/misc/general2

    • Property svn:eol-style changed from native to LF
  • vendor/gnumake/current/tests/scripts/misc/general3

    • Property svn:eol-style changed from native to LF
  • vendor/gnumake/current/tests/scripts/misc/general4

    • Property svn:eol-style changed from native to LF
    r501 r2596  
    2727cc foo.o -o foo');
    2828unlink('foo.c');
    29 
    30 
    31 # Test other implicit rule searching
    32 
    33 &touch('bar');
    34 run_make_test('
    35 test.foo:
    36 %.foo : baz ; @echo done $<
    37 %.foo : bar ; @echo done $<
    38 fox: baz
    39 ',
    40               '',
    41               'done bar');
    42 unlink('bar');
    4329
    4430
     
    8167              '', "mkdir -p dir/subdir\ntouch dir/subdir/file.\$b\ncp dir/subdir/file.\$b dir/subdir/file.\$a\n");
    8268
     69# Test odd whitespace at the beginning of a line
     70
     71run_make_test("
     72all:
     73   \f
     74
     75    \\
     76 \f  \\
     77    \013 \\
     78all: ; \@echo hi
     79",
     80              '', "hi\n");
     81
    83821;
  • vendor/gnumake/current/tests/scripts/options/dash-B

    • Property svn:eol-style changed from native to LF
    r501 r2596  
    7171rmfiles('foo.x', 'blah.x');
    7272
     73# Test that $? is set properly with -B; all prerequisites will be newer!
     74
     75utouch(-10, 'x.b');
     76touch('x.a');
     77
     78run_make_test(q!
     79x.a: x.b ; @echo $?
     80!,
     81              '-B', "x.b\n");
     82
     83unlink(qw(x.a x.b));
     84
    73851;
  • vendor/gnumake/current/tests/scripts/options/dash-C

    • Property svn:eol-style changed from native to LF
  • vendor/gnumake/current/tests/scripts/options/dash-I

    • Property svn:eol-style changed from native to LF
  • vendor/gnumake/current/tests/scripts/options/dash-W

    • Property svn:eol-style set to LF
  • vendor/gnumake/current/tests/scripts/options/dash-e

    • Property svn:eol-style changed from native to LF
  • vendor/gnumake/current/tests/scripts/options/dash-f

    • Property svn:eol-style changed from native to LF
  • vendor/gnumake/current/tests/scripts/options/dash-k

    • Property svn:eol-style changed from native to LF
  • vendor/gnumake/current/tests/scripts/options/dash-l

    • Property svn:eol-style changed from native to LF
  • vendor/gnumake/current/tests/scripts/options/dash-n

    • Property svn:eol-style changed from native to LF
  • vendor/gnumake/current/tests/scripts/options/dash-q

    • Property svn:eol-style changed from native to LF
  • vendor/gnumake/current/tests/scripts/options/dash-t

    • Property svn:eol-style changed from native to LF
  • vendor/gnumake/current/tests/scripts/options/general

    • Property svn:eol-style changed from native to LF
  • vendor/gnumake/current/tests/scripts/options/symlinks

    • Property svn:eol-style changed from native to LF
    • Property svn:keywords deleted
  • vendor/gnumake/current/tests/scripts/options/warn-undefined-variables

    • Property svn:eol-style set to LF
  • vendor/gnumake/current/tests/scripts/targets/DEFAULT

    • Property svn:eol-style changed from native to LF
  • vendor/gnumake/current/tests/scripts/targets/FORCE

    • Property svn:eol-style changed from native to LF
  • vendor/gnumake/current/tests/scripts/targets/INTERMEDIATE

    • Property svn:eol-style changed from native to LF
  • vendor/gnumake/current/tests/scripts/targets/PHONY

    • Property svn:eol-style changed from native to LF
  • vendor/gnumake/current/tests/scripts/targets/SECONDARY

    • Property svn:eol-style changed from native to LF
  • vendor/gnumake/current/tests/scripts/targets/SILENT

    • Property svn:eol-style changed from native to LF
  • vendor/gnumake/current/tests/scripts/targets/clean

    • Property svn:eol-style changed from native to LF
  • vendor/gnumake/current/tests/scripts/test_template

    • Property svn:eol-style changed from native to LF
  • vendor/gnumake/current/tests/scripts/variables/CURDIR

    • Property svn:eol-style changed from native to LF
  • vendor/gnumake/current/tests/scripts/variables/DEFAULT_GOAL

    • Property svn:eol-style changed from native to LF
    • Property svn:keywords deleted
    r283 r2596  
    7474'foo');
    7575
     76# TEST #5: .DEFAULT_GOAL containing just whitespace (Savannah bug #25697)
     77
     78run_make_test('
     79N =
     80.DEFAULT_GOAL = $N  $N  # Just whitespace
     81
     82foo: ; @echo "boo"
     83',
     84              '', "#MAKE#: *** No targets.  Stop.\n", 512);
    7685
    7786# This tells the test driver that the perl test script executed properly.
  • vendor/gnumake/current/tests/scripts/variables/INCLUDE_DIRS

    • Property svn:eol-style set to LF
  • vendor/gnumake/current/tests/scripts/variables/MAKE

    • Property svn:eol-style changed from native to LF
    r284 r2596  
    11#                                                                    -*-perl-*-
    22
    3 $description = "The following test creates a makefile to test MAKE \n"
    4               ."(very generic)";
     3$description = "Test proper behavior of the MAKE variable";
    54
    65$details = "DETAILS";
    76
    8 open(MAKEFILE,"> $makefile");
     7run_make_test(q!
     8TMP  := $(MAKE)
     9MAKE := $(subst X=$(X),,$(MAKE))
     10all:
     11        @echo $(TMP)
     12        $(MAKE) -f #MAKEFILE# foo
    913
    10 # The Contents of the MAKEFILE ...
     14foo:
     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");
    1121
    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));
     22rmfiles("foo");
    3423
    35241;
  • vendor/gnumake/current/tests/scripts/variables/MAKECMDGOALS

    • Property svn:eol-style changed from native to LF
  • vendor/gnumake/current/tests/scripts/variables/MAKEFILES

    • Property svn:eol-style changed from native to LF
    r53 r2596  
    3232&compare_output($answer,&get_logfile(1));
    3333
     34# TEST 2: Verify that included makefiles don't set the default goal.
     35# See Savannah bug #13401.
     36
     37create_file('xx-inc.mk', '
     38include_goal: ; @echo $@
     39include xx-ind.mk
     40');
     41
     42create_file('xx-ind.mk', '
     43indirect_goal: ; @echo $@
     44');
     45
     46run_make_test(q!
     47top: ; @echo $@
     48!,
     49              'MAKEFILES=xx-inc.mk', "top\n");
     50
     51unlink(qw(xx-inc.mk xx-ind.mk));
     52
    34531;
  • vendor/gnumake/current/tests/scripts/variables/MAKELEVEL

    • Property svn:eol-style changed from native to LF
  • vendor/gnumake/current/tests/scripts/variables/MAKE_RESTARTS

    • Property svn:eol-style set to LF
  • vendor/gnumake/current/tests/scripts/variables/MFILE_LIST

    • Property svn:eol-style changed from native to LF
    • Property svn:keywords deleted
  • vendor/gnumake/current/tests/scripts/variables/SHELL

    • Property svn:eol-style changed from native to LF
    • Property svn:keywords deleted
    r501 r2596  
    5050$extraENV{SHELL} = $mshell;
    5151
    52 run_make_test("all: export SHELL := /./$mshell\n".'
    53 all:;@echo "$(SHELL) $$SHELL"
    54 ', '', "/./$mshell $mshell");
     52run_make_test("
     53SHELL := /././$mshell
     54one: two
     55two: export SHELL := /./$mshell\n".'
     56one 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 (!!)
     63my $script = 'true; true';
     64my $flags = '-xc';
     65my $out = `/bin/sh $flags '$script' 2>&1`;
     66
     67run_make_test(qq!
     68.SHELLFLAGS = $flags
     69all: ; \@$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`;
     78my $err = $? >> 8;
     79
     80run_make_test(qq!
     81.SHELLFLAGS = $flags
     82all: ; \@$script
     83!,
     84              '', "$out#MAKE#: *** [all] Error $err\n", 512);
    5585
    56861;
  • vendor/gnumake/current/tests/scripts/variables/automatic

    • Property svn:eol-style changed from native to LF
    r900 r2596  
    108108unlink('foo');
    109109
     110# TEST #4: ensure prereq ordering is correct when the commmand target has none
     111# See Savannah bug #21198
     112
     113run_make_test('
     114all : A B
     115all : ; @echo $@ -- $^ -- $<
     116all : C D
     117all : E F
     118A B C D E F G H : ; @:
     119',
     120              '', "all -- A B C D E F -- A\n");
     121
    1101221;
  • vendor/gnumake/current/tests/scripts/variables/flavors

    • Property svn:eol-style changed from native to LF
    r284 r2596  
    55$details = "";
    66
    7 open(MAKEFILE, "> $makefile");
     7# TEST 0: Recursive
    88
    9 # The Contents of the MAKEFILE ...
    10 
    11 print MAKEFILE <<'EOF';
     9run_make_test('
     10ugh = Goodbye
    1211foo = $(bar)
    1312bar = ${ugh}
    1413ugh = Hello
     14all: ; @echo $(foo)
     15',
     16              '', "Hello\n");
    1517
    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
    11619
    11720run_make_test('
    118 define FOO
    119 $(V1)echo hello
    120 $(V2)echo world
    121 endef
    122 all: ; @$(FOO)
    123 ', '', 'hello
    124 world');
     21bar = Goodbye
     22foo := $(bar)
     23bar = ${ugh}
     24ugh = Hello
     25all: ; @echo $(foo)
     26',
     27              '', "Goodbye\n");
    12528
    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
    13430
    13531run_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');
     32foo = Hello
     33ugh = Goodbye
     34foo += $(bar)
     35bar = ${ugh}
     36ugh = Hello
     37all: ; @echo $(foo)
     38',
     39              '', "Hello Hello\n");
    14440
    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
    16242
    16343run_make_test('
    164 define FOO
    165 @echo hello
    166 echo world
    167 endef
    168 define BAR
    169 echo hello
    170 echo world
    171 endef
     44foo := Hello
     45ugh = Goodbye
     46bar = ${ugh}
     47foo += $(bar)
     48ugh = Hello
     49all: ; @echo $(foo)
     50',
     51              '', "Hello Goodbye\n");
    17252
    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
     55run_make_test('
     56foo = Hello
     57ugh = Goodbye
     58bar = ${ugh}
     59foo ?= $(bar)
     60ugh = Hello
     61all: ; @echo $(foo)
     62',
     63              '', "Hello\n");
     64
     65# TEST 5: Conditional unset
     66
     67run_make_test('
     68ugh = Goodbye
     69bar = ${ugh}
     70foo ?= $(bar)
     71ugh = Hello
     72all: ; @echo $(foo)
     73',
     74              '', "Hello\n");
    18275
    183761;
  • vendor/gnumake/current/tests/scripts/variables/negative

    • Property svn:eol-style set to LF
  • vendor/gnumake/current/tests/scripts/variables/special

    • Property svn:eol-style changed from native to LF
  • vendor/gnumake/current/tests/test_driver.pl

    r1989 r2596  
    77#
    88# 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.
    1011# This file is part of GNU Make.
    1112#
     
    3031# variables and then calls &toplevel, which does all the real work.
    3132
    32 # $Id: test_driver.pl,v 1.24 2007/11/04 21:54:02 psmith Exp $
     33# $Id: test_driver.pl,v 1.30 2010/07/28 05:39:50 psmith Exp $
    3334
    3435
     
    5455$test_timeout = 5;
    5556
     57# Path to Perl
     58$perl_name = $^X;
    5659
    5760# %makeENV is the cleaned-out environment.
     
    236239{
    237240  # Set up an initial value.  In perl5 we can do it the easy way.
    238   #
    239241  $osname = defined($^O) ? $^O : '';
     242
     243  # Find a path to Perl
    240244
    241245  # See if the filesystem supports long file names with multiple
     
    273277    if ($osname =~ /not found/i)
    274278    {
    275         $osname = "(something unixy with no uname)";
     279        $osname = "(something posixy with no uname)";
    276280    }
    277281    elsif ($@ ne "" || $?)
     
    280284        if ($@ ne "" || $?)
    281285        {
    282             $osname = "(something unixy)";
     286            $osname = "(something posixy)";
    283287        }
    284288    }
     
    436440      $diffext = 'd';
    437441      $baseext = 'b';
     442      $runext = 'r';
    438443      $extext = '';
    439444    } else {
     
    441446      $diffext = 'diff';
    442447      $baseext = 'base';
     448      $runext = 'run';
    443449      $extext = '.';
    444450    }
     
    446452    $diff_filename = "$testpath.$diffext";
    447453    $base_filename = "$testpath.$baseext";
     454    $run_filename = "$testpath.$runext";
    448455    $tmp_filename = "$testpath.$tmpfilesuffix";
    449456
     
    459466    $tests_run = 0;
    460467    $tests_passed = 0;
     468
    461469    $code = do $perl_testname;
    462470
     
    692700
    693701    &create_file (&get_basefile, $answer);
     702    &create_file (&get_runfile, $command_string);
    694703
    695704    print "\nCreating Difference File ...\n" if $debug;
     
    699708    local($command) = "diff -c " . &get_basefile . " " . $logfile;
    700709    &run_command_with_output(&get_difffile,$command);
     710  } else {
     711      &rmfiles ();
    701712  }
    702713
     
    792803      local $SIG{ALRM} = sub { die "timeout\n"; };
    793804      alarm $test_timeout;
    794       $code = system @_;
     805      $code = system(@_);
    795806      alarm 0;
    796807  };
     
    829840  my $filename = shift;
    830841
    831   print "\nrun_command_with_output($filename): @_\n" if $debug;
     842  print "\nrun_command_with_output($filename,$runname): @_\n" if $debug;
    832843  &attach_default_output ($filename);
    833844  my $code = _run_command(@_);
     
    12021213}
    12031214
     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
     1219sub get_runfile
     1220{
     1221  return ($run_filename . &num_suffix ($num_of_logfiles));
     1222}
     1223
    12041224# just like logfile, only a generic tmp filename for use by the test.
    12051225# they are automatically cleaned up unless -keep was used, or the test fails.
  • vendor/gnumake/current/variable.c

    r1989 r2596  
    11/* Internals of variables for GNU Make.
    22Copyright (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.
     31998, 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009,
     42010 Free Software Foundation, Inc.
    55This file is part of GNU Make.
    66
     
    3636static struct pattern_var *pattern_vars;
    3737
    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
     40static 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. */
    4348
    4449struct pattern_var *
    4550create_pattern_var (const char *target, const char *suffix)
    4651{
     52  register unsigned int len = strlen (target);
    4753  register struct pattern_var *p = xmalloc (sizeof (struct pattern_var));
    4854
    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    }
    5181  else
    52     pattern_vars = p;
    53   last_pattern_var = p;
    54   p->next = 0;
     82    {
     83      pattern_vars = p;
     84      p->next = 0;
     85    }
    5586
    5687  p->target = target;
    57   p->len = strlen (target);
     88  p->len = len;
    5889  p->suffix = suffix + 1;
     90
     91  if (len < 256)
     92    last_pattern_vars[len] = p;
    5993
    6094  return p;
     
    140174static struct variable_set global_variable_set;
    141175static struct variable_set_list global_setlist
    142   = { 0, &global_variable_set };
     176  = { 0, &global_variable_set, 0 };
    143177struct variable_set_list *current_variable_set_list = &global_setlist;
    144178
     
    209243
    210244  v = xmalloc (sizeof (struct variable));
    211   v->name = savestring (name, length);
     245  v->name = xstrndup (name, length);
    212246  v->length = length;
    213247  hash_insert_at (&set->table, v, var_slot);
     
    224258  v->per_target = 0;
    225259  v->append = 0;
     260  v->private_var = 0;
    226261  v->export = v_default;
    227262
     
    244279}
    245280
     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
     287static void
     288free_variable_name_and_value (const void *item);
     289
     290void
     291undefine_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}
    246326
    247327/* If the variable passed in is "special", handle its special nature.
     
    345425  const struct variable_set_list *setlist;
    346426  struct variable var_key;
     427  int is_parent = 0;
    347428
    348429  var_key.name = (char *) name;
     
    356437
    357438      v = (struct variable *) hash_find_item ((struct hash_table *) &set->table, &var_key);
    358       if (v)
     439      if (v && (!is_parent || !v->private_var))
    359440        return v->special ? lookup_special_var (v) : v;
     441
     442      is_parent |= setlist->next_is_parent;
    360443    }
    361444
     
    470553      initialize_file_variables (file->double_colon, reading);
    471554      l->next = file->double_colon->variables;
     555      l->next_is_parent = 0;
    472556      return;
    473557    }
     
    480564      l->next = file->parent->variables;
    481565    }
     566  l->next_is_parent = 1;
    482567
    483568  /* If we're not reading makefiles and we haven't looked yet, see if
     
    525610              v->per_target = p->variable.per_target;
    526611              v->export = p->variable.export;
     612              v->private_var = p->variable.private_var;
    527613            }
    528614          while ((p = lookup_pattern_var (p, file->name)) != 0);
     
    538624    {
    539625      file->pat_variables->next = l->next;
     626      file->pat_variables->next_is_parent = l->next_is_parent;
    540627      l->next = file->pat_variables;
     628      l->next_is_parent = 0;
    541629    }
    542630}
     
    560648  setlist->set = set;
    561649  setlist->next = current_variable_set_list;
     650  setlist->next_is_parent = 0;
    562651
    563652  return setlist;
     
    631720      global_setlist.set = setlist->set;
    632721      global_setlist.next = setlist->next;
     722      global_setlist.next_is_parent = setlist->next_is_parent;
    633723    }
    634724
     
    719809
    720810  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);
    722812
    723813  sprintf (buf, "%s%s%s",
     
    727817           (remote_description == 0 || remote_description[0] == '\0')
    728818           ? "" : remote_description);
    729   (void) define_variable ("MAKE_VERSION", 12, buf, o_default, 0);
     819  define_variable_cname ("MAKE_VERSION", buf, o_default, 0);
    730820
    731821#ifdef  __MSDOS__
     
    738828    struct variable *comp = lookup_variable ("COMSPEC", 7);
    739829
    740     /* Make $MAKESHELL override $SHELL even if -e is in effect.  */
     830    /* $(MAKESHELL) overrides $(SHELL) even if -e is in effect.  */
    741831    if (mshp)
    742832      (void) define_variable (shell_str, shlen,
     
    744834    else if (comp)
    745835      {
    746         /* $COMSPEC shouldn't override $SHELL.  */
     836        /* $(COMSPEC) shouldn't override $(SHELL).  */
    747837        struct variable *shp = lookup_variable (shell_str, shlen);
    748838
     
    803893  /* This won't override any definition, but it will provide one if there
    804894     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);
    806896#ifdef __MSDOS__
    807897  v->export = v_export;  /*  Export always SHELL.  */
     
    823913
    824914  /* 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);
    826916  v->export = v_ifset;
    827917
     
    830920
    831921#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);
    839929#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);
    847937#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);
    855945}
    856946
     
    9791069              convert_Path_to_windows32(value, ';');
    9801070#endif
    981             *result++ = xstrdup (concat (v->name, "=", value));
     1071            *result++ = xstrdup (concat (3, v->name, "=", value));
    9821072            free (value);
    9831073          }
     
    9891079              convert_Path_to_windows32(v->value, ';');
    9901080#endif
    991             *result++ = xstrdup (concat (v->name, "=", v->value));
     1081            *result++ = xstrdup (concat (3, v->name, "=", v->value));
    9921082          }
    9931083      }
     
    10931183            unsigned int oldlen, vallen;
    10941184            const char *val;
    1095             char *tp;
     1185            char *tp = NULL;
    10961186
    10971187            val = value;
     
    11061196                 memory for the expansion as we may still need the rest of the
    11071197                 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);
    11091199
    11101200            oldlen = strlen (v->value);
    11111201            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);
    11171209          }
    11181210      }
     
    12221314      else
    12231315        {
    1224           if (alloc_value)
    1225             free (alloc_value);
     1316          char *tp = alloc_value;
    12261317
    12271318          alloc_value = allocated_variable_expand (p);
     1319
    12281320          if (find_and_set_default_shell (alloc_value))
    12291321            {
     
    12381330          else
    12391331            v = lookup_variable (varname, strlen (varname));
     1332
     1333          if (tp)
     1334            free (tp);
    12401335        }
    12411336    }
     
    12641359
    12651360
    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
     1368char *
     1369parse_variable_definition (const char *p, enum variable_flavor *flavor)
     1370{
     1371  int wspace = 0;
     1372
     1373  p = next_token (p);
    12881374
    12891375  while (1)
    12901376    {
    1291       c = *p++;
     1377      int c = *p++;
     1378
     1379      /* If we find a comment or EOS, it's not a variable definition.  */
    12921380      if (c == '\0' || c == '#')
    1293         return 0;
    1294       if (c == '=')
     1381        return NULL;
     1382
     1383      if (c == '$')
    12951384        {
    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.  */
    13261387          char closeparen;
    13271388          int count;
     
    13321393            closeparen = '}';
    13331394          else
    1334             continue;           /* Nope.  */
     1395            /* '$$' or '$X'.  Either way, nothing special to do here.  */
     1396            continue;
    13351397
    13361398          /* P now points past the opening paren or brace.
     
    13471409                }
    13481410            }
     1411          continue;
    13491412        }
    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
     1475struct variable *
     1476assign_variable_definition (struct variable *v, char *line)
     1477{
     1478  char *beg;
     1479  char *end;
     1480  enum variable_flavor flavor;
     1481  char *name;
    13521482
    13531483  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);
    13541489  while (end > beg && isblank ((unsigned char)end[-1]))
    13551490    --end;
    1356   p = next_token (p);
    1357   v->value = p;
     1491  line = next_token (line);
     1492  v->value = line;
     1493  v->flavor = flavor;
    13581494
    13591495  /* Expand the name, so "$(foo)bar = baz" works.  */
     
    13771513   or without the -e switch, or the command line.
    13781514
    1379    See the comments for parse_variable_definition().
     1515   See the comments for assign_variable_definition().
    13801516
    13811517   If LINE was recognized as a variable definition, a pointer to its `struct
     
    13951531    v.fileinfo.filenm = 0;
    13961532
    1397   if (!parse_variable_definition (&v, line))
     1533  if (!assign_variable_definition (&v, line))
    13981534    return 0;
    13991535
     
    14451581  fputs ("# ", stdout);
    14461582  fputs (origin, stdout);
     1583  if (v->private_var)
     1584    fputs (" private", stdout);
    14471585  if (v->fileinfo.filenm)
    14481586    printf (_(" (from `%s', line %lu)"),
     
    14561594  else
    14571595    {
    1458       register char *p;
     1596      char *p;
    14591597
    14601598      printf ("%s %s= ", v->name, v->recursive ? v->append ? "+" : "" : ":");
     
    15541692   */
    15551693  convert_Path_to_windows32 (path, ';');
    1556   environ_path = xstrdup (concat ("PATH", "=", path));
     1694  environ_path = xstrdup (concat (3, "PATH", "=", path));
    15571695  putenv (environ_path);
    15581696  free (path);
  • vendor/gnumake/current/variable.h

    r1989 r2596  
    11/* Definitions for using variables in GNU Make.
    22Copyright (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.
     31998, 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009,
     42010 Free Software Foundation, Inc.
    55This file is part of GNU Make.
    66
     
    6060    unsigned int conditional:1; /* Nonzero if set with a ?=. */
    6161    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.  */
    6363    unsigned int exportable:1;  /* Nonzero if the variable _could_ be
    6464                                   exported.  */
    6565    unsigned int expanding:1;   /* Nonzero if currently being expanded.  */
     66    unsigned int private_var:1; /* Nonzero avoids inheritance of this
     67                                   target-specific variable.  */
    6668    unsigned int exp_count:EXP_COUNT_BITS;
    6769                                /* If >1, allow this many self-referential
     
    9395    struct variable_set_list *next;     /* Link in the chain.  */
    9496    struct variable_set *set;           /* Variable set.  */
     97    int next_is_parent;                 /* True if next is a parent target.  */
    9598  };
    9699
     
    108111extern char *variable_buffer;
    109112extern struct variable_set_list *current_variable_set_list;
     113extern struct variable *default_goal_var;
    110114
    111115/* expand.c */
     
    152156                                         enum variable_flavor flavor,
    153157                                         int target_var);
    154 struct variable *parse_variable_definition (struct variable *v, char *line);
     158char *parse_variable_definition (const char *line,
     159                                 enum variable_flavor *flavor);
     160struct variable *assign_variable_definition (struct variable *v, char *line);
    155161struct variable *try_variable_definition (const struct floc *flocp, char *line,
    156162                                          enum variable_origin origin,
     
    175181                                 current_variable_set_list->set,NILF)
    176182
     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
    177189/* Define a variable with a location in the current variable set.  */
    178190
     
    190202#define define_variable_for_file(n,l,v,o,r,f) \
    191203          define_variable_in_set((n),(l),(v),(o),(r),(f)->variables->set,NILF)
     204
     205void 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)
    192213
    193214/* Warn that NAME is an undefined variable.  */
  • vendor/gnumake/current/version.c

    r1989 r2596  
    11/* Record version and build host architecture for GNU make.
    22Copyright (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.
     31998, 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009,
     42010 Free Software Foundation, Inc.
    55This file is part of GNU Make.
    66
  • vendor/gnumake/current/vmsdir.h

    r1989 r2596  
    11/* dirent.h for vms
    22Copyright (C) 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006,
    3 2007 Free Software Foundation, Inc.
     32007, 2008, 2009, 2010 Free Software Foundation, Inc.
    44This file is part of GNU Make.
    55
  • vendor/gnumake/current/vmsfunctions.c

    r1989 r2596  
    11/* VMS functions
    22Copyright (C) 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006,
    3 2007 Free Software Foundation, Inc.
     32007, 2008, 2009, 2010 Free Software Foundation, Inc.
    44This file is part of GNU Make.
    55
     
    3535opendir (char *dspec)
    3636{
    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));
    3939  struct FAB *dfab = &dir->fab;
    4040  char *searchspec = xmalloc (MAXNAMLEN + 1);
    41 
    42   memset (dir, 0, sizeof *dir);
    4341
    4442  *dfab = cc$rms_fab;
     
    9290  if (!((i = sys$search (dfab)) & 1))
    9391    {
    94       DB (DB_VERBOSE, (_("sys$search failed with %d\n"), i));
     92      DB (DB_VERBOSE, (_("sys$search() failed with %d\n"), i));
    9593      return (NULL);
    9694    }
     
    142140}
    143141
     142#if 0
     143/*
     144 * Is this used? I don't see any reference, so I suggest to remove it.
     145 */
    144146int
    145147vms_stat (char *name, struct stat *buf)
     
    238240  return 0;
    239241}
     242#endif
    240243
    241244char *
  • vendor/gnumake/current/vmsify.c

    r1989 r2596  
    11/* vmsify.c -- Module for vms <-> unix file name conversion
    22Copyright (C) 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006,
    3 2007 Free Software Foundation, Inc.
     32007, 2008, 2009, 2010 Free Software Foundation, Inc.
    44This file is part of GNU Make.
    55
     
    121121  char *s;
    122122
    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);
    124128
    125129  stat = lib$sys_trnlog (&name_dsc, &resltlen, &reslt_dsc);
     
    228232  int as_dir;
    229233  int count;
     234  const char *s;
     235  const char *s1;
     236  const char *s2;
    230237
    231238  if (name == 0)
     
    240247  if (t != 0)
    241248    {
    242       const char *s1;
    243       const char *s2;
     249//      const char *s1;
     250//      const char *s2;
    244251
    245252      if (type == 1)
     
    273280  if (t != 0)
    274281    {
    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, '[');
    277285      if (s1 == 0)
    278286        {
     
    389397          case 3:                               /* '//' at start */
    390398            {
    391             const char *s;
    392             const char *s1;
     399//            const char *s;
     400//            const char *s1;
    393401            char *vp;
    394402            while (*fptr == '/')        /* collapse all '/' */
  • vendor/gnumake/current/vmsjobs.c

    • Property svn:keywords deleted
    r1989 r2596  
    33
    44Copyright (C) 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006,
    5 2007 Free Software Foundation, Inc.
     52007, 2008, 2009, 2010 Free Software Foundation, Inc.
    66This file is part of GNU Make.
    77
     
    111111}
    112112
    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).
     113static 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.
    115118*/
    116119int
     
    124127
    125128    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      }
    126135
    127136    (void) sigblock (fatal_signal_mask);
     
    220229static int oldCtrlMask;
    221230static int setupYAstTried= 0;
    222 static int pidToAbort= 0;
    223 static int chan= 0;
     231static unsigned short int chan= 0;
    224232
    225233static void
     
    229237}
    230238
    231 static void
    232 astHandler (void)
     239static int
     240astYHandler (void)
    233241{
    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;
    238246        kill (getpid(),SIGQUIT);
     247        return SS$_NORMAL;
    239248}
    240249
     
    248257                int     dvi;
    249258        } iosb;
     259        unsigned short int loc_chan;
    250260
    251261        setupYAstTried++;
    252262
    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);
    255267                if (!(status&SS$_NORMAL)) {
    256268                        lib$signal(status);
     
    258270                }
    259271        }
    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);
    276281                return;
    277282        }
     
    288293                return;
    289294        }
     295        if (!chan)
     296                chan = loc_chan;
    290297}
    291298
     
    300307  static struct dsc$descriptor_s efiledsc;
    301308  int have_redirection = 0;
     309  int have_append = 0;
    302310  int have_newline = 0;
    303311
     
    306314  char *cmd = alloca (strlen (argv) + 512), *p, *q;
    307315  char ifile[256], ofile[256], efile[256];
    308   char *comname = 0;
     316  int comnamelen;
    309317  char procname[100];
    310318  int in_string;
     
    315323  ofile[0] = 0;
    316324  efile[0] = 0;
     325  child->comname = NULL;
    317326
    318327  DB (DB_JOBS, ("child_execute_job (%s)\n", argv));
     
    384393            else
    385394              {
     395                if (*(p+1) == '>')
     396                  {
     397                    have_append = 1;
     398                    p += 1;
     399                  }
    386400                p = vms_redirect (&ofiledsc, ofile, p);
    387401              }
     
    482496        }
    483497
    484       outfile = open_tmpfile (&comname, "sys$scratch:CMDXXXXXX.COM");
     498      outfile = open_tmpfile (&child->comname, "sys$scratch:CMDXXXXXX.COM");
    485499      if (outfile == 0)
    486500        pfatal_with_name (_("fopen (temporary file)"));
     501      comnamelen = strlen (child->comname);
    487502
    488503      if (ifile[0])
     
    502517      if (ofile[0])
    503518        {
    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            }
    507532        }
    508533
     
    559584        }
    560585
    561       fwrite (p, 1, q - p, outfile);
     586      if (*p)
     587        {
     588          fwrite (p, 1, --q - p, outfile);
    562589      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        }
    563601
    564602      fclose (outfile);
    565603
    566       sprintf (cmd, "$ @%s", comname);
     604      sprintf (cmd, "$ @%s", child->comname);
    567605
    568606      DB (DB_JOBS, (_("Executing %s instead\n"), cmd));
     
    579617      status = lib$get_ef ((unsigned long *)&child->efn);
    580618      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        }
    582628    }
    583629
     
    648694  if (status & 1)
    649695    {
    650       pidToAbort= child->pid;
    651696      status= sys$waitfr (child->efn);
    652       pidToAbort= 0;
    653697      vmsHandleChildTerm(child);
    654698    }
     
    678722    }
    679723
    680   if (comname && !ISDB (DB_JOBS))
    681     unlink (comname);
    682 
    683724  return (status & 1);
    684725}
  • vendor/gnumake/current/vpath.c

    r1989 r2596  
    11/* Implementation of pattern-matching file search paths for GNU Make.
    22Copyright (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.
     31998, 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009,
     42010 Free Software Foundation, Inc.
    55This file is part of GNU Make.
    66
     
    140140
    141141
    142 /* Construct the VPATH listing for the pattern and searchpath given.
     142/* Construct the VPATH listing for the PATTERN and DIRPATH given.
    143143
    144144   This function is called to generate selective VPATH lists and also for
     
    148148   variable.
    149149
    150    If SEARCHPATH is nil, remove all previous listings with the same
     150   If DIRPATH is nil, remove all previous listings with the same
    151151   pattern.  If PATTERN is nil, remove all VPATH listings.  Existing
    152    and readable directories that are not "." given in the searchpath
     152   and readable directories that are not "." given in the DIRPATH
    153153   separated by the path element separator (defined in make.h) are
    154154   loaded into the directory hash table if they are not there already
     
    195195
    196196              /* Free its unused storage.  */
    197               free (path->searchpath);
     197              /* MSVC erroneously warns without a cast here.  */
     198              free ((void *)path->searchpath);
    198199              free (path);
    199200            }
     
    300301  else
    301302    /* 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);
    303305}
    304306
     
    325327   FILE exists.  If it is found, we return a cached name of the existing file
    326328   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.  */
    328331
    329332static const char *
    330333selective_vpath_search (struct vpath *path, const char *file,
    331                         FILE_TIMESTAMP *mtime_ptr)
     334                        FILE_TIMESTAMP *mtime_ptr, unsigned int* path_index)
    332335{
    333336  int not_target;
     
    509512          /* Store the name we found and return it.  */
    510513
     514          if (path_index)
     515            *path_index = i;
     516
    511517          return strcache_add_len (name, (p + 1 - name) + flen);
    512518        }
     
    520526   exists.  If it is found, return the cached name of an existing file, and
    521527   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.  */
    523530
    524531const char *
    525 vpath_search (const char *file, FILE_TIMESTAMP *mtime_ptr)
     532vpath_search (const char *file, FILE_TIMESTAMP *mtime_ptr,
     533              unsigned int* vpath_index, unsigned int* path_index)
    526534{
    527535  struct vpath *v;
     
    537545    return 0;
    538546
     547  if (vpath_index)
     548    {
     549      *vpath_index = 0;
     550      *path_index = 0;
     551    }
     552
    539553  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
    546567
    547568  if (general_vpath != 0)
    548569    {
    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);
    550572      if (p)
    551573        return p;
     
    554576  return 0;
    555577}
     578
     579
     580
    556581
    557582
  • vendor/gnumake/current/w32/Makefile.am

    • Property svn:keywords deleted
    r1989 r2596  
    11# Makefile.am to create libw32.a for mingw32 host.
    22# 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.
    44# This file is part of GNU Make.
    55#
  • vendor/gnumake/current/w32/compat/dirent.c

    r1989 r2596  
    11/* Directory entry code for Window platforms.
    22Copyright (C) 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005,
    3 2006, 2007 Free Software Foundation, Inc.
     32006, 2007, 2008, 2009, 2010 Free Software Foundation, Inc.
    44This file is part of GNU Make.
    55
     
    1717
    1818
     19#include <config.h>
    1920#include <sys/types.h>
    2021#include <sys/stat.h>
     
    133134
    134135        /* fill in struct dirent values */
    135         pDir->dir_sdReturn.d_ino = -1;
     136        pDir->dir_sdReturn.d_ino = (ino_t)-1;
    136137        strcpy(pDir->dir_sdReturn.d_name, wfdFindData.cFileName);
    137138
  • vendor/gnumake/current/w32/include/dirent.h

    r1989 r2596  
    11/* Windows version of dirent.h
    22Copyright (C) 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006,
    3 2007 Free Software Foundation, Inc.
     32007, 2008, 2009, 2010 Free Software Foundation, Inc.
    44This file is part of GNU Make.
    55
  • vendor/gnumake/current/w32/include/pathstuff.h

    r1989 r2596  
    11/* Definitions for Windows path manipulation.
    22Copyright (C) 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006,
    3 2007 Free Software Foundation, Inc.
     32007, 2008, 2009, 2010 Free Software Foundation, Inc.
    44This file is part of GNU Make.
    55
  • vendor/gnumake/current/w32/include/sub_proc.h

    r1989 r2596  
    11/* Definitions for Windows process invocation.
    22Copyright (C) 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005,
    3 2006, 2007 Free Software Foundation, Inc.
     32006, 2007, 2008, 2009, 2010 Free Software Foundation, Inc.
    44This file is part of GNU Make.
    55
     
    2222 * Component Name:
    2323 *
    24  * $Date: 2007/10/24 20:06:32 $
     24 * $Date: 2010/07/13 01:20:43 $
    2525 *
    2626 * $Source: /sources/make/make/w32/include/sub_proc.h,v $
    2727 *
    28  * $Id: sub_proc.h,v 1.10 2007/10/24 20:06:32 eliz Exp $
     28 * $Id: sub_proc.h,v 1.12 2010/07/13 01:20:43 psmith Exp $
    2929 */
    3030
  • vendor/gnumake/current/w32/include/w32err.h

    r1989 r2596  
    11/* Definitions for Windows error handling.
    22Copyright (C) 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005,
    3 2006, 2007 Free Software Foundation, Inc.
     32006, 2007, 2008, 2009, 2010 Free Software Foundation, Inc.
    44This file is part of GNU Make.
    55
  • vendor/gnumake/current/w32/pathstuff.c

    r1989 r2596  
    11/* Path conversion for Windows pathnames.
    22Copyright (C) 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006,
    3 2007 Free Software Foundation, Inc.
     32007, 2008, 2009, 2010 Free Software Foundation, Inc.
    44This file is part of GNU Make.
    55
     
    1616this program.  If not, see <http://www.gnu.org/licenses/>.  */
    1717
     18#include "make.h"
    1819#include <string.h>
    1920#include <stdlib.h>
    20 #include "make.h"
    2121#include "pathstuff.h"
    2222
     
    5050
    5151    /* 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?  */
    5255    for (p = Path, etok = strpbrk(p, ":;");
    5356         etok;
     
    7578                ;
    7679            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);
    7985        } else {
    8086            /* found another one, no drive letter */
  • vendor/gnumake/current/w32/subproc/NMakefile

    r1989 r2596  
    33#
    44# 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.
    66# This file is part of GNU Make.
    77#
  • vendor/gnumake/current/w32/subproc/build.bat

    r1991 r2596  
    1919@echo off
    2020rem Copyright (C) 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004,
    21 rem 2005, 2006, 2007 Free Software Foundation, Inc.
     21rem 2005, 2006, 2007, 2008, 2009, 2010 Free Software Foundation, Inc.
    2222rem This file is part of GNU Make.
    2323rem
  • vendor/gnumake/current/w32/subproc/misc.c

    r1989 r2596  
    11/* Process handling for Windows
    22Copyright (C) 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005,
    3 2006, 2007 Free Software Foundation, Inc.
     32006, 2007, 2008, 2009, 2010 Free Software Foundation, Inc.
    44This file is part of GNU Make.
    55
     
    1616this program.  If not, see <http://www.gnu.org/licenses/>.  */
    1717
     18#include <config.h>
    1819#include <stddef.h>
    1920#include <stdlib.h>
     
    7879        }
    7980
    80         free(tmp);
     81        free(tmp);
    8182        return TRUE;
    8283}
  • vendor/gnumake/current/w32/subproc/proc.h

    r1989 r2596  
    11/* Definitions for Windows
    22Copyright (C) 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005,
    3 2006, 2007 Free Software Foundation, Inc.
     32006, 2007, 2008, 2009, 2010 Free Software Foundation, Inc.
    44This file is part of GNU Make.
    55
  • vendor/gnumake/current/w32/subproc/sub_proc.c

    r1989 r2596  
    11/* Process handling for Windows.
    22Copyright (C) 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005,
    3 2006, 2007 Free Software Foundation, Inc.
     32006, 2007, 2008, 2009, 2010 Free Software Foundation, Inc.
    44This file is part of GNU Make.
    55
     
    1616this program.  If not, see <http://www.gnu.org/licenses/>.  */
    1717
     18#include <config.h>
    1819#include <stdlib.h>
    1920#include <stdio.h>
     21#ifdef _MSC_VER
     22# include <stddef.h>    /* for intptr_t */
     23#else
     24# include <stdint.h>
     25#endif
    2026#include <process.h>  /* for msvc _beginthreadex, _endthreadex */
    2127#include <signal.h>
     
    2531#include "proc.h"
    2632#include "w32err.h"
    27 #include "config.h"
    2833#include "debug.h"
    2934
    3035static char *make_command_line(char *shell_name, char *exec_path, char **argv);
     36extern char *xmalloc (unsigned int);
    3137
    3238typedef 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];
    3642        int using_pipes;
    3743        char *inp;
     
    4147        char * volatile errp;
    4248        volatile DWORD errcnt;
    43         int pid;
     49        pid_t pid;
    4450        int exit_code;
    4551        int signal;
     
    310316                return((HANDLE)pproc);
    311317        }
    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];
    318324
    319325        pproc->using_pipes = 1;
     
    337343         * pipe, bypassing pipes altogether.
    338344         */
    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;
    342348
    343349        pproc->last_err = pproc->lerrno = 0;
     
    348354
    349355static HANDLE
    350 find_file(char *exec_path, LPOFSTRUCT file_info)
     356find_file(const char *exec_path, const char *path_var,
     357          char *full_fname, DWORD full_len)
    351358{
    352359        HANDLE exec_handle;
    353360        char *fname;
    354361        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);
    357369        strcpy(fname, exec_path);
    358370        ext = fname + strlen(fname);
    359371
    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                }
    393400        }
    394401
    395402        free(fname);
    396         return(exec_handle);
     403        return INVALID_HANDLE_VALUE;
    397404}
    398405
     
    417424        int file_not_found=0;
    418425        HANDLE exec_handle;
     426        char exec_fname[MAX_PATH];
     427        const char *path_var = NULL;
     428        char **ep;
    419429        char buf[256];
    420430        DWORD bytes_returned;
     
    424434        PROCESS_INFORMATION procInfo;
    425435        char *envblk=NULL;
    426         OFSTRUCT file_info;
    427 
    428436
    429437        /*
     
    434442         *  assume it's in the path somewhere (generally, the NT tools
    435443         *  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));
    440459
    441460        /*
    442          * If we couldn't open the file, just assume that Windows32 will be able
    443          * 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) {
    446465                file_not_found++;
    447466        }
     
    497516                command_line = make_command_line( shell_name, exec_path, argv);
    498517        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);
    501519
    502520        if ( command_line == NULL ) {
     
    518536                exec_path = 0;  /* Search for the program in %Path% */
    519537        } else {
    520                 exec_path = file_info.szPathName;
     538                exec_path = exec_fname;
    521539        }
    522540
     
    563581        }
    564582
    565         pproc->pid = (int)procInfo.hProcess;
     583        pproc->pid = (pid_t)procInfo.hProcess;
    566584        /* Close the thread handle -- we'll just watch the process */
    567585        CloseHandle(procInfo.hThread);
  • vendor/gnumake/current/w32/subproc/w32err.c

    r1989 r2596  
    11/* Error handling for Windows
    22Copyright (C) 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005,
    3 2006, 2007 Free Software Foundation, Inc.
     32006, 2007, 2008, 2009, 2010 Free Software Foundation, Inc.
    44This file is part of GNU Make.
    55
Note: See TracChangeset for help on using the changeset viewer.