blob: 9bb26aa6dad14bea5c39559859e9403c209077f5 [file] [log] [blame]
Bram Moolenaar4f7e8212014-11-05 13:53:32 +01001# Makefile for VIM on Win32 (Cygwin and MinGW)
2#
3# This file contains common part for Cygwin and MinGW and it is included
4# from Make_cyg.mak and Make_ming.mak.
5#
6# Info at http://www.mingw.org
7# Alternative x86 and 64-builds: http://mingw-w64.sourceforge.net
8# Also requires GNU make, which you can download from the same sites.
9# Get missing libraries from http://gnuwin32.sf.net.
10#
11# Tested on Win32 NT 4 and Win95.
12#
13# To make everything, just 'make -f Make_ming.mak'.
14# To make just e.g. gvim.exe, 'make -f Make_ming.mak gvim.exe'.
15# After a run, you can 'make -f Make_ming.mak clean' to clean up.
16#
17# NOTE: Sometimes 'GNU Make' will stop after building vimrun.exe -- I think
18# it's just run out of memory or something. Run again, and it will continue
19# with 'xxd'.
20#
21# "make upx" makes *compressed* versions of the 32 bit GUI and console EXEs,
22# using the excellent UPX compressor:
23# http://upx.sourceforge.net/
24# "make mpress" uses the MPRESS compressor for 32- and 64-bit EXEs:
25# http://www.matcode.com/mpress.htm
26#
27# Maintained by Ron Aaron <ronaharon@yahoo.com> et al.
28# Updated 2014 Oct 13.
29
30#>>>>> choose options:
31# set to yes for a debug build
32DEBUG=no
33# set to SIZE for size, SPEED for speed, MAXSPEED for maximum optimization
34OPTIMIZE=MAXSPEED
35# set to yes to make gvim, no for vim
36GUI=yes
37# set to yes if you want to use DirectWrite (DirectX)
38# MinGW-w64 is needed, and ARCH should be set to i686 or x86-64.
39DIRECTX=no
40# FEATURES=[TINY | SMALL | NORMAL | BIG | HUGE]
41# Set to TINY to make minimal version (few features).
Bram Moolenaare5f2be62016-01-21 20:24:34 +010042FEATURES=HUGE
Bram Moolenaar4f7e8212014-11-05 13:53:32 +010043# Set to one of i386, i486, i586, i686 as the minimum target processor.
44# For amd64/x64 architecture set ARCH=x86-64 .
Bram Moolenaar223b7232016-02-19 19:43:49 +010045ARCH=i686
Bram Moolenaar4f7e8212014-11-05 13:53:32 +010046# Set to yes to cross-compile from unix; no=native Windows (and Cygwin).
47CROSS=no
48# Set to path to iconv.h and libiconv.a to enable using 'iconv.dll'.
49#ICONV="."
50ICONV=yes
51GETTEXT=yes
52# Set to yes to include multibyte support.
53MBYTE=yes
54# Set to yes to include IME support.
55IME=yes
56DYNAMIC_IME=yes
57# Set to yes to enable writing a postscript file with :hardcopy.
58POSTSCRIPT=no
59# Set to yes to enable OLE support.
60OLE=no
Bram Moolenaar223b7232016-02-19 19:43:49 +010061# Set the default $(WINVER) to make it work with WinXP.
Bram Moolenaar4f7e8212014-11-05 13:53:32 +010062ifndef WINVER
Bram Moolenaar223b7232016-02-19 19:43:49 +010063WINVER = 0x0501
Bram Moolenaar4f7e8212014-11-05 13:53:32 +010064endif
65# Set to yes to enable Cscope support.
66CSCOPE=yes
Bram Moolenaare0874f82016-01-24 20:36:41 +010067# Set to yes to enable Netbeans support (requires CHANNEL).
Bram Moolenaar4f7e8212014-11-05 13:53:32 +010068NETBEANS=$(GUI)
Bram Moolenaare0874f82016-01-24 20:36:41 +010069# Set to yes to enable inter process communication.
70CHANNEL=$(GUI)
Bram Moolenaar4f7e8212014-11-05 13:53:32 +010071
72
73# Link against the shared version of libstdc++ by default. Set
74# STATIC_STDCPLUS to "yes" to link against static version instead.
75ifndef STATIC_STDCPLUS
76STATIC_STDCPLUS=no
77endif
78
79# If the user doesn't want gettext, undefine it.
80ifeq (no, $(GETTEXT))
81GETTEXT=
82endif
83# Added by E.F. Amatria <eferna1@platea.ptic.mec.es> 2001 Feb 23
84# Uncomment the first line and one of the following three if you want Native Language
85# Support. You'll need gnu_gettext.win32, a MINGW32 Windows PORT of gettext by
86# Franco Bez <franco.bez@gmx.de>. It may be found at
87# http://home.a-city.de/franco.bez/gettext/gettext_win32_en.html
88# Tested with mingw32 with GCC-2.95.2 on Win98
89# Updated 2001 Jun 9
90#GETTEXT=c:/gettext.win32.msvcrt
91#STATIC_GETTEXT=USE_STATIC_GETTEXT
92#DYNAMIC_GETTEXT=USE_GETTEXT_DLL
93#DYNAMIC_GETTEXT=USE_SAFE_GETTEXT_DLL
94SAFE_GETTEXT_DLL_OBJ = $(GETTEXT)/src/safe_gettext_dll/safe_gettext_dll.o
95# Alternatively, if you uncomment the two following lines, you get a "safe" version
96# without linking the safe_gettext_dll.o object file.
97#DYNAMIC_GETTEXT=DYNAMIC_GETTEXT
98#GETTEXT_DYNAMIC=gnu_gettext.dll
99INTLPATH=$(GETTEXT)/lib/mingw32
100INTLLIB=gnu_gettext
101
102# If you are using gettext-0.10.35 from http://sourceforge.net/projects/gettext
103# or gettext-0.10.37 from http://sourceforge.net/projects/mingwrep/
104# uncomment the following, but I can't build a static version with them, ?-(|
105#GETTEXT=c:/gettext-0.10.37-20010430
106#STATIC_GETTEXT=USE_STATIC_GETTEXT
107#DYNAMIC_GETTEXT=DYNAMIC_GETTEXT
108#INTLPATH=$(GETTEXT)/lib
109#INTLLIB=intl
110
111# Perl interface:
112# PERL=[Path to Perl directory] (Set inside Make_cyg.mak or Make_ming.mak)
113# DYNAMIC_PERL=yes (to load the Perl DLL dynamically)
114# PERL_VER=[Perl version, eg 56, 58, 510] (default is 56)
115ifdef PERL
116ifndef PERL_VER
117PERL_VER=56
118endif
119ifndef DYNAMIC_PERL
120DYNAMIC_PERL=yes
121endif
122# on Linux, for cross-compile, it's here:
123#PERLLIB=/home/ron/ActivePerl/lib
124# on NT, it's here:
125PERLEXE=$(PERL)/bin/perl
126PERLLIB=$(PERL)/lib
127PERLLIBS=$(PERLLIB)/Core
128ifeq ($(UNDER_CYGWIN),yes)
129PERLTYPEMAP:=$(shell cygpath -m $(PERLLIB)/ExtUtils/typemap)
130XSUBPPTRY:=$(shell cygpath -m $(PERLLIB)/ExtUtils/xsubpp)
131else
132PERLTYPEMAP=$(PERLLIB)/ExtUtils/typemap
133XSUBPPTRY=$(PERLLIB)/ExtUtils/xsubpp
134endif
135XSUBPP_EXISTS=$(shell $(PERLEXE) -e "print 1 unless -e '$(XSUBPPTRY)'")
136ifeq "$(XSUBPP_EXISTS)" ""
Bram Moolenaar345326a2014-11-06 10:03:01 +0100137XSUBPP=$(PERLEXE) $(XSUBPPTRY)
Bram Moolenaar4f7e8212014-11-05 13:53:32 +0100138else
139XSUBPP=xsubpp
140endif
141endif
142
143# Lua interface:
144# LUA=[Path to Lua directory] (Set inside Make_cyg.mak or Make_ming.mak)
145# DYNAMIC_LUA=yes (to load the Lua DLL dynamically)
146# LUA_VER=[Lua version, eg 51, 52] (default is 51)
147ifdef LUA
148ifndef DYNAMIC_LUA
149DYNAMIC_LUA=yes
150endif
151
152ifndef LUA_VER
153LUA_VER=51
154endif
155
156ifeq (no,$(DYNAMIC_LUA))
157LUA_LIB = -L$(LUA)/lib -llua
158endif
159
160endif
161
162# MzScheme interface:
163# MZSCHEME=[Path to MzScheme directory] (Set inside Make_cyg.mak or Make_ming.mak)
164# DYNAMIC_MZSCHEME=yes (to load the MzScheme DLL dynamically)
165# MZSCHEME_VER=[MzScheme version] (default is 205_000)
166# MZSCHEME_DEBUG=no
167ifdef MZSCHEME
168ifndef DYNAMIC_MZSCHEME
169DYNAMIC_MZSCHEME=yes
170endif
171
172ifndef MZSCHEME_VER
173MZSCHEME_VER=205_000
174endif
175
Bram Moolenaar4f7e8212014-11-05 13:53:32 +0100176# for version 4.x we need to generate byte-code for Scheme base
177ifndef MZSCHEME_GENERATE_BASE
178MZSCHEME_GENERATE_BASE=no
179endif
180
Bram Moolenaar4e640bd2016-01-16 16:20:38 +0100181ifneq ($(wildcard $(MZSCHEME)/lib/msvc/libmzsch$(MZSCHEME_VER).lib),)
Bram Moolenaar4f7e8212014-11-05 13:53:32 +0100182MZSCHEME_MAIN_LIB=mzsch
183else
184MZSCHEME_MAIN_LIB=racket
185endif
186
Bram Moolenaar4e640bd2016-01-16 16:20:38 +0100187ifndef MZSCHEME_PRECISE_GC
188MZSCHEME_PRECISE_GC=no
189ifneq ($(wildcard $(MZSCHEME)\lib\lib$(MZSCHEME_MAIN_LIB)$(MZSCHEME_VER).dll),)
190ifeq ($(wildcard $(MZSCHEME)\lib\libmzgc$(MZSCHEME_VER).dll),)
191MZSCHEME_PRECISE_GC=yes
192endif
193else
194ifneq ($(wildcard $(MZSCHEME)\lib\msvc\lib$(MZSCHEME_MAIN_LIB)$(MZSCHEME_VER).lib),)
195ifeq ($(wildcard $(MZSCHEME)\lib\msvc\libmzgc$(MZSCHEME_VER).lib),)
196MZSCHEME_PRECISE_GC=yes
197endif
198endif
199endif
200endif
201
Bram Moolenaar4f7e8212014-11-05 13:53:32 +0100202ifeq (no,$(DYNAMIC_MZSCHEME))
203ifeq (yes,$(MZSCHEME_PRECISE_GC))
204MZSCHEME_LIB=-l$(MZSCHEME_MAIN_LIB)$(MZSCHEME_VER)
205else
Bram Moolenaar4e640bd2016-01-16 16:20:38 +0100206MZSCHEME_LIB=-l$(MZSCHEME_MAIN_LIB)$(MZSCHEME_VER) -lmzgc$(MZSCHEME_VER)
Bram Moolenaar4f7e8212014-11-05 13:53:32 +0100207endif
208# the modern MinGW can dynamically link to dlls directly.
209# point MZSCHEME_DLLS to where you put libmzschXXXXXXX.dll and libgcXXXXXXX.dll
210ifndef MZSCHEME_DLLS
211MZSCHEME_DLLS=$(MZSCHEME)
212endif
213MZSCHEME_LIBDIR=-L$(MZSCHEME_DLLS) -L$(MZSCHEME_DLLS)\lib
214endif
215
216endif
217
218# Python interface:
219# PYTHON=[Path to Python directory] (Set inside Make_cyg.mak or Make_ming.mak)
220# DYNAMIC_PYTHON=yes (to load the Python DLL dynamically)
221# PYTHON_VER=[Python version, eg 22, 23, ..., 27] (default is 22)
222ifdef PYTHON
223ifndef DYNAMIC_PYTHON
224DYNAMIC_PYTHON=yes
225endif
226
227ifndef PYTHON_VER
Bram Moolenaar3c6f92e2016-01-02 20:26:36 +0100228PYTHON_VER=27
229endif
230ifndef DYNAMIC_PYTHON_DLL
231DYNAMIC_PYTHON_DLL=python$(PYTHON_VER).dll
232endif
233ifdef PYTHON_HOME
234PYTHON_HOME_DEF=-DPYTHON_HOME=\"$(PYTHON_HOME)\"
Bram Moolenaar4f7e8212014-11-05 13:53:32 +0100235endif
236
237ifeq (no,$(DYNAMIC_PYTHON))
238PYTHONLIB=-L$(PYTHON)/libs -lpython$(PYTHON_VER)
239endif
240# my include files are in 'win32inc' on Linux, and 'include' in the standard
241# NT distro (ActiveState)
Bram Moolenaar3c6f92e2016-01-02 20:26:36 +0100242ifndef PYTHONINC
Bram Moolenaar4f7e8212014-11-05 13:53:32 +0100243ifeq ($(CROSS),no)
244PYTHONINC=-I $(PYTHON)/include
245else
246PYTHONINC=-I $(PYTHON)/win32inc
247endif
248endif
Bram Moolenaar3c6f92e2016-01-02 20:26:36 +0100249endif
Bram Moolenaar4f7e8212014-11-05 13:53:32 +0100250
251# Python3 interface:
252# PYTHON3=[Path to Python3 directory] (Set inside Make_cyg.mak or Make_ming.mak)
253# DYNAMIC_PYTHON3=yes (to load the Python3 DLL dynamically)
254# PYTHON3_VER=[Python3 version, eg 31, 32] (default is 31)
255ifdef PYTHON3
256ifndef DYNAMIC_PYTHON3
257DYNAMIC_PYTHON3=yes
258endif
259
260ifndef PYTHON3_VER
261PYTHON3_VER=31
262endif
Bram Moolenaara7c37952016-01-20 22:23:15 +0100263ifndef DYNAMIC_PYTHON3_DLL
264DYNAMIC_PYTHON3_DLL=python$(PYTHON3_VER).dll
265endif
266ifdef PYTHON3_HOME
Bram Moolenaaracd58ef2016-02-16 13:42:24 +0100267PYTHON3_HOME_DEF=-DPYTHON3_HOME=L\"$(PYTHON3_HOME)\"
Bram Moolenaar4f7e8212014-11-05 13:53:32 +0100268endif
269
Bram Moolenaara7c37952016-01-20 22:23:15 +0100270ifeq (no,$(DYNAMIC_PYTHON3))
271PYTHON3LIB=-L$(PYTHON3)/libs -lpython$(PYTHON3_VER)
272endif
273
274ifndef PYTHON3INC
Bram Moolenaar4f7e8212014-11-05 13:53:32 +0100275ifeq ($(CROSS),no)
276PYTHON3INC=-I $(PYTHON3)/include
277else
278PYTHON3INC=-I $(PYTHON3)/win32inc
279endif
280endif
Bram Moolenaara7c37952016-01-20 22:23:15 +0100281endif
Bram Moolenaar4f7e8212014-11-05 13:53:32 +0100282
283# TCL interface:
284# TCL=[Path to TCL directory] (Set inside Make_cyg.mak or Make_ming.mak)
285# DYNAMIC_TCL=yes (to load the TCL DLL dynamically)
286# TCL_VER=[TCL version, eg 83, 84] (default is 83)
Bram Moolenaareca99bd2016-01-07 22:50:05 +0100287# TCL_VER_LONG=[Tcl version, eg 8.3] (default is 8.3)
288# You must set TCL_VER_LONG when you set TCL_VER.
Bram Moolenaar4f7e8212014-11-05 13:53:32 +0100289ifdef TCL
290ifndef DYNAMIC_TCL
291DYNAMIC_TCL=yes
292endif
293ifndef TCL_VER
294TCL_VER = 83
295endif
Bram Moolenaareca99bd2016-01-07 22:50:05 +0100296ifndef TCL_VER_LONG
297TCL_VER_LONG = 8.3
298endif
Bram Moolenaar4f7e8212014-11-05 13:53:32 +0100299TCLINC += -I$(TCL)/include
300endif
301
302
303# Ruby interface:
304# RUBY=[Path to Ruby directory] (Set inside Make_cyg.mak or Make_ming.mak)
305# DYNAMIC_RUBY=yes (to load the Ruby DLL dynamically)
306# RUBY_VER=[Ruby version, eg 18, 19, 20] (default is 18)
307# RUBY_VER_LONG=[Ruby version, eg 1.8, 1.9.1, 2.0.0] (default is 1.8)
308# You must set RUBY_VER_LONG when changing RUBY_VER.
309# RUBY_API_VER is derived from RUBY_VER_LONG.
310# Note: If you use Ruby 1.9.3, set as follows:
311# RUBY_VER=19
312# RUBY_VER_LONG=1.9.1 (not 1.9.3, because the API version is 1.9.1.)
313ifdef RUBY
314ifndef DYNAMIC_RUBY
315DYNAMIC_RUBY=yes
316endif
317# Set default value
318ifndef RUBY_VER
319RUBY_VER = 18
320endif
321ifndef RUBY_VER_LONG
322RUBY_VER_LONG = 1.8
323endif
324ifndef RUBY_API_VER
325RUBY_API_VER = $(subst .,,$(RUBY_VER_LONG))
326endif
327
328ifndef RUBY_PLATFORM
329ifeq ($(RUBY_VER), 16)
330RUBY_PLATFORM = i586-mswin32
331else
332ifneq ($(wildcard $(RUBY)/lib/ruby/$(RUBY_VER_LONG)/i386-mingw32),)
333RUBY_PLATFORM = i386-mingw32
334else
335ifneq ($(wildcard $(RUBY)/lib/ruby/$(RUBY_VER_LONG)/x64-mingw32),)
336RUBY_PLATFORM = x64-mingw32
337else
338RUBY_PLATFORM = i386-mswin32
339endif
340endif
341endif
342endif
343
344ifndef RUBY_INSTALL_NAME
345ifeq ($(RUBY_VER), 16)
346RUBY_INSTALL_NAME = mswin32-ruby$(RUBY_API_VER)
347else
Bram Moolenaar0bee2fe2016-01-07 22:45:09 +0100348ifndef RUBY_MSVCRT_NAME
349# Base name of msvcrXX.dll which is used by ruby's dll.
350RUBY_MSVCRT_NAME = msvcrt
351endif
Bram Moolenaar4f7e8212014-11-05 13:53:32 +0100352ifeq ($(ARCH),x86-64)
Bram Moolenaar0bee2fe2016-01-07 22:45:09 +0100353RUBY_INSTALL_NAME = x64-$(RUBY_MSVCRT_NAME)-ruby$(RUBY_API_VER)
Bram Moolenaar4f7e8212014-11-05 13:53:32 +0100354else
Bram Moolenaar0bee2fe2016-01-07 22:45:09 +0100355RUBY_INSTALL_NAME = $(RUBY_MSVCRT_NAME)-ruby$(RUBY_API_VER)
Bram Moolenaar4f7e8212014-11-05 13:53:32 +0100356endif
357endif
358endif
359
360ifeq (19, $(word 1,$(sort 19 $(RUBY_VER))))
361RUBY_19_OR_LATER = 1
362endif
363
364RUBYINC = -I $(RUBY)/lib/ruby/$(RUBY_VER_LONG)/$(RUBY_PLATFORM)
365ifdef RUBY_19_OR_LATER
366RUBYINC += -I $(RUBY)/include/ruby-$(RUBY_VER_LONG) -I $(RUBY)/include/ruby-$(RUBY_VER_LONG)/$(RUBY_PLATFORM)
367endif
368ifeq (no, $(DYNAMIC_RUBY))
369RUBYLIB = -L$(RUBY)/lib -l$(RUBY_INSTALL_NAME)
370endif
371
372endif # RUBY
373
374# See feature.h for a list of options.
375# Any other defines can be included here.
376DEF_GUI=-DFEAT_GUI_W32 -DFEAT_CLIPBOARD
377DEFINES=-DWIN32 -DWINVER=$(WINVER) -D_WIN32_WINNT=$(WINVER) \
378 -DHAVE_PATHDEF -DFEAT_$(FEATURES)
379ifeq ($(ARCH),x86-64)
380DEFINES+=-DMS_WIN64
381endif
382ifeq ($(CROSS),yes)
383# cross-compiler prefix:
384ifndef CROSS_COMPILE
385CROSS_COMPILE = i586-pc-mingw32msvc-
386endif
387DEL = rm
388MKDIR = mkdir -p
389DIRSLASH = /
390else
391# normal (Windows) compilation:
392ifndef CROSS_COMPILE
393CROSS_COMPILE =
394endif
395ifneq (sh.exe, $(SHELL))
396DEL = rm
397MKDIR = mkdir -p
398DIRSLASH = /
399else
400DEL = del
401MKDIR = mkdir
402DIRSLASH = \\
403endif
404endif
405CC := $(CROSS_COMPILE)gcc
406CXX := $(CROSS_COMPILE)g++
Bram Moolenaar2d78cd72014-12-13 20:50:09 +0100407ifeq ($(UNDER_CYGWIN),yes)
Bram Moolenaar4f7e8212014-11-05 13:53:32 +0100408WINDRES := $(CROSS_COMPILE)windres
Bram Moolenaar2d78cd72014-12-13 20:50:09 +0100409else
410WINDRES := windres
411endif
Bram Moolenaar4f7e8212014-11-05 13:53:32 +0100412WINDRES_CC = $(CC)
413
414#>>>>> end of choices
415###########################################################################
416
Bram Moolenaara971df82016-02-15 21:22:10 +0100417CFLAGS = -Iproto $(DEFINES) -pipe -march=$(ARCH) -Wall
Bram Moolenaarcc6cf9b2016-03-19 20:51:35 +0100418CXXFLAGS = -std=c++11
Bram Moolenaar4f7e8212014-11-05 13:53:32 +0100419WINDRES_FLAGS = --preprocessor="$(WINDRES_CC) -E -xc" -DRC_INVOKED
420EXTRA_LIBS =
421
422ifdef GETTEXT
423DEFINES += -DHAVE_GETTEXT -DHAVE_LOCALE_H
424GETTEXTINCLUDE = $(GETTEXT)/include
425GETTEXTLIB = $(INTLPATH)
426ifeq (yes, $(GETTEXT))
427DEFINES += -DDYNAMIC_GETTEXT
428else
429ifdef DYNAMIC_GETTEXT
430DEFINES += -D$(DYNAMIC_GETTEXT)
431ifdef GETTEXT_DYNAMIC
432DEFINES += -DGETTEXT_DYNAMIC -DGETTEXT_DLL=\"$(GETTEXT_DYNAMIC)\"
433endif
434endif
435endif
436endif
437
438ifdef PERL
Bram Moolenaar367fbf12015-06-25 16:13:46 +0200439CFLAGS += -I$(PERLLIBS) -DFEAT_PERL -DPERL_IMPLICIT_CONTEXT -DPERL_IMPLICIT_SYS
Bram Moolenaar4f7e8212014-11-05 13:53:32 +0100440ifeq (yes, $(DYNAMIC_PERL))
441CFLAGS += -DDYNAMIC_PERL -DDYNAMIC_PERL_DLL=\"perl$(PERL_VER).dll\"
442EXTRA_LIBS += -L$(PERLLIBS) -lperl$(PERL_VER)
443endif
444endif
445
446ifdef LUA
447CFLAGS += -I$(LUA)/include -I$(LUA) -DFEAT_LUA
448ifeq (yes, $(DYNAMIC_LUA))
449CFLAGS += -DDYNAMIC_LUA -DDYNAMIC_LUA_DLL=\"lua$(LUA_VER).dll\"
450endif
451endif
452
453ifdef MZSCHEME
Bram Moolenaar4e640bd2016-01-16 16:20:38 +0100454ifndef MZSCHEME_COLLECTS
455MZSCHEME_COLLECTS=$(MZSCHEME)/collects
456ifeq (yes, $(UNDER_CYGWIN))
457MZSCHEME_COLLECTS:=$(shell cygpath -m $(MZSCHEME_COLLECTS) | sed -e 's/ /\\ /g')
458endif
459endif
460CFLAGS += -I$(MZSCHEME)/include -DFEAT_MZSCHEME -DMZSCHEME_COLLECTS=\"$(MZSCHEME_COLLECTS)\"
Bram Moolenaar4f7e8212014-11-05 13:53:32 +0100461ifeq (yes, $(DYNAMIC_MZSCHEME))
Bram Moolenaar4e640bd2016-01-16 16:20:38 +0100462ifeq (yes, $(MZSCHEME_PRECISE_GC))
463# Precise GC does not use separate dll
464CFLAGS += -DDYNAMIC_MZSCHEME -DDYNAMIC_MZSCH_DLL=\"lib$(MZSCHEME_MAIN_LIB)$(MZSCHEME_VER).dll\" -DDYNAMIC_MZGC_DLL=\"lib$(MZSCHEME_MAIN_LIB)$(MZSCHEME_VER).dll\"
465else
Bram Moolenaar4f7e8212014-11-05 13:53:32 +0100466CFLAGS += -DDYNAMIC_MZSCHEME -DDYNAMIC_MZSCH_DLL=\"lib$(MZSCHEME_MAIN_LIB)$(MZSCHEME_VER).dll\" -DDYNAMIC_MZGC_DLL=\"libmzgc$(MZSCHEME_VER).dll\"
467endif
Bram Moolenaar4e640bd2016-01-16 16:20:38 +0100468endif
Bram Moolenaar4f7e8212014-11-05 13:53:32 +0100469ifeq (yes, "$(MZSCHEME_DEBUG)")
470CFLAGS += -DMZSCHEME_FORCE_GC
471endif
472endif
473
474ifdef RUBY
475CFLAGS += -DFEAT_RUBY $(RUBYINC)
476ifeq (yes, $(DYNAMIC_RUBY))
477CFLAGS += -DDYNAMIC_RUBY -DDYNAMIC_RUBY_DLL=\"$(RUBY_INSTALL_NAME).dll\"
478CFLAGS += -DDYNAMIC_RUBY_VER=$(RUBY_VER)
479endif
480ifneq ($(findstring w64-mingw32,$(CC)),)
481# A workaround for MinGW-w64
482CFLAGS += -DHAVE_STRUCT_TIMESPEC -DHAVE_STRUCT_TIMEZONE
483endif
484endif
485
486ifdef PYTHON
Bram Moolenaar223b7232016-02-19 19:43:49 +0100487CFLAGS += -DFEAT_PYTHON
Bram Moolenaar4f7e8212014-11-05 13:53:32 +0100488ifeq (yes, $(DYNAMIC_PYTHON))
Bram Moolenaar449538c2016-01-09 17:49:15 +0100489CFLAGS += -DDYNAMIC_PYTHON -DDYNAMIC_PYTHON_DLL=\"$(DYNAMIC_PYTHON_DLL)\"
Bram Moolenaar4f7e8212014-11-05 13:53:32 +0100490endif
491endif
492
Bram Moolenaar223b7232016-02-19 19:43:49 +0100493ifdef PYTHON3
494CFLAGS += -DFEAT_PYTHON3
Bram Moolenaar4f7e8212014-11-05 13:53:32 +0100495ifeq (yes, $(DYNAMIC_PYTHON3))
Bram Moolenaara7c37952016-01-20 22:23:15 +0100496CFLAGS += -DDYNAMIC_PYTHON3 -DDYNAMIC_PYTHON3_DLL=\"$(DYNAMIC_PYTHON3_DLL)\"
Bram Moolenaar4f7e8212014-11-05 13:53:32 +0100497endif
498endif
499
500ifdef TCL
501CFLAGS += -DFEAT_TCL $(TCLINC)
502ifeq (yes, $(DYNAMIC_TCL))
Bram Moolenaareca99bd2016-01-07 22:50:05 +0100503CFLAGS += -DDYNAMIC_TCL -DDYNAMIC_TCL_DLL=\"tcl$(TCL_VER).dll\" -DDYNAMIC_TCL_VER=\"$(TCL_VER_LONG)\"
Bram Moolenaar4f7e8212014-11-05 13:53:32 +0100504endif
505endif
506
507ifeq ($(POSTSCRIPT),yes)
508DEFINES += -DMSWINPS
509endif
510
511ifeq (yes, $(OLE))
512DEFINES += -DFEAT_OLE
513endif
514
515ifeq ($(CSCOPE),yes)
516DEFINES += -DFEAT_CSCOPE
517endif
518
519ifeq ($(NETBEANS),yes)
520# Only allow NETBEANS for a GUI build.
521ifeq (yes, $(GUI))
522DEFINES += -DFEAT_NETBEANS_INTG
523
524ifeq ($(NBDEBUG), yes)
525DEFINES += -DNBDEBUG
526NBDEBUG_INCL = nbdebug.h
527NBDEBUG_SRC = nbdebug.c
528endif
529endif
530endif
531
Bram Moolenaare0874f82016-01-24 20:36:41 +0100532ifeq ($(CHANNEL),yes)
Bram Moolenaar509ce2a2016-03-11 22:52:15 +0100533DEFINES += -DFEAT_JOB_CHANNEL
Bram Moolenaare0874f82016-01-24 20:36:41 +0100534endif
535
Bram Moolenaar4f7e8212014-11-05 13:53:32 +0100536# DirectWrite (DirectX)
537ifeq ($(DIRECTX),yes)
538# Only allow DirectWrite for a GUI build.
539ifeq (yes, $(GUI))
540DEFINES += -DFEAT_DIRECTX -DDYNAMIC_DIRECTX
541endif
542endif
543
544# Only allow XPM for a GUI build.
545ifeq (yes, $(GUI))
546
547ifndef XPM
548ifeq ($(ARCH),i386)
549XPM = xpm/x86
550endif
551ifeq ($(ARCH),i486)
552XPM = xpm/x86
553endif
554ifeq ($(ARCH),i586)
555XPM = xpm/x86
556endif
557ifeq ($(ARCH),i686)
558XPM = xpm/x86
559endif
560ifeq ($(ARCH),x86-64)
561XPM = xpm/x64
562endif
563endif
564ifdef XPM
565ifneq ($(XPM),no)
566CFLAGS += -DFEAT_XPM_W32 -I $(XPM)/include -I $(XPM)/../include
567endif
568endif
569
570endif
571
572ifeq ($(DEBUG),yes)
573CFLAGS += -g -fstack-check
574DEBUG_SUFFIX=d
575else
576ifeq ($(OPTIMIZE), SIZE)
577CFLAGS += -Os
578else
579ifeq ($(OPTIMIZE), MAXSPEED)
580CFLAGS += -O3
581CFLAGS += -fomit-frame-pointer -freg-struct-return
582else # SPEED
583CFLAGS += -O2
584endif
585endif
586CFLAGS += -s
587endif
588
589LIB = -lkernel32 -luser32 -lgdi32 -ladvapi32 -lcomdlg32 -lcomctl32 -lversion
590GUIOBJ = $(OUTDIR)/gui.o $(OUTDIR)/gui_w32.o $(OUTDIR)/gui_beval.o $(OUTDIR)/os_w32exe.o
591OBJ = \
592 $(OUTDIR)/blowfish.o \
593 $(OUTDIR)/buffer.o \
594 $(OUTDIR)/charset.o \
595 $(OUTDIR)/crypt.o \
596 $(OUTDIR)/crypt_zip.o \
597 $(OUTDIR)/diff.o \
598 $(OUTDIR)/digraph.o \
599 $(OUTDIR)/edit.o \
600 $(OUTDIR)/eval.o \
601 $(OUTDIR)/ex_cmds.o \
602 $(OUTDIR)/ex_cmds2.o \
603 $(OUTDIR)/ex_docmd.o \
604 $(OUTDIR)/ex_eval.o \
605 $(OUTDIR)/ex_getln.o \
606 $(OUTDIR)/fileio.o \
607 $(OUTDIR)/fold.o \
608 $(OUTDIR)/getchar.o \
609 $(OUTDIR)/hardcopy.o \
610 $(OUTDIR)/hashtab.o \
Bram Moolenaar520e1e42016-01-23 19:46:28 +0100611 $(OUTDIR)/json.o \
Bram Moolenaar4f7e8212014-11-05 13:53:32 +0100612 $(OUTDIR)/main.o \
613 $(OUTDIR)/mark.o \
614 $(OUTDIR)/memfile.o \
615 $(OUTDIR)/memline.o \
616 $(OUTDIR)/menu.o \
617 $(OUTDIR)/message.o \
618 $(OUTDIR)/misc1.o \
619 $(OUTDIR)/misc2.o \
620 $(OUTDIR)/move.o \
621 $(OUTDIR)/mbyte.o \
622 $(OUTDIR)/normal.o \
623 $(OUTDIR)/ops.o \
624 $(OUTDIR)/option.o \
625 $(OUTDIR)/os_win32.o \
626 $(OUTDIR)/os_mswin.o \
627 $(OUTDIR)/winclip.o \
628 $(OUTDIR)/pathdef.o \
629 $(OUTDIR)/popupmnu.o \
630 $(OUTDIR)/quickfix.o \
631 $(OUTDIR)/regexp.o \
632 $(OUTDIR)/screen.o \
633 $(OUTDIR)/search.o \
634 $(OUTDIR)/sha256.o \
635 $(OUTDIR)/spell.o \
636 $(OUTDIR)/syntax.o \
637 $(OUTDIR)/tag.o \
638 $(OUTDIR)/term.o \
639 $(OUTDIR)/ui.o \
640 $(OUTDIR)/undo.o \
641 $(OUTDIR)/version.o \
642 $(OUTDIR)/vimrc.o \
643 $(OUTDIR)/window.o
644
645ifdef PERL
646OBJ += $(OUTDIR)/if_perl.o
647endif
648ifdef LUA
649OBJ += $(OUTDIR)/if_lua.o
650endif
651ifdef MZSCHEME
652OBJ += $(OUTDIR)/if_mzsch.o
653MZSCHEME_INCL = if_mzsch.h
654ifeq (yes,$(MZSCHEME_GENERATE_BASE))
655CFLAGS += -DINCLUDE_MZSCHEME_BASE
656MZ_EXTRA_DEP += mzscheme_base.c
657endif
658ifeq (yes,$(MZSCHEME_PRECISE_GC))
659CFLAGS += -DMZ_PRECISE_GC
660endif
661endif
662ifdef PYTHON
663OBJ += $(OUTDIR)/if_python.o
664endif
665ifdef PYTHON3
666OBJ += $(OUTDIR)/if_python3.o
667endif
668ifdef RUBY
669OBJ += $(OUTDIR)/if_ruby.o
670endif
671ifdef TCL
672OBJ += $(OUTDIR)/if_tcl.o
673endif
674ifeq ($(CSCOPE),yes)
675OBJ += $(OUTDIR)/if_cscope.o
676endif
Bram Moolenaare0874f82016-01-24 20:36:41 +0100677
Bram Moolenaar4f7e8212014-11-05 13:53:32 +0100678ifeq ($(NETBEANS),yes)
Bram Moolenaare0874f82016-01-24 20:36:41 +0100679ifneq ($(CHANNEL),yes)
680# Cannot use Netbeans without CHANNEL
681NETBEANS=no
682else
Bram Moolenaar44d57182016-02-14 23:11:23 +0100683ifneq (yes, $(GUI))
684# Cannot use Netbeans without GUI.
685NETBEANS=no
686else
Bram Moolenaar4f7e8212014-11-05 13:53:32 +0100687OBJ += $(OUTDIR)/netbeans.o
Bram Moolenaar4f7e8212014-11-05 13:53:32 +0100688endif
689endif
Bram Moolenaare0874f82016-01-24 20:36:41 +0100690endif
691
692ifeq ($(CHANNEL),yes)
693OBJ += $(OUTDIR)/channel.o
Bram Moolenaare0874f82016-01-24 20:36:41 +0100694LIB += -lwsock32
695endif
Bram Moolenaare0874f82016-01-24 20:36:41 +0100696
Bram Moolenaar4f7e8212014-11-05 13:53:32 +0100697ifeq ($(DIRECTX),yes)
698# Only allow DIRECTX for a GUI build.
699ifeq (yes, $(GUI))
700OBJ += $(OUTDIR)/gui_dwrite.o
701LIB += -ld2d1 -ldwrite
702USE_STDCPLUS = yes
703endif
704endif
705ifneq ($(XPM),no)
706# Only allow XPM for a GUI build.
707ifeq (yes, $(GUI))
708OBJ += $(OUTDIR)/xpm_w32.o
709# You'll need libXpm.a from http://gnuwin32.sf.net
710LIB += -L$(XPM)/lib -lXpm
711endif
712endif
713
714
715ifdef MZSCHEME
716MZSCHEME_SUFFIX = Z
717endif
718
719ifeq ($(GUI),yes)
720TARGET := gvim$(DEBUG_SUFFIX).exe
721DEFINES += $(DEF_GUI)
722OBJ += $(GUIOBJ)
723LFLAGS += -mwindows
724OUTDIR = gobj$(DEBUG_SUFFIX)$(MZSCHEME_SUFFIX)$(ARCH)
725else
726TARGET := vim$(DEBUG_SUFFIX).exe
727OUTDIR = obj$(DEBUG_SUFFIX)$(MZSCHEME_SUFFIX)$(ARCH)
728endif
729
730ifdef GETTEXT
731ifneq (yes, $(GETTEXT))
732CFLAGS += -I$(GETTEXTINCLUDE)
733ifndef STATIC_GETTEXT
734LIB += -L$(GETTEXTLIB) -l$(INTLLIB)
735ifeq (USE_SAFE_GETTEXT_DLL, $(DYNAMIC_GETTEXT))
736OBJ+=$(SAFE_GETTEXT_DLL_OBJ)
737endif
738else
739LIB += -L$(GETTEXTLIB) -lintl
740endif
741endif
742endif
743
744ifdef PERL
745ifeq (no, $(DYNAMIC_PERL))
746LIB += -L$(PERLLIBS) -lperl$(PERL_VER)
747endif
748endif
749
750ifdef TCL
751LIB += -L$(TCL)/lib
752ifeq (yes, $(DYNAMIC_TCL))
753LIB += -ltclstub$(TCL_VER)
754else
755LIB += -ltcl$(TCL_VER)
756endif
757endif
758
759ifeq (yes, $(OLE))
760LIB += -loleaut32
761OBJ += $(OUTDIR)/if_ole.o
762USE_STDCPLUS = yes
763endif
764
765ifeq (yes, $(MBYTE))
766DEFINES += -DFEAT_MBYTE
767endif
768
769ifeq (yes, $(IME))
770DEFINES += -DFEAT_MBYTE_IME
771ifeq (yes, $(DYNAMIC_IME))
772DEFINES += -DDYNAMIC_IME
773else
774LIB += -limm32
775endif
776endif
777
778ifdef ICONV
779ifneq (yes, $(ICONV))
780LIB += -L$(ICONV)
781CFLAGS += -I$(ICONV)
782endif
783DEFINES+=-DDYNAMIC_ICONV
784endif
785
786ifeq (yes, $(USE_STDCPLUS))
787ifeq (yes, $(STATIC_STDCPLUS))
788LIB += -Wl,-Bstatic -lstdc++ -Wl,-Bdynamic
789else
790LIB += -lstdc++
791endif
792endif
793
794all: $(TARGET) vimrun.exe xxd/xxd.exe install.exe uninstal.exe GvimExt/gvimext.dll
795
796vimrun.exe: vimrun.c
797 $(CC) $(CFLAGS) -o vimrun.exe vimrun.c $(LIB)
798
799install.exe: dosinst.c
800 $(CC) $(CFLAGS) -o install.exe dosinst.c $(LIB) -lole32 -luuid
801
802uninstal.exe: uninstal.c
803 $(CC) $(CFLAGS) -o uninstal.exe uninstal.c $(LIB)
804
805$(TARGET): $(OUTDIR) $(OBJ)
806 $(CC) $(CFLAGS) $(LFLAGS) -o $@ $(OBJ) $(LIB) -lole32 -luuid $(LUA_LIB) $(MZSCHEME_LIBDIR) $(MZSCHEME_LIB) $(PYTHONLIB) $(PYTHON3LIB) $(RUBYLIB)
807
808upx: exes
809 upx gvim.exe
810 upx vim.exe
811
812mpress: exes
813 mpress gvim.exe
814 mpress vim.exe
815
816xxd/xxd.exe: xxd/xxd.c
817 $(MAKE) -C xxd -f Make_ming.mak CC='$(CC)'
818
819GvimExt/gvimext.dll: GvimExt/gvimext.cpp GvimExt/gvimext.rc GvimExt/gvimext.h
820 $(MAKE) -C GvimExt -f Make_ming.mak CROSS=$(CROSS) CROSS_COMPILE=$(CROSS_COMPILE) CXX='$(CXX)' STATIC_STDCPLUS=$(STATIC_STDCPLUS)
821
822clean:
823 -$(DEL) $(OUTDIR)$(DIRSLASH)*.o
824 -$(DEL) $(OUTDIR)$(DIRSLASH)*.res
825 -rmdir $(OUTDIR)
826 -$(DEL) *.exe
827 -$(DEL) pathdef.c
828ifdef PERL
829 -$(DEL) if_perl.c
830endif
831ifdef MZSCHEME
832 -$(DEL) mzscheme_base.c
833endif
834 $(MAKE) -C GvimExt -f Make_ming.mak clean
835 $(MAKE) -C xxd -f Make_ming.mak clean
836
837###########################################################################
838INCL = vim.h feature.h os_win32.h os_dos.h ascii.h keymap.h term.h macros.h \
839 structs.h regexp.h option.h ex_cmds.h proto.h globals.h farsi.h \
840 gui.h
841
842$(OUTDIR)/if_python.o : if_python.c if_py_both.h $(INCL)
Bram Moolenaar449538c2016-01-09 17:49:15 +0100843 $(CC) -c $(CFLAGS) $(PYTHONINC) $(PYTHON_HOME_DEF) $< -o $@
Bram Moolenaar4f7e8212014-11-05 13:53:32 +0100844
845$(OUTDIR)/if_python3.o : if_python3.c if_py_both.h $(INCL)
Bram Moolenaara7c37952016-01-20 22:23:15 +0100846 $(CC) -c $(CFLAGS) $(PYTHON3INC) $(PYTHON3_HOME_DEF) $< -o $@
Bram Moolenaar4f7e8212014-11-05 13:53:32 +0100847
848$(OUTDIR)/%.o : %.c $(INCL)
849 $(CC) -c $(CFLAGS) $< -o $@
850
851$(OUTDIR)/vimrc.o: vim.rc version.h gui_w32_rc.h
852 $(WINDRES) $(WINDRES_FLAGS) $(DEFINES) \
853 --input-format=rc --output-format=coff -i vim.rc -o $@
854
855$(OUTDIR):
856 $(MKDIR) $(OUTDIR)
857
858$(OUTDIR)/ex_docmd.o: ex_docmd.c $(INCL) ex_cmds.h
859 $(CC) -c $(CFLAGS) ex_docmd.c -o $(OUTDIR)/ex_docmd.o
860
861$(OUTDIR)/ex_eval.o: ex_eval.c $(INCL) ex_cmds.h
862 $(CC) -c $(CFLAGS) ex_eval.c -o $(OUTDIR)/ex_eval.o
863
Bram Moolenaarcf7164a2016-02-20 13:55:06 +0100864$(OUTDIR)/gui_w32.o: gui_w32.c $(INCL)
Bram Moolenaar4f7e8212014-11-05 13:53:32 +0100865 $(CC) -c $(CFLAGS) gui_w32.c -o $(OUTDIR)/gui_w32.o
866
867$(OUTDIR)/gui_dwrite.o: gui_dwrite.cpp $(INCL) gui_dwrite.h
Bram Moolenaarcc6cf9b2016-03-19 20:51:35 +0100868 $(CC) -c $(CFLAGS) $(CXXFLAGS) gui_dwrite.cpp -o $(OUTDIR)/gui_dwrite.o
Bram Moolenaar4f7e8212014-11-05 13:53:32 +0100869
870$(OUTDIR)/if_cscope.o: if_cscope.c $(INCL) if_cscope.h
871 $(CC) -c $(CFLAGS) if_cscope.c -o $(OUTDIR)/if_cscope.o
872
873# Remove -D__IID_DEFINED__ for newer versions of the w32api
874$(OUTDIR)/if_ole.o: if_ole.cpp $(INCL)
Bram Moolenaarcc6cf9b2016-03-19 20:51:35 +0100875 $(CC) $(CFLAGS) $(CXXFLAGS) -c -o $(OUTDIR)/if_ole.o if_ole.cpp
Bram Moolenaar4f7e8212014-11-05 13:53:32 +0100876
877$(OUTDIR)/if_ruby.o: if_ruby.c $(INCL)
878ifeq (16, $(RUBY))
879 $(CC) $(CFLAGS) -U_WIN32 -c -o $(OUTDIR)/if_ruby.o if_ruby.c
880endif
881
882if_perl.c: if_perl.xs typemap
883 $(XSUBPP) -prototypes -typemap \
Bram Moolenaar345326a2014-11-06 10:03:01 +0100884 $(PERLTYPEMAP) if_perl.xs > $@
Bram Moolenaar4f7e8212014-11-05 13:53:32 +0100885
886$(OUTDIR)/netbeans.o: netbeans.c $(INCL) $(NBDEBUG_INCL) $(NBDEBUG_SRC)
887 $(CC) -c $(CFLAGS) netbeans.c -o $(OUTDIR)/netbeans.o
888
Bram Moolenaare0874f82016-01-24 20:36:41 +0100889$(OUTDIR)/channel.o: channel.c $(INCL)
890 $(CC) -c $(CFLAGS) channel.c -o $(OUTDIR)/channel.o
891
Bram Moolenaar4f7e8212014-11-05 13:53:32 +0100892$(OUTDIR)/regexp.o: regexp.c regexp_nfa.c $(INCL)
893 $(CC) -c $(CFLAGS) regexp.c -o $(OUTDIR)/regexp.o
894
895$(OUTDIR)/if_mzsch.o: if_mzsch.c $(INCL) if_mzsch.h $(MZ_EXTRA_DEP)
896 $(CC) -c $(CFLAGS) if_mzsch.c -o $(OUTDIR)/if_mzsch.o
897
898mzscheme_base.c:
899 $(MZSCHEME)/mzc --c-mods mzscheme_base.c ++lib scheme/base
900
901pathdef.c: $(INCL)
902ifneq (sh.exe, $(SHELL))
903 @echo creating pathdef.c
904 @echo '/* pathdef.c */' > pathdef.c
905 @echo '#include "vim.h"' >> pathdef.c
906 @echo 'char_u *default_vim_dir = (char_u *)"$(VIMRCLOC)";' >> pathdef.c
907 @echo 'char_u *default_vimruntime_dir = (char_u *)"$(VIMRUNTIMEDIR)";' >> pathdef.c
908 @echo 'char_u *all_cflags = (char_u *)"$(CC) $(CFLAGS)";' >> pathdef.c
909 @echo 'char_u *all_lflags = (char_u *)"$(CC) $(CFLAGS) $(LFLAGS) -o $(TARGET) $(LIB) -lole32 -luuid $(LUA_LIB) $(MZSCHEME_LIBDIR) $(MZSCHEME_LIB) $(PYTHONLIB) $(PYTHON3LIB) $(RUBYLIB)";' >> pathdef.c
910 @echo 'char_u *compiled_user = (char_u *)"$(USERNAME)";' >> pathdef.c
911 @echo 'char_u *compiled_sys = (char_u *)"$(USERDOMAIN)";' >> pathdef.c
912else
913 @echo creating pathdef.c
914 @echo /* pathdef.c */ > pathdef.c
915 @echo #include "vim.h" >> pathdef.c
916 @echo char_u *default_vim_dir = (char_u *)"$(VIMRCLOC)"; >> pathdef.c
917 @echo char_u *default_vimruntime_dir = (char_u *)"$(VIMRUNTIMEDIR)"; >> pathdef.c
918 @echo char_u *all_cflags = (char_u *)"$(CC) $(CFLAGS)"; >> pathdef.c
919 @echo char_u *all_lflags = (char_u *)"$(CC) $(CFLAGS) $(LFLAGS) -o $(TARGET) $(LIB) -lole32 -luuid $(LUA_LIB) $(MZSCHEME_LIBDIR) $(MZSCHEME_LIB) $(PYTHONLIB) $(PYTHON3LIB) $(RUBYLIB)"; >> pathdef.c
920 @echo char_u *compiled_user = (char_u *)"$(USERNAME)"; >> pathdef.c
921 @echo char_u *compiled_sys = (char_u *)"$(USERDOMAIN)"; >> pathdef.c
922endif