summaryrefslogtreecommitdiff
path: root/src/vpath.c
Commit message (Collapse)AuthorAgeFilesLines
* Add functions to directly expand variables by namePaul Smith2023-04-011-2/+4
| | | | | | | | | | | | | | | | | | | | | | | | | Replace all locally-created "$("+varname+")" and similar constructs with calls to these new functions. * src/expand.c (expand_variable_output): Call expand_string_output() on the expansion of a variable value. Replaces reference_variable(). (expand_variable_buf): Like expand_variable_output() but return the starting location of the result. (allocated_expand_variable): Like expand_variable_buf() but return an allocated string. (expand_string_buf): Call expand_variable_output(). * src/variable.h: Declare the new functions. * src/function.c (func_call): Call expand_variable_output() instead of expand_string_buf(). * src/main.c (decode_env_switches): Call expand_variable() instead of expand_string(). * src/remake.c (library_search): Call allocated_expand_variable() instead of expand_string() plus xstrdup(). * src/vpath.c (build_vpath_lists): Expand VPATH and GPATH using expand_variable() instead of expand_string(). * src/w32/subproc/sub_proc.c (process_begin): Use expand_variable() to expand SHELL. Also use alloc() in case the result is larger than PATH_MAX.
* Clean up expand.cPaul Smith2023-03-261-2/+2
| | | | | | | | | | | | | | | | | | | | | | | | | Clarify the naming and documentation on functions in src/expand.c: - variable_expand -> expand_string - variable_expand_string -> expand_string_buf - variable_expand_for_file -> expand_string_for_file - allocated_variable_expand -> allocated_expand_string - allocated_variable_expand_for_file -> allocated_expand_string_for_file Change all callers to use the new names. * src/variable.h: Rename the functions and macros. * src/expand.c: Ditto. * src/file.c: Use the new function names. * src/function.c: Ditto. * src/implicit.c: Ditto. * src/job.c: Ditto. * src/loadapi.c: Ditto. * src/main.c: Ditto. * src/read.c: Ditto. * src/remake.c: Ditto. * src/variable.c: Ditto. * src/vpath.c: Ditto. * src/w32/subproc/sub_proc.c: Ditto.
* Use MK_OS_OS2 macro instead of __EMX__Paul Smith2023-01-161-1/+1
| | | | | * src/makeint.h: Set MK_OS_OS2 to 1 if __EMX__ is set. * src/*: Convert #if refs to __EMX__, to use MK_OS_OS2.
* Use MK_OS_DOS macro instead of __MSDOS__Paul Smith2023-01-161-1/+1
| | | | | | * src/configh.dos: Set MK_OS_DOS to 1 * src/*: Convert #if refs to __MSDOS__, to use MK_OS_DOS. * gl/lib/*: Ditto.
* Rename WINDOWS32 macro to MK_OS_W32Paul Smith2023-01-151-2/+2
| | | | | | | | | | * configure.ac: Set MK_OS_W32 to 1 if we're on Windows32. * src/config.h.W32: Ditto. * mk/Windows32.mk: Ditto. * src/makeint.h: Convert #if refs to WINDOWS32, to use MK_OS_W32. * src/*: Ditto. * src/w32/*: Ditto. * gl/lib/*: Ditto.
* Rename VMS macro to MK_OS_VMSPaul Smith2023-01-151-4/+4
| | | | | | * src/makeint.h: Set MK_OS_VMS to 1 if we're on VMS. * src/*: Convert all #if references to VMS, to use MK_OS_VMS. * gl/lib/*: Ditto.
* Update the copyright year on all filesPaul Smith2023-01-011-1/+1
|
* [SV 63439, SV 63452] Don't warn on undefined internal variablesPaul Smith2022-12-241-24/+6
| | | | | | | | | | | | | | | | | Don't generate undefined variable warnings for variables that are internal / special to make and where the empty string is valid. Rather than defining them to empty, which could introduce unwanted behavior, keep a list of variable names which we should never warn about. * src/variable.h (warn_undefined): Convert the macro to a function. * src/variable.c (defined_vars): Always "defined" variable names. (warn_undefined): Implement as a function and check against the defined_vars before generating a warning. * src/read.c (read_all_makefiles): No need to reset warning flag. * src/vpath.c (build_vpath_lists): Ditto. * tests/scripts/options/warn-undefined-variables: Expand all the pre-defined variables to ensure warnings are not generated.
* Update URLs to use https rather than httpPaul Smith2022-10-181-1/+1
| | | | | * (all): Change http:// to https:// * README.W32: Remove invalid link to mingw.org.
* Add ISDIRSEP() helper macro and use itPaul Smith2022-10-181-2/+1
| | | | | | | | | | | | | | | | | | | | | | | | Create a ISDIRSEP() macro to check for directory separator chars using the stopchar_map, and replace inline checks and explicit STOP_SET calls with this macro. * src/makeint.h (ISDIRSEP): Create the macro using MAP_DIRSEP. * src/dir.c (find_directory): Replace inline checks with ISDIRSEP. (file_exists_p): Ditto. (file_impossible): Ditto. (file_impossible_p): Ditto. (local_stat): Ditto. * src/file.c (lookup_file): Ditto. * src/function.c (abspath): Ditto. * src/job.c (_is_unixy_shell): Ditto. (is_bourne_compatible_shell): Ditto. (construct_command_argv): Ditto. * src/main.c (find_and_set_default_shell): Ditto. (main): Ditto. * src/read.c (eval): Ditto. (parse_file_seq): Ditto. * src/remake.c (name_mtime): Ditto. * src/vpath.c (construct_vpath_list): Ditto.
* Take advantage of mempcpy() and stpcpy()Paul Smith2022-07-301-4/+2
| | | | | | | | | | | | | | | | | | | | | | | * src/makeint.h (stpcpy): Add missing declaration. * src/amiga.c (MyExecute): Avoid extra strlen using stpcpy. * src/function.c (func_shell_base): Ditto. (func_error): Use memcpy() not strcpy() when we know the length. * src/job.c (construct_command_argv_internal): Use stpcpy(). * src/main.c (main): Ditto. (define_makeflags): Ditto. * src/variable.c (print_target_variables): Use memcpy() when we know the length. * src/commands.c (set_file_variables): Use mempcpy(). * src/expand.c (variable_buffer_output): Ditto. * src/file.c (expand_deps): Ditto. * src/function.c (abspath): Ditto. (handle_function): Ditto. * src/implicit.c (pattern_search): Ditto. * src/job.c (construct_command_argv_internal): Use mempcpy() and don't add multiple spaces when there are no shell flags. * src/main.c (decode_env_switches): Use mempcpy() to simplify. (define_makeflags): Ditto. * src/variable.c (selective_vpath_search): Ditto.
* * <all>: Update copyright notices.Paul Smith2022-02-101-1/+1
|
* Clean up a few Windows build warnings (not all!)Paul Smith2021-09-051-1/+1
| | | | | | | * build_w32.bat: Quote uses of %VSWHERE% so it can contain spaces * src/hash.c (hash_init): Avoid use of an undefined struct. (hash_rehash): Ditto. * src/vpath.c (construct_vpath_list): Cast explicitly to void*.
* Update copyright statements for 2020Paul Smith2020-01-031-1/+1
|
* Update copyright statements for 2019Paul Smith2019-05-191-1/+1
|
* Resolve most of the Windows Visual Studio warnings.Paul Smith2018-07-021-11/+11
| | | | | * Convert integer types to size_t where necessary. * Align other integral types to avoid casts and type warnings.
* * all: Update Copyright statements for 2018Paul Smith2018-07-011-1/+1
|
* Rework directory structure to use GNU-recommended "src" directory.Paul Smith2017-11-191-0/+637
Move the source code (other than glob) into the "src" subdirectory. Update all scripting and recommendations to support this change. * *.c, *.h, w32/*: Move to src/ * configure.ac, Makefile.am, maintMakefile: Locate new source files. * Basic.mk.template, mk/*: Update for new source file locations. * NEWS, README.DOS.template: Update for new locations. * build.template, build_w32.bat, builddos.bat: Ditto. * po/POTFILES.in: Ditto * tests/run_make_tests.pl, tests/scripts/features/load*: Ditto. * make.1: Move to doc. * mk/VMS.mk: Add support for building on VMS (hopefully). * makefile.vms, prepare_w32.bat: Remove. * SCOPTIONS: Update to define HAVE_CONFIG_H