mirror of
https://git.savannah.gnu.org/git/make.git
synced 2024-12-26 14:00:55 +00:00
Fix MS-Windows MinGW build
* src/w32/subproc/sub_proc.c (process_wait_for_multiple_objects): Fix format specifier for GetLastError's value. * src/job.c (reap_children): Define the 'remote_status_lose' label only for Posix platforms, to avoid compiler warning. * build_w32.bat (LNKOUT): New variable, using forward slashes. Use forward slashes in calls to :Compile, so that linking with GNU ld works. * src/makeint.h [!HAVE_UMASK]: Prototype for 'umask'. (UMASK, MODE_T): Don't define. * src/misc.c (get_tmpfile): Don't call UMASK, call umask, to avoid compilation warning on !HAVE_UMASK platforms. * src/output.c (output_tmpfd): Likewise. * src/misc.c (umask) [!HAVE_UMASK]: New no-op function. * src/config.h.W32.template (__USE_MINGW_ANSI_STDIO) [__MINGW32__]: Define to 1, to force Make use ANSI-compatible stdio functions, which also support the non-standard 'Id' and 'Ix' specifiers. (HAVE_UMASK) [__MINGW32__]: Define to 1. * src/arscan.c (ar_member_touch): Type-cast argument of strlen to avoid compiler warnings.
This commit is contained in:
parent
e304a03b6d
commit
715c787dc6
8 changed files with 76 additions and 54 deletions
|
@ -154,9 +154,11 @@ exit 1
|
|||
|
||||
:FoundMSVC
|
||||
set OUTDIR=.\WinRel
|
||||
set LNKOUT=./WinRel
|
||||
set "OPTS=/O2 /D NDEBUG"
|
||||
set LINKOPTS=
|
||||
if "%DEBUG%" == "Y" set OUTDIR=.\WinDebug
|
||||
if "%DEBUG%" == "Y" set LNKOUT=./WinDebug
|
||||
if "%DEBUG%" == "Y" set "OPTS=/Zi /Od /D _DEBUG"
|
||||
if "%DEBUG%" == "Y" set LINKOPTS=/DEBUG
|
||||
if "%MAINT%" == "Y" set "OPTS=%OPTS% /D MAKE_MAINTAINER_MODE"
|
||||
|
@ -168,9 +170,11 @@ goto Build
|
|||
|
||||
:FindGcc
|
||||
set OUTDIR=.\GccRel
|
||||
set LNKOUT=./GccRel
|
||||
set OPTS=-O2
|
||||
if "%DEBUG%" == "Y" set OPTS=-O0
|
||||
if "%DEBUG%" == "Y" set OUTDIR=.\GccDebug
|
||||
if "%DEBUG%" == "Y" set LNKOUT=./GccDebug
|
||||
if "%MAINT%" == "Y" set "OPTS=%OPTS% -DMAKE_MAINTAINER_MODE"
|
||||
:: Show the compiler version that we found
|
||||
echo.
|
||||
|
@ -204,43 +208,43 @@ copy lib\fnmatch.in.h %OUTDIR%\lib\fnmatch.h
|
|||
|
||||
if exist %OUTDIR%\link.sc del %OUTDIR%\link.sc
|
||||
|
||||
call :Compile src\ar
|
||||
call :Compile src\arscan
|
||||
call :Compile src\commands
|
||||
call :Compile src\default
|
||||
call :Compile src\dir
|
||||
call :Compile src\expand
|
||||
call :Compile src\file
|
||||
call :Compile src\function
|
||||
call :Compile src\getopt
|
||||
call :Compile src\getopt1
|
||||
call :Compile src\guile GUILE
|
||||
call :Compile src\hash
|
||||
call :Compile src\implicit
|
||||
call :Compile src\job
|
||||
call :Compile src\load
|
||||
call :Compile src\loadapi
|
||||
call :Compile src\main GUILE
|
||||
call :Compile src\misc
|
||||
call :Compile src\output
|
||||
call :Compile src\read
|
||||
call :Compile src\remake
|
||||
call :Compile src\remote-stub
|
||||
call :Compile src\rule
|
||||
call :Compile src\signame
|
||||
call :Compile src\strcache
|
||||
call :Compile src\variable
|
||||
call :Compile src\version
|
||||
call :Compile src\vpath
|
||||
call :Compile src\w32\pathstuff
|
||||
call :Compile src\w32\w32os
|
||||
call :Compile src\w32\compat\posixfcn
|
||||
call :Compile src\w32\subproc\misc
|
||||
call :Compile src\w32\subproc\sub_proc
|
||||
call :Compile src\w32\subproc\w32err
|
||||
call :Compile lib\fnmatch
|
||||
call :Compile lib\glob
|
||||
call :Compile lib\getloadavg
|
||||
call :Compile src/ar
|
||||
call :Compile src/arscan
|
||||
call :Compile src/commands
|
||||
call :Compile src/default
|
||||
call :Compile src/dir
|
||||
call :Compile src/expand
|
||||
call :Compile src/file
|
||||
call :Compile src/function
|
||||
call :Compile src/getopt
|
||||
call :Compile src/getopt1
|
||||
call :Compile src/guile GUILE
|
||||
call :Compile src/hash
|
||||
call :Compile src/implicit
|
||||
call :Compile src/job
|
||||
call :Compile src/load
|
||||
call :Compile src/loadapi
|
||||
call :Compile src/main GUILE
|
||||
call :Compile src/misc
|
||||
call :Compile src/output
|
||||
call :Compile src/read
|
||||
call :Compile src/remake
|
||||
call :Compile src/remote-stub
|
||||
call :Compile src/rule
|
||||
call :Compile src/signame
|
||||
call :Compile src/strcache
|
||||
call :Compile src/variable
|
||||
call :Compile src/version
|
||||
call :Compile src/vpath
|
||||
call :Compile src/w32/pathstuff
|
||||
call :Compile src/w32/w32os
|
||||
call :Compile src/w32/compat/posixfcn
|
||||
call :Compile src/w32/subproc/misc
|
||||
call :Compile src/w32/subproc/sub_proc
|
||||
call :Compile src/w32/subproc/w32err
|
||||
call :Compile lib/fnmatch
|
||||
call :Compile lib/glob
|
||||
call :Compile lib/getloadavg
|
||||
|
||||
if not "%COMPILER%" == "gcc" call :Compile src\w32\compat\dirent
|
||||
|
||||
|
@ -262,7 +266,7 @@ goto :EOF
|
|||
::
|
||||
|
||||
:Compile
|
||||
echo %OUTDIR%\%1.%O% >>%OUTDIR%\link.sc
|
||||
echo %LNKOUT%/%1.%O% >>%OUTDIR%\link.sc
|
||||
set EXTRAS=
|
||||
if "%2" == "GUILE" set "EXTRAS=%GUILECFLAGS%"
|
||||
if exist "%OUTDIR%\%1.%O%" del "%OUTDIR%\%1.%O%"
|
||||
|
@ -277,7 +281,7 @@ goto CompileDone
|
|||
:GccCompile
|
||||
:: GCC Compile
|
||||
echo on
|
||||
%COMPILER% -mthreads -Wall -std=gnu99 -gdwarf-2 -g3 %OPTS% -I%OUTDIR%/src -I./src -I%OUTDIR%/lib -I./lib -I./src/w32/include -DWINDOWS32 -DHAVE_CONFIG_H %EXTRAS% -o %OUTDIR%\%1.%O% -c %1.c
|
||||
%COMPILER% -mthreads -Wall -std=gnu99 -gdwarf-2 -g3 %OPTS% -I%OUTDIR%/src -I./src -I%OUTDIR%/lib -I./lib -I./src/w32/include -DWINDOWS32 -DHAVE_CONFIG_H %EXTRAS% -o %OUTDIR%/%1.%O% -c %1.c
|
||||
@echo off
|
||||
|
||||
:CompileDone
|
||||
|
@ -285,13 +289,14 @@ if not exist "%OUTDIR%\%1.%O%" exit 1
|
|||
goto :EOF
|
||||
|
||||
:Link
|
||||
echo Linking %OUTDIR%/%MAKE%.exe
|
||||
echo.
|
||||
echo Linking %LNKOUT%/%MAKE%.exe
|
||||
if "%COMPILER%" == "gcc" goto GccLink
|
||||
|
||||
:: MSVC Link
|
||||
echo %GUILELIBS% kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib >>%OUTDIR%\link.sc
|
||||
echo on
|
||||
link.exe /NOLOGO /SUBSYSTEM:console /PDB:%OUTDIR%\%MAKE%.pdb %LINKOPTS% /OUT:%OUTDIR%\%MAKE%.exe @%OUTDIR%\link.sc
|
||||
link.exe /NOLOGO /SUBSYSTEM:console /PDB:%LNKOUT%\%MAKE%.pdb %LINKOPTS% /OUT:%LNKOUT%\%MAKE%.exe @%LNKOUT%\link.sc
|
||||
@echo off
|
||||
goto :EOF
|
||||
|
||||
|
@ -299,7 +304,7 @@ goto :EOF
|
|||
:: GCC Link
|
||||
echo on
|
||||
echo %GUILELIBS% -lkernel32 -luser32 -lgdi32 -lwinspool -lcomdlg32 -ladvapi32 -lshell32 -lole32 -loleaut32 -luuid -lodbc32 -lodbccp32 >>%OUTDIR%\link.sc
|
||||
%COMPILER% -mthreads -gdwarf-2 -g3 %OPTS% -o %OUTDIR%\%MAKE%.exe @%OUTDIR%\link.sc -Wl,--out-implib=%OUTDIR%\libgnumake-1.dll.a
|
||||
%COMPILER% -mthreads -gdwarf-2 -g3 %OPTS% -o %LNKOUT%/%MAKE%.exe @%LNKOUT%/link.sc -Wl,--out-implib=%LNKOUT%/libgnumake-1.dll.a
|
||||
@echo off
|
||||
goto :EOF
|
||||
|
||||
|
@ -390,6 +395,7 @@ set NOGUILE=
|
|||
set O=
|
||||
set OPTS=
|
||||
set OUTDIR=
|
||||
set LNKOUT=
|
||||
set PKGMSC=
|
||||
set VSVARS=
|
||||
goto :EOF
|
||||
|
|
|
@ -909,7 +909,7 @@ ar_member_touch (const char *arname, const char *memname)
|
|||
for (ui = 0; ui < sizeof ar_hdr.ar_date; ui++)
|
||||
ar_hdr.ar_date[ui] = ' ';
|
||||
sprintf (TOCHAR (ar_hdr.ar_date), "%lu", (long unsigned) statbuf.st_mtime);
|
||||
ar_hdr.ar_date[strlen (ar_hdr.ar_date)] = ' ';
|
||||
ar_hdr.ar_date[strlen ((char *) ar_hdr.ar_date)] = ' ';
|
||||
#else
|
||||
ar_hdr.ar_date = statbuf.st_mtime;
|
||||
#endif
|
||||
|
|
|
@ -298,6 +298,11 @@ this program. If not, see <http://www.gnu.org/licenses/>. */
|
|||
#define HAVE_TTYNAME 1
|
||||
char *ttyname (int);
|
||||
|
||||
/* Define to 1 if you have the `umask' function. */
|
||||
#ifdef __MINGW32__
|
||||
# define HAVE_UMASK 1
|
||||
#endif
|
||||
|
||||
/* Define to 1 if 'n_un.n_name' is a member of 'struct nlist'. */
|
||||
/* #undef HAVE_STRUCT_NLIST_N_UN_N_NAME */
|
||||
|
||||
|
@ -470,6 +475,11 @@ char *ttyname (int);
|
|||
/* Define to empty if 'const' does not conform to ANSI C. */
|
||||
/* #undef const */
|
||||
|
||||
#ifdef __MINGW32__
|
||||
# undef __USE_MINGW_ANSI_STDIO
|
||||
# define __USE_MINGW_ANSI_STDIO 1
|
||||
#endif
|
||||
|
||||
#include <sys/types.h>
|
||||
|
||||
/* Define to 'int' if <sys/types.h> doesn't define. */
|
||||
|
|
|
@ -724,7 +724,9 @@ reap_children (int block, int err)
|
|||
else if (pid < 0)
|
||||
{
|
||||
/* A remote status command failed miserably. Punt. */
|
||||
#if !defined(__MSDOS__) && !defined(_AMIGA) && !defined(WINDOWS32)
|
||||
remote_status_lose:
|
||||
#endif
|
||||
pfatal_with_name ("remote_status");
|
||||
}
|
||||
else
|
||||
|
|
|
@ -292,12 +292,8 @@ char *strerror (int errnum);
|
|||
char *strsignal (int signum);
|
||||
#endif
|
||||
|
||||
#if defined(HAVE_UMASK)
|
||||
# define UMASK(_m) umask (_m)
|
||||
# define MODE_T mode_t
|
||||
#else
|
||||
# define UMASK(_m) 0
|
||||
# define MODE_T int
|
||||
#if !defined(HAVE_UMASK)
|
||||
extern mode_t umask (mode_t);
|
||||
#endif
|
||||
|
||||
/* ISDIGIT offers the following features:
|
||||
|
|
12
src/misc.c
12
src/misc.c
|
@ -437,6 +437,14 @@ char *mktemp (char *template);
|
|||
# endif
|
||||
#endif
|
||||
|
||||
#ifndef HAVE_UMASK
|
||||
mode_t
|
||||
umask (mode_t mask)
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
#endif
|
||||
|
||||
FILE *
|
||||
get_tmpfile (char **name, const char *template)
|
||||
{
|
||||
|
@ -446,7 +454,7 @@ get_tmpfile (char **name, const char *template)
|
|||
#endif
|
||||
|
||||
/* Preserve the current umask, and set a restrictive one for temp files. */
|
||||
MODE_T mask = UMASK (0077);
|
||||
mode_t mask = umask (0077);
|
||||
|
||||
#if defined(HAVE_MKSTEMP) || defined(HAVE_MKTEMP)
|
||||
# define TEMPLATE_LEN strlen (template)
|
||||
|
@ -482,7 +490,7 @@ get_tmpfile (char **name, const char *template)
|
|||
# endif
|
||||
#endif
|
||||
|
||||
UMASK (mask);
|
||||
umask (mask);
|
||||
|
||||
return file;
|
||||
}
|
||||
|
|
|
@ -281,7 +281,7 @@ release_semaphore (void *sem)
|
|||
int
|
||||
output_tmpfd (void)
|
||||
{
|
||||
MODE_T mask = UMASK (0077);
|
||||
mode_t mask = umask (0077);
|
||||
int fd = -1;
|
||||
FILE *tfile = tmpfile ();
|
||||
|
||||
|
@ -297,7 +297,7 @@ output_tmpfd (void)
|
|||
|
||||
set_append_mode (fd);
|
||||
|
||||
UMASK (mask);
|
||||
umask (mask);
|
||||
|
||||
return fd;
|
||||
}
|
||||
|
|
|
@ -108,7 +108,7 @@ DWORD process_wait_for_multiple_objects(
|
|||
continue;
|
||||
break;
|
||||
case WAIT_FAILED:
|
||||
fprintf(stderr,"WaitForMultipleOjbects failed waiting with error %d\n", GetLastError());
|
||||
fprintf(stderr,"WaitForMultipleOjbects failed waiting with error %lu\n", GetLastError());
|
||||
break;
|
||||
default:
|
||||
if (retVal >= WAIT_ABANDONED_0) {
|
||||
|
|
Loading…
Reference in a new issue