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... ) Modified: branches/xmlbuildsystem/reactos/Makefile Modified: branches/xmlbuildsystem/reactos/tools/Makefile Modified: branches/xmlbuildsystem/reactos/tools/cabman/cabinet.cxx Modified: branches/xmlbuildsystem/reactos/tools/cabman/cabinet.h Modified: branches/xmlbuildsystem/reactos/tools/cabman/main.cxx Modified: branches/xmlbuildsystem/reactos/tools/cdmake/Makefile Modified: branches/xmlbuildsystem/reactos/tools/nci/makefile Modified: branches/xmlbuildsystem/reactos/tools/rbuild/backend/mingw/modulehandler .cpp Modified: branches/xmlbuildsystem/reactos/tools/rbuild/makefile Modified: branches/xmlbuildsystem/reactos/tools/wmc/makefile _____
Modified: branches/xmlbuildsystem/reactos/Makefile --- branches/xmlbuildsystem/reactos/Makefile 2005-03-05 00:21:38 UTC (rev 13822) +++ branches/xmlbuildsystem/reactos/Makefile 2005-03-05 05:13:38 UTC (rev 13823) @@ -71,5 +71,7 @@
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 _____
Modified: branches/xmlbuildsystem/reactos/tools/Makefile --- branches/xmlbuildsystem/reactos/tools/Makefile 2005-03-05 00:21:38 UTC (rev 13822) +++ branches/xmlbuildsystem/reactos/tools/Makefile 2005-03-05 05:13:38 UTC (rev 13823) @@ -19,11 +19,12 @@
$(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
BUILDNO_TARGET = \ @@ -45,8 +46,10 @@ $(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 _____
Modified: branches/xmlbuildsystem/reactos/tools/cabman/cabinet.cxx --- branches/xmlbuildsystem/reactos/tools/cabman/cabinet.cxx 2005-03-05 00:21:38 UTC (rev 13822) +++ branches/xmlbuildsystem/reactos/tools/cabman/cabinet.cxx 2005-03-05 05:13:38 UTC (rev 13823) @@ -34,7 +34,7 @@
#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) @@ -70,7 +70,7 @@ 0, // No sharing NULL, // No security CREATE_ALWAYS, // Create or overwrite - FILE_ATTRIBUTE_NORMAL, // Normal file + FILE_ATTRIBUTE_NORMAL, // Normal file NULL); // No attribute template if (FileHandle == INVALID_HANDLE_VALUE) { DPRINT(MID_TRACE, ("ERROR OPENING '%d'.\n", (unsigned int)GetLastError())); @@ -143,7 +143,7 @@ if ((FileHandle = tmpfile()) == NULL) return CAB_STATUS_CANNOT_CREATE; /* - FileHandle = fopen(FullName, "w+b"); + FileHandle = fopen(FullName, "w+b"); if (FileHandle == NULL) { DPRINT(MID_TRACE, ("ERROR '%d'.\n", (unsigned int)errno)); return CAB_STATUS_CANNOT_CREATE; @@ -297,9 +297,15 @@ * 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;
@@ -521,19 +527,19 @@
#if defined(WIN32) FileHandle = CreateFile(ConvertPath(FileName, true), // Open this file - GENERIC_READ, // Open for reading - FILE_SHARE_READ, // Share for reading - NULL, // No security - OPEN_EXISTING, // Existing file only - FILE_ATTRIBUTE_NORMAL, // Normal file - NULL); // No attribute template + GENERIC_READ, // Open for reading + FILE_SHARE_READ, // Share for reading + NULL, // No security + OPEN_EXISTING, // Existing file only + FILE_ATTRIBUTE_NORMAL, // Normal file + NULL); // No attribute template if (FileHandle == INVALID_HANDLE_VALUE) { DPRINT(MID_TRACE, ("Cannot open cabinet reserved file.\n")); return false; } #else /* !WIN32 */ - - FileHandle = fopen(ConvertPath(FileName, true), "rb"); + + FileHandle = fopen(ConvertPath(FileName, true), "rb"); if (FileHandle == NULL) { DPRINT(MID_TRACE, ("Cannot open cabinet reserved file.\n")); return false; @@ -614,19 +620,19 @@
#if defined(WIN32) FileHandle = CreateFile(CabinetName, // Open this file - GENERIC_READ, // Open for reading - FILE_SHARE_READ, // Share for reading - NULL, // No security - OPEN_EXISTING, // Existing file only - FILE_ATTRIBUTE_NORMAL, // Normal file - NULL); // No attribute template - + GENERIC_READ, // Open for reading + FILE_SHARE_READ, // Share for reading + NULL, // No security + OPEN_EXISTING, // Existing file only + FILE_ATTRIBUTE_NORMAL, // Normal file + NULL); // No attribute template + if (FileHandle == INVALID_HANDLE_VALUE) { DPRINT(MID_TRACE, ("Cannot open file.\n")); return CAB_STATUS_CANNOT_OPEN; } #else /* !WIN32 */ - FileHandle = fopen(CabinetName, "rb"); + FileHandle = fopen(CabinetName, "rb"); if (FileHandle == NULL) { DPRINT(MID_TRACE, ("Cannot open file.\n")); return CAB_STATUS_CANNOT_OPEN; @@ -694,7 +700,7 @@ strcpy(CabinetPrev, ""); strcpy(DiskPrev, ""); } - + if ((CABHeader.Flags & CAB_FLAG_HASNEXT) > 0) { /* Read name of next cabinet */ Status = ReadString(CabinetNext, 256); @@ -818,7 +824,7 @@ OnDiskChange(CabinetNext, DiskNext);
Status = Open(); - if (Status != CAB_STATUS_SUCCESS) + if (Status != CAB_STATUS_SUCCESS) return Status;
Search->Next = FileListHead; @@ -925,7 +931,7 @@ } } #else /* !WIN32 */ - DestFile = fopen(DestName, "rb"); + DestFile = fopen(DestName, "rb"); if (DestFile != NULL) { fclose(DestFile); /* If file exists, ask to overwrite file */ @@ -961,7 +967,7 @@ if (!Buffer) { CloseFile(DestFile); DPRINT(MIN_TRACE, ("Insufficient memory.\n")); - return CAB_STATUS_NOMEMORY; + return CAB_STATUS_NOMEMORY; }
/* Call OnExtract event handler */ @@ -1007,7 +1013,7 @@ do { DPRINT(MAX_TRACE, ("Size (%lu bytes).\n", Size));
- if (((Status = ReadBlock(&CFData, sizeof(CFDATA), &BytesRead)) != + if (((Status = ReadBlock(&CFData, sizeof(CFDATA), &BytesRead)) != CAB_STATUS_SUCCESS) || (BytesRead != sizeof(CFDATA))) { CloseFile(DestFile); FreeMemory(Buffer); @@ -1027,7 +1033,7 @@ DPRINT(MAX_TRACE, ("Read: (0x%lX,0x%lX).\n", (long unsigned int)CurrentBuffer, (long unsigned int)Buffer));
- if (((Status = ReadBlock(CurrentBuffer, BytesToRead, &BytesRead)) != + if (((Status = ReadBlock(CurrentBuffer, BytesToRead, &BytesRead)) != CAB_STATUS_SUCCESS) || (BytesToRead != BytesRead)) { CloseFile(DestFile); FreeMemory(Buffer); @@ -1068,7 +1074,7 @@ OnDiskChange(CabinetNext, DiskNext);
Status = Open(); - if (Status != CAB_STATUS_SUCCESS) + if (Status != CAB_STATUS_SUCCESS) return Status;
/* The first data block of the file will not be @@ -1140,7 +1146,7 @@ CurrentDataNode->AbsoluteOffset + sizeof(CFDATA) + CurrentDataNode->Data.CompSize));
- if (((Status = ReadBlock(&CFData, sizeof(CFDATA), &BytesRead)) != + if (((Status = ReadBlock(&CFData, sizeof(CFDATA), &BytesRead)) != CAB_STATUS_SUCCESS) || (BytesRead != sizeof(CFDATA))) { CloseFile(DestFile); FreeMemory(Buffer); @@ -1274,7 +1280,7 @@ InputBuffer = AllocateMemory(CAB_BLOCKSIZE + 12); // This should be enough if ((!OutputBuffer) || (!InputBuffer)) { DPRINT(MIN_TRACE, ("Insufficient memory.\n")); - return CAB_STATUS_NOMEMORY; + return CAB_STATUS_NOMEMORY; } CurrentIBuffer = InputBuffer; CurrentIBufferSize = 0; @@ -1417,14 +1423,14 @@ FILE_SHARE_READ, // Share for reading NULL, // No security OPEN_EXISTING, // File must exist - FILE_ATTRIBUTE_NORMAL, // Normal file + FILE_ATTRIBUTE_NORMAL, // Normal file NULL); // No attribute template if (SourceFile == INVALID_HANDLE_VALUE) { DPRINT(MID_TRACE, ("File not found (%s).\n", FileNode->FileName)); return CAB_STATUS_NOFILE; } #else /* !WIN32 */ - SourceFile = fopen(FileNode->FileName, "rb"); + SourceFile = fopen(FileNode->FileName, "rb"); if (SourceFile == NULL) { DPRINT(MID_TRACE, ("Cannot open cabinet reserved file.\n")); return CAB_STATUS_NOFILE; @@ -1447,7 +1453,7 @@
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;
@@ -1543,7 +1549,7 @@ ContinueFile = true; CreateNewDisk = false;
- DPRINT(MAX_TRACE, ("First on new disk. CurrentIBufferSize (%lu) CurrentOBufferSize (%lu).\n", + DPRINT(MAX_TRACE, ("First on new disk. CurrentIBufferSize (%lu) CurrentOBufferSize (%lu).\n", CurrentIBufferSize, CurrentOBufferSize));
if ((CurrentIBufferSize > 0) || (CurrentOBufferSize > 0)) { @@ -1635,7 +1641,7 @@ } } #else /* !WIN32 */ - FileHandle = fopen(CabinetName, "rb"); + FileHandle = fopen(CabinetName, "rb"); if (FileHandle != NULL) { fclose(FileHandle); /* If file exists, ask to overwrite file */ @@ -1655,7 +1661,7 @@ } #endif
- WriteCabinetHeader(MoreDisks); + WriteCabinetHeader(MoreDisks != 0);
Status = WriteFolderEntries(); if (Status != CAB_STATUS_SUCCESS) @@ -1770,14 +1776,14 @@ FILE_SHARE_READ, // Share for reading NULL, // No security OPEN_EXISTING, // File must exist - FILE_ATTRIBUTE_NORMAL, // Normal file + FILE_ATTRIBUTE_NORMAL, // Normal file NULL); // No attribute template if (SrcFile == INVALID_HANDLE_VALUE) { DPRINT(MID_TRACE, ("File not found (%s).\n", FileNode->FileName)); return CAB_STATUS_CANNOT_OPEN; } #else /* !WIN32 */ - SrcFile = fopen(FileNode->FileName, "rb"); + SrcFile = fopen(FileNode->FileName, "rb"); if (SrcFile == NULL) { DPRINT(MID_TRACE, ("File not found (%s).\n", FileNode->FileName)); return CAB_STATUS_CANNOT_OPEN; @@ -2545,8 +2551,8 @@ 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; if (!OnDiskLabel(PrevCabinetNumber, DiskPrev)) @@ -2672,7 +2678,7 @@ /* Write per-cabinet reserved area if present */ if (CABHeader.Flags & CAB_FLAG_RESERVE) { unsigned long ReservedSize; - + ReservedSize = CabinetReservedFileSize & 0xffff; ReservedSize |= (0 << 16); /* Folder reserved area size */ ReservedSize |= (0 << 24); /* Folder reserved area size */ @@ -2846,7 +2852,7 @@
/* The file could end in the last (split) block and should therefore appear in the next disk too */ - + if ((File->File.FileOffset + File->File.FileSize >= LastBlockStart) && (File->File.FileControlID <= CAB_FILE_MAX_FOLDER) && (BlockIsSplit)) { File->File.FileControlID = CAB_FILE_SPLIT; @@ -2914,7 +2920,7 @@ DataNode = FolderNode->DataListHead; if (DataNode != NULL) Status = ScratchFile->Seek(DataNode->ScratchFilePosition); - + while (DataNode != NULL) { DPRINT(MAX_TRACE, ("Reading block at (0x%lX) CompSize (%d) UncompSize (%d).\n", DataNode->ScratchFilePosition, _____
Modified: branches/xmlbuildsystem/reactos/tools/cabman/cabinet.h --- branches/xmlbuildsystem/reactos/tools/cabman/cabinet.h 2005-03-05 00:21:38 UTC (rev 13822) +++ branches/xmlbuildsystem/reactos/tools/cabman/cabinet.h 2005-03-05 05:13:38 UTC (rev 13823) @@ -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)) { \ _____
Modified: branches/xmlbuildsystem/reactos/tools/cabman/main.cxx --- branches/xmlbuildsystem/reactos/tools/cabman/main.cxx 2005-03-05 00:21:38 UTC (rev 13822) +++ branches/xmlbuildsystem/reactos/tools/cabman/main.cxx 2005-03-05 05:13:38 UTC (rev 13823) @@ -189,9 +189,9 @@
*/ { 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 @@
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 @@ 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 @@ } return true; } else - printf("Cannot not open file: %s\n", GetCabinetName()); + printf("Cannot open file: %s\n", GetCabinetName());
return false; } @@ -443,7 +443,7 @@ } return true; } else - printf("Cannot not open file: %s.\n", GetCabinetName()); + printf("Cannot open file: %s.\n", GetCabinetName());
return false; } _____
Modified: branches/xmlbuildsystem/reactos/tools/cdmake/Makefile --- branches/xmlbuildsystem/reactos/tools/cdmake/Makefile 2005-03-05 00:21:38 UTC (rev 13822) +++ branches/xmlbuildsystem/reactos/tools/cdmake/Makefile 2005-03-05 05:13:38 UTC (rev 13823) @@ -20,5 +20,7 @@
$(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 _____
Modified: branches/xmlbuildsystem/reactos/tools/nci/makefile --- branches/xmlbuildsystem/reactos/tools/nci/makefile 2005-03-05 00:21:38 UTC (rev 13822) +++ branches/xmlbuildsystem/reactos/tools/nci/makefile 2005-03-05 05:13:38 UTC (rev 13823) @@ -19,8 +19,10 @@
$(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 @@ $(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 _____
Modified: branches/xmlbuildsystem/reactos/tools/rbuild/backend/mingw/modulehandler .cpp --- branches/xmlbuildsystem/reactos/tools/rbuild/backend/mingw/modulehandler .cpp 2005-03-05 00:21:38 UTC (rev 13822) +++ branches/xmlbuildsystem/reactos/tools/rbuild/backend/mingw/modulehandler .cpp 2005-03-05 05:13:38 UTC (rev 13823) @@ -1029,14 +1029,16 @@
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 @@ 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 () ); _____
Modified: branches/xmlbuildsystem/reactos/tools/rbuild/makefile --- branches/xmlbuildsystem/reactos/tools/rbuild/makefile 2005-03-05 00:21:38 UTC (rev 13822) +++ branches/xmlbuildsystem/reactos/tools/rbuild/makefile 2005-03-05 05:13:38 UTC (rev 13823) @@ -104,5 +104,7 @@
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 _____
Modified: branches/xmlbuildsystem/reactos/tools/wmc/makefile --- branches/xmlbuildsystem/reactos/tools/wmc/makefile 2005-03-05 00:21:38 UTC (rev 13822) +++ branches/xmlbuildsystem/reactos/tools/wmc/makefile 2005-03-05 05:13:38 UTC (rev 13823) @@ -26,5 +26,7 @@
$(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