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.
This commit is contained in:
Aaron Giles 2011-01-07 05:28:57 +00:00
parent 08d14a29e8
commit 1d226e8795
3 changed files with 36 additions and 28 deletions

View File

@ -47,12 +47,12 @@
#if (_MSC_VER >= 1400)
#include <intrin.h>
#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)

View File

@ -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;

View File

@ -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