From d691d84eedc0f02b4caebbee89149fff18e1db91 Mon Sep 17 00:00:00 2001 From: Ramsay Jones Date: Sat, 7 Nov 2009 20:08:01 +0000 Subject: Makefile: keep MSVC and Cygwin configuration separate Signed-off-by: Ramsay Jones Signed-off-by: Junio C Hamano diff --git a/Makefile b/Makefile index 8e1cfc5..306ca86 100644 --- a/Makefile +++ b/Makefile @@ -212,6 +212,12 @@ uname_R := $(shell sh -c 'uname -r 2>/dev/null || echo not') uname_P := $(shell sh -c 'uname -p 2>/dev/null || echo not') uname_V := $(shell sh -c 'uname -v 2>/dev/null || echo not') +ifdef MSVC + # avoid the MingW and Cygwin configuration sections + uname_S := Windows + uname_O := Windows +endif + # CFLAGS and LDFLAGS are for the users to override from the command line. CFLAGS = -g -O2 -Wall @@ -893,7 +899,7 @@ ifeq ($(uname_S),HP-UX) NO_SYS_SELECT_H = YesPlease SNPRINTF_RETURNS_BOGUS = YesPlease endif -ifdef MSVC +ifeq ($(uname_S),Windows) GIT_VERSION := $(GIT_VERSION).MSVC pathsep = ; NO_PREAD = YesPlease @@ -945,7 +951,7 @@ else BASIC_CFLAGS += -Zi -MTd endif X = .exe -else +endif ifneq (,$(findstring MINGW,$(uname_S))) pathsep = ; NO_PREAD = YesPlease @@ -994,7 +1000,6 @@ else NO_PTHREADS = YesPlease endif endif -endif -include config.mak.autogen -include config.mak -- cgit v0.10.2-6-g49f6 From b1b952043f8f909649fdf053c371109c84f9cf56 Mon Sep 17 00:00:00 2001 From: Ramsay Jones Date: Sat, 7 Nov 2009 20:10:31 +0000 Subject: MSVC: Add support for building with NO_MMAP When the NO_MMAP build variable is set, the msvc linker complains: error LNK2001: unresolved external symbol _getpagesize The msvc libraries do not define the getpagesize() function, so we move the mingw_getpagesize() implementation from the conditionally built win32mmap.c file to mingw.c. Signed-off-by: Ramsay Jones Signed-off-by: Junio C Hamano diff --git a/compat/mingw.c b/compat/mingw.c index 6b5b5b2..15fe33e 100644 --- a/compat/mingw.c +++ b/compat/mingw.c @@ -1000,6 +1000,18 @@ repeat: return -1; } +/* + * Note that this doesn't return the actual pagesize, but + * the allocation granularity. If future Windows specific git code + * needs the real getpagesize function, we need to find another solution. + */ +int mingw_getpagesize(void) +{ + SYSTEM_INFO si; + GetSystemInfo(&si); + return si.dwAllocationGranularity; +} + struct passwd *getpwuid(int uid) { static char user_name[100]; diff --git a/compat/mingw.h b/compat/mingw.h index 5b5258b..26c4027 100644 --- a/compat/mingw.h +++ b/compat/mingw.h @@ -166,7 +166,7 @@ int mingw_connect(int sockfd, struct sockaddr *sa, size_t sz); int mingw_rename(const char*, const char*); #define rename mingw_rename -#ifdef USE_WIN32_MMAP +#if defined(USE_WIN32_MMAP) || defined(_MSC_VER) int mingw_getpagesize(void); #define getpagesize mingw_getpagesize #endif diff --git a/compat/win32mmap.c b/compat/win32mmap.c index 779d796..1c5a149 100644 --- a/compat/win32mmap.c +++ b/compat/win32mmap.c @@ -1,17 +1,5 @@ #include "../git-compat-util.h" -/* - * Note that this doesn't return the actual pagesize, but - * the allocation granularity. If future Windows specific git code - * needs the real getpagesize function, we need to find another solution. - */ -int mingw_getpagesize(void) -{ - SYSTEM_INFO si; - GetSystemInfo(&si); - return si.dwAllocationGranularity; -} - void *git_mmap(void *start, size_t length, int prot, int flags, int fd, off_t offset) { HANDLE hmap; -- cgit v0.10.2-6-g49f6