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) #if (_MSC_VER >= 1400)
#include <intrin.h> #include <intrin.h>
#else #else
long __cdecl _InterlockedIncrement(long volatile *); extern "C" long __cdecl _InterlockedIncrement(long volatile *);
long __cdecl _InterlockedDecrement(long volatile *); extern "C" long __cdecl _InterlockedDecrement(long volatile *);
long _InterlockedExchange(long volatile *, long); extern "C" long _InterlockedExchange(long volatile *, long);
long _InterlockedCompareExchange (long volatile *, long, long); extern "C" long _InterlockedCompareExchange (long volatile *, long, long);
long _InterlockedExchangeAdd(long volatile *, long); extern "C" long _InterlockedExchangeAdd(long volatile *, long);
unsigned char _BitScanReverse(unsigned long *Index, unsigned long Mask); extern "C" unsigned char _BitScanReverse(unsigned long *Index, unsigned long Mask);
#endif #endif
#pragma intrinsic(_InterlockedIncrement) #pragma intrinsic(_InterlockedIncrement)

View File

@ -288,7 +288,7 @@ static void build_command_line(int argc, char *argv[])
else if (!strcmp(argv[1], "ar")) else if (!strcmp(argv[1], "ar"))
{ {
transtable = ar_translate; transtable = ar_translate;
executable = "lib.exe"; executable = "link.exe";
dst += sprintf(dst, "link /lib /nologo "); dst += sprintf(dst, "link /lib /nologo ");
outstring = "/out:"; outstring = "/out:";
output_is_first = 1; output_is_first = 1;

View File

@ -107,8 +107,7 @@ endif
ifdef MSVC_BUILD ifdef MSVC_BUILD
VCONV = $(WINOBJ)/vconv$(EXE) OSPREBUILD = $(VCONV_TARGET)
VCONVPREFIX = $(subst /,\,$(VCONV))
# append a 'v' prefix if nothing specified # append a 'v' prefix if nothing specified
ifndef PREFIX ifndef PREFIX
@ -116,10 +115,10 @@ PREFIX = v
endif endif
# replace the various compilers with vconv.exe prefixes # replace the various compilers with vconv.exe prefixes
CC = @$(VCONVPREFIX) gcc -I. CC = @$(VCONV) gcc -I.
LD = @$(VCONVPREFIX) ld /profile LD = @$(VCONV) ld /profile
AR = @$(VCONVPREFIX) ar AR = @$(VCONV) ar
RC = @$(VCONVPREFIX) windres RC = @$(VCONV) windres
# make sure we use the multithreaded runtime # make sure we use the multithreaded runtime
ifdef DEBUG ifdef DEBUG
@ -156,27 +155,15 @@ CPPONLYFLAGS += /wd4800
# disable better packing warning # disable better packing warning
CPPONLYFLAGS += /wd4371 CPPONLYFLAGS += /wd4371
# disable macro redefinition warning
CCOMFLAGS += /wd4005
# explicitly set the entry point for UNICODE builds # explicitly set the entry point for UNICODE builds
LDFLAGS += /ENTRY:wmainCRTStartup LDFLAGS += /ENTRY:wmainCRTStartup
# add some VC++-specific defines # add some VC++-specific defines
DEFS += -D_CRT_SECURE_NO_DEPRECATE -D_CRT_NONSTDC_NO_DEPRECATE -DXML_STATIC -Dsnprintf=_snprintf 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 OSDCLEAN = msvcclean
msvcclean: msvcclean:
@ -186,8 +173,29 @@ msvcclean:
$(RM) *.exp $(RM) *.exp
endif endif
#-------------------------------------------------
# build VCONV
#-------------------------------------------------
VCONV_TARGET = $(BUILDOUT)/vconv$(BUILD_EXE)
VCONV = $(subst /,\,$(VCONV_TARGET))
ifneq ($(CROSS_BUILD),1)
BUILD += \
$(VCONV_TARGET)
endif 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 # due to quirks of using /bin/sh, we need to