Skip to content

Commit

Permalink
Make cross-compiling for Windows a little bit easier
Browse files Browse the repository at this point in the history
  • Loading branch information
ch4rr0 committed Oct 13, 2023
1 parent 773e22f commit 6dd1829
Showing 1 changed file with 10 additions and 10 deletions.
20 changes: 10 additions & 10 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -36,17 +36,18 @@ NGS_VER ?= 2.10.2
VDB_VER ?= 2.10.2

# Detect Cygwin or MinGW
WINDOWS :=
MINGW :=
ifneq (,$(findstring mingw,$(shell $(CXX) --version)))
WINDOWS := 1
MINGW := 1
endif

CXX ?= x86_64-w64-mingw32-g++-posix
CC ?= x86_64-w64-mingw32-gcc-posix
AR ?= x86_64-w64-mingw32-ar
RC ?= x86_64-w64-mingw32-windres
STRIP ?= x86_64-w64-mingw32-strip
ifeq (1, $(MINGW))
CXX = x86_64-w64-mingw32-g++-posix
CC = x86_64-w64-mingw32-gcc-posix
AR = x86_64-w64-mingw32-ar
RC = x86_64-w64-mingw32-windres
LD = x86_64-w64-mingw32-ld
STRIP = x86_64-w64-mingw32-strip
endif

# POSIX memory-mapped files not currently supported on Windows
Expand Down Expand Up @@ -550,7 +551,6 @@ perl-deps:
eval `perl -I $(CURDIR)/.tmp/lib/perl5 -Mlocal::lib=$(CURDIR)/.tmp` ; \
$(CURDIR)/.tmp/bin/cpanm --force File::Which Math::Random Clone Test::Deep Sys::Info ; \

#make -f win32/Makefile.gcc CC=x86_64-w64-mingw32-gcc-posix AR=x86_64-w64-mingw32-ar RC=x86_64-w64-mingw32-windres STRIP=x86_64-w64-mingw32-strip
.PHONY: static-libs
static-libs:
if [ ! -d "$(CURDIR)/.tmp" ] ; then \
Expand All @@ -564,14 +564,14 @@ static-libs:
DL=$$( ( which wget >/dev/null 2>&1 && echo "wget --no-check-certificate" ) || echo "curl -LOk") ; \
if [ ! -f "$(CURDIR)/.tmp/lib/libz.a" ] ; then \
$$DL http://zlib.net/zlib-1.3.tar.gz && tar xzf zlib-1.3.tar.gz && cd zlib-1.3 ; \
$(if $(MINGW), $(MAKE) -f win32/Makefile.gcc, ./configure --static && make) && \
$(if $(MINGW), $(MAKE) libz.a -f win32/Makefile.gcc CC=$(CC) AR=$(AR) RC=$(RC) STRIP=$(STRIP) LD=$(LD), ./configure --static && make) && \
cp zlib.h zconf.h $(CURDIR)/.tmp/include && cp libz.a $(CURDIR)/.tmp/lib ; \
rm -rf zlib-1.3* ; \
fi ; \
if [ ! -f "$(CURDIR)/.tmp/lib/libzstd.a" ]; then \
cd $(CURDIR)/.tmp ; \
$$DL https://github.com/facebook/zstd/releases/download/v1.5.5/zstd-1.5.5.tar.gz && tar xzf zstd-1.5.5.tar.gz ; \
cd zstd-1.5.5 && $(MAKE) lib ; \
cd zstd-1.5.5 && $(MAKE) CC=$(CC) AR=$(AR) RC=$(RC) STRIP=$(STRIP) LD=$(LD) lib ; \
cd $(CURDIR)/.tmp/zstd-1.5.5/lib && cp zstd.h $(CURDIR)/.tmp/include && cp libzstd.a $(CURDIR)/.tmp/lib ; \
rm -rf zstd-1.5.5* ; \
fi
Expand Down

0 comments on commit 6dd1829

Please sign in to comment.