Modifications to enable building on Win95. Added source for several new tools,

wtc's change to makecopy to support wildcards, and win95 specific makefile
configuration and rules.
This commit is contained in:
spider 1998-04-07 20:41:06 +00:00
parent c5f0bd3b5e
commit 12066836a2
8 changed files with 267 additions and 29 deletions

BIN
config/W95MAKE.EXE Executable file

Binary file not shown.

BIN
config/W95MKDIR.EXE Executable file

Binary file not shown.

79
config/W95make.c Normal file
View file

@ -0,0 +1,79 @@
/* -*- 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.
*/
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <process.h>
/*
* A feeble attempt at recursive make on win95 - spider 1/98
*
* argv[1] == target
* argv[2] == end directory (full)
* argv[3...n] == list of source directories
*
*/
void main(int argc, char **argv)
{
char *args[6];
int n = 0 ;
int rc = 0 ;
/* Set up parameters to be sent: Sorry for the hardcode!*/
args[0] = "-nologo";
args[1] = "-nologo";
args[2] = "-S";
args[3] = "-f";
args[4] = "makefile.win";
args[5] = argv[1] ;
args[6] = NULL ;
if (argc < 3) {
fprintf(stderr, "w95make: Not enough arguments, you figure it out\n");
exit (666) ;
}
while(argv[n+3] != NULL) {
if (_chdir(argv[n+3]) != 0) {
fprintf(stderr, "w95make: Could not change to directory %s ... skipping\n", argv[n+3]);
} else {
fprintf(stdout, "w95make: Entering Directory %s\\%s with target %s\n", argv[2], argv[n+3], argv[1]);
if ((rc = _spawnvp(_P_WAIT,"nmake", args)) != 0) {
fprintf(stderr, "w95make: nmake failed in directory %s with error code %d\n", argv[n+3], rc);
exit(rc);
}
if (_chdir(argv[2]) != 0) {
fprintf(stderr, "w95make: Could not change back to directory %s\n", argv[2]);
exit (666) ;
}
fprintf(stdout, "w95make: Leaving Directory %s\\%s with target %s\n", argv[2], argv[n+3], argv[1]);
}
n++;
}
exit(0);
}

38
config/W95mkdir.c Normal file
View file

@ -0,0 +1,38 @@
/* -*- 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.
*/
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <process.h>
/*
* win95 mkdir that responds nicely if the directory already exists - spider 1/98
*
*/
void main(int argc, char **argv)
{
if (argc < 1) {
fprintf(stderr, "w95mkdir: Not enough arguments, you figure it out\n");
exit (666) ;
}
_mkdir(argv[1]);
}

View file

@ -38,6 +38,15 @@ CONFIG_CONFIG_MAK=1
#// #//
#//------------------------------------------------------------------------ #//------------------------------------------------------------------------
!if [$(MOZ_TOOLS)\bin\uname > osuname.inc]
!endif
WINOS=\
!include "osuname.inc"
WINOS=$(WINOS: =)^
!if [del osuname.inc]
!endif
## Include support for MOZ_LITE/MOZ_MEDIUM ## Include support for MOZ_LITE/MOZ_MEDIUM
include <$(DEPTH)/config/liteness.mak> include <$(DEPTH)/config/liteness.mak>
@ -151,6 +160,15 @@ CFLAGS = $(CFLAGS) -DMOZILLA_CLIENT
PERL= $(MOZ_TOOLS)\perl5\perl.exe PERL= $(MOZ_TOOLS)\perl5\perl.exe
MASM = $(MOZ_TOOLS)\bin\ml.exe MASM = $(MOZ_TOOLS)\bin\ml.exe
!if "$(WINOS)" == "WIN95"
MKDIR = $(MOZ_SRC)\ns\config\w95mkdir
QUIET =
!else
MKDIR = mkdir
QUIET=@
!endif
#//------------------------------------------------------------------------ #//------------------------------------------------------------------------
#// #//
#// Include the OS dependent configuration information #// Include the OS dependent configuration information
@ -181,7 +199,7 @@ CFLAGS = $(CFLAGS) -DDEBUG_$(USERNAME)
#enable builds on any drive if defined. #enable builds on any drive if defined.
MOZ_SRC=y: MOZ_SRC=y:
!endif !endif
MAKE_INSTALL=@$(DEPTH)\config\makecopy.exe MAKE_INSTALL=$(QUIET)$(DEPTH)\config\makecopy.exe
MAKE_MANGLE=$(DEPTH)\config\mangle.exe MAKE_MANGLE=$(DEPTH)\config\mangle.exe
MAKE_UNMANGLE=if exist unmangle.bat call unmangle.bat MAKE_UNMANGLE=if exist unmangle.bat call unmangle.bat

View file

@ -44,19 +44,6 @@ void FlipSlashes(char *name)
} }
} }
void GetPathName(char *file, char *new_path)
{
int i;
i = strlen(file);
for( i=strlen(file); i && file[i] != '\\'; i--);
strncpy(new_path, file, i);
if( new_path[i] != '\\' ) {
new_path[i++] = '\\';
}
new_path[i] = '\0';
}
int MakeDir( char *path ) int MakeDir( char *path )
{ {
char *cp, *pstr; char *cp, *pstr;
@ -80,7 +67,7 @@ int MakeDir( char *path )
} }
} }
int CopyIfNecessary(char *oldFile, char *newFile, char *path) int CopyIfNecessary(char *oldFile, char *newFile)
{ {
BY_HANDLE_FILE_INFORMATION hNewInfo; BY_HANDLE_FILE_INFORMATION hNewInfo;
BY_HANDLE_FILE_INFORMATION hOldInfo; BY_HANDLE_FILE_INFORMATION hOldInfo;
@ -119,40 +106,62 @@ int CopyIfNecessary(char *oldFile, char *newFile, char *path)
} }
copy_file: copy_file:
printf("+++ makecopy: Installing %s into directory %s\n", oldFile, path);
if( ! CopyFile(oldFile, newFile, FALSE) ) { if( ! CopyFile(oldFile, newFile, FALSE) ) {
return 1; return 1;
} }
return 0; return 0;
} }
static char new_file[4096];
static char new_path[4096];
int main( int argc, char *argv[] ) int main( int argc, char *argv[] )
{ {
char fname[_MAX_FNAME]; char old_path[4096];
char ext[_MAX_EXT]; 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;
HANDLE hFindFile;
int rv;
if( argc != 3 ) { if( argc != 3 ) {
Usage(); Usage();
return 2; return 2;
} }
_splitpath(argv[1], NULL, NULL, fname, ext); strcpy(old_path, argv[1]);
FlipSlashes(old_path);
sprintf(new_file, "%s\\%s%s", argv[2], fname, ext); oldFileName = strrchr(old_path, '\\');
FlipSlashes(new_file); if (oldFileName) {
oldFileName++;
} else {
oldFileName = old_path;
}
sprintf(new_path, "%s\\", argv[2]); sprintf(new_path, "%s\\", argv[2]);
FlipSlashes(new_path); FlipSlashes(new_path);
newFileName = new_path + strlen(new_path);
if( MakeDir(new_path) < 0 ) { if( MakeDir(new_path) < 0 ) {
fprintf(stderr, "\n+++ makecopy: unable to create directory %s\n", new_path); fprintf(stderr, "\n+++ makecopy: unable to create directory %s\n", new_path);
return 1; return 1;
} }
return CopyIfNecessary(argv[1], new_file, new_path); hFindFile = FindFirstFile(old_path, &findFileData);
if (hFindFile == INVALID_HANDLE_VALUE) {
fprintf(stderr, "\n+++ makecopy: no such file: %s\n", argv[1]);
return 1;
}
printf("+++ makecopy: Installing %s into directory %s\n", argv[1], argv[2]);
do {
strcpy(oldFileName, findFileData.cFileName);
strcpy(newFileName, findFileData.cFileName);
rv = CopyIfNecessary(old_path, new_path);
if (rv != 0) {
break;
}
} while (FindNextFile(hFindFile, &findFileData) != 0);
FindClose(hFindFile);
return rv;
} }

Binary file not shown.

View file

@ -57,12 +57,20 @@ JRI_GEN_DIR=_jri
MANIFEST_LEVEL=MACROS MANIFEST_LEVEL=MACROS
!IF EXIST(manifest.mn) && !defined(IGNORE_MANIFEST) !IF EXIST(manifest.mn) && !defined(IGNORE_MANIFEST)
!IF "$(WINOS)" == "WIN95"
!IF [$(MOZ_SRC)\ns\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 ["$(MOZ_SRC)\ns\config\mantomak.exe manifest.mn manifest.mnw"] == 0 !IF ["$(MOZ_SRC)\ns\config\mantomak.exe manifest.mn manifest.mnw"] == 0
!INCLUDE <manifest.mnw> !INCLUDE <manifest.mnw>
!ELSE !ELSE
!ERROR ERROR: Unable to generate manifest.mnw from manifest.mn !ERROR ERROR: Unable to generate manifest.mnw from manifest.mn
!ENDIF !ENDIF
!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
@ -106,6 +114,13 @@ TARGETS=$(PROGRAM) $(LIBRARY) $(DLL)
#MAKE_ARGS=all #MAKE_ARGS=all
!endif !endif
!if "$(WINOS)" == "WIN95"
W95MAKE=$(MOZ_SRC)\ns\config\w95make.exe
W32OBJS = $(OBJS:.obj=.obj, )
W32LOBJS = $(OBJS: .= +-.)
!endif
all:: all::
$(NMAKE) -f makefile.win export $(NMAKE) -f makefile.win export
$(NMAKE) -f makefile.win libs $(NMAKE) -f makefile.win libs
@ -155,10 +170,14 @@ MAPFILE=.\$(OBJDIR)\$(MAPFILE)
#// #//
#//------------------------------------------------------------------------ #//------------------------------------------------------------------------
$(DIRS):: $(DIRS)::
!if "$(WINOS)" == "WIN95"
@echo +++ make: cannot recursively make on win95 using command.com, use w95make.
!else
@echo +++ make: %MAKE_ARGS% in $(MAKEDIR)\$@ @echo +++ make: %MAKE_ARGS% in $(MAKEDIR)\$@
@cd $@ @cd $@
@$(NMAKE) -f makefile.win %%MAKE_ARGS%% @$(NMAKE) -f makefile.win %%MAKE_ARGS%%
@cd $(MAKEDIR) @cd $(MAKEDIR)
!endif
!endif # DIRS !endif # DIRS
@ -223,6 +242,10 @@ export:: $(JAVA_DESTPATH) $(JDIRS)
$(JDIRS):: $(JAVA_DESTPATH) $(TMPDIR) $(JDIRS):: $(JAVA_DESTPATH) $(TMPDIR)
!if "$(WINOS)" == "WIN95"
JDIRS = $(JDIRS:/=\)
!endif
!if defined(NO_CAFE) !if defined(NO_CAFE)
$(JDIRS):: $(JDIRS)::
@ -237,7 +260,11 @@ $(JDIRS)::
# compile using symantec cafe's super-speedy compiler! # compile using symantec cafe's super-speedy compiler!
$(JDIRS):: $(JDIRS)::
@echo +++ make: building package $@ @echo +++ make: building package $@
-@mkdir $(MOZ_SRC)\ns\dist\classes\$@ 2> NUL !if "$(WINOS)" == "WIN95"
-@$(MKDIR) $(MOZ_SRC)\ns\dist\classes\$(@:/=\)
!else
-@$(MKDIR) $(MOZ_SRC)\ns\dist\classes\$@ 2> NUL
!endif
$(MOZ_TOOLS)\bin\sj -classpath $(JAVA_DESTPATH);$(JAVA_SOURCEPATH) \ $(MOZ_TOOLS)\bin\sj -classpath $(JAVA_DESTPATH);$(JAVA_SOURCEPATH) \
-d $(JAVA_DESTPATH) $(JAVAC_OPTIMIZER) $@\*.java -d $(JAVA_DESTPATH) $(JAVAC_OPTIMIZER) $@\*.java
@ -284,6 +311,71 @@ LIBRARY=$(OBJDIR)\$(LIBRARY_NAME)$(LIBRARY_SUFFIX).lib
#// Set the MAKE_ARGS variable to indicate the target being built... This is used #// Set the MAKE_ARGS variable to indicate the target being built... This is used
#// when processing subdirectories via the $(DIRS) rule #// when processing subdirectories via the $(DIRS) rule
#// #//
#
# Nasty hack to get around the win95 shell's inability to set
# environment variables whilst in a set of target commands
#
!if "$(WINOS)" == "WIN95"
clean::
!ifdef DIRS
@$(W95MAKE) clean $(MAKEDIR) $(DIRS)
!endif
-$(RM) $(OBJS) $(NOSUCHFILE) NUL 2> NUL
clobber::
!ifdef DIRS
@$(W95MAKE) clobber $(MAKEDIR) $(DIRS)
!endif
-$(RM_R) $(GARBAGE) $(OBJDIR) 2> NUL
clobber_all::
!ifdef DIRS
@$(W95MAKE) clobber_all $(MAKEDIR) $(DIRS)
!endif
-$(RM_R) *.OBJ $(TARGETS) $(GARBAGE) $(OBJDIR) 2> NUL
export::
!ifdef DIRS
@$(W95MAKE) export $(MAKEDIR) $(DIRS)
!endif # DIRS
libs:: w95libs $(LIBRARY)
w95libs::
!ifdef DIRS
@$(W95MAKE) libs $(MAKEDIR) $(DIRS)
!endif # DIRS
install::
!ifdef DIRS
@$(W95MAKE) install $(MAKEDIR) $(DIRS)
!endif # DIRS
depend::
!ifdef DIRS
@$(W95MAKE) depend $(MAKEDIR) $(DIRS)
!endif # DIRS
mangle::
!ifdef DIRS
@$(W95MAKE) mangle $(MAKEDIR) $(DIRS)
!endif # DIRS
$(MAKE_MANGLE)
unmangle::
!ifdef DIRS
@$(W95MAKE) unmangle $(MAKEDIR) $(DIRS)
!endif # DIRS
-$(MAKE_UNMANGLE)
!else
clean:: clean::
@set MAKE_ARGS=$@ @set MAKE_ARGS=$@
@ -311,6 +403,8 @@ unmangle::
depend:: depend::
@set MAKE_ARGS=$@ @set MAKE_ARGS=$@
!endif
#//------------------------------------------------------------------------ #//------------------------------------------------------------------------
#// DEPEND #// DEPEND
#//------------------------------------------------------------------------ #//------------------------------------------------------------------------