mirror of
https://github.com/ZDoom/gzdoom.git
synced 2024-11-22 04:01:31 +00:00
Upgraded ccdv-win32.c and the Makefiles so that they are fully functional under MSYS.
SVN r286 (trunk)
This commit is contained in:
parent
b8312a9bd8
commit
55e299e4b3
14 changed files with 331 additions and 119 deletions
|
@ -7,6 +7,15 @@
|
||||||
# Copyright (C) 1995-2003 Jean-loup Gailly.
|
# Copyright (C) 1995-2003 Jean-loup Gailly.
|
||||||
# For conditions of distribution and use, see copyright notice in zlib.h
|
# For conditions of distribution and use, see copyright notice in zlib.h
|
||||||
|
|
||||||
|
ifeq (Windows_NT,$(OS))
|
||||||
|
WIN=1
|
||||||
|
WINCMD=1
|
||||||
|
endif
|
||||||
|
ifeq (msys,$(OSTYPE))
|
||||||
|
WIN=1
|
||||||
|
WINCMD=0
|
||||||
|
endif
|
||||||
|
|
||||||
STATICLIB = libflac.a
|
STATICLIB = libflac.a
|
||||||
|
|
||||||
#LOC = -DASMV
|
#LOC = -DASMV
|
||||||
|
@ -44,8 +53,13 @@ $(STATICLIB): $(OBJS)
|
||||||
.PHONY: clean
|
.PHONY: clean
|
||||||
|
|
||||||
clean:
|
clean:
|
||||||
|
ifeq (1,$(WINCMD))
|
||||||
-del /q /f $(STATICLIB) 2>nul
|
-del /q /f $(STATICLIB) 2>nul
|
||||||
-del /q /f *.o 2>nul
|
-del /q /f *.o 2>nul
|
||||||
|
else
|
||||||
|
rm -f $(STATICLIB)
|
||||||
|
rm -f *.o
|
||||||
|
endif
|
||||||
|
|
||||||
cpu_asm.o: ia32/cpu_asm.nasm
|
cpu_asm.o: ia32/cpu_asm.nasm
|
||||||
$(CCDV) $(NASM) -o $@ $(NASMFLAGS) $<
|
$(CCDV) $(NASM) -o $@ $(NASMFLAGS) $<
|
||||||
|
|
7
Makefile
7
Makefile
|
@ -1,4 +1,11 @@
|
||||||
ifeq (Windows_NT,$(OS))
|
ifeq (Windows_NT,$(OS))
|
||||||
|
WIN=1
|
||||||
|
endif
|
||||||
|
ifeq (msys,$(OSTYPE))
|
||||||
|
WIN=1
|
||||||
|
endif
|
||||||
|
|
||||||
|
ifeq (1,$(WIN))
|
||||||
include Makefile.mgw
|
include Makefile.mgw
|
||||||
else
|
else
|
||||||
include Makefile.linux
|
include Makefile.linux
|
||||||
|
|
16
Makefile.mgw
16
Makefile.mgw
|
@ -25,23 +25,27 @@ basetools: ccdv.exe
|
||||||
$(MAKE) -C tools/makewad
|
$(MAKE) -C tools/makewad
|
||||||
$(MAKE) -C tools/dehsupp
|
$(MAKE) -C tools/dehsupp
|
||||||
$(MAKE) -C tools/xlatcc
|
$(MAKE) -C tools/xlatcc
|
||||||
$(MAKE) -C wadsrc
|
$(MAKE) -C wadsrc -f Makefile.mgw
|
||||||
$(MAKE) -C flac -f Makefile.mgw
|
$(MAKE) -C flac -f Makefile.mgw
|
||||||
|
|
||||||
cleanexe:
|
cleanexe:
|
||||||
@$(MAKE) -C . -f Makefile.mingw clean
|
@$(MAKE) -C . -f Makefile.mingw clean
|
||||||
|
|
||||||
clean:
|
clean:
|
||||||
@$(MAKE) -C tools/lemon -f Makefile clean
|
@$(MAKE) -C tools/lemon clean
|
||||||
@$(MAKE) -C tools/re2c -f Makefile clean
|
@$(MAKE) -C tools/re2c clean
|
||||||
@$(MAKE) -C tools/dehsupp -f Makefile clean
|
@$(MAKE) -C tools/dehsupp clean
|
||||||
@$(MAKE) -C tools/makewad -f Makefile clean
|
@$(MAKE) -C tools/makewad clean
|
||||||
@$(MAKE) -C tools/xlatcc -f Makefile clean
|
@$(MAKE) -C tools/xlatcc clean
|
||||||
@$(MAKE) -C wadsrc -f Makefile.mgw clean
|
@$(MAKE) -C wadsrc -f Makefile.mgw clean
|
||||||
@$(MAKE) -C . -f Makefile.mingw clean
|
@$(MAKE) -C . -f Makefile.mingw clean
|
||||||
@$(MAKE) -C zlib -f Makefile.mgw clean
|
@$(MAKE) -C zlib -f Makefile.mgw clean
|
||||||
@$(MAKE) -C flac -f Makefile.mgw clean
|
@$(MAKE) -C flac -f Makefile.mgw clean
|
||||||
|
ifeq (msys,$(OSTYPE))
|
||||||
|
rm -f ccdv.exe
|
||||||
|
else
|
||||||
del /q /f ccdv.exe 2>nul
|
del /q /f ccdv.exe 2>nul
|
||||||
|
endif
|
||||||
|
|
||||||
ccdv.exe: ccdv-win32.c
|
ccdv.exe: ccdv-win32.c
|
||||||
@gcc -Os -s -nostdlib -fomit-frame-pointer -o ccdv.exe ccdv-win32.c -lkernel32 -luser32
|
@gcc -Os -s -nostdlib -fomit-frame-pointer -o ccdv.exe ccdv-win32.c -lkernel32 -luser32
|
||||||
|
|
|
@ -4,6 +4,12 @@
|
||||||
# Where did you install the FMOD API to? Change this line so that the build process can find it.
|
# Where did you install the FMOD API to? Change this line so that the build process can find it.
|
||||||
FMODDIR = "c:/program files/fmodapi375win"
|
FMODDIR = "c:/program files/fmodapi375win"
|
||||||
|
|
||||||
|
ifeq (msys,$(OSTYPE))
|
||||||
|
WINCMD=0
|
||||||
|
else
|
||||||
|
WINCMD=1
|
||||||
|
endif
|
||||||
|
|
||||||
CC ?= gcc
|
CC ?= gcc
|
||||||
CXX ?= g++
|
CXX ?= g++
|
||||||
|
|
||||||
|
@ -93,6 +99,7 @@ $(OBJDIR)/%.o : %.rc
|
||||||
$(TARGET): testobjdir updaterev $(OBJS)
|
$(TARGET): testobjdir updaterev $(OBJS)
|
||||||
$(CCDV) $(CXX) -o $@ $(OBJS) $(LDFLAGS)
|
$(CCDV) $(CXX) -o $@ $(OBJS) $(LDFLAGS)
|
||||||
|
|
||||||
|
ifeq (1,$(WINCMD))
|
||||||
clean:
|
clean:
|
||||||
-del /q /f $(RELEASETARGET) 2>nul
|
-del /q /f $(RELEASETARGET) 2>nul
|
||||||
-del /q /f $(DEBUGTARGET) 2>nul
|
-del /q /f $(DEBUGTARGET) 2>nul
|
||||||
|
@ -102,9 +109,24 @@ clean:
|
||||||
cleandep:
|
cleandep:
|
||||||
-del /q /f $(DEBUGOBJDIR)\*.d 2>nul
|
-del /q /f $(DEBUGOBJDIR)\*.d 2>nul
|
||||||
-del /q /f $(RELEASEOBJDIR)\*.d 2>nul
|
-del /q /f $(RELEASEOBJDIR)\*.d 2>nul
|
||||||
|
else
|
||||||
|
clean:
|
||||||
|
rm -f $(RELEASETARGET)
|
||||||
|
rm -f $(DEBUGTARGET)
|
||||||
|
rm -fr $(DEBUGOBJDIR)
|
||||||
|
rm -fr $(RELEASEOBJDIR)
|
||||||
|
|
||||||
|
cleandep:
|
||||||
|
rm -f $(DEBUGOBJDIR)\*.d
|
||||||
|
rm -f $(RELEASEOBJDIR)\*.d
|
||||||
|
endif
|
||||||
|
|
||||||
testobjdir:
|
testobjdir:
|
||||||
|
ifeq (1,$(WINCMD))
|
||||||
-@if not exist $(OBJDIR) mkdir $(OBJDIR)
|
-@if not exist $(OBJDIR) mkdir $(OBJDIR)
|
||||||
|
else
|
||||||
|
-@if [ ! -e $(OBJDIR) ]; then mkdir $(OBJDIR); fi
|
||||||
|
endif
|
||||||
|
|
||||||
updaterev: tools/updaterevision/updaterevision.exe
|
updaterev: tools/updaterevision/updaterevision.exe
|
||||||
@tools/updaterevision/updaterevision . src/svnrevision.h
|
@tools/updaterevision/updaterevision . src/svnrevision.h
|
||||||
|
|
190
ccdv-win32.c
190
ccdv-win32.c
|
@ -22,6 +22,16 @@
|
||||||
#define COLOR_FAILURE (FOREGROUND_RED|FOREGROUND_INTENSITY) /* red */
|
#define COLOR_FAILURE (FOREGROUND_RED|FOREGROUND_INTENSITY) /* red */
|
||||||
#define COLOR_WARNING (FOREGROUND_RED|FOREGROUND_GREEN|FOREGROUND_INTENSITY) /* yellow */
|
#define COLOR_WARNING (FOREGROUND_RED|FOREGROUND_GREEN|FOREGROUND_INTENSITY) /* yellow */
|
||||||
#define COLOR_COMMAND (FOREGROUND_GREEN|FOREGROUND_BLUE|FOREGROUND_INTENSITY) /* cyan */
|
#define COLOR_COMMAND (FOREGROUND_GREEN|FOREGROUND_BLUE|FOREGROUND_INTENSITY) /* cyan */
|
||||||
|
#define COLOR_ERROROUTPUT (FOREGROUND_RED|FOREGROUND_BLUE|FOREGROUND_INTENSITY) /* magenta */
|
||||||
|
#define COLOR_WARNINGOUTPUT (FOREGROUND_RED|FOREGROUND_GREEN|FOREGROUND_BLUE|FOREGROUND_INTENSITY) /* white */
|
||||||
|
|
||||||
|
#define SETCOLOR_SUCCESS "\033[1;32m" /* green */
|
||||||
|
#define SETCOLOR_FAILURE "\033[1;31m" /* red */
|
||||||
|
#define SETCOLOR_WARNING "\033[0;33m" /* dark yellow */
|
||||||
|
#define SETCOLOR_COMMAND "\033[1;35m" /* magenta */
|
||||||
|
#define SETCOLOR_ERROROUTPUT "\033[1;31m" /* red */
|
||||||
|
#define SETCOLOR_WARNINGOUTPUT "\033[1;39m" /* bold */
|
||||||
|
#define SETCOLOR_NORMAL "\033[0;39m" /* normal */
|
||||||
|
|
||||||
#define TEXT_BLOCK_SIZE 8192
|
#define TEXT_BLOCK_SIZE 8192
|
||||||
#define INDENT 2
|
#define INDENT 2
|
||||||
|
@ -36,6 +46,7 @@ char *gArLibraryTarget;
|
||||||
BOOL gDumpCmdArgs;
|
BOOL gDumpCmdArgs;
|
||||||
char *gArgsStr;
|
char *gArgsStr;
|
||||||
int gColumns;
|
int gColumns;
|
||||||
|
BOOL gRxvt;
|
||||||
int gExitStatus;
|
int gExitStatus;
|
||||||
HANDLE gHeap;
|
HANDLE gHeap;
|
||||||
|
|
||||||
|
@ -50,25 +61,47 @@ HANDLE gStdOut, gStdErr;
|
||||||
void REGPARM(1) perror(const char *string)
|
void REGPARM(1) perror(const char *string)
|
||||||
{
|
{
|
||||||
char *buffer;
|
char *buffer;
|
||||||
|
char errcode[9];
|
||||||
DWORD error = GetLastError();
|
DWORD error = GetLastError();
|
||||||
DWORD len = FormatMessageA(FORMAT_MESSAGE_ALLOCATE_BUFFER|FORMAT_MESSAGE_FROM_SYSTEM|FORMAT_MESSAGE_IGNORE_INSERTS,
|
DWORD len = FormatMessageA(FORMAT_MESSAGE_ALLOCATE_BUFFER|FORMAT_MESSAGE_FROM_SYSTEM|FORMAT_MESSAGE_IGNORE_INSERTS,
|
||||||
NULL, error, 0, (LPTSTR)&buffer, 0, NULL);
|
NULL, error, 0, (LPTSTR)&buffer, 0, NULL);
|
||||||
DWORD wrote;
|
DWORD wrote;
|
||||||
WriteFile (gStdErr, string, lstrlen(string), &wrote, NULL);
|
WriteFile (gStdErr, string, lstrlen(string), &wrote, NULL);
|
||||||
if(len == 0)
|
|
||||||
{
|
|
||||||
char errcode[9];
|
|
||||||
wsprintf(errcode, "%08x", error);
|
wsprintf(errcode, "%08x", error);
|
||||||
WriteFile (gStdErr, ": Error ", 8, &wrote, NULL);
|
WriteFile (gStdErr, ": Error 0x", 10, &wrote, NULL);
|
||||||
WriteFile (gStdErr, errcode, 8, &wrote, NULL);
|
WriteFile (gStdErr, errcode, 8, &wrote, NULL);
|
||||||
}
|
if(len != 0)
|
||||||
else
|
|
||||||
{
|
{
|
||||||
WriteFile (gStdErr, ": ", 2, &wrote, NULL);
|
WriteFile (gStdErr, "\n", 1, &wrote, NULL);
|
||||||
WriteFile (gStdErr, buffer, len, &wrote, NULL);
|
WriteFile (gStdErr, buffer, len, &wrote, NULL);
|
||||||
LocalFree(buffer);
|
LocalFree(buffer);
|
||||||
}
|
}
|
||||||
WriteFile (gStdErr, "\n", 1, &wrote, NULL);
|
WriteFile (gStdErr, "\n", 1, &wrote, NULL);
|
||||||
|
gColumns = 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
static int REGPARM(1) str2int(const char *string)
|
||||||
|
{
|
||||||
|
int out = 0;
|
||||||
|
|
||||||
|
while (*string >= '0' && *string <= '9')
|
||||||
|
{
|
||||||
|
out = out * 10 + *string++ - '0';
|
||||||
|
}
|
||||||
|
return out;
|
||||||
|
}
|
||||||
|
|
||||||
|
static void Writef(HANDLE hFile, const char *fmt, ...)
|
||||||
|
{
|
||||||
|
char buf[1024];
|
||||||
|
int buflen;
|
||||||
|
va_list arglist;
|
||||||
|
DWORD wrote;
|
||||||
|
|
||||||
|
va_start(arglist, fmt);
|
||||||
|
buflen = wvsprintf(buf, fmt, arglist);
|
||||||
|
va_end(arglist);
|
||||||
|
WriteFile(hFile, buf, buflen, &wrote, NULL);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void DumpFormattedOutput()
|
static void DumpFormattedOutput()
|
||||||
|
@ -82,19 +115,43 @@ static void DumpFormattedOutput()
|
||||||
int curcol;
|
int curcol;
|
||||||
int i;
|
int i;
|
||||||
|
|
||||||
if(!GetConsoleScreenBufferInfo(gStdOut, &info))
|
|
||||||
{
|
|
||||||
WriteFile(gStdOut, gBuf, lstrlen(gBuf), &out, NULL);
|
|
||||||
WriteFile(gStdOut, "\n", 1, &out, NULL);
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
for(i = 0; i < 8; ++i)
|
for(i = 0; i < 8; ++i)
|
||||||
{
|
{
|
||||||
spaces[i] = ' ';
|
spaces[i] = ' ';
|
||||||
}
|
}
|
||||||
spaces[i] = '\0';
|
spaces[i] = '\0';
|
||||||
|
|
||||||
|
if(gRxvt)
|
||||||
|
{
|
||||||
|
curcol = 0;
|
||||||
|
saved = NULL;
|
||||||
|
if(gDumpCmdArgs)
|
||||||
|
{
|
||||||
|
Writef(gStdOut, SETCOLOR_COMMAND "%s" SETCOLOR_NORMAL "\n", gArgsStr);
|
||||||
|
for(i = gColumns; i > 0; i -= 7)
|
||||||
|
{
|
||||||
|
WriteFile(gStdOut, "=======", i > 7 ? 7 : i, &out, NULL);
|
||||||
|
}
|
||||||
|
WriteFile(gStdOut, SETCOLOR_ERROROUTPUT, sizeof(SETCOLOR_ERROROUTPUT), &out, NULL);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
WriteFile(gStdOut, SETCOLOR_WARNINGOUTPUT, sizeof(SETCOLOR_WARNINGOUTPUT), &out, NULL);
|
||||||
|
}
|
||||||
|
WriteFile(gStdOut, gBuf + lstrlen(gArgsStr), lstrlen(gBuf + lstrlen(gArgsStr)), &out, NULL);
|
||||||
|
WriteFile(gStdOut, SETCOLOR_NORMAL, sizeof(SETCOLOR_NORMAL), &out, NULL);
|
||||||
|
HeapFree(gHeap, 0, gBuf);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
if(!GetConsoleScreenBufferInfo(gStdOut, &info))
|
||||||
|
{
|
||||||
|
WriteFile(gStdOut, gBuf, lstrlen(gBuf), &out, NULL);
|
||||||
|
WriteFile(gStdOut, "\n", 1, &out, NULL);
|
||||||
|
HeapFree(gHeap, 0, gBuf);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
color = info.wAttributes & ~(FOREGROUND_RED|FOREGROUND_GREEN|FOREGROUND_BLUE|FOREGROUND_INTENSITY);
|
color = info.wAttributes & ~(FOREGROUND_RED|FOREGROUND_GREEN|FOREGROUND_BLUE|FOREGROUND_INTENSITY);
|
||||||
curcol = 0;
|
curcol = 0;
|
||||||
saved = NULL;
|
saved = NULL;
|
||||||
|
@ -103,41 +160,19 @@ static void DumpFormattedOutput()
|
||||||
SetConsoleTextAttribute(gStdOut, color | COLOR_COMMAND);
|
SetConsoleTextAttribute(gStdOut, color | COLOR_COMMAND);
|
||||||
WriteConsole(gStdOut, gBuf, lstrlen(gArgsStr)+1, &out, NULL);
|
WriteConsole(gStdOut, gBuf, lstrlen(gArgsStr)+1, &out, NULL);
|
||||||
SetConsoleTextAttribute(gStdOut, info.wAttributes);
|
SetConsoleTextAttribute(gStdOut, info.wAttributes);
|
||||||
|
for(i = gColumns; i > 0; i -= 7)
|
||||||
|
{
|
||||||
|
WriteConsole(gStdOut, "=======", i > 7 ? 7 : i, &out, NULL);
|
||||||
}
|
}
|
||||||
for(cp = gBuf + lstrlen(gArgsStr) + 1;; cp++)
|
color |= COLOR_ERROROUTPUT;
|
||||||
{
|
|
||||||
if(*cp == '\0')
|
|
||||||
{
|
|
||||||
if(saved != NULL)
|
|
||||||
{
|
|
||||||
cp = saved;
|
|
||||||
saved = NULL;
|
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
break;
|
|
||||||
}
|
|
||||||
if(*cp == '\r')
|
|
||||||
continue;
|
|
||||||
if(*cp == '\t')
|
|
||||||
{
|
{
|
||||||
saved = cp + 1;
|
color |= COLOR_WARNINGOUTPUT;
|
||||||
cp = spaces + 8 - (8 - ((curcol - INDENT - 1) % 8));
|
|
||||||
}
|
|
||||||
if(curcol == 0)
|
|
||||||
{
|
|
||||||
for(i = INDENT; --i >= 0;)
|
|
||||||
WriteConsole(gStdOut, " " ,1, &out, NULL);
|
|
||||||
curcol = INDENT;
|
|
||||||
}
|
|
||||||
WriteConsole(gStdOut, cp, 1, &out, NULL);
|
|
||||||
if(++curcol == (gColumns - 1))
|
|
||||||
{
|
|
||||||
WriteConsole(gStdOut, "\n", 1, &out, NULL);
|
|
||||||
curcol = 0;
|
|
||||||
}
|
|
||||||
else if(*cp == '\n')
|
|
||||||
curcol = 0;
|
|
||||||
}
|
}
|
||||||
|
SetConsoleTextAttribute(gStdOut, color);
|
||||||
|
WriteConsole(gStdOut, gBuf + lstrlen(gArgsStr) + 1, lstrlen(gBuf + lstrlen(gArgsStr) + 1), &out, NULL);
|
||||||
|
SetConsoleTextAttribute(gStdOut, info.wAttributes);
|
||||||
HeapFree(gHeap, 0, gBuf);
|
HeapFree(gHeap, 0, gBuf);
|
||||||
} /* DumpFormattedOutput */
|
} /* DumpFormattedOutput */
|
||||||
|
|
||||||
|
@ -225,9 +260,12 @@ static int REGPARM(2) Slurp(HANDLE fd, HANDLE hStdOut)
|
||||||
}
|
}
|
||||||
|
|
||||||
if(hStdOut != NULL)
|
if(hStdOut != NULL)
|
||||||
|
{
|
||||||
|
if(!gRxvt)
|
||||||
{
|
{
|
||||||
GetConsoleScreenBufferInfo(hStdOut, &info);
|
GetConsoleScreenBufferInfo(hStdOut, &info);
|
||||||
info.dwCursorPosition.X = info.dwSize.X - 9;
|
info.dwCursorPosition.X = info.dwSize.X - 9;
|
||||||
|
}
|
||||||
if(GetConsoleCursorInfo(hStdOut, &cursorInfo))
|
if(GetConsoleCursorInfo(hStdOut, &cursorInfo))
|
||||||
{
|
{
|
||||||
cursorInfo.bVisible = FALSE;
|
cursorInfo.bVisible = FALSE;
|
||||||
|
@ -247,9 +285,16 @@ static int REGPARM(2) Slurp(HANDLE fd, HANDLE hStdOut)
|
||||||
{
|
{
|
||||||
case WAIT_TIMEOUT:
|
case WAIT_TIMEOUT:
|
||||||
if(hStdOut != NULL)
|
if(hStdOut != NULL)
|
||||||
|
{
|
||||||
|
if(!gRxvt)
|
||||||
{
|
{
|
||||||
SetConsoleCursorPosition(hStdOut, info.dwCursorPosition);
|
SetConsoleCursorPosition(hStdOut, info.dwCursorPosition);
|
||||||
WriteConsoleA(hStdOut, trailcp, 1, &out, NULL);
|
WriteConsoleA(hStdOut, trailcp, 1, &out, NULL);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
Writef(hStdOut, "\033[999C\033[9D%c", *trailcp);
|
||||||
|
}
|
||||||
if(*++trailcp == '\0')
|
if(*++trailcp == '\0')
|
||||||
trailcp = trail;
|
trailcp = trail;
|
||||||
}
|
}
|
||||||
|
@ -284,6 +329,8 @@ static int REGPARM(2) Slurp(HANDLE fd, HANDLE hStdOut)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if(hStdOut != NULL)
|
if(hStdOut != NULL)
|
||||||
|
{
|
||||||
|
if(!gRxvt)
|
||||||
{
|
{
|
||||||
info.dwCursorPosition.X = 0;
|
info.dwCursorPosition.X = 0;
|
||||||
SetConsoleCursorPosition(hStdOut, info.dwCursorPosition);
|
SetConsoleCursorPosition(hStdOut, info.dwCursorPosition);
|
||||||
|
@ -319,6 +366,24 @@ static int REGPARM(2) Slurp(HANDLE fd, HANDLE hStdOut)
|
||||||
WriteConsole(hStdOut, "\n", 1, &out, NULL);
|
WriteConsole(hStdOut, "\n", 1, &out, NULL);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
|
{
|
||||||
|
WriteFile(hStdOut, "\033[255D", 6, &out, NULL);
|
||||||
|
WriteAction(hStdOut, ": ");
|
||||||
|
if(gExitStatus == 0)
|
||||||
|
{
|
||||||
|
Writef(hStdOut, "\033[999C\033[10D[%sOK%s]",
|
||||||
|
((gNBufUsed - strlen(gArgsStr)) <
|
||||||
|
4) ? SETCOLOR_SUCCESS : SETCOLOR_WARNING, SETCOLOR_NORMAL);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
Writef(hStdOut, "\033[999C\033[10D[%sERROR%s]\n",
|
||||||
|
SETCOLOR_FAILURE, SETCOLOR_NORMAL);
|
||||||
|
gDumpCmdArgs = 1; /* print cmd when there are errors */
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else
|
||||||
{
|
{
|
||||||
gDumpCmdArgs = (gExitStatus != 0); /* print cmd when there are errors */
|
gDumpCmdArgs = (gExitStatus != 0); /* print cmd when there are errors */
|
||||||
}
|
}
|
||||||
|
@ -457,6 +522,38 @@ void mainCRTStartup(void)
|
||||||
Usage();
|
Usage();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if(GetConsoleScreenBufferInfo(gStdOut, &bufferInfo))
|
||||||
|
{
|
||||||
|
gColumns = bufferInfo.dwSize.X;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
char envbuf[16];
|
||||||
|
DWORD envlen;
|
||||||
|
|
||||||
|
// Check for MSYS by checking for an rxvt COLORTERM.
|
||||||
|
envlen = GetEnvironmentVariable("COLORTERM", envbuf, sizeof(envbuf));
|
||||||
|
if(envlen > 0 && envlen < sizeof(envbuf) - 1)
|
||||||
|
{
|
||||||
|
if(lstrcmp(envbuf, "rxvt") == 0)
|
||||||
|
{
|
||||||
|
gRxvt = TRUE;
|
||||||
|
|
||||||
|
// We're in an rxvt, so check the number of columns.
|
||||||
|
// Unfortunately, COLUMNS is not exported by default by MSYS.
|
||||||
|
envlen = GetEnvironmentVariable("COLUMNS", envbuf, sizeof(envbuf));
|
||||||
|
if(envlen > 0 && envlen < sizeof(envbuf) - 1)
|
||||||
|
{
|
||||||
|
gColumns = str2int(envbuf);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
gColumns = 80;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
// "Running *argv[1]*"
|
// "Running *argv[1]*"
|
||||||
ext = Basename(arg, arglen);
|
ext = Basename(arg, arglen);
|
||||||
extlen = arglen - (ext - arg);
|
extlen = arglen - (ext - arg);
|
||||||
|
@ -620,15 +717,14 @@ void mainCRTStartup(void)
|
||||||
}
|
}
|
||||||
CloseHandle(gCCP.hThread);
|
CloseHandle(gCCP.hThread);
|
||||||
|
|
||||||
if(GetConsoleScreenBufferInfo(gStdOut, &bufferInfo))
|
if(!gRxvt)
|
||||||
{
|
{
|
||||||
gColumns = bufferInfo.dwSize.X;
|
|
||||||
if(Slurp(pipeRdDup, gStdOut) < 0)
|
if(Slurp(pipeRdDup, gStdOut) < 0)
|
||||||
goto panic;
|
goto panic;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
if(Slurp(pipeRdDup, NULL) < 0)
|
if(Slurp(pipeRdDup, gStdOut) < 0)
|
||||||
goto panic;
|
goto panic;
|
||||||
}
|
}
|
||||||
DumpFormattedOutput();
|
DumpFormattedOutput();
|
||||||
|
|
|
@ -1,13 +1,21 @@
|
||||||
ifeq (Windows_NT,$(OS))
|
ifeq (Windows_NT,$(OS))
|
||||||
|
WIN=1
|
||||||
|
WINCMD=1
|
||||||
|
endif
|
||||||
|
ifeq (msys,$(OSTYPE))
|
||||||
|
WIN=1
|
||||||
|
WINCMD=0
|
||||||
|
endif
|
||||||
|
|
||||||
|
ifeq (1,$(WIN))
|
||||||
EXE = dehsupp.exe
|
EXE = dehsupp.exe
|
||||||
CCDV = @../../ccdv
|
|
||||||
CFLAGS = $(LOC) -Os -Wall -fomit-frame-pointer
|
CFLAGS = $(LOC) -Os -Wall -fomit-frame-pointer
|
||||||
else
|
else
|
||||||
EXE = dehsupp
|
EXE = dehsupp
|
||||||
CCDV = @../../ccdv
|
|
||||||
CFLAGS = -Dstricmp=strcasecmp -Dstrnicmp=strncasecmp -Os -Wall -fomit-frame-pointer
|
CFLAGS = -Dstricmp=strcasecmp -Dstrnicmp=strncasecmp -Os -Wall -fomit-frame-pointer
|
||||||
endif
|
endif
|
||||||
|
|
||||||
|
CCDV = @../../ccdv
|
||||||
CC = gcc
|
CC = gcc
|
||||||
LDFLAGS = -s
|
LDFLAGS = -s
|
||||||
|
|
||||||
|
@ -26,7 +34,7 @@ $(EXE): $(OBJS)
|
||||||
.PHONY: clean
|
.PHONY: clean
|
||||||
|
|
||||||
clean:
|
clean:
|
||||||
ifeq (Windows_NT,$(OS))
|
ifeq (1,$(WINCMD))
|
||||||
-del /q /f $(EXE) 2>nul
|
-del /q /f $(EXE) 2>nul
|
||||||
-del /q /f *.o 2>nul
|
-del /q /f *.o 2>nul
|
||||||
else
|
else
|
||||||
|
|
|
@ -1,13 +1,21 @@
|
||||||
ifeq (Windows_NT,$(OS))
|
ifeq (Windows_NT,$(OS))
|
||||||
|
WIN=1
|
||||||
|
WINCMD=1
|
||||||
|
endif
|
||||||
|
ifeq (msys,$(OSTYPE))
|
||||||
|
WIN=1
|
||||||
|
WINCMD=0
|
||||||
|
endif
|
||||||
|
|
||||||
|
ifeq (1,$(WIN))
|
||||||
EXE = lemon.exe
|
EXE = lemon.exe
|
||||||
CCDV = @../../ccdv
|
|
||||||
CFLAGS = $(LOC) -D_WIN32 -Os -Wall -Wno-implicit -fomit-frame-pointer
|
CFLAGS = $(LOC) -D_WIN32 -Os -Wall -Wno-implicit -fomit-frame-pointer
|
||||||
else
|
else
|
||||||
EXE = lemon
|
EXE = lemon
|
||||||
CCDV = @../../ccdv
|
|
||||||
CFLAGS = -Os -Wall -Wno-implicit -fomit-frame-pointer
|
CFLAGS = -Os -Wall -Wno-implicit -fomit-frame-pointer
|
||||||
endif
|
endif
|
||||||
|
|
||||||
|
CCDV = @../../ccdv
|
||||||
CC = gcc
|
CC = gcc
|
||||||
LDFLAGS = -s
|
LDFLAGS = -s
|
||||||
|
|
||||||
|
@ -24,7 +32,7 @@ $(EXE): $(OBJS)
|
||||||
.PHONY: clean
|
.PHONY: clean
|
||||||
|
|
||||||
clean:
|
clean:
|
||||||
ifeq (Windows_NT,$(OS))
|
ifeq (1,$(WINCMD))
|
||||||
-del /q /f $(EXE) 2>nul
|
-del /q /f $(EXE) 2>nul
|
||||||
-del /q /f *.o 2>nul
|
-del /q /f *.o 2>nul
|
||||||
else
|
else
|
||||||
|
|
|
@ -1,17 +1,25 @@
|
||||||
ifeq (Windows_NT,$(OS))
|
ifeq (Windows_NT,$(OS))
|
||||||
|
WIN=1
|
||||||
|
WINCMD=1
|
||||||
|
endif
|
||||||
|
ifeq (msys,$(OSTYPE))
|
||||||
|
WIN=1
|
||||||
|
WINCMD=0
|
||||||
|
endif
|
||||||
|
|
||||||
|
ifeq (1,$(WIN))
|
||||||
EXE = makewad.exe
|
EXE = makewad.exe
|
||||||
CCDV = @../../ccdv
|
|
||||||
CFLAGS = -Os -Wall -fomit-frame-pointer
|
CFLAGS = -Os -Wall -fomit-frame-pointer
|
||||||
LDFLAGS = -s -L../../zlib/ -lz
|
LDFLAGS = -s -L../../zlib/ -lz
|
||||||
ZLIB = ../../zlib/libz.a
|
ZLIB = ../../zlib/libz.a
|
||||||
else
|
else
|
||||||
EXE = makewad
|
EXE = makewad
|
||||||
CCDV = @../../ccdv
|
|
||||||
CFLAGS = -Dstricmp=strcasecmp -Dstrnicmp=strncasecmp -Os -Wall -fomit-frame-pointer
|
CFLAGS = -Dstricmp=strcasecmp -Dstrnicmp=strncasecmp -Os -Wall -fomit-frame-pointer
|
||||||
LDFLAGS = -s -lz
|
LDFLAGS = -s -lz
|
||||||
ZLIB =
|
ZLIB =
|
||||||
endif
|
endif
|
||||||
|
|
||||||
|
CCDV = @../../ccdv
|
||||||
CC = gcc
|
CC = gcc
|
||||||
|
|
||||||
OBJS = makewad.o ioapi.o zip.o
|
OBJS = makewad.o ioapi.o zip.o
|
||||||
|
@ -24,7 +32,7 @@ all: $(EXE)
|
||||||
$(EXE): $(OBJS) $(ZLIB)
|
$(EXE): $(OBJS) $(ZLIB)
|
||||||
$(CCDV) $(CC) -o $(EXE) $(OBJS) $(LDFLAGS)
|
$(CCDV) $(CC) -o $(EXE) $(OBJS) $(LDFLAGS)
|
||||||
|
|
||||||
ifeq (Windows_NT,$(OS))
|
ifeq (1,$(WIN))
|
||||||
$(ZLIB):
|
$(ZLIB):
|
||||||
make -C ../../zlib -f Makefile.mgw
|
make -C ../../zlib -f Makefile.mgw
|
||||||
endif
|
endif
|
||||||
|
@ -32,7 +40,7 @@ endif
|
||||||
.PHONY: clean
|
.PHONY: clean
|
||||||
|
|
||||||
clean:
|
clean:
|
||||||
ifeq (Windows_NT,$(OS))
|
ifeq (1,$(WINCMD))
|
||||||
-del /q /f $(EXE) 2>nul
|
-del /q /f $(EXE) 2>nul
|
||||||
-del /q /f *.o 2>nul
|
-del /q /f *.o 2>nul
|
||||||
else
|
else
|
||||||
|
|
|
@ -194,7 +194,7 @@ int appendtozip (zipFile zipfile, const char * zipname, const char *filename)
|
||||||
// - otherwise, we're writing lumps into a wad/zip
|
// - otherwise, we're writing lumps into a wad/zip
|
||||||
//
|
//
|
||||||
*/
|
*/
|
||||||
int buildwad (FILE *listfile, char *listfilename, char *makecmd, char *makefile)
|
int buildwad (FILE *listfile, char *listfilename, const char *makecmd, char *makefile)
|
||||||
{
|
{
|
||||||
// destination we're writing output into -
|
// destination we're writing output into -
|
||||||
// one of these:
|
// one of these:
|
||||||
|
@ -442,6 +442,7 @@ int buildwad (FILE *listfile, char *listfilename, char *makecmd, char *makefile)
|
||||||
|
|
||||||
int __cdecl main (int argc, char **argv)
|
int __cdecl main (int argc, char **argv)
|
||||||
{
|
{
|
||||||
|
const char *makecmd;
|
||||||
FILE *listfile = NULL;
|
FILE *listfile = NULL;
|
||||||
char *listfilename = NULL;
|
char *listfilename = NULL;
|
||||||
char *makefile = NULL;
|
char *makefile = NULL;
|
||||||
|
@ -480,7 +481,16 @@ int __cdecl main (int argc, char **argv)
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
ret = buildwad (listfile ? listfile : stdin, listfilename, argv[0], makefile);
|
// Hack for msys
|
||||||
|
if ((makecmd = getenv("OSTYPE")) != NULL && strcmp (makecmd, "msys") == 0)
|
||||||
|
{
|
||||||
|
makecmd = "../tools/makewad/makewad.exe";
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
makecmd = argv[0];
|
||||||
|
}
|
||||||
|
ret = buildwad (listfile ? listfile : stdin, listfilename, makecmd, makefile);
|
||||||
if (listfile != NULL)
|
if (listfile != NULL)
|
||||||
{
|
{
|
||||||
fclose (listfile);
|
fclose (listfile);
|
||||||
|
|
|
@ -1,13 +1,21 @@
|
||||||
ifeq (Windows_NT,$(OS))
|
ifeq (Windows_NT,$(OS))
|
||||||
|
WIN=1
|
||||||
|
WINCMD=1
|
||||||
|
endif
|
||||||
|
ifeq (msys,$(OSTYPE))
|
||||||
|
WIN=1
|
||||||
|
WINCMD=0
|
||||||
|
endif
|
||||||
|
|
||||||
|
ifeq (1,$(WIN))
|
||||||
EXE = re2c.exe
|
EXE = re2c.exe
|
||||||
CCDV = @../../ccdv
|
|
||||||
CXXFLAGS = $(LOC) -D_WIN32 -DNDEBUG -Os -Wall -Wno-unused
|
CXXFLAGS = $(LOC) -D_WIN32 -DNDEBUG -Os -Wall -Wno-unused
|
||||||
else
|
else
|
||||||
EXE = re2c
|
EXE = re2c
|
||||||
CCDV = @../../ccdv
|
|
||||||
CXXFLAGS = -DHAVE_CONFIG_H -DNDEBUG -Os -Wall -Wno-unused
|
CXXFLAGS = -DHAVE_CONFIG_H -DNDEBUG -Os -Wall -Wno-unused
|
||||||
endif
|
endif
|
||||||
|
|
||||||
|
CCDV = @../../ccdv
|
||||||
CXX = g++
|
CXX = g++
|
||||||
LDFLAGS= -s
|
LDFLAGS= -s
|
||||||
|
|
||||||
|
@ -24,7 +32,7 @@ $(EXE): $(OBJS)
|
||||||
.PHONY: clean
|
.PHONY: clean
|
||||||
|
|
||||||
clean:
|
clean:
|
||||||
ifeq (Windows_NT,$(OS))
|
ifeq (1,$(WINCMD))
|
||||||
-del /q /f $(EXE) 2>nul
|
-del /q /f $(EXE) 2>nul
|
||||||
-del /q /f *.o 2>nul
|
-del /q /f *.o 2>nul
|
||||||
else
|
else
|
||||||
|
|
|
@ -1,16 +1,24 @@
|
||||||
|
ifeq (Windows_NT,$(OS))
|
||||||
|
WIN=1
|
||||||
|
WINCMD=1
|
||||||
|
endif
|
||||||
|
ifeq (msys,$(OSTYPE))
|
||||||
|
WIN=1
|
||||||
|
WINCMD=0
|
||||||
|
endif
|
||||||
|
|
||||||
CC = gcc
|
CC = gcc
|
||||||
CFLAGS = -Os -Wall -fomit-frame-pointer
|
CFLAGS = -Os -Wall -fomit-frame-pointer
|
||||||
LDFLAGS = -s
|
LDFLAGS = -s
|
||||||
|
|
||||||
ifeq (Windows_NT,$(OS))
|
ifeq (1,$(WIN))
|
||||||
EXE = updaterevision.exe
|
EXE = updaterevision.exe
|
||||||
CCDV = @../../ccdv
|
|
||||||
else
|
else
|
||||||
EXE = updaterevision
|
EXE = updaterevision
|
||||||
CCDV = @../../ccdv
|
|
||||||
CFLAGS = -Os -Wall -fomit-frame-pointer
|
|
||||||
endif
|
endif
|
||||||
|
|
||||||
|
CCDV = @../../ccdv
|
||||||
|
|
||||||
OBJS = updaterevision.o
|
OBJS = updaterevision.o
|
||||||
|
|
||||||
all: $(EXE)
|
all: $(EXE)
|
||||||
|
@ -21,7 +29,7 @@ $(EXE): $(OBJS)
|
||||||
.PHONY: clean
|
.PHONY: clean
|
||||||
|
|
||||||
clean:
|
clean:
|
||||||
ifeq (Windows_NT,$(OS))
|
ifeq (1,$(WINCMD))
|
||||||
-del /q /f $(EXE) 2>nul
|
-del /q /f $(EXE) 2>nul
|
||||||
-del /q /f *.o 2>nul
|
-del /q /f *.o 2>nul
|
||||||
else
|
else
|
||||||
|
|
|
@ -1,13 +1,21 @@
|
||||||
ifeq (Windows_NT,$(OS))
|
ifeq (Windows_NT,$(OS))
|
||||||
|
WIN=1
|
||||||
|
WINCMD=1
|
||||||
|
endif
|
||||||
|
ifeq (msys,$(OSTYPE))
|
||||||
|
WIN=1
|
||||||
|
WINCMD=0
|
||||||
|
endif
|
||||||
|
|
||||||
|
ifeq (1,$(WIN))
|
||||||
EXE = xlatcc.exe
|
EXE = xlatcc.exe
|
||||||
CCDV = @../../ccdv
|
|
||||||
CFLAGS = $(LOC) -Os -Wall -fomit-frame-pointer
|
CFLAGS = $(LOC) -Os -Wall -fomit-frame-pointer
|
||||||
else
|
else
|
||||||
EXE = xlatcc
|
EXE = xlatcc
|
||||||
CCDV = @../../ccdv
|
|
||||||
CFLAGS = -Dstricmp=strcasecmp -Dstrnicmp=strncasecmp $(LOC) -Os -Wall -fomit-frame-pointer
|
CFLAGS = -Dstricmp=strcasecmp -Dstrnicmp=strncasecmp $(LOC) -Os -Wall -fomit-frame-pointer
|
||||||
endif
|
endif
|
||||||
|
|
||||||
|
CCDV = @../../ccdv
|
||||||
CC = gcc
|
CC = gcc
|
||||||
LDFLAGS= -s
|
LDFLAGS= -s
|
||||||
|
|
||||||
|
@ -24,7 +32,7 @@ $(EXE): $(OBJS)
|
||||||
.PHONY: clean
|
.PHONY: clean
|
||||||
|
|
||||||
clean:
|
clean:
|
||||||
ifeq (Windows_NT,$(OS))
|
ifeq (1,$(WINCMD))
|
||||||
-del /q /f $(EXE) 2>nul
|
-del /q /f $(EXE) 2>nul
|
||||||
-del /q /f *.o 2>nul
|
-del /q /f *.o 2>nul
|
||||||
else
|
else
|
||||||
|
|
|
@ -10,7 +10,11 @@ wadmake: zdoom.lst $(MAKEWAD).exe $(XLATCC).exe $(DEHSUPP).exe
|
||||||
$(MAKEWAD) -make wadmake zdoom.lst
|
$(MAKEWAD) -make wadmake zdoom.lst
|
||||||
|
|
||||||
clean:
|
clean:
|
||||||
|
ifeq (msys,$(OSTYPE))
|
||||||
|
rm -f wadmake zdoom.pk3 xlat/*.x dehsupp.lmp
|
||||||
|
else
|
||||||
del /q /f wadmake zdoom.pk3 xlat\*.x dehsupp.lmp 2>nul
|
del /q /f wadmake zdoom.pk3 xlat\*.x dehsupp.lmp 2>nul
|
||||||
|
endif
|
||||||
|
|
||||||
../tools/makewad/makewad.exe:
|
../tools/makewad/makewad.exe:
|
||||||
$(MAKE) -C ../tools/makewad -f Makefile
|
$(MAKE) -C ../tools/makewad -f Makefile
|
||||||
|
|
|
@ -63,10 +63,17 @@ minigzip: minigzip.o $(STATICLIB)
|
||||||
.PHONY: clean
|
.PHONY: clean
|
||||||
|
|
||||||
clean:
|
clean:
|
||||||
|
ifeq (msys,$(OSTYPE))
|
||||||
|
rm -f $(STATICLIB)
|
||||||
|
rm -f *.o
|
||||||
|
rm -f *.exe
|
||||||
|
rm -f foo.gz
|
||||||
|
else
|
||||||
-del /q /f $(STATICLIB) 2>nul
|
-del /q /f $(STATICLIB) 2>nul
|
||||||
-del /q /f *.o 2>nul
|
-del /q /f *.o 2>nul
|
||||||
-del /q /f *.exe 2>nul
|
-del /q /f *.exe 2>nul
|
||||||
-del /q /f foo.gz 2>nul
|
-del /q /f foo.gz 2>nul
|
||||||
|
endif
|
||||||
|
|
||||||
adler32.o: zlib.h zconf.h
|
adler32.o: zlib.h zconf.h
|
||||||
compress.o: zlib.h zconf.h
|
compress.o: zlib.h zconf.h
|
||||||
|
|
Loading…
Reference in a new issue