From 35a9c794b2099d7d1f1be7c9532f10c897a67b08 Mon Sep 17 00:00:00 2001 From: Veselin Georgiev Date: Thu, 18 Jun 2009 15:32:44 +0000 Subject: [PATCH] Added a Makefile for x86 (commandline build). Using _vsnprintf when _MSC_VER is defined unconditionally, since the MSVC 2003 doesn't have vsnprintf. git-svn-id: https://svn.code.sf.net/p/libcpuid/code/HEAD/libcpuid@56 3b4be424-7ac5-41d7-8526-f4ddcb85d872 --- libcpuid/Makefile.x64 | 4 ++-- libcpuid/Makefile.x86 | 40 ++++++++++++++++++++++++++++++++++++++++ libcpuid/libcpuid_util.c | 2 +- 3 files changed, 43 insertions(+), 3 deletions(-) create mode 100644 libcpuid/Makefile.x86 diff --git a/libcpuid/Makefile.x64 b/libcpuid/Makefile.x64 index 9ee53ba..c2ab91b 100644 --- a/libcpuid/Makefile.x64 +++ b/libcpuid/Makefile.x64 @@ -4,7 +4,7 @@ all: libcpuid.lib ASM = ml64 /nologo CC = cl.exe /nologo /TC -OPTFLAGS = +OPTFLAGS = /MT DEFINES = /D "VERSION=\"0.1.0\"" OBJECTS = masm-x64.obj asm-bits.obj cpuid_main.obj libcpuid_util.obj recog_amd.obj recog_intel.obj rdtsc.obj @@ -30,7 +30,7 @@ recog_intel.obj: recog_intel.c $(CC) $(OPTFLAGS) $(DEFINES) /c recog_intel.c rdtsc.obj: rdtsc.c - $(CC) $(OPTFLASG) $(DEFINES) /c rdtsc.c + $(CC) $(OPTFLAGS) $(DEFINES) /c rdtsc.c clean: del *.obj libcpuid.lib diff --git a/libcpuid/Makefile.x86 b/libcpuid/Makefile.x86 new file mode 100644 index 0000000..12f7a2c --- /dev/null +++ b/libcpuid/Makefile.x86 @@ -0,0 +1,40 @@ +# Makefile for Win32 +# +# This is required on machines with multiple versions of the Microsoft compiler +# +# E.g. if you have Visual Studio 2008 and compile libcpuid with it, the static lib +# will not link in an executable, created through makefiles and MSVC 2003 (7.1). +# +# The solution is to use this custom makefile and compile libcpuid for MSVC 2003 +# + +all: libcpuid.lib + +CC = cl.exe /nologo /TC +OPTFLAGS = /MT +DEFINES = /D "VERSION=\"0.1.0\"" +OBJECTS = asm-bits.obj cpuid_main.obj libcpuid_util.obj recog_amd.obj recog_intel.obj rdtsc.obj + +libcpuid.lib: $(OBJECTS) + lib /nologo /out:libcpuid.lib $(OBJECTS) + +asm-bits.obj: asm-bits.c + $(CC) $(OPTFLAGS) $(DEFINES) /c asm-bits.c + +cpuid_main.obj: cpuid_main.c + $(CC) $(OPTFLAGS) $(DEFINES) /c cpuid_main.c + +libcpuid_util.obj: libcpuid_util.c + $(CC) $(OPTFLAGS) $(DEFINES) /c libcpuid_util.c + +recog_amd.obj: recog_amd.c + $(CC) $(OPTFLAGS) $(DEFINES) /c recog_amd.c + +recog_intel.obj: recog_intel.c + $(CC) $(OPTFLAGS) $(DEFINES) /c recog_intel.c + +rdtsc.obj: rdtsc.c + $(CC) $(OPTFLAGS) $(DEFINES) /c rdtsc.c + +clean: + del *.obj libcpuid.lib diff --git a/libcpuid/libcpuid_util.c b/libcpuid/libcpuid_util.c index 979383f..32f3d98 100644 --- a/libcpuid/libcpuid_util.c +++ b/libcpuid/libcpuid_util.c @@ -48,7 +48,7 @@ static void default_warn(const char *msg) libcpuid_warn_fn_t _warn_fun = default_warn; -#if defined(_MSC_VER) && defined(_M_AMD64) +#if defined(_MSC_VER) # define vsnprintf _vsnprintf #endif void warnf(const char* format, ...)