Follow up to PR #5574. 1. BugFix: Unlock GNU Make's dll load feature in the executable. 2. BugFix: User-defined dll's for the dll load feature are linked against the created import library libgnumake-1.dll.a which itself refers to its associated executable. The executable name is hardcoded in the import library. In order not to break the dll load feature, this implies for the autotools build branch that in the installation process the executable must not be renamed and autotools has to create the main executable with our preferred name (here: mingw32-make.exe). Thus the autotools package is to be informed about the new executable name if different from 'make'. 3. Update the build branch using build_w32.bat of the GNU Make package. The standard executable is 'gnumake' which currently cannot be changed without breaking the dll load feature. Documentation on GNU make's dll load feature: [here](https://www.gnu.org/software/make/manual/html_node/Loading-Objects.html#Loading-Objects). * PKGBUILD: - prepare(): change program name in Makefile.am, if different from the standard name 'make'. sed is used for less maintenance. - build(): add CPPFLAGS=-DMAKE_LOAD to unlock the dll load feature. - package(): - use the make target install instead of manually copying files. - add a check after running 'make install' whether the dll load feature properly works for the installed program. - update build branch using build_w32.bat. * make-4.2.1-Makefile.am-gcc-only-link-libgnumake-1.dll.a.patch: - add dependency bug fix (libw32.a > make.exe). * make-check-load-feature.mak: - add this makefile for the post-packaging check whether - the load feature is compiled into the created executable - the load feature works. * mk_temp.c: - add sample code, copied from the GNU Make Manual, for a new make function dynamically loaded by mingw32-make. Used in the post-packaging check.
56 lines
1.3 KiB
C
56 lines
1.3 KiB
C
|
|
/* Sample from example in GNU Make Manual
|
|
* (https://www.gnu.org/software/make/manual/html_node/Loaded-Object-Example.html#Loaded-Object-Example)
|
|
* with minor edits for error reporting.
|
|
*/
|
|
|
|
#include <stdlib.h>
|
|
#include <stdio.h>
|
|
#include <string.h>
|
|
#include <unistd.h>
|
|
#include <errno.h>
|
|
|
|
#include <gnumake.h>
|
|
|
|
int plugin_is_GPL_compatible;
|
|
|
|
char *
|
|
gen_tmpfile ( const char *nm, unsigned int argc, char **argv )
|
|
{
|
|
int fd;
|
|
|
|
/* Compute the size of the filename and allocate space for it. */
|
|
int len = strlen ( argv[0] ) + 6 + 1;
|
|
char *buf = gmk_alloc ( len );
|
|
|
|
strcpy ( buf, argv[0] );
|
|
strcat ( buf, "XXXXXX" );
|
|
|
|
fd = mkstemp ( buf );
|
|
if ( fd >= 0 ) {
|
|
/* Don't leak the file descriptor. */
|
|
close ( fd );
|
|
} else {
|
|
/* Failure. */
|
|
fprintf ( stderr, "%s:%d: error: mkstemp(%s) failed: %s\n"
|
|
, __FILE__, __LINE__, buf, strerror ( errno ) );
|
|
gmk_free ( buf );
|
|
buf = NULL;
|
|
}
|
|
|
|
return buf;
|
|
}
|
|
|
|
int
|
|
mk_temp_gmk_setup (const gmk_floc *floc)
|
|
{
|
|
const char* funcnm = "mk-temp";
|
|
|
|
fprintf(stderr, "%s:%d(%s): Registering function with make name '%s', implemented in '%s'.\n",
|
|
floc->filenm, floc->lineno, __FILE__, funcnm, "mk_temp.dll");
|
|
|
|
/* Register the function with make name "mk-temp". */
|
|
gmk_add_function ( funcnm, gen_tmpfile, 1, 1, 1 );
|
|
return 1;
|
|
}
|