зеркало из https://github.com/mozilla/pjs.git
Makecopy speedup thanks to david.gardiner@unisa.edu.au,
removed dead/unused manifest code, clobber speedups and cleanup
This commit is contained in:
Родитель
832c54952e
Коммит
ad7075d66f
|
@ -0,0 +1,534 @@
|
||||||
|
/* -*- Mode: C; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 2 -*-
|
||||||
|
*
|
||||||
|
* The contents of this file are subject to the Netscape Public License
|
||||||
|
* Version 1.0 (the "NPL"); you may not use this file except in
|
||||||
|
* compliance with the NPL. You may obtain a copy of the NPL at
|
||||||
|
* http://www.mozilla.org/NPL/
|
||||||
|
*
|
||||||
|
* Software distributed under the NPL is distributed on an "AS IS" basis,
|
||||||
|
* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the NPL
|
||||||
|
* for the specific language governing rights and limitations under the
|
||||||
|
* NPL.
|
||||||
|
*
|
||||||
|
* The Initial Developer of this code under the NPL is Netscape
|
||||||
|
* Communications Corporation. Portions created by Netscape are
|
||||||
|
* Copyright (C) 1998 Netscape Communications Corporation. All Rights
|
||||||
|
* Reserved.
|
||||||
|
*
|
||||||
|
* Modified by David.Gardiner@unisa.edu.au
|
||||||
|
* added -i option, which prepends a #line with the absolute path of the file. Useful
|
||||||
|
* for debugging Mozilla on Windows.
|
||||||
|
* added hard symbolic link instead of copy for NTFS partitions
|
||||||
|
* added multi-copy, so a number of files can be copied to the same destination at once.
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
|
||||||
|
/*
|
||||||
|
test cases:
|
||||||
|
|
||||||
|
cd d:\mozilla_src\mozilla\nsprpub
|
||||||
|
-i ..\dist\WIN954.0_DBG.OBJD\include\*.h ..\dist\WIN32_D.OBJ\include
|
||||||
|
|
||||||
|
cd d:\mozilla_src\mozilla\webshell
|
||||||
|
-i nsIBrowserWindow.h nsIContentViewer.h nsIContentViewerContainer.h nsIDocumentLoader.h nsIDocumentLoaderObserver.h nsIDocStreamLoaderFactory.h nsIDocumentViewer.h nsILinkHandler.h nsIThrobber.h nsIWebShell.h nsIWebShellServices.h nsIClipboardCommands.h nsweb.h ..\..\dist\public\raptor
|
||||||
|
*/
|
||||||
|
|
||||||
|
#include <windows.h>
|
||||||
|
#include <stdio.h>
|
||||||
|
#include <stdlib.h>
|
||||||
|
#include <string.h>
|
||||||
|
#include <direct.h>
|
||||||
|
#include <sys/stat.h>
|
||||||
|
#include <sys/utime.h>
|
||||||
|
#include <io.h>
|
||||||
|
#include <fcntl.h>
|
||||||
|
|
||||||
|
/*
|
||||||
|
Unicode calls are linked at run-time, so that the application can run under
|
||||||
|
Windows NT and 95 (which doesn't support the Unicode calls)
|
||||||
|
|
||||||
|
The following APIs are linked:
|
||||||
|
BackupWrite
|
||||||
|
CreateFileW
|
||||||
|
GetFullPathNameW
|
||||||
|
*/
|
||||||
|
|
||||||
|
//static const char *prog;
|
||||||
|
|
||||||
|
BOOL insertHashLine = FALSE;
|
||||||
|
BOOL isWindowsNT = FALSE;
|
||||||
|
|
||||||
|
typedef WINBASEAPI BOOL (WINAPI* LPFNBackupWrite)(HANDLE, LPBYTE, DWORD, LPDWORD, BOOL, BOOL, LPVOID *);
|
||||||
|
typedef WINBASEAPI HANDLE (WINAPI* LPFNCreateFileW)(LPCWSTR, DWORD, DWORD, LPSECURITY_ATTRIBUTES, DWORD, DWORD, HANDLE);
|
||||||
|
typedef WINBASEAPI DWORD (WINAPI* LPFNGetFullPathNameW)(LPCWSTR, DWORD, LPWSTR, LPWSTR *);
|
||||||
|
|
||||||
|
// Function pointers (used for NTFS hard links)
|
||||||
|
LPFNBackupWrite lpfnDllBackupWrite = NULL;
|
||||||
|
LPFNCreateFileW lpfnDllCreateFileW = NULL;
|
||||||
|
LPFNGetFullPathNameW lpfnDllGetFullPathNameW = NULL;
|
||||||
|
|
||||||
|
// Handle to DLL
|
||||||
|
HINSTANCE hDLL = NULL;
|
||||||
|
|
||||||
|
/*
|
||||||
|
** Flip any "unix style slashes" into "dos style backslashes"
|
||||||
|
*/
|
||||||
|
void FlipSlashes(char *name)
|
||||||
|
{
|
||||||
|
int i;
|
||||||
|
|
||||||
|
for( i=0; name[i]; i++ ) {
|
||||||
|
if( name[i] == '/' ) name[i] = '\\';
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Flip any "dos style backslashes" into "unix style slashes"
|
||||||
|
*/
|
||||||
|
void UnflipSlashes(char *name)
|
||||||
|
{
|
||||||
|
int i;
|
||||||
|
|
||||||
|
for( i=0; name[i]; i++ ) {
|
||||||
|
if( name[i] == '\\' ) name[i] = '/';
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
int MakeDir( char *path )
|
||||||
|
{
|
||||||
|
char *cp, *pstr;
|
||||||
|
struct stat sb;
|
||||||
|
|
||||||
|
pstr = path;
|
||||||
|
while( cp = strchr(pstr, '\\') ) {
|
||||||
|
*cp = '\0';
|
||||||
|
|
||||||
|
if( !(stat(path, &sb) == 0 && (sb.st_mode & _S_IFDIR) )) {
|
||||||
|
/* create the new sub-directory */
|
||||||
|
printf("+++ makecopy: creating directory %s\n", path);
|
||||||
|
if( mkdir(path) < 0 ) {
|
||||||
|
return -1;
|
||||||
|
}
|
||||||
|
} /* else sub-directory already exists.... */
|
||||||
|
|
||||||
|
*cp = '\\';
|
||||||
|
pstr = cp+1;
|
||||||
|
}
|
||||||
|
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Display error code and message for last error
|
||||||
|
*/
|
||||||
|
int ReportError()
|
||||||
|
{
|
||||||
|
LPVOID lpMsgBuf = NULL;
|
||||||
|
|
||||||
|
DWORD err = GetLastError();
|
||||||
|
|
||||||
|
FormatMessage(FORMAT_MESSAGE_FROM_SYSTEM | FORMAT_MESSAGE_ALLOCATE_BUFFER,
|
||||||
|
NULL,
|
||||||
|
err,
|
||||||
|
0,
|
||||||
|
(LPTSTR) &lpMsgBuf,
|
||||||
|
0,
|
||||||
|
NULL);
|
||||||
|
|
||||||
|
fprintf(stderr, "%u, %s\n", err, (LPCTSTR) lpMsgBuf ) ;
|
||||||
|
|
||||||
|
LocalFree( lpMsgBuf );
|
||||||
|
|
||||||
|
return -1;
|
||||||
|
}
|
||||||
|
|
||||||
|
int ReportError(const char* msg)
|
||||||
|
{
|
||||||
|
fprintf(stderr, "%Error: s\n", msg);
|
||||||
|
return ReportError();
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/*
|
||||||
|
Creates an NTFS hard link of src at dest.
|
||||||
|
NT5 will have a CreateHardLink API which will do the same thing, but a lot simpler
|
||||||
|
This is based on the MSDN code sample Q153181
|
||||||
|
|
||||||
|
*/
|
||||||
|
BOOL hardSymLink(LPCSTR src, LPCSTR dest)
|
||||||
|
{
|
||||||
|
WCHAR FileLink[ MAX_PATH + 1 ];
|
||||||
|
LPWSTR FilePart;
|
||||||
|
|
||||||
|
WIN32_STREAM_ID StreamId;
|
||||||
|
DWORD dwBytesWritten;
|
||||||
|
|
||||||
|
BOOL bSuccess;
|
||||||
|
|
||||||
|
// Convert src and dest to Unicode
|
||||||
|
DWORD cbPathLen = MultiByteToWideChar(CP_ACP, 0, src, -1, NULL, 0);
|
||||||
|
LPWSTR FileSource = new WCHAR[cbPathLen+1];
|
||||||
|
MultiByteToWideChar(CP_ACP, 0, src, -1, FileSource, cbPathLen);
|
||||||
|
|
||||||
|
cbPathLen = MultiByteToWideChar(CP_ACP, 0, dest, -1, NULL, 0);
|
||||||
|
LPWSTR FileDest = new WCHAR[cbPathLen+1];
|
||||||
|
MultiByteToWideChar(CP_ACP, 0, dest, -1, FileDest, cbPathLen);
|
||||||
|
|
||||||
|
//
|
||||||
|
// open existing file that we link to
|
||||||
|
//
|
||||||
|
|
||||||
|
HANDLE hFileSource = lpfnDllCreateFileW(
|
||||||
|
FileSource,
|
||||||
|
FILE_WRITE_ATTRIBUTES,
|
||||||
|
FILE_SHARE_READ | FILE_SHARE_WRITE | FILE_SHARE_DELETE,
|
||||||
|
NULL, // sa
|
||||||
|
OPEN_EXISTING,
|
||||||
|
0,
|
||||||
|
NULL
|
||||||
|
);
|
||||||
|
|
||||||
|
if(hFileSource == INVALID_HANDLE_VALUE) {
|
||||||
|
ReportError("CreateFile (source)");
|
||||||
|
return FALSE;
|
||||||
|
}
|
||||||
|
|
||||||
|
//
|
||||||
|
// validate and sanitize supplied link path and use the result
|
||||||
|
// the full path MUST be Unicode for BackupWrite
|
||||||
|
//
|
||||||
|
|
||||||
|
cbPathLen = lpfnDllGetFullPathNameW( FileDest, MAX_PATH, FileLink, &FilePart);
|
||||||
|
|
||||||
|
if(cbPathLen == 0) {
|
||||||
|
ReportError("GetFullPathName");
|
||||||
|
return FALSE;
|
||||||
|
}
|
||||||
|
|
||||||
|
cbPathLen = (cbPathLen + 1) * sizeof(WCHAR); // adjust for byte count
|
||||||
|
|
||||||
|
//
|
||||||
|
// it might also be a good idea to verify the existence of the link,
|
||||||
|
// (and possibly bail), as the file specified in FileLink will be
|
||||||
|
// overwritten if it already exists
|
||||||
|
//
|
||||||
|
|
||||||
|
//
|
||||||
|
// prepare and write the WIN32_STREAM_ID out
|
||||||
|
//
|
||||||
|
|
||||||
|
LPVOID lpContext = NULL;
|
||||||
|
|
||||||
|
StreamId.dwStreamId = BACKUP_LINK;
|
||||||
|
StreamId.dwStreamAttributes = 0;
|
||||||
|
StreamId.dwStreamNameSize = 0;
|
||||||
|
StreamId.Size.HighPart = 0;
|
||||||
|
StreamId.Size.LowPart = cbPathLen;
|
||||||
|
|
||||||
|
//
|
||||||
|
// compute length of variable size WIN32_STREAM_ID
|
||||||
|
//
|
||||||
|
|
||||||
|
DWORD StreamHeaderSize = (LPBYTE)&StreamId.cStreamName - (LPBYTE)&
|
||||||
|
StreamId+ StreamId.dwStreamNameSize ;
|
||||||
|
|
||||||
|
bSuccess = lpfnDllBackupWrite(
|
||||||
|
hFileSource,
|
||||||
|
(LPBYTE)&StreamId, // buffer to write
|
||||||
|
StreamHeaderSize, // number of bytes to write
|
||||||
|
&dwBytesWritten,
|
||||||
|
FALSE, // don't abort yet
|
||||||
|
FALSE, // don't process security
|
||||||
|
&lpContext
|
||||||
|
);
|
||||||
|
|
||||||
|
if(bSuccess) {
|
||||||
|
|
||||||
|
//
|
||||||
|
// write out the buffer containing the path
|
||||||
|
//
|
||||||
|
|
||||||
|
bSuccess = lpfnDllBackupWrite(
|
||||||
|
hFileSource,
|
||||||
|
(LPBYTE)FileLink, // buffer to write
|
||||||
|
cbPathLen, // number of bytes to write
|
||||||
|
&dwBytesWritten,
|
||||||
|
FALSE, // don't abort yet
|
||||||
|
FALSE, // don't process security
|
||||||
|
&lpContext
|
||||||
|
);
|
||||||
|
|
||||||
|
//
|
||||||
|
// free context
|
||||||
|
//
|
||||||
|
|
||||||
|
lpfnDllBackupWrite(
|
||||||
|
hFileSource,
|
||||||
|
NULL, // buffer to write
|
||||||
|
0, // number of bytes to write
|
||||||
|
&dwBytesWritten,
|
||||||
|
TRUE, // abort
|
||||||
|
FALSE, // don't process security
|
||||||
|
&lpContext
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
CloseHandle( hFileSource );
|
||||||
|
|
||||||
|
if(!bSuccess) {
|
||||||
|
ReportError("BackupWrite");
|
||||||
|
return FALSE;
|
||||||
|
}
|
||||||
|
|
||||||
|
delete FileSource;
|
||||||
|
delete FileDest;
|
||||||
|
|
||||||
|
return TRUE;
|
||||||
|
}
|
||||||
|
|
||||||
|
int CopyIfNecessary(const char *oldFile, const char *newFile)
|
||||||
|
{
|
||||||
|
LPTSTR fullPathName = NULL;
|
||||||
|
LPTSTR filenamePart = NULL;
|
||||||
|
|
||||||
|
char buffer[8192];
|
||||||
|
DWORD bytesRead = 0;
|
||||||
|
DWORD bytesWritten = 0;
|
||||||
|
|
||||||
|
struct stat newsb;
|
||||||
|
struct stat oldsb;
|
||||||
|
|
||||||
|
// Use stat to find file details
|
||||||
|
if (stat(oldFile, &oldsb)) {
|
||||||
|
return -1;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!stat(newFile, &newsb)) {
|
||||||
|
// If file times are equal, don't copy
|
||||||
|
if (newsb.st_mtime == oldsb.st_mtime) {
|
||||||
|
#if 0
|
||||||
|
printf("+++ makecopy: %s is up to date\n", newFile);
|
||||||
|
#endif
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
// find out required size
|
||||||
|
DWORD bufSize = GetFullPathName(oldFile, 0, fullPathName, &filenamePart);
|
||||||
|
|
||||||
|
fullPathName = new char[bufSize];
|
||||||
|
GetFullPathName(oldFile, bufSize, fullPathName, &filenamePart);
|
||||||
|
|
||||||
|
// If we need to insert #line, the copying is a bit involved.
|
||||||
|
if (insertHashLine == TRUE) {
|
||||||
|
struct _utimbuf utim;
|
||||||
|
|
||||||
|
printf(" #Installing %s into %s\n", oldFile, newFile);
|
||||||
|
|
||||||
|
utim.actime = oldsb.st_atime;
|
||||||
|
utim.modtime = oldsb.st_mtime; // modification time
|
||||||
|
|
||||||
|
HANDLE hNewFile = CreateFile(newFile, GENERIC_WRITE, FILE_SHARE_WRITE, NULL,
|
||||||
|
CREATE_ALWAYS, FILE_ATTRIBUTE_NORMAL,
|
||||||
|
NULL);
|
||||||
|
if (hNewFile == INVALID_HANDLE_VALUE) {
|
||||||
|
return ReportError("CreateFile");
|
||||||
|
}
|
||||||
|
|
||||||
|
HANDLE hOldFile = CreateFile(oldFile, GENERIC_READ, FILE_SHARE_READ, NULL,
|
||||||
|
OPEN_EXISTING, FILE_ATTRIBUTE_NORMAL,
|
||||||
|
NULL);
|
||||||
|
if (hOldFile == INVALID_HANDLE_VALUE) {
|
||||||
|
return ReportError("CreateFile");
|
||||||
|
}
|
||||||
|
|
||||||
|
// Insert first line.
|
||||||
|
sprintf(buffer, "#line 1 \"%s\"\r\n", fullPathName);
|
||||||
|
|
||||||
|
// convert to unix.
|
||||||
|
UnflipSlashes(buffer);
|
||||||
|
|
||||||
|
WriteFile(hNewFile, buffer, strlen(buffer), &bytesWritten, NULL);
|
||||||
|
|
||||||
|
// Copy file.
|
||||||
|
do {
|
||||||
|
if (!ReadFile(hOldFile, buffer, sizeof(buffer), &bytesRead, NULL)) {
|
||||||
|
return ReportError("ReadFile");
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!WriteFile(hNewFile, buffer, bytesRead, &bytesWritten, NULL)) {
|
||||||
|
return ReportError("WriteFile");
|
||||||
|
}
|
||||||
|
|
||||||
|
} while (bytesRead > 0);
|
||||||
|
|
||||||
|
CloseHandle(hNewFile);
|
||||||
|
CloseHandle(hOldFile);
|
||||||
|
|
||||||
|
// make copy have same time
|
||||||
|
_utime(newFile, &utim);
|
||||||
|
|
||||||
|
// If we don't need to do a #line, use an API to copy the file..
|
||||||
|
} else {
|
||||||
|
|
||||||
|
BOOL isNTFS = FALSE;
|
||||||
|
|
||||||
|
// Find out what kind of volume this is.
|
||||||
|
if (isWindowsNT) {
|
||||||
|
char rootPathName[MAX_PATH];
|
||||||
|
char *c = strchr(fullPathName, '\\');
|
||||||
|
|
||||||
|
if (c != NULL) {
|
||||||
|
LPTSTR fileSystemName;
|
||||||
|
|
||||||
|
strncpy(rootPathName, fullPathName, (c - fullPathName) + 1);
|
||||||
|
|
||||||
|
fileSystemName = new TCHAR[50];
|
||||||
|
if (!GetVolumeInformation(rootPathName, NULL, 0, NULL, NULL, NULL, fileSystemName, sizeof(rootPathName))) {
|
||||||
|
return ReportError("GetVolumeInformation");
|
||||||
|
}
|
||||||
|
|
||||||
|
isNTFS = (strcmp(fileSystemName, "NTFS") == 0);
|
||||||
|
delete fileSystemName;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (isNTFS) {
|
||||||
|
printf("+++ makecopy: Symlinking %s into %s\n", oldFile, newFile);
|
||||||
|
|
||||||
|
if (! hardSymLink(oldFile, newFile) ) {
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
printf(" Installing %s into %s\n", oldFile, newFile);
|
||||||
|
|
||||||
|
if( ! CopyFile(oldFile, newFile, FALSE) ) {
|
||||||
|
ReportError("CopyFile");
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
delete fullPathName;
|
||||||
|
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
void Usage(void)
|
||||||
|
{
|
||||||
|
fprintf(stderr, "makecopy: [-i|-c] <file1> [file2] [filen] <dir-path>\n");
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
int main( int argc, char *argv[] )
|
||||||
|
{
|
||||||
|
char old_path[4096];
|
||||||
|
char new_path[4096];
|
||||||
|
char *oldFileName; // points to where file name starts in old_path
|
||||||
|
char *newFileName; // points to where file name starts in new_path
|
||||||
|
WIN32_FIND_DATA findFileData;
|
||||||
|
int rv = 0;
|
||||||
|
int i = 1;
|
||||||
|
|
||||||
|
if (argc < 3) {
|
||||||
|
Usage();
|
||||||
|
return 2;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (stricmp(argv[i], "-i") == 0) {
|
||||||
|
insertHashLine = TRUE;
|
||||||
|
i++;
|
||||||
|
}
|
||||||
|
|
||||||
|
// -c option forces copy instead of symlink
|
||||||
|
if (stricmp(argv[i], "-c") == 0) {
|
||||||
|
isWindowsNT = FALSE;
|
||||||
|
i++;
|
||||||
|
} else {
|
||||||
|
OSVERSIONINFO osvi;
|
||||||
|
|
||||||
|
// Is this Windows NT?
|
||||||
|
osvi.dwOSVersionInfoSize = sizeof(OSVERSIONINFO);
|
||||||
|
|
||||||
|
if (!GetVersionEx(&osvi)) {
|
||||||
|
return ReportError();
|
||||||
|
}
|
||||||
|
|
||||||
|
isWindowsNT = (osvi.dwPlatformId == VER_PLATFORM_WIN32_NT);
|
||||||
|
|
||||||
|
if (isWindowsNT) {
|
||||||
|
|
||||||
|
hDLL = LoadLibrary("Kernel32");
|
||||||
|
if (hDLL != NULL)
|
||||||
|
{
|
||||||
|
lpfnDllBackupWrite = (LPFNBackupWrite)GetProcAddress(hDLL, "BackupWrite");
|
||||||
|
lpfnDllCreateFileW = (LPFNCreateFileW)GetProcAddress(hDLL, "CreateFileW");
|
||||||
|
lpfnDllGetFullPathNameW = (LPFNGetFullPathNameW) GetProcAddress(hDLL, "GetFullPathNameW");
|
||||||
|
|
||||||
|
if ((!lpfnDllBackupWrite) || (!lpfnDllCreateFileW) || (!lpfnDllGetFullPathNameW))
|
||||||
|
{
|
||||||
|
// handle the error
|
||||||
|
int r = ReportError("GetProcAddress");
|
||||||
|
|
||||||
|
FreeLibrary(hDLL);
|
||||||
|
return r;
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
return ReportError();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// destination path is last argument
|
||||||
|
strcpy(new_path, argv[argc-1]);
|
||||||
|
|
||||||
|
// append backslash to path if not already there
|
||||||
|
if (new_path[strlen(new_path)] != '\\') {
|
||||||
|
strcat(new_path, "\\");
|
||||||
|
}
|
||||||
|
|
||||||
|
//sprintf(new_path, "%s\\", argv[i+1]);
|
||||||
|
FlipSlashes(new_path);
|
||||||
|
newFileName = new_path + strlen(new_path);
|
||||||
|
|
||||||
|
if( MakeDir(new_path) < 0 ) {
|
||||||
|
fprintf(stderr, "\n+++ makecopy: unable to create directory %s\n", new_path);
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
//i++;
|
||||||
|
|
||||||
|
// copy all named source files
|
||||||
|
while (i < (argc - 1)) {
|
||||||
|
strcpy(old_path, argv[i]);
|
||||||
|
|
||||||
|
FlipSlashes(old_path);
|
||||||
|
oldFileName = strrchr(old_path, '\\');
|
||||||
|
if (oldFileName) {
|
||||||
|
oldFileName++;
|
||||||
|
} else {
|
||||||
|
oldFileName = old_path;
|
||||||
|
}
|
||||||
|
|
||||||
|
HANDLE hFindFile = FindFirstFile(old_path, &findFileData);
|
||||||
|
|
||||||
|
if (hFindFile != INVALID_HANDLE_VALUE) {
|
||||||
|
do {
|
||||||
|
strcpy(oldFileName, findFileData.cFileName);
|
||||||
|
strcpy(newFileName, findFileData.cFileName);
|
||||||
|
rv = CopyIfNecessary(old_path, new_path);
|
||||||
|
|
||||||
|
} while (FindNextFile(hFindFile, &findFileData) != 0);
|
||||||
|
} else {
|
||||||
|
fprintf(stderr, "\n+++ makecopy: no such file: %s\n", old_path);
|
||||||
|
}
|
||||||
|
|
||||||
|
FindClose(hFindFile);
|
||||||
|
i++;
|
||||||
|
}
|
||||||
|
if (isWindowsNT) {
|
||||||
|
FreeLibrary(hDLL);
|
||||||
|
}
|
||||||
|
return 0;
|
||||||
|
}
|
Двоичные данные
config/makecopy.exe
Двоичные данные
config/makecopy.exe
Двоичный файл не отображается.
|
@ -66,24 +66,28 @@ build_number::
|
||||||
|
|
||||||
|
|
||||||
#//
|
#//
|
||||||
#// Rule to build makedir.exe
|
#// Rules to build make utils
|
||||||
#//
|
#//
|
||||||
makecopy.exe:: makecopy.c
|
|
||||||
$(CC) -O2 -MD makecopy.c
|
#CFLAGS = /FR /Zi -MDd /W4
|
||||||
|
CFLAGS = /O2 /GB /MD
|
||||||
|
|
||||||
|
makecopy.exe:: makecopy.cpp
|
||||||
|
$(CC) $(CFLAGS) $**
|
||||||
|
|
||||||
mangle.exe:: mangle.c
|
mangle.exe:: mangle.c
|
||||||
$(CC) -O2 -MD mangle.c
|
$(CC) $(CFLAGS) $**
|
||||||
|
|
||||||
mantomak.exe:: mantomak.c
|
mantomak.exe:: mantomak.c
|
||||||
$(CC) -O2 -MD mantomak.c
|
$(CC) $(CFLAGS) $**
|
||||||
|
|
||||||
bin2rc.exe:: bin2rc.c
|
bin2rc.exe:: bin2rc.c
|
||||||
$(CC) -O2 -MD bin2rc.c
|
$(CC) $(CFLAGS) $**
|
||||||
|
|
||||||
makedep.exe:: makedep.cpp
|
makedep.exe:: makedep.cpp
|
||||||
@cl -MT makedep.cpp
|
$(CC) -MT /O2 /GB $**
|
||||||
|
|
||||||
export:: makecopy.exe mangle.exe mantomak.exe bin2rc.exe makedep.exe build_number $(INSTALL_FILES)
|
export:: makecopy.exe mangle.exe mantomak.exe bin2rc.exe makedep.exe build_number
|
||||||
|
|
||||||
!ifdef MOZ_FULLCIRCLE
|
!ifdef MOZ_FULLCIRCLE
|
||||||
|
|
||||||
|
|
|
@ -59,23 +59,6 @@ JNI_GEN_DIR=_jni
|
||||||
!endif
|
!endif
|
||||||
|
|
||||||
|
|
||||||
MANIFEST_LEVEL=MACROS
|
|
||||||
!IF EXIST(manifest.mn) && !defined(IGNORE_MANIFEST)
|
|
||||||
!IF "$(WINOS)" == "WIN95"
|
|
||||||
!IF [$(DEPTH)\config\mantomak.exe manifest.mn manifest.mnw] == 0
|
|
||||||
!INCLUDE <manifest.mnw>
|
|
||||||
!ELSE
|
|
||||||
!ERROR ERROR: Unable to generate manifest.mnw from manifest.mn
|
|
||||||
!ENDIF
|
|
||||||
!ELSE
|
|
||||||
!IF ["$(DEPTH)\config\mantomak.exe manifest.mn manifest.mnw"] == 0
|
|
||||||
!INCLUDE <manifest.mnw>
|
|
||||||
!ELSE
|
|
||||||
!ERROR ERROR: Unable to generate manifest.mnw from manifest.mn
|
|
||||||
!ENDIF
|
|
||||||
!ENDIF
|
|
||||||
!ENDIF
|
|
||||||
|
|
||||||
#//------------------------------------------------------------------------
|
#//------------------------------------------------------------------------
|
||||||
#// Make sure that JDIRS is set after the manifest file is included
|
#// Make sure that JDIRS is set after the manifest file is included
|
||||||
#// and before the rules for JDIRS get generated. We cannot put this line
|
#// and before the rules for JDIRS get generated. We cannot put this line
|
||||||
|
@ -355,14 +338,11 @@ clobber::
|
||||||
!ifdef DIRS
|
!ifdef DIRS
|
||||||
@$(W95MAKE) clobber $(MAKEDIR) $(DIRS)
|
@$(W95MAKE) clobber $(MAKEDIR) $(DIRS)
|
||||||
!endif
|
!endif
|
||||||
-$(RM_R) $(GARBAGE) $(OBJDIR) 2> NUL
|
|
||||||
|
|
||||||
clobber_all::
|
clobber_all::
|
||||||
!ifdef DIRS
|
!ifdef DIRS
|
||||||
@$(W95MAKE) clobber_all $(MAKEDIR) $(DIRS)
|
@$(W95MAKE) clobber_all $(MAKEDIR) $(DIRS)
|
||||||
!endif
|
!endif
|
||||||
-$(RM_R) *.OBJ $(TARGETS) $(GARBAGE) $(OBJDIR) 2> NUL
|
|
||||||
|
|
||||||
|
|
||||||
export::
|
export::
|
||||||
!ifdef DIRS
|
!ifdef DIRS
|
||||||
|
@ -601,25 +581,33 @@ export:: $(JMC_STUBS) $(OBJDIR) $(JMC_OBJS)
|
||||||
|
|
||||||
#//------------------------------------------------------------------------
|
#//------------------------------------------------------------------------
|
||||||
#//
|
#//
|
||||||
#// JMC
|
#// EXPORTS
|
||||||
#//
|
#//
|
||||||
#// EXPORTS Names of headers to be copied to MODULE
|
#// Names of headers to be copied to common include directory
|
||||||
#//
|
#//
|
||||||
#//------------------------------------------------------------------------
|
#//------------------------------------------------------------------------
|
||||||
!if "$(EXPORTS)" != "$(NULL)"
|
!if "$(EXPORTS)" != "$(NULL)"
|
||||||
export:: $(PUBLIC)
|
|
||||||
for %f in ($(EXPORTS)) do $(MAKE_INSTALL:/=\) %f $(XPDIST:/=\)\include
|
export::
|
||||||
|
@echo +++ make: exporting headers
|
||||||
|
$(MAKE_INSTALL:/=\) -i $(EXPORTS) $(PUBLIC)
|
||||||
|
|
||||||
clobber::
|
clobber::
|
||||||
-for %g in ($(EXPORTS)) do $(RM) $(XPDIST:/=\)\include\%g
|
!if exist($(PUBLIC))
|
||||||
|
@cd $(PUBLIC)
|
||||||
|
-$(RM) $(EXPORTS)
|
||||||
|
@cd $(MAKEDIR)
|
||||||
|
!endif # $(PUBLIC) exists
|
||||||
|
|
||||||
clobber_all:: clobber
|
clobber_all:: clobber
|
||||||
|
|
||||||
!endif # EXPORTS
|
!endif # EXPORTS
|
||||||
|
|
||||||
#//------------------------------------------------------------------------
|
#//------------------------------------------------------------------------
|
||||||
#// These rules must follow all lines that define the macros they use
|
#// These rules must follow all lines that define the macros they use
|
||||||
#//------------------------------------------------------------------------
|
#//------------------------------------------------------------------------
|
||||||
!if defined(JAVA_OR_NSJVM)
|
!if defined(JAVA_OR_NSJVM)
|
||||||
GARBAGE = $(JMC_GEN_DIR) $(JMC_HEADERS) $(JMC_STUBS) \
|
GARBAGE = $(GARBAGE) $(JMC_GEN_DIR) $(JMC_HEADERS) $(JMC_STUBS) \
|
||||||
$(JDK_STUB_DIR) $(JRI_GEN_DIR) $(JDK_GEN_DIR) $(JNI_GEN_DIR)
|
$(JDK_STUB_DIR) $(JRI_GEN_DIR) $(JDK_GEN_DIR) $(JNI_GEN_DIR)
|
||||||
!endif
|
!endif
|
||||||
|
|
||||||
|
@ -633,15 +621,14 @@ clobber:: $(DIRS)
|
||||||
clobber_all:: $(DIRS)
|
clobber_all:: $(DIRS)
|
||||||
-$(RM_R) *.OBJ $(TARGETS) $(GARBAGE) $(OBJDIR) 2> NUL
|
-$(RM_R) *.OBJ $(TARGETS) $(GARBAGE) $(OBJDIR) 2> NUL
|
||||||
|
|
||||||
MANIFEST_LEVEL=RULES
|
|
||||||
!IF EXIST(manifest.mnw) && !defined(IGNORE_MANIFEST)
|
|
||||||
!INCLUDE <manifest.mnw>
|
|
||||||
!ENDIF
|
|
||||||
|
|
||||||
!if "$(MOZ_BITS)"=="32"
|
!if "$(MOZ_BITS)"=="32"
|
||||||
CFLAGS = $(CFLAGS) -DNO_JNI_STUBS
|
CFLAGS = $(CFLAGS) -DNO_JNI_STUBS
|
||||||
!endif
|
!endif
|
||||||
|
|
||||||
|
|
||||||
|
#//------------------------------------------------------------------------
|
||||||
|
#// XPIDL rules
|
||||||
|
#//------------------------------------------------------------------------
|
||||||
!if "$(XPIDLSRCS)" != "$(NULL)"
|
!if "$(XPIDLSRCS)" != "$(NULL)"
|
||||||
!if "$(MODULE)" != "$(NULL)"
|
!if "$(MODULE)" != "$(NULL)"
|
||||||
|
|
||||||
|
@ -698,13 +685,11 @@ $(XPDIST)\idl:
|
||||||
|
|
||||||
export:: $(XPDIST)\idl
|
export:: $(XPDIST)\idl
|
||||||
@echo +++ make: exporting IDL files
|
@echo +++ make: exporting IDL files
|
||||||
@echo.
|
$(MAKE_INSTALL) $(XPIDLSRCS:/=\) $(XPDIST)\idl
|
||||||
-for %i in ($(XPIDLSRCS:/=\)) do $(MAKE_INSTALL) %i $(XPDIST)\idl
|
|
||||||
|
|
||||||
export:: $(XPIDL_GEN_DIR) $(XPIDL_HEADERS) $(PUBLIC)
|
export:: $(XPIDL_GEN_DIR) $(XPIDL_HEADERS) $(PUBLIC)
|
||||||
@echo +++ make: exporting generated XPIDL header files
|
@echo +++ make: exporting generated XPIDL header files
|
||||||
@echo.
|
$(MAKE_INSTALL) $(XPIDL_HEADERS:/=\) $(PUBLIC)
|
||||||
-for %i in ($(XPIDL_HEADERS:/=\)) do $(MAKE_INSTALL) %i $(PUBLIC)
|
|
||||||
|
|
||||||
!ifndef NO_GEN_XPT
|
!ifndef NO_GEN_XPT
|
||||||
install:: $(XPIDL_GEN_DIR) $(TYPELIB)
|
install:: $(XPIDL_GEN_DIR) $(TYPELIB)
|
||||||
|
@ -713,21 +698,26 @@ install:: $(XPIDL_GEN_DIR) $(TYPELIB)
|
||||||
$(MAKE_INSTALL) $(TYPELIB) $(DIST)\bin\components
|
$(MAKE_INSTALL) $(TYPELIB) $(DIST)\bin\components
|
||||||
!endif
|
!endif
|
||||||
|
|
||||||
GARBAGE=$(GARBAGE) $(XPIDL_GEN_DIR) $(DIST)\bin\components\$(MODULE).xpt
|
|
||||||
|
|
||||||
clobber::
|
clobber::
|
||||||
-for %g in ($(XPIDLSRCS:.idl=.h)) do $(RM) $(XPDIST:/=\)\include\%g
|
!if exist($(PUBLIC))
|
||||||
-$(RM_R) $(GARBAGE) 2> NUL
|
@cd $(PUBLIC)
|
||||||
|
-$(RM) $(XPIDLSRCS:.idl=.h)
|
||||||
clobber_all::
|
@cd $(MAKEDIR)
|
||||||
-for %g in ($(XPIDLSRCS:.idl=.h)) do $(RM) $(XPDIST:/=\)\include\%g
|
!endif
|
||||||
-$(RM_R) $(GARBAGE) 2> NUL
|
!if exist($(XPDIST:/=\)\idl)
|
||||||
|
@cd $(XPDIST:/=\)\idl
|
||||||
GARBAGE=$(GARBAGE) $(XPIDL_GEN_DIR) $(DIST)\bin\components\$(XPIDL_MODULE).xpt
|
-$(RM) $(XPIDLSRCS)
|
||||||
|
@cd $(MAKEDIR)
|
||||||
|
!endif
|
||||||
|
-$(RM_R) $(XPIDL_GEN_DIR) 2> NUL
|
||||||
|
|
||||||
|
clobber_all:: clobber
|
||||||
|
-$(RM) $(DIST)\bin\components\$(XPIDL_MODULE).xpt
|
||||||
|
|
||||||
!endif
|
!endif
|
||||||
!endif
|
!endif
|
||||||
|
|
||||||
|
|
||||||
# Generate chrome building rules.
|
# Generate chrome building rules.
|
||||||
#
|
#
|
||||||
# You need to set these in your makefile.win to utilize this support:
|
# You need to set these in your makefile.win to utilize this support:
|
||||||
|
|
Загрузка…
Ссылка в новой задаче