From 1d226e879507a7cc0bb193036e7d91ff0ec3d69e Mon Sep 17 00:00:00 2001 From: Aaron Giles Date: Fri, 7 Jan 2011 05:28:57 +0000 Subject: [PATCH] Build vconv in all circumstances as part of win32 build. Always use gcc to build vconv. Add missing extern "C" to intrinsic definitions. Change vconv to call link.exe instead of lib.exe for libraries. --- src/osd/windows/eivc.h | 12 ++++----- src/osd/windows/vconv.c | 2 +- src/osd/windows/windows.mak | 50 +++++++++++++++++++++---------------- 3 files changed, 36 insertions(+), 28 deletions(-) diff --git a/src/osd/windows/eivc.h b/src/osd/windows/eivc.h index 1813245ac61..6dc54d93b31 100644 --- a/src/osd/windows/eivc.h +++ b/src/osd/windows/eivc.h @@ -47,12 +47,12 @@ #if (_MSC_VER >= 1400) #include #else -long __cdecl _InterlockedIncrement(long volatile *); -long __cdecl _InterlockedDecrement(long volatile *); -long _InterlockedExchange(long volatile *, long); -long _InterlockedCompareExchange (long volatile *, long, long); -long _InterlockedExchangeAdd(long volatile *, long); -unsigned char _BitScanReverse(unsigned long *Index, unsigned long Mask); +extern "C" long __cdecl _InterlockedIncrement(long volatile *); +extern "C" long __cdecl _InterlockedDecrement(long volatile *); +extern "C" long _InterlockedExchange(long volatile *, long); +extern "C" long _InterlockedCompareExchange (long volatile *, long, long); +extern "C" long _InterlockedExchangeAdd(long volatile *, long); +extern "C" unsigned char _BitScanReverse(unsigned long *Index, unsigned long Mask); #endif #pragma intrinsic(_InterlockedIncrement) diff --git a/src/osd/windows/vconv.c b/src/osd/windows/vconv.c index 098eae56137..05afed42db2 100644 --- a/src/osd/windows/vconv.c +++ b/src/osd/windows/vconv.c @@ -288,7 +288,7 @@ static void build_command_line(int argc, char *argv[]) else if (!strcmp(argv[1], "ar")) { transtable = ar_translate; - executable = "lib.exe"; + executable = "link.exe"; dst += sprintf(dst, "link /lib /nologo "); outstring = "/out:"; output_is_first = 1; diff --git a/src/osd/windows/windows.mak b/src/osd/windows/windows.mak index bb6e3212b94..ad8584b9a2e 100644 --- a/src/osd/windows/windows.mak +++ b/src/osd/windows/windows.mak @@ -107,8 +107,7 @@ endif ifdef MSVC_BUILD -VCONV = $(WINOBJ)/vconv$(EXE) -VCONVPREFIX = $(subst /,\,$(VCONV)) +OSPREBUILD = $(VCONV_TARGET) # append a 'v' prefix if nothing specified ifndef PREFIX @@ -116,10 +115,10 @@ PREFIX = v endif # replace the various compilers with vconv.exe prefixes -CC = @$(VCONVPREFIX) gcc -I. -LD = @$(VCONVPREFIX) ld /profile -AR = @$(VCONVPREFIX) ar -RC = @$(VCONVPREFIX) windres +CC = @$(VCONV) gcc -I. +LD = @$(VCONV) ld /profile +AR = @$(VCONV) ar +RC = @$(VCONV) windres # make sure we use the multithreaded runtime ifdef DEBUG @@ -156,27 +155,15 @@ CPPONLYFLAGS += /wd4800 # disable better packing warning CPPONLYFLAGS += /wd4371 +# disable macro redefinition warning +CCOMFLAGS += /wd4005 + # explicitly set the entry point for UNICODE builds LDFLAGS += /ENTRY:wmainCRTStartup # add some VC++-specific defines DEFS += -D_CRT_SECURE_NO_DEPRECATE -D_CRT_NONSTDC_NO_DEPRECATE -DXML_STATIC -Dsnprintf=_snprintf -# make msvcprep into a pre-build step -OSPREBUILD = $(VCONV) - -ifneq ($(CROSS_BUILD),1) -# add VCONV to the build tools -BUILD += $(VCONV) - -$(VCONV): $(WINOBJ)/vconv.o - @echo Linking $@... - @link.exe /nologo $^ version.lib /out:$@ - -$(WINOBJ)/vconv.o: $(WINSRC)/vconv.c - @echo Compiling $<... - @cl.exe /nologo /O1 -D_CRT_SECURE_NO_DEPRECATE -c $< /Fo$@ - OSDCLEAN = msvcclean msvcclean: @@ -186,8 +173,29 @@ msvcclean: $(RM) *.exp endif + + +#------------------------------------------------- +# build VCONV +#------------------------------------------------- + +VCONV_TARGET = $(BUILDOUT)/vconv$(BUILD_EXE) +VCONV = $(subst /,\,$(VCONV_TARGET)) + +ifneq ($(CROSS_BUILD),1) +BUILD += \ + $(VCONV_TARGET) endif +$(VCONV_TARGET): $(WINOBJ)/vconv.o + @echo Linking $@... + @gcc.exe -static-libgcc $^ $(LIBS) -lversion -o $@ + +$(WINOBJ)/vconv.o: $(WINSRC)/vconv.c + @echo Compiling $<... + @gcc.exe -O3 -c $< -o $@ + + #------------------------------------------------- # due to quirks of using /bin/sh, we need to