Skip to content

Instantly share code, notes, and snippets.

@k-takata
Last active December 14, 2015 02:59
Show Gist options
  • Select an option

  • Save k-takata/5018169 to your computer and use it in GitHub Desktop.

Select an option

Save k-takata/5018169 to your computer and use it in GitHub Desktop.
merge Make_cyg.mak into Make_ming.mak (Vim 7.3.831)
#
# Makefile for VIM on Win32, using Cygwin gcc-3 or MinGW cross compiler
# Last updated by Ken Takata. Last Change: 2013 Feb 23
#
# Also read INSTALLpc.txt!
#
# This compiles Vim as a Windows application. If you want Vim to run as a
# Cygwin application use the Makefile (just like on Unix).
#
# The old Make_cyg.mak (maintained by Dan Sharp et al.) was merged into
# Make_ming.mak. Note: USEDLL option was removed.
#
# Set 'yes' if you want to use old gcc-3 compiler.
USE_GCC3 = no
ifeq ($(USE_GCC3),yes)
# Use old gcc-3 compiler with -mno-cygwin option.
CC = gcc-3 -mno-cygwin
CXX = g++-3 -mno-cygwin
else
# Use MinGW(-w64) cross compiler.
# There are three MinGW packages in Cygwin:
# mingw-gcc-g++, mingw64-i686-gcc-g++ and mingw64-x86_64-gcc-g++.
CROSS_COMPILE = i686-pc-mingw32-
#CROSS_COMPILE = i686-w64-mingw32-
#CROSS_COMPILE = x86_64-w64-mingw32-
CC := $(CROSS_COMPILE)gcc
CXX := $(CROSS_COMPILE)g++
endif
# Do not change this.
UNDER_CYGWIN = yes
include Make_ming.mak
diff --git a/src/Make_ming.mak b/src/Make_ming.mak
--- a/src/Make_ming.mak
+++ b/src/Make_ming.mak
@@ -112,12 +112,19 @@
# on Linux, for cross-compile, it's here:
#PERLLIB=/home/ron/ActivePerl/lib
# on NT, it's here:
+PERLEXE=$(PERL)/bin/perl
PERLLIB=$(PERL)/lib
PERLLIBS=$(PERLLIB)/Core
+ifeq ($(UNDER_CYGWIN),yes)
+PERLTYPEMAP:=$(shell cygpath -m $(PERLLIB)/ExtUtils/typemap)
+XSUBPPTRY:=$(shell cygpath -m $(PERLLIB)/ExtUtils/xsubpp)
+else
+PERLTYPEMAP=$(PERLLIB)/ExtUtils/typemap
XSUBPPTRY=$(PERLLIB)/ExtUtils/xsubpp
-XSUBPP_EXISTS=$(shell perl -e "print 1 unless -e '$(XSUBPPTRY)'")
+endif
+XSUBPP_EXISTS=$(shell $(PERLEXE) -e "print 1 unless -e '$(XSUBPPTRY)'")
ifeq "$(XSUBPP_EXISTS)" ""
-XSUBPP=perl $(XSUBPPTRY)
+XSUBPP=$(PERLEXE) '$(XSUBPPTRY)'
else
XSUBPP=xsubpp
endif
@@ -322,13 +329,17 @@
-DHAVE_PATHDEF -DFEAT_$(FEATURES)
ifeq ($(CROSS),yes)
# cross-compiler prefix:
+ifndef CROSS_COMPILE
CROSS_COMPILE = i586-pc-mingw32msvc-
+endif
DEL = rm
MKDIR = mkdir -p
DIRSLASH = /
else
# normal (Windows) compilation:
+ifndef CROSS_COMPILE
CROSS_COMPILE =
+endif
ifneq (sh.exe, $(SHELL))
DEL = rm
MKDIR = mkdir -p
@@ -339,7 +350,10 @@
DIRSLASH = \\
endif
endif
+ifneq ($(UNDER_CYGWIN),yes)
CC := $(CROSS_COMPILE)gcc
+CXX := $(CROSS_COMPILE)g++
+endif
WINDRES := $(CROSS_COMPILE)windres
WINDRES_CC = $(CC)
@@ -395,6 +409,10 @@
CFLAGS += -DDYNAMIC_RUBY -DDYNAMIC_RUBY_DLL=\"$(RUBY_INSTALL_NAME).dll\"
CFLAGS += -DDYNAMIC_RUBY_VER=$(RUBY_VER)
endif
+ifneq ($(findstring w64-mingw32,$(CC)),)
+# A workaround for MinGW-w64
+CFLAGS += -DHAVE_STRUCT_TIMESPEC -DHAVE_STRUCT_TIMEZONE
+endif
endif
ifdef PYTHON
@@ -687,10 +705,10 @@
mpress vim.exe
xxd/xxd.exe: xxd/xxd.c
- $(MAKE) -C xxd -f Make_ming.mak CC=$(CC)
+ $(MAKE) -C xxd -f Make_ming.mak CC='$(CC)'
GvimExt/gvimext.dll: GvimExt/gvimext.cpp GvimExt/gvimext.rc GvimExt/gvimext.h
- $(MAKE) -C GvimExt -f Make_ming.mak CROSS=$(CROSS) CROSS_COMPILE=$(CROSS_COMPILE)
+ $(MAKE) -C GvimExt -f Make_ming.mak CROSS=$(CROSS) CROSS_COMPILE=$(CROSS_COMPILE) CXX='$(CXX)' STATIC_STDCPLUS=$(STATIC_STDCPLUS)
clean:
-$(DEL) $(OUTDIR)$(DIRSLASH)*.o
@@ -751,7 +769,7 @@
if_perl.c: if_perl.xs typemap
$(XSUBPP) -prototypes -typemap \
- $(PERLLIB)/ExtUtils/typemap if_perl.xs > $@
+ '$(PERLTYPEMAP)' if_perl.xs > $@
$(OUTDIR)/netbeans.o: netbeans.c $(INCL) $(NBDEBUG_INCL) $(NBDEBUG_SRC)
$(CC) -c $(CFLAGS) netbeans.c -o $(OUTDIR)/netbeans.o
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment