per-module clean rules, make cabman more *nix/msys friendly

This fix made it so I was able to successfully build a 22.4MB ReactOS.iso from the xmlbuildsystem branch! ( now to test it... )

svn path=/branches/xmlbuildsystem/; revision=13823
This commit is contained in:
Royce Mitchell III 2005-03-05 05:13:38 +00:00
parent c4f496eb04
commit 83cac15e73
10 changed files with 98 additions and 71 deletions

View file

@ -71,5 +71,7 @@ include$(SEP)reactos$(SEP)bugcodes.h ntoskrnl$(SEP)bugcodes.rc: $(WMC_TARGET) nt
include$(SEP)reactos$(SEP)errcodes.h lib$(SEP)kernel32$(SEP)errcodes.rc: $(WMC_TARGET) lib$(SEP)kernel32$(SEP)kernel32.mc
$(WMC_TARGET) -H include$(SEP)reactos$(SEP)errcodes.h -o lib$(SEP)kernel32$(SEP)errcodes.rc lib$(SEP)kernel32$(SEP)kernel32.mc
clean::
.PHONY: makefile_auto_clean
makefile_auto_clean:
-@$(rm) Makefile.auto $(PREAUTO) 2>$(NUL)
clean: makefile_auto_clean

View file

@ -19,9 +19,10 @@ $(RMKDIR_TARGET): $(RMKDIR_OBJECTS)
$(RMKDIR_OBJECTS): %.o : %.c
${host_gcc} $(RMKDIR_HOST_CFLAGS) -c $< -o $@
clean::
.PHONY: rmkdir_clean
rmkdir_clean:
-@$(rm) $(RMKDIR_TARGET) $(RMKDIR_OBJECTS) 2>$(NUL)
clean: rmkdir_clean
BUILDNO_BASE = tools
@ -45,8 +46,10 @@ $(BUILDNO_TARGET): $(BUILDNO_OBJECTS)
$(BUILDNO_OBJECTS): %.o : %.c
${host_gcc} $(BUILDNO_HOST_CFLAGS) -c $< -o $@
clean::
.PHONY: buildno_clean
buildno_clean:
-@$(rm) $(BUILDNO_TARGET) $(BUILDNO_OBJECTS) 2>$(NUL)
clean: buildno_clean
include$(SEP)reactos$(SEP)buildno.h: $(BUILDNO_TARGET)
$(EXEPREFIX)$(BUILDNO_TARGET) include$(SEP)reactos$(SEP)buildno.h

View file

@ -34,7 +34,7 @@ static long _GetSizeOfFile(FILEHANDLE handle)
#define ReadFileData(handle, buffer, size, bytesread) _ReadFileData(handle, buffer, size, bytesread)
static bool _ReadFileData(FILEHANDLE handle, void* buffer, unsigned long size, unsigned long* bytesread)
{
return ReadFile(handle, buffer, size, bytesread, NULL);
return ReadFile(handle, buffer, size, bytesread, NULL) != 0;
}
#else
#define GetSizeOfFile(handle) _GetSizeOfFile(handle)
@ -297,9 +297,15 @@ CCabinet::CCabinet()
* FUNCTION: Default constructor
*/
{
*CabinetName = '\0';
*CabinetPrev = '\0';
*DiskPrev = '\0';
*CabinetNext = '\0';
*DiskNext = '\0';
*DestPath = '\0';
*CabinetReservedFile = '\0';
FileOpen = false;
strcpy(DestPath, "");
strcpy(CabinetReservedFile, "");
CabinetReservedFileBuffer = NULL;
CabinetReservedFileSize = 0;
@ -1447,7 +1453,7 @@ unsigned long CCabinet::WriteFileToScratchStorage(PCFFILE_NODE FileNode)
FileNode->File.FileOffset = CurrentFolderNode->UncompOffset;
CurrentFolderNode->UncompOffset += TotalBytesLeft;
FileNode->File.FileControlID = NextFolderNumber - 1;
FileNode->File.FileControlID = (unsigned short)(NextFolderNumber - 1);
CurrentFolderNode->Commit = true;
PrevCabinetNumber = CurrentDiskNumber;
@ -1655,7 +1661,7 @@ unsigned long CCabinet::CommitDisk(unsigned long MoreDisks)
}
#endif
WriteCabinetHeader(MoreDisks);
WriteCabinetHeader(MoreDisks != 0);
Status = WriteFolderEntries();
if (Status != CAB_STATUS_SUCCESS)
@ -2545,7 +2551,7 @@ unsigned long CCabinet::InitCabinetHeader()
CABHeader.FileCount = 0; // Not known yet
CABHeader.Flags = 0; // Not known yet
CABHeader.CabinetNumber = CurrentDiskNumber;
CABHeader.CabinetNumber = (unsigned short)CurrentDiskNumber;
if ((CurrentDiskNumber > 0) && (OnCabinetName(PrevCabinetNumber, CabinetPrev))) {
CABHeader.Flags |= CAB_FLAG_HASPREV;

View file

@ -58,6 +58,10 @@
extern unsigned long DebugTraceLevel;
#ifdef _MSC_VER
#define __FUNCTION__ ""
#endif//_MSC_VER
#define DPRINT(_t_, _x_) \
if (((DebugTraceLevel & NORMAL_MASK) >= _t_) || \
((DebugTraceLevel & _t_) > NORMAL_MASK)) { \

View file

@ -189,9 +189,9 @@ void CCABManager::Usage()
*/
{
printf("ReactOS Cabinet Manager - Version %s\n\n", CM_VERSION);
printf("CABMAN [/D | /E] [/A] [/L dir] cabinet [filename ...]\n");
printf("CABMAN /C dirfile [/I] [/RC file]\n");
printf("CABMAN /S cabinet filename\n");
printf("CABMAN [-D | -E] [-A] [-L dir] cabinet [filename ...]\n");
printf("CABMAN -C dirfile [-I] [-RC file]\n");
printf("CABMAN -S cabinet filename\n");
printf(" cabinet Cabinet file.\n");
printf(" filename Name of the file to extract from the cabinet.\n");
printf(" Wild cards and multiple filenames\n");
@ -199,18 +199,18 @@ void CCABManager::Usage()
printf(" dirfile Name of the directive file to use.\n");
printf(" /A Process ALL cabinets. Follows cabinet chain\n");
printf(" -A Process ALL cabinets. Follows cabinet chain\n");
printf(" starting in first cabinet mentioned.\n");
printf(" /C Create cabinet.\n");
printf(" /D Display cabinet directory.\n");
printf(" /E Extract files from cabinet.\n");
printf(" /I Don't create the cabinet, only the .inf file.\n");
printf(" /L dir Location to place extracted or generated files\n");
printf(" -C Create cabinet.\n");
printf(" -D Display cabinet directory.\n");
printf(" -E Extract files from cabinet.\n");
printf(" -I Don't create the cabinet, only the .inf file.\n");
printf(" -L dir Location to place extracted or generated files\n");
printf(" (default is current directory).\n");
printf(" /N Don't create the .inf file, only the cabinet.\n");
printf(" /RC Specify file to put in cabinet reserved area\n");
printf(" -N Don't create the .inf file, only the cabinet.\n");
printf(" -RC Specify file to put in cabinet reserved area\n");
printf(" (size must be less than 64KB).\n");
printf(" /S Create simple cabinet.\n");
printf(" -S Create simple cabinet.\n");
}
bool CCABManager::ParseCmdline(int argc, char* argv[])
@ -230,7 +230,7 @@ bool CCABManager::ParseCmdline(int argc, char* argv[])
ShowUsage = (argc < 2);
for (i = 1; i < argc; i++) {
if (argv[i][0] == '/') {
if (argv[i][0] == '-') {
switch (argv[i][1]) {
case 'a':
case 'A': ProcessAll = true; break;
@ -404,7 +404,7 @@ bool CCABManager::DisplayCabinet()
}
return true;
} else
printf("Cannot not open file: %s\n", GetCabinetName());
printf("Cannot open file: %s\n", GetCabinetName());
return false;
}
@ -443,7 +443,7 @@ bool CCABManager::ExtractFromCabinet()
}
return true;
} else
printf("Cannot not open file: %s.\n", GetCabinetName());
printf("Cannot open file: %s.\n", GetCabinetName());
return false;
}

View file

@ -20,5 +20,7 @@ $(CDMAKE_TARGET): $(CDMAKE_OBJECTS)
$(CDMAKE_OBJECTS): %.o : %.c
${host_gcc} $(CDMAKE_CFLAGS) -c $< -o $@
clean::
.PHONY: cdmake_clean
cdmake_clean:
-@$(rm) $(CDMAKE_TARGET) $(CDMAKE_OBJECTS) 2>$(NUL)
clean: cdmake_clean

View file

@ -19,8 +19,10 @@ $(NCI_TARGET): $(NCI_OBJECTS)
$(NCI_OBJECTS): %.o : %.c
${host_gcc} $(NCI_HOST_CFLAGS) -c $< -o $@
clean::
.PHONY: nci_clean
nci_clean:
-@$(rm) $(NCI_TARGET) $(NCI_OBJECTS) 2>$(NUL)
clean: nci_clean
# WIN32K.SYS
WIN32K_SVC_DB = $(NCI_BASE)$(SEP)w32ksvc.db
@ -53,5 +55,7 @@ $(NCI_SERVICE_FILES): $(NCI_TARGET)
$(WIN32K_GDI_STUBS) \
$(WIN32K_USER_STUBS)
clean::
.PHONY: nci_service_files_clean
nci_service_files_clean:
-@$(rm) $(NCI_SERVICE_FILES) 2>$(NUL)
clean: nci_service_files_clean

View file

@ -1029,14 +1029,16 @@ MingwModuleHandler::GenerateMacrosAndTargets (
clean_files.push_back ( ar_target );
GetCleanTargets ( clean_files, module.files, module.ifs );
fprintf ( fMakefile, "clean::\n\t-@$(rm)" );
fprintf ( fMakefile, ".PHONY: %s_clean\n", module.name.c_str() );
fprintf ( fMakefile, "%s_clean:\n\t-@$(rm)", module.name.c_str() );
for ( size_t i = 0; i < clean_files.size(); i++ )
{
if ( 9==(i%10) )
fprintf ( fMakefile, " 2>$(NUL)\n\t-@$(rm)" );
fprintf ( fMakefile, " %s", clean_files[i].c_str() );
}
fprintf ( fMakefile, " 2>$(NUL)\n\n" );
fprintf ( fMakefile, " 2>$(NUL)\n" );
fprintf ( fMakefile, "clean: %s_clean\n\n", module.name.c_str() );
}
void
@ -2100,11 +2102,11 @@ MingwIsoModuleHandler::GenerateIsoModuleTarget ( const Module& module )
cdDirectories.c_str (),
cdFiles.c_str () );
fprintf ( fMakefile,
"\t${cabman} /C %s /L %s /I\n",
"\t${cabman} -C %s -L %s -I\n",
reactosDff.c_str (),
bootcdReactos.c_str () );
fprintf ( fMakefile,
"\t${cabman} /C %s /RC %s /L %s /N\n",
"\t${cabman} -C %s -RC %s -L %s -N\n",
reactosDff.c_str (),
reactosInf.c_str (),
bootcdReactos.c_str () );

View file

@ -104,5 +104,7 @@ $(RBUILD_TEST_SPECIAL_OBJECTS): %.o: %.cpp
rbuild_test: $(RBUILD_TEST_TARGET)
$(RBUILD_TEST_TARGET)
clean::
.PHONY: rbuild_clean
rbuild_clean:
-@$(rm) $(RBUILD_TARGET) $(RBUILD_OBJECTS) $(RBUILD_TEST_TARGET) $(RBUILD_TEST_OBJECTS) 2>$(NUL)
clean: rbuild_clean

View file

@ -26,5 +26,7 @@ $(WMC_TARGET): $(WMC_OBJECTS)
$(WMC_OBJECTS): %.o : %.c
${host_gcc} $(WMC_HOST_CXXFLAGS) -c $< -o $@
clean::
.PHONY: wmc_clean
wmc_clean:
-@$(rm) $(WMC_TARGET) $(WMC_OBJECTS) 2>$(NUL)
clean: wmc_clean