| 1 | 
 /* External interfaces usable by dynamic objects loaded into GNU Make. | 
 
 
 
 
 
 | 2 | 
    --THIS API IS A "TECHNOLOGY PREVIEW" ONLY.  IT IS NOT A STABLE INTERFACE-- | 
 
 
 
 
 
 | 3 | 
  | 
 
 
 
 
 
 | 4 | 
 Copyright (C) 2013-2020 Free Software Foundation, Inc. | 
 
 
 
 
 
 | 5 | 
 This file is part of GNU Make. | 
 
 
 
 
 
 | 6 | 
  | 
 
 
 
 
 
 | 7 | 
 GNU Make is free software; you can redistribute it and/or modify it under the | 
 
 
 
 
 
 | 8 | 
 terms of the GNU General Public License as published by the Free Software | 
 
 
 
 
 
 | 9 | 
 Foundation; either version 3 of the License, or (at your option) any later | 
 
 
 
 
 
 | 10 | 
 version. | 
 
 
 
 
 
 | 11 | 
  | 
 
 
 
 
 
 | 12 | 
 GNU Make is distributed in the hope that it will be useful, but WITHOUT ANY | 
 
 
 
 
 
 | 13 | 
 WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR | 
 
 
 
 
 
 | 14 | 
 A PARTICULAR PURPOSE.  See the GNU General Public License for more details. | 
 
 
 
 
 
 | 15 | 
  | 
 
 
 
 
 
 | 16 | 
 You should have received a copy of the GNU General Public License along with | 
 
 
 
 
 
 | 17 | 
 this program.  If not, see <http://www.gnu.org/licenses/>.  */ | 
 
 
 
 
 
 | 18 | 
  | 
 
 
 
 
 
 | 19 | 
 #ifndef _GNUMAKE_H_ | 
 
 
 
 
 
 | 20 | 
 #define _GNUMAKE_H_ | 
 
 
 
 
 
 | 21 | 
  | 
 
 
 
 
 
 | 22 | 
 /* Specify the location of elements read from makefiles.  */ | 
 
 
 
 
 
 | 23 | 
 typedef struct | 
 
 
 
 
 
 | 24 | 
   { | 
 
 
 
 
 
 | 25 | 
     const char *filenm; | 
 
 
 
 
 
 | 26 | 
     unsigned long lineno; | 
 
 
 
 
 
 | 27 | 
   } gmk_floc; | 
 
 
 
 
 
 | 28 | 
  | 
 
 
 
 
 
 | 29 | 
 typedef char *(*gmk_func_ptr)(const char *nm, unsigned int argc, char **argv); | 
 
 
 
 
 
 | 30 | 
  | 
 
 
 
 
 
 | 31 | 
 #ifdef _WIN32 | 
 
 
 
 
 
 | 32 | 
 # ifdef GMK_BUILDING_MAKE | 
 
 
 
 
 
 | 33 | 
 #  define GMK_EXPORT  __declspec(dllexport) | 
 
 
 
 
 
 | 34 | 
 # else | 
 
 
 
 
 
 | 35 | 
 #  define GMK_EXPORT  __declspec(dllimport) | 
 
 
 
 
 
 | 36 | 
 # endif | 
 
 
 
 
 
 | 37 | 
 #else | 
 
 
 
 
 
 | 38 | 
 # define GMK_EXPORT | 
 
 
 
 
 
 | 39 | 
 #endif | 
 
 
 
 
 
 | 40 | 
  | 
 
 
 
 
 
 | 41 | 
 /* Free memory returned by the gmk_expand() function.  */ | 
 
 
 
 
 
 | 42 | 
 GMK_EXPORT void gmk_free (char *str); | 
 
 
 
 
 
 | 43 | 
  | 
 
 
 
 
 
 | 44 | 
 /* Allocate memory in GNU make's context.  */ | 
 
 
 
 
 
 | 45 | 
 GMK_EXPORT char *gmk_alloc (unsigned int len); | 
 
 
 
 
 
 | 46 | 
  | 
 
 
 
 
 
 | 47 | 
 /* Run $(eval ...) on the provided string BUFFER.  */ | 
 
 
 
 
 
 | 48 | 
 GMK_EXPORT void gmk_eval (const char *buffer, const gmk_floc *floc); | 
 
 
 
 
 
 | 49 | 
  | 
 
 
 
 
 
 | 50 | 
 /* Run GNU make expansion on the provided string STR. | 
 
 
 
 
 
 | 51 | 
    Returns an allocated buffer that the caller must free with gmk_free().  */ | 
 
 
 
 
 
 | 52 | 
 GMK_EXPORT char *gmk_expand (const char *str); | 
 
 
 
 
 
 | 53 | 
  | 
 
 
 
 
 
 | 54 | 
 /* Register a new GNU make function NAME (maximum of 255 chars long). | 
 
 
 
 
 
 | 55 | 
    When the function is expanded in the makefile, FUNC will be invoked with | 
 
 
 
 
 
 | 56 | 
    the appropriate arguments. | 
 
 
 
 
 
 | 57 | 
  | 
 
 
 
 
 
 | 58 | 
    The return value of FUNC must be either NULL, in which case it expands to | 
 
 
 
 
 
 | 59 | 
    the empty string, or a pointer to the result of the expansion in a string | 
 
 
 
 
 
 | 60 | 
    created by gmk_alloc().  GNU make will free the memory when it's done. | 
 
 
 
 
 
 | 61 | 
  | 
 
 
 
 
 
 | 62 | 
    MIN_ARGS is the minimum number of arguments the function requires. | 
 
 
 
 
 
 | 63 | 
    MAX_ARGS is the maximum number of arguments (or 0 if there's no maximum). | 
 
 
 
 
 
 | 64 | 
    MIN_ARGS and MAX_ARGS may not exceed 255. | 
 
 
 
 
 
 | 65 | 
  | 
 
 
 
 
 
 | 66 | 
    The FLAGS value may be GMK_FUNC_DEFAULT, or one or more of the following | 
 
 
 
 
 
 | 67 | 
    flags OR'd together: | 
 
 
 
 
 
 | 68 | 
  | 
 
 
 
 
 
 | 69 | 
      GMK_FUNC_NOEXPAND: the arguments to the function will be not be expanded | 
 
 
 
 
 
 | 70 | 
                         before FUNC is called. | 
 
 
 
 
 
 | 71 | 
 */ | 
 
 
 
 
 
 | 72 | 
 GMK_EXPORT void gmk_add_function (const char *name, gmk_func_ptr func, | 
 
 
 
 
 
 | 73 | 
                                   unsigned int min_args, unsigned int max_args, | 
 
 
 
 
 
 | 74 | 
                                   unsigned int flags); | 
 
 
 
 
 
 | 75 | 
  | 
 
 
 
 
 
 | 76 | 
 #define GMK_FUNC_DEFAULT    0x00 | 
 
 
 
 
 
 | 77 | 
 #define GMK_FUNC_NOEXPAND   0x01 | 
 
 
 
 
 
 | 78 | 
  | 
 
 
 
 
 
 | 79 | 
 #endif  /* _GNUMAKE_H_ */ |