blob: d51b6ea89896ea662036c9cce9458a2d384fd3ae [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:
Bram Moolenaar43cb6262018-03-14 21:39:02 +010023# https://upx.github.io/
Bram Moolenaar4f7e8212014-11-05 13:53:32 +010024# "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:
Bram Moolenaar4f7e8212014-11-05 13:53:32 +010031# FEATURES=[TINY | SMALL | NORMAL | BIG | HUGE]
32# Set to TINY to make minimal version (few features).
Bram Moolenaare5f2be62016-01-21 20:24:34 +010033FEATURES=HUGE
Bram Moolenaarcccd62d2018-04-12 20:23:48 +020034
35# set to yes for a debug build
36DEBUG=no
37
38# set to SIZE for size, SPEED for speed, MAXSPEED for maximum optimization
39OPTIMIZE=MAXSPEED
40
41# set to yes to make gvim, no for vim
42GUI=yes
43
44# set to no if you do not want to use DirectWrite (DirectX)
45# MinGW-w64 is needed, and ARCH should be set to i686 or x86-64.
46DIRECTX=yes
47
48# Disable Color emoji support
49# (default is yes if DIRECTX=yes, requires WinSDK 8.1 or later.)
50#COLOR_EMOJI=no
51
Bram Moolenaar4f7e8212014-11-05 13:53:32 +010052# Set to one of i386, i486, i586, i686 as the minimum target processor.
53# For amd64/x64 architecture set ARCH=x86-64 .
Bram Moolenaare0485392016-07-12 21:17:03 +020054# If not set, it will be automatically detected. (Normally i686 or x86-64.)
55#ARCH=i686
Bram Moolenaar4f7e8212014-11-05 13:53:32 +010056# Set to yes to cross-compile from unix; no=native Windows (and Cygwin).
57CROSS=no
Bram Moolenaarcccd62d2018-04-12 20:23:48 +020058
Bram Moolenaar4f7e8212014-11-05 13:53:32 +010059# Set to path to iconv.h and libiconv.a to enable using 'iconv.dll'.
Bram Moolenaarac8069b2017-10-14 20:24:19 +020060# Use "yes" when the path does not need to be define.
Bram Moolenaar4f7e8212014-11-05 13:53:32 +010061#ICONV="."
62ICONV=yes
63GETTEXT=yes
Bram Moolenaarcccd62d2018-04-12 20:23:48 +020064
Bram Moolenaar4f7e8212014-11-05 13:53:32 +010065# Set to yes to include multibyte support.
66MBYTE=yes
Bram Moolenaarcccd62d2018-04-12 20:23:48 +020067
Bram Moolenaar4f7e8212014-11-05 13:53:32 +010068# Set to yes to include IME support.
69IME=yes
70DYNAMIC_IME=yes
Bram Moolenaarcccd62d2018-04-12 20:23:48 +020071
Bram Moolenaar4f7e8212014-11-05 13:53:32 +010072# Set to yes to enable writing a postscript file with :hardcopy.
73POSTSCRIPT=no
Bram Moolenaarcccd62d2018-04-12 20:23:48 +020074
Bram Moolenaar4f7e8212014-11-05 13:53:32 +010075# Set to yes to enable OLE support.
76OLE=no
Bram Moolenaarcccd62d2018-04-12 20:23:48 +020077
Bram Moolenaar223b7232016-02-19 19:43:49 +010078# Set the default $(WINVER) to make it work with WinXP.
Bram Moolenaar4f7e8212014-11-05 13:53:32 +010079ifndef WINVER
Bram Moolenaar223b7232016-02-19 19:43:49 +010080WINVER = 0x0501
Bram Moolenaar4f7e8212014-11-05 13:53:32 +010081endif
Bram Moolenaarcccd62d2018-04-12 20:23:48 +020082
Bram Moolenaar4f7e8212014-11-05 13:53:32 +010083# Set to yes to enable Cscope support.
84CSCOPE=yes
Bram Moolenaarcccd62d2018-04-12 20:23:48 +020085
Bram Moolenaare0874f82016-01-24 20:36:41 +010086# Set to yes to enable Netbeans support (requires CHANNEL).
Bram Moolenaar4f7e8212014-11-05 13:53:32 +010087NETBEANS=$(GUI)
Bram Moolenaarcccd62d2018-04-12 20:23:48 +020088
Bram Moolenaare0874f82016-01-24 20:36:41 +010089# Set to yes to enable inter process communication.
Bram Moolenaar1aa07bd2016-06-03 19:43:16 +020090ifeq (HUGE, $(FEATURES))
91CHANNEL=yes
92else
Bram Moolenaare0874f82016-01-24 20:36:41 +010093CHANNEL=$(GUI)
Bram Moolenaar1aa07bd2016-06-03 19:43:16 +020094endif
Bram Moolenaarcccd62d2018-04-12 20:23:48 +020095
Bram Moolenaar8a773062017-07-24 22:29:21 +020096# Set to yes to enable terminal support.
Bram Moolenaarac8069b2017-10-14 20:24:19 +020097ifeq (HUGE, $(FEATURES))
98TERMINAL=yes
99else
Bram Moolenaar4fc63502017-07-19 11:28:17 +0200100TERMINAL=no
Bram Moolenaarac8069b2017-10-14 20:24:19 +0200101endif
Bram Moolenaar4f7e8212014-11-05 13:53:32 +0100102
Bram Moolenaar9ac9dfa2017-09-01 18:41:26 +0200103ifndef CTAGS
104# this assumes ctags is Exuberant ctags
105CTAGS = ctags -I INIT+ --fields=+S
106endif
Bram Moolenaar4f7e8212014-11-05 13:53:32 +0100107
108# Link against the shared version of libstdc++ by default. Set
109# STATIC_STDCPLUS to "yes" to link against static version instead.
110ifndef STATIC_STDCPLUS
111STATIC_STDCPLUS=no
112endif
113
Bram Moolenaare3af7632016-12-01 20:37:47 +0100114
115# Link against the shared version of libwinpthread by default. Set
116# STATIC_WINPTHREAD to "yes" to link against static version instead.
117ifndef STATIC_WINPTHREAD
118STATIC_WINPTHREAD=$(STATIC_STDCPLUS)
119endif
120
Bram Moolenaar4f7e8212014-11-05 13:53:32 +0100121# If the user doesn't want gettext, undefine it.
122ifeq (no, $(GETTEXT))
123GETTEXT=
124endif
125# Added by E.F. Amatria <eferna1@platea.ptic.mec.es> 2001 Feb 23
126# Uncomment the first line and one of the following three if you want Native Language
127# Support. You'll need gnu_gettext.win32, a MINGW32 Windows PORT of gettext by
128# Franco Bez <franco.bez@gmx.de>. It may be found at
129# http://home.a-city.de/franco.bez/gettext/gettext_win32_en.html
130# Tested with mingw32 with GCC-2.95.2 on Win98
131# Updated 2001 Jun 9
132#GETTEXT=c:/gettext.win32.msvcrt
133#STATIC_GETTEXT=USE_STATIC_GETTEXT
134#DYNAMIC_GETTEXT=USE_GETTEXT_DLL
135#DYNAMIC_GETTEXT=USE_SAFE_GETTEXT_DLL
136SAFE_GETTEXT_DLL_OBJ = $(GETTEXT)/src/safe_gettext_dll/safe_gettext_dll.o
137# Alternatively, if you uncomment the two following lines, you get a "safe" version
138# without linking the safe_gettext_dll.o object file.
139#DYNAMIC_GETTEXT=DYNAMIC_GETTEXT
140#GETTEXT_DYNAMIC=gnu_gettext.dll
141INTLPATH=$(GETTEXT)/lib/mingw32
142INTLLIB=gnu_gettext
143
144# If you are using gettext-0.10.35 from http://sourceforge.net/projects/gettext
145# or gettext-0.10.37 from http://sourceforge.net/projects/mingwrep/
146# uncomment the following, but I can't build a static version with them, ?-(|
147#GETTEXT=c:/gettext-0.10.37-20010430
148#STATIC_GETTEXT=USE_STATIC_GETTEXT
149#DYNAMIC_GETTEXT=DYNAMIC_GETTEXT
150#INTLPATH=$(GETTEXT)/lib
151#INTLLIB=intl
152
Bram Moolenaare0485392016-07-12 21:17:03 +0200153
154# Command definitions (depends on cross-compiling and shell)
155ifeq ($(CROSS),yes)
156# cross-compiler prefix:
157ifndef CROSS_COMPILE
158CROSS_COMPILE = i586-pc-mingw32msvc-
159endif
160DEL = rm
161MKDIR = mkdir -p
162DIRSLASH = /
163else
164# normal (Windows) compilation:
165ifndef CROSS_COMPILE
166CROSS_COMPILE =
167endif
168ifneq (sh.exe, $(SHELL))
169DEL = rm
170MKDIR = mkdir -p
171DIRSLASH = /
172else
173DEL = del
174MKDIR = mkdir
175DIRSLASH = \\
176endif
177endif
178CC := $(CROSS_COMPILE)gcc
179CXX := $(CROSS_COMPILE)g++
180ifeq ($(UNDER_CYGWIN),yes)
181WINDRES := $(CROSS_COMPILE)windres
182else
183WINDRES := windres
184endif
185WINDRES_CC = $(CC)
186
187# Get the default ARCH.
188ifndef ARCH
Bram Moolenaarf62e7972016-07-14 20:25:03 +0200189ARCH := $(shell $(CC) -dumpmachine | sed -e 's/-.*//' -e 's/_/-/' -e 's/^mingw32$$/i686/')
Bram Moolenaare0485392016-07-12 21:17:03 +0200190endif
191
192
Bram Moolenaar4f7e8212014-11-05 13:53:32 +0100193# Perl interface:
194# PERL=[Path to Perl directory] (Set inside Make_cyg.mak or Make_ming.mak)
195# DYNAMIC_PERL=yes (to load the Perl DLL dynamically)
Bram Moolenaar0eaadec2016-09-08 20:28:45 +0200196# PERL_VER=[Perl version, eg 56, 58, 510] (default is 524)
Bram Moolenaar4f7e8212014-11-05 13:53:32 +0100197ifdef PERL
198ifndef PERL_VER
Bram Moolenaar0eaadec2016-09-08 20:28:45 +0200199PERL_VER=524
Bram Moolenaar4f7e8212014-11-05 13:53:32 +0100200endif
201ifndef DYNAMIC_PERL
202DYNAMIC_PERL=yes
203endif
204# on Linux, for cross-compile, it's here:
205#PERLLIB=/home/ron/ActivePerl/lib
206# on NT, it's here:
207PERLEXE=$(PERL)/bin/perl
208PERLLIB=$(PERL)/lib
209PERLLIBS=$(PERLLIB)/Core
210ifeq ($(UNDER_CYGWIN),yes)
211PERLTYPEMAP:=$(shell cygpath -m $(PERLLIB)/ExtUtils/typemap)
212XSUBPPTRY:=$(shell cygpath -m $(PERLLIB)/ExtUtils/xsubpp)
213else
214PERLTYPEMAP=$(PERLLIB)/ExtUtils/typemap
215XSUBPPTRY=$(PERLLIB)/ExtUtils/xsubpp
216endif
217XSUBPP_EXISTS=$(shell $(PERLEXE) -e "print 1 unless -e '$(XSUBPPTRY)'")
218ifeq "$(XSUBPP_EXISTS)" ""
Bram Moolenaar345326a2014-11-06 10:03:01 +0100219XSUBPP=$(PERLEXE) $(XSUBPPTRY)
Bram Moolenaar4f7e8212014-11-05 13:53:32 +0100220else
221XSUBPP=xsubpp
222endif
223endif
224
225# Lua interface:
226# LUA=[Path to Lua directory] (Set inside Make_cyg.mak or Make_ming.mak)
227# DYNAMIC_LUA=yes (to load the Lua DLL dynamically)
Bram Moolenaar0eaadec2016-09-08 20:28:45 +0200228# LUA_VER=[Lua version, eg 51, 52] (default is 53)
Bram Moolenaar4f7e8212014-11-05 13:53:32 +0100229ifdef LUA
230ifndef DYNAMIC_LUA
231DYNAMIC_LUA=yes
232endif
233
234ifndef LUA_VER
Bram Moolenaar0eaadec2016-09-08 20:28:45 +0200235LUA_VER=53
Bram Moolenaar4f7e8212014-11-05 13:53:32 +0100236endif
237
238ifeq (no,$(DYNAMIC_LUA))
239LUA_LIB = -L$(LUA)/lib -llua
240endif
241
242endif
243
244# MzScheme interface:
245# MZSCHEME=[Path to MzScheme directory] (Set inside Make_cyg.mak or Make_ming.mak)
246# DYNAMIC_MZSCHEME=yes (to load the MzScheme DLL dynamically)
Bram Moolenaar0eaadec2016-09-08 20:28:45 +0200247# MZSCHEME_VER=[MzScheme version] (default is 3m_a0solc (6.6))
Bram Moolenaarf16c71b2017-09-18 20:01:02 +0200248# Used for the DLL file name. E.g.:
249# C:\Program Files (x86)\Racket\lib\libracket3m_XXXXXX.dll
Bram Moolenaar4f7e8212014-11-05 13:53:32 +0100250# MZSCHEME_DEBUG=no
251ifdef MZSCHEME
252ifndef DYNAMIC_MZSCHEME
253DYNAMIC_MZSCHEME=yes
254endif
255
256ifndef MZSCHEME_VER
Bram Moolenaar0eaadec2016-09-08 20:28:45 +0200257MZSCHEME_VER=3m_a0solc
Bram Moolenaar4f7e8212014-11-05 13:53:32 +0100258endif
259
Bram Moolenaar4f7e8212014-11-05 13:53:32 +0100260# for version 4.x we need to generate byte-code for Scheme base
261ifndef MZSCHEME_GENERATE_BASE
262MZSCHEME_GENERATE_BASE=no
263endif
264
Bram Moolenaar4e640bd2016-01-16 16:20:38 +0100265ifneq ($(wildcard $(MZSCHEME)/lib/msvc/libmzsch$(MZSCHEME_VER).lib),)
Bram Moolenaar4f7e8212014-11-05 13:53:32 +0100266MZSCHEME_MAIN_LIB=mzsch
267else
268MZSCHEME_MAIN_LIB=racket
269endif
270
Bram Moolenaar4e640bd2016-01-16 16:20:38 +0100271ifndef MZSCHEME_PRECISE_GC
272MZSCHEME_PRECISE_GC=no
273ifneq ($(wildcard $(MZSCHEME)\lib\lib$(MZSCHEME_MAIN_LIB)$(MZSCHEME_VER).dll),)
274ifeq ($(wildcard $(MZSCHEME)\lib\libmzgc$(MZSCHEME_VER).dll),)
275MZSCHEME_PRECISE_GC=yes
276endif
277else
278ifneq ($(wildcard $(MZSCHEME)\lib\msvc\lib$(MZSCHEME_MAIN_LIB)$(MZSCHEME_VER).lib),)
279ifeq ($(wildcard $(MZSCHEME)\lib\msvc\libmzgc$(MZSCHEME_VER).lib),)
280MZSCHEME_PRECISE_GC=yes
281endif
282endif
283endif
284endif
285
Bram Moolenaar4f7e8212014-11-05 13:53:32 +0100286ifeq (no,$(DYNAMIC_MZSCHEME))
287ifeq (yes,$(MZSCHEME_PRECISE_GC))
288MZSCHEME_LIB=-l$(MZSCHEME_MAIN_LIB)$(MZSCHEME_VER)
289else
Bram Moolenaar4e640bd2016-01-16 16:20:38 +0100290MZSCHEME_LIB=-l$(MZSCHEME_MAIN_LIB)$(MZSCHEME_VER) -lmzgc$(MZSCHEME_VER)
Bram Moolenaar4f7e8212014-11-05 13:53:32 +0100291endif
292# the modern MinGW can dynamically link to dlls directly.
293# point MZSCHEME_DLLS to where you put libmzschXXXXXXX.dll and libgcXXXXXXX.dll
294ifndef MZSCHEME_DLLS
295MZSCHEME_DLLS=$(MZSCHEME)
296endif
297MZSCHEME_LIBDIR=-L$(MZSCHEME_DLLS) -L$(MZSCHEME_DLLS)\lib
298endif
299
300endif
301
302# Python interface:
303# PYTHON=[Path to Python directory] (Set inside Make_cyg.mak or Make_ming.mak)
304# DYNAMIC_PYTHON=yes (to load the Python DLL dynamically)
Bram Moolenaar0eaadec2016-09-08 20:28:45 +0200305# PYTHON_VER=[Python version, eg 22, 23, ..., 27] (default is 27)
Bram Moolenaar4f7e8212014-11-05 13:53:32 +0100306ifdef PYTHON
307ifndef DYNAMIC_PYTHON
308DYNAMIC_PYTHON=yes
309endif
310
311ifndef PYTHON_VER
Bram Moolenaar3c6f92e2016-01-02 20:26:36 +0100312PYTHON_VER=27
313endif
314ifndef DYNAMIC_PYTHON_DLL
315DYNAMIC_PYTHON_DLL=python$(PYTHON_VER).dll
316endif
317ifdef PYTHON_HOME
318PYTHON_HOME_DEF=-DPYTHON_HOME=\"$(PYTHON_HOME)\"
Bram Moolenaar4f7e8212014-11-05 13:53:32 +0100319endif
320
321ifeq (no,$(DYNAMIC_PYTHON))
322PYTHONLIB=-L$(PYTHON)/libs -lpython$(PYTHON_VER)
323endif
324# my include files are in 'win32inc' on Linux, and 'include' in the standard
325# NT distro (ActiveState)
Bram Moolenaar3c6f92e2016-01-02 20:26:36 +0100326ifndef PYTHONINC
Bram Moolenaar4f7e8212014-11-05 13:53:32 +0100327ifeq ($(CROSS),no)
328PYTHONINC=-I $(PYTHON)/include
329else
330PYTHONINC=-I $(PYTHON)/win32inc
331endif
332endif
Bram Moolenaar3c6f92e2016-01-02 20:26:36 +0100333endif
Bram Moolenaar4f7e8212014-11-05 13:53:32 +0100334
335# Python3 interface:
336# PYTHON3=[Path to Python3 directory] (Set inside Make_cyg.mak or Make_ming.mak)
337# DYNAMIC_PYTHON3=yes (to load the Python3 DLL dynamically)
Bram Moolenaar59eb0162017-12-10 18:17:44 +0100338# PYTHON3_VER=[Python3 version, eg 31, 32] (default is 36)
Bram Moolenaar4f7e8212014-11-05 13:53:32 +0100339ifdef PYTHON3
340ifndef DYNAMIC_PYTHON3
341DYNAMIC_PYTHON3=yes
342endif
343
344ifndef PYTHON3_VER
Bram Moolenaar59eb0162017-12-10 18:17:44 +0100345PYTHON3_VER=36
Bram Moolenaar4f7e8212014-11-05 13:53:32 +0100346endif
Bram Moolenaara7c37952016-01-20 22:23:15 +0100347ifndef DYNAMIC_PYTHON3_DLL
348DYNAMIC_PYTHON3_DLL=python$(PYTHON3_VER).dll
349endif
350ifdef PYTHON3_HOME
Bram Moolenaaracd58ef2016-02-16 13:42:24 +0100351PYTHON3_HOME_DEF=-DPYTHON3_HOME=L\"$(PYTHON3_HOME)\"
Bram Moolenaar4f7e8212014-11-05 13:53:32 +0100352endif
353
Bram Moolenaara7c37952016-01-20 22:23:15 +0100354ifeq (no,$(DYNAMIC_PYTHON3))
355PYTHON3LIB=-L$(PYTHON3)/libs -lpython$(PYTHON3_VER)
356endif
357
358ifndef PYTHON3INC
Bram Moolenaar4f7e8212014-11-05 13:53:32 +0100359ifeq ($(CROSS),no)
360PYTHON3INC=-I $(PYTHON3)/include
361else
362PYTHON3INC=-I $(PYTHON3)/win32inc
363endif
364endif
Bram Moolenaara7c37952016-01-20 22:23:15 +0100365endif
Bram Moolenaar4f7e8212014-11-05 13:53:32 +0100366
367# TCL interface:
368# TCL=[Path to TCL directory] (Set inside Make_cyg.mak or Make_ming.mak)
369# DYNAMIC_TCL=yes (to load the TCL DLL dynamically)
Bram Moolenaar0eaadec2016-09-08 20:28:45 +0200370# TCL_VER=[TCL version, eg 83, 84] (default is 86)
371# TCL_VER_LONG=[Tcl version, eg 8.3] (default is 8.6)
Bram Moolenaareca99bd2016-01-07 22:50:05 +0100372# You must set TCL_VER_LONG when you set TCL_VER.
Bram Moolenaar77f74742017-08-23 22:40:41 +0200373# TCL_DLL=[TCL dll name, eg tcl86.dll] (default is tcl86.dll)
Bram Moolenaar4f7e8212014-11-05 13:53:32 +0100374ifdef TCL
375ifndef DYNAMIC_TCL
376DYNAMIC_TCL=yes
377endif
378ifndef TCL_VER
Bram Moolenaar0eaadec2016-09-08 20:28:45 +0200379TCL_VER = 86
Bram Moolenaar4f7e8212014-11-05 13:53:32 +0100380endif
Bram Moolenaareca99bd2016-01-07 22:50:05 +0100381ifndef TCL_VER_LONG
Bram Moolenaar0eaadec2016-09-08 20:28:45 +0200382TCL_VER_LONG = 8.6
Bram Moolenaareca99bd2016-01-07 22:50:05 +0100383endif
Bram Moolenaar77f74742017-08-23 22:40:41 +0200384ifndef TCL_DLL
385TCL_DLL = tcl$(TCL_VER).dll
386endif
Bram Moolenaar4f7e8212014-11-05 13:53:32 +0100387TCLINC += -I$(TCL)/include
388endif
389
390
391# Ruby interface:
392# RUBY=[Path to Ruby directory] (Set inside Make_cyg.mak or Make_ming.mak)
Bram Moolenaar61766972018-04-20 22:31:41 +0200393# DYNAMIC_RUBY=yes (to load the Ruby DLL dynamically, "no" for static)
Bram Moolenaar6384c5d2016-09-06 22:06:35 +0200394# RUBY_VER=[Ruby version, eg 19, 22] (default is 22)
395# RUBY_API_VER_LONG=[Ruby API version, eg 1.8, 1.9.1, 2.2.0]
396# (default is 2.2.0)
397# You must set RUBY_API_VER_LONG when changing RUBY_VER.
Bram Moolenaar4f7e8212014-11-05 13:53:32 +0100398# Note: If you use Ruby 1.9.3, set as follows:
399# RUBY_VER=19
Bram Moolenaar6384c5d2016-09-06 22:06:35 +0200400# RUBY_API_VER_LONG=1.9.1 (not 1.9.3, because the API version is 1.9.1.)
Bram Moolenaar4f7e8212014-11-05 13:53:32 +0100401ifdef RUBY
402ifndef DYNAMIC_RUBY
403DYNAMIC_RUBY=yes
404endif
405# Set default value
406ifndef RUBY_VER
Bram Moolenaar6384c5d2016-09-06 22:06:35 +0200407RUBY_VER = 22
Bram Moolenaar4f7e8212014-11-05 13:53:32 +0100408endif
409ifndef RUBY_VER_LONG
Bram Moolenaar6384c5d2016-09-06 22:06:35 +0200410RUBY_VER_LONG = 2.2.0
411endif
412ifndef RUBY_API_VER_LONG
Bram Moolenaar0eaadec2016-09-08 20:28:45 +0200413RUBY_API_VER_LONG = $(RUBY_VER_LONG)
Bram Moolenaar4f7e8212014-11-05 13:53:32 +0100414endif
415ifndef RUBY_API_VER
Bram Moolenaar6384c5d2016-09-06 22:06:35 +0200416RUBY_API_VER = $(subst .,,$(RUBY_API_VER_LONG))
Bram Moolenaar4f7e8212014-11-05 13:53:32 +0100417endif
418
419ifndef RUBY_PLATFORM
420ifeq ($(RUBY_VER), 16)
421RUBY_PLATFORM = i586-mswin32
422else
Bram Moolenaar6384c5d2016-09-06 22:06:35 +0200423ifneq ($(wildcard $(RUBY)/lib/ruby/$(RUBY_API_VER_LONG)/i386-mingw32),)
Bram Moolenaar4f7e8212014-11-05 13:53:32 +0100424RUBY_PLATFORM = i386-mingw32
425else
Bram Moolenaar6384c5d2016-09-06 22:06:35 +0200426ifneq ($(wildcard $(RUBY)/lib/ruby/$(RUBY_API_VER_LONG)/x64-mingw32),)
Bram Moolenaar4f7e8212014-11-05 13:53:32 +0100427RUBY_PLATFORM = x64-mingw32
428else
429RUBY_PLATFORM = i386-mswin32
430endif
431endif
432endif
433endif
434
435ifndef RUBY_INSTALL_NAME
436ifeq ($(RUBY_VER), 16)
437RUBY_INSTALL_NAME = mswin32-ruby$(RUBY_API_VER)
438else
Bram Moolenaar0bee2fe2016-01-07 22:45:09 +0100439ifndef RUBY_MSVCRT_NAME
440# Base name of msvcrXX.dll which is used by ruby's dll.
441RUBY_MSVCRT_NAME = msvcrt
442endif
Bram Moolenaar4f7e8212014-11-05 13:53:32 +0100443ifeq ($(ARCH),x86-64)
Bram Moolenaar0bee2fe2016-01-07 22:45:09 +0100444RUBY_INSTALL_NAME = x64-$(RUBY_MSVCRT_NAME)-ruby$(RUBY_API_VER)
Bram Moolenaar4f7e8212014-11-05 13:53:32 +0100445else
Bram Moolenaar0bee2fe2016-01-07 22:45:09 +0100446RUBY_INSTALL_NAME = $(RUBY_MSVCRT_NAME)-ruby$(RUBY_API_VER)
Bram Moolenaar4f7e8212014-11-05 13:53:32 +0100447endif
448endif
449endif
450
451ifeq (19, $(word 1,$(sort 19 $(RUBY_VER))))
452RUBY_19_OR_LATER = 1
453endif
454
Bram Moolenaar6384c5d2016-09-06 22:06:35 +0200455RUBYINC = -I $(RUBY)/lib/ruby/$(RUBY_API_VER_LONG)/$(RUBY_PLATFORM)
Bram Moolenaar4f7e8212014-11-05 13:53:32 +0100456ifdef RUBY_19_OR_LATER
Bram Moolenaar6384c5d2016-09-06 22:06:35 +0200457RUBYINC += -I $(RUBY)/include/ruby-$(RUBY_API_VER_LONG) -I $(RUBY)/include/ruby-$(RUBY_API_VER_LONG)/$(RUBY_PLATFORM)
Bram Moolenaar4f7e8212014-11-05 13:53:32 +0100458endif
459ifeq (no, $(DYNAMIC_RUBY))
460RUBYLIB = -L$(RUBY)/lib -l$(RUBY_INSTALL_NAME)
461endif
462
463endif # RUBY
464
465# See feature.h for a list of options.
466# Any other defines can be included here.
467DEF_GUI=-DFEAT_GUI_W32 -DFEAT_CLIPBOARD
468DEFINES=-DWIN32 -DWINVER=$(WINVER) -D_WIN32_WINNT=$(WINVER) \
Bram Moolenaar22fcfad2016-07-01 18:17:26 +0200469 -DHAVE_PATHDEF -DFEAT_$(FEATURES) -DHAVE_STDINT_H
Bram Moolenaar4f7e8212014-11-05 13:53:32 +0100470ifeq ($(ARCH),x86-64)
471DEFINES+=-DMS_WIN64
472endif
Bram Moolenaar4f7e8212014-11-05 13:53:32 +0100473
474#>>>>> end of choices
475###########################################################################
476
Bram Moolenaara971df82016-02-15 21:22:10 +0100477CFLAGS = -Iproto $(DEFINES) -pipe -march=$(ARCH) -Wall
Bram Moolenaar6c0e9842016-03-22 20:42:31 +0100478CXXFLAGS = -std=gnu++11
Bram Moolenaar4f7e8212014-11-05 13:53:32 +0100479WINDRES_FLAGS = --preprocessor="$(WINDRES_CC) -E -xc" -DRC_INVOKED
480EXTRA_LIBS =
481
482ifdef GETTEXT
483DEFINES += -DHAVE_GETTEXT -DHAVE_LOCALE_H
484GETTEXTINCLUDE = $(GETTEXT)/include
485GETTEXTLIB = $(INTLPATH)
486ifeq (yes, $(GETTEXT))
487DEFINES += -DDYNAMIC_GETTEXT
488else
489ifdef DYNAMIC_GETTEXT
490DEFINES += -D$(DYNAMIC_GETTEXT)
491ifdef GETTEXT_DYNAMIC
492DEFINES += -DGETTEXT_DYNAMIC -DGETTEXT_DLL=\"$(GETTEXT_DYNAMIC)\"
493endif
494endif
495endif
496endif
497
498ifdef PERL
Bram Moolenaar367fbf12015-06-25 16:13:46 +0200499CFLAGS += -I$(PERLLIBS) -DFEAT_PERL -DPERL_IMPLICIT_CONTEXT -DPERL_IMPLICIT_SYS
Bram Moolenaar4f7e8212014-11-05 13:53:32 +0100500ifeq (yes, $(DYNAMIC_PERL))
501CFLAGS += -DDYNAMIC_PERL -DDYNAMIC_PERL_DLL=\"perl$(PERL_VER).dll\"
502EXTRA_LIBS += -L$(PERLLIBS) -lperl$(PERL_VER)
503endif
504endif
505
506ifdef LUA
507CFLAGS += -I$(LUA)/include -I$(LUA) -DFEAT_LUA
508ifeq (yes, $(DYNAMIC_LUA))
509CFLAGS += -DDYNAMIC_LUA -DDYNAMIC_LUA_DLL=\"lua$(LUA_VER).dll\"
510endif
511endif
512
513ifdef MZSCHEME
Bram Moolenaar4e640bd2016-01-16 16:20:38 +0100514ifndef MZSCHEME_COLLECTS
515MZSCHEME_COLLECTS=$(MZSCHEME)/collects
516ifeq (yes, $(UNDER_CYGWIN))
517MZSCHEME_COLLECTS:=$(shell cygpath -m $(MZSCHEME_COLLECTS) | sed -e 's/ /\\ /g')
518endif
519endif
520CFLAGS += -I$(MZSCHEME)/include -DFEAT_MZSCHEME -DMZSCHEME_COLLECTS=\"$(MZSCHEME_COLLECTS)\"
Bram Moolenaar4f7e8212014-11-05 13:53:32 +0100521ifeq (yes, $(DYNAMIC_MZSCHEME))
Bram Moolenaar4e640bd2016-01-16 16:20:38 +0100522ifeq (yes, $(MZSCHEME_PRECISE_GC))
523# Precise GC does not use separate dll
524CFLAGS += -DDYNAMIC_MZSCHEME -DDYNAMIC_MZSCH_DLL=\"lib$(MZSCHEME_MAIN_LIB)$(MZSCHEME_VER).dll\" -DDYNAMIC_MZGC_DLL=\"lib$(MZSCHEME_MAIN_LIB)$(MZSCHEME_VER).dll\"
525else
Bram Moolenaar4f7e8212014-11-05 13:53:32 +0100526CFLAGS += -DDYNAMIC_MZSCHEME -DDYNAMIC_MZSCH_DLL=\"lib$(MZSCHEME_MAIN_LIB)$(MZSCHEME_VER).dll\" -DDYNAMIC_MZGC_DLL=\"libmzgc$(MZSCHEME_VER).dll\"
527endif
Bram Moolenaar4e640bd2016-01-16 16:20:38 +0100528endif
Bram Moolenaar4f7e8212014-11-05 13:53:32 +0100529ifeq (yes, "$(MZSCHEME_DEBUG)")
530CFLAGS += -DMZSCHEME_FORCE_GC
531endif
532endif
533
534ifdef RUBY
535CFLAGS += -DFEAT_RUBY $(RUBYINC)
536ifeq (yes, $(DYNAMIC_RUBY))
537CFLAGS += -DDYNAMIC_RUBY -DDYNAMIC_RUBY_DLL=\"$(RUBY_INSTALL_NAME).dll\"
538CFLAGS += -DDYNAMIC_RUBY_VER=$(RUBY_VER)
539endif
Bram Moolenaar259a90f2018-04-21 19:08:55 +0200540ifeq (no, $(DYNAMIC_RUBY))
541CFLAGS += -DRUBY_VERSION=$(RUBY_VER)
542endif
Bram Moolenaar4f7e8212014-11-05 13:53:32 +0100543ifneq ($(findstring w64-mingw32,$(CC)),)
544# A workaround for MinGW-w64
545CFLAGS += -DHAVE_STRUCT_TIMESPEC -DHAVE_STRUCT_TIMEZONE
546endif
547endif
548
549ifdef PYTHON
Bram Moolenaar223b7232016-02-19 19:43:49 +0100550CFLAGS += -DFEAT_PYTHON
Bram Moolenaar4f7e8212014-11-05 13:53:32 +0100551ifeq (yes, $(DYNAMIC_PYTHON))
Bram Moolenaar449538c2016-01-09 17:49:15 +0100552CFLAGS += -DDYNAMIC_PYTHON -DDYNAMIC_PYTHON_DLL=\"$(DYNAMIC_PYTHON_DLL)\"
Bram Moolenaar4f7e8212014-11-05 13:53:32 +0100553endif
554endif
555
Bram Moolenaar223b7232016-02-19 19:43:49 +0100556ifdef PYTHON3
557CFLAGS += -DFEAT_PYTHON3
Bram Moolenaar4f7e8212014-11-05 13:53:32 +0100558ifeq (yes, $(DYNAMIC_PYTHON3))
Bram Moolenaara7c37952016-01-20 22:23:15 +0100559CFLAGS += -DDYNAMIC_PYTHON3 -DDYNAMIC_PYTHON3_DLL=\"$(DYNAMIC_PYTHON3_DLL)\"
Bram Moolenaar4f7e8212014-11-05 13:53:32 +0100560endif
561endif
562
563ifdef TCL
564CFLAGS += -DFEAT_TCL $(TCLINC)
565ifeq (yes, $(DYNAMIC_TCL))
Bram Moolenaar77f74742017-08-23 22:40:41 +0200566CFLAGS += -DDYNAMIC_TCL -DDYNAMIC_TCL_DLL=\"$(TCL_DLL)\" -DDYNAMIC_TCL_VER=\"$(TCL_VER_LONG)\"
Bram Moolenaar4f7e8212014-11-05 13:53:32 +0100567endif
568endif
569
570ifeq ($(POSTSCRIPT),yes)
571DEFINES += -DMSWINPS
572endif
573
574ifeq (yes, $(OLE))
575DEFINES += -DFEAT_OLE
576endif
577
578ifeq ($(CSCOPE),yes)
579DEFINES += -DFEAT_CSCOPE
580endif
581
582ifeq ($(NETBEANS),yes)
583# Only allow NETBEANS for a GUI build.
584ifeq (yes, $(GUI))
585DEFINES += -DFEAT_NETBEANS_INTG
586
587ifeq ($(NBDEBUG), yes)
588DEFINES += -DNBDEBUG
589NBDEBUG_INCL = nbdebug.h
590NBDEBUG_SRC = nbdebug.c
591endif
592endif
593endif
594
Bram Moolenaare0874f82016-01-24 20:36:41 +0100595ifeq ($(CHANNEL),yes)
Bram Moolenaar509ce2a2016-03-11 22:52:15 +0100596DEFINES += -DFEAT_JOB_CHANNEL
Bram Moolenaare0874f82016-01-24 20:36:41 +0100597endif
598
Bram Moolenaar4fc63502017-07-19 11:28:17 +0200599ifeq ($(TERMINAL),yes)
600DEFINES += -DFEAT_TERMINAL
Bram Moolenaarf80451e2017-07-25 21:49:35 +0200601TERM_DEPS = \
602 libvterm/include/vterm.h \
603 libvterm/include/vterm_keycodes.h \
604 libvterm/src/rect.h \
605 libvterm/src/utf8.h \
606 libvterm/src/vterm_internal.h
Bram Moolenaar4fc63502017-07-19 11:28:17 +0200607endif
608
Bram Moolenaar4f7e8212014-11-05 13:53:32 +0100609# DirectWrite (DirectX)
610ifeq ($(DIRECTX),yes)
611# Only allow DirectWrite for a GUI build.
612ifeq (yes, $(GUI))
Bram Moolenaarcccd62d2018-04-12 20:23:48 +0200613DEFINES += -DFEAT_DIRECTX -DDYNAMIC_DIRECTX
614ifneq ($(COLOR_EMOJI),no)
615DEFINES += -DFEAT_DIRECTX_COLOR_EMOJI
616endif
Bram Moolenaar4f7e8212014-11-05 13:53:32 +0100617endif
618endif
619
620# Only allow XPM for a GUI build.
621ifeq (yes, $(GUI))
622
623ifndef XPM
624ifeq ($(ARCH),i386)
625XPM = xpm/x86
626endif
627ifeq ($(ARCH),i486)
628XPM = xpm/x86
629endif
630ifeq ($(ARCH),i586)
631XPM = xpm/x86
632endif
633ifeq ($(ARCH),i686)
634XPM = xpm/x86
635endif
636ifeq ($(ARCH),x86-64)
637XPM = xpm/x64
638endif
639endif
640ifdef XPM
641ifneq ($(XPM),no)
642CFLAGS += -DFEAT_XPM_W32 -I $(XPM)/include -I $(XPM)/../include
643endif
644endif
645
646endif
647
648ifeq ($(DEBUG),yes)
649CFLAGS += -g -fstack-check
650DEBUG_SUFFIX=d
651else
652ifeq ($(OPTIMIZE), SIZE)
653CFLAGS += -Os
654else
655ifeq ($(OPTIMIZE), MAXSPEED)
656CFLAGS += -O3
657CFLAGS += -fomit-frame-pointer -freg-struct-return
658else # SPEED
659CFLAGS += -O2
660endif
661endif
662CFLAGS += -s
663endif
664
665LIB = -lkernel32 -luser32 -lgdi32 -ladvapi32 -lcomdlg32 -lcomctl32 -lversion
666GUIOBJ = $(OUTDIR)/gui.o $(OUTDIR)/gui_w32.o $(OUTDIR)/gui_beval.o $(OUTDIR)/os_w32exe.o
Bram Moolenaar97ff9b92016-06-26 20:37:46 +0200667CUIOBJ = $(OUTDIR)/iscygpty.o
Bram Moolenaar4f7e8212014-11-05 13:53:32 +0100668OBJ = \
Bram Moolenaar75464dc2016-07-02 20:27:50 +0200669 $(OUTDIR)/arabic.o \
Bram Moolenaarc3719bd2017-11-18 22:13:31 +0100670 $(OUTDIR)/beval.o \
Bram Moolenaar4f7e8212014-11-05 13:53:32 +0100671 $(OUTDIR)/blowfish.o \
672 $(OUTDIR)/buffer.o \
673 $(OUTDIR)/charset.o \
674 $(OUTDIR)/crypt.o \
675 $(OUTDIR)/crypt_zip.o \
Bram Moolenaar6583c442016-07-17 18:41:47 +0200676 $(OUTDIR)/dict.o \
Bram Moolenaar4f7e8212014-11-05 13:53:32 +0100677 $(OUTDIR)/diff.o \
678 $(OUTDIR)/digraph.o \
679 $(OUTDIR)/edit.o \
680 $(OUTDIR)/eval.o \
Bram Moolenaar73dad1e2016-07-17 22:13:49 +0200681 $(OUTDIR)/evalfunc.o \
Bram Moolenaar4f7e8212014-11-05 13:53:32 +0100682 $(OUTDIR)/ex_cmds.o \
683 $(OUTDIR)/ex_cmds2.o \
684 $(OUTDIR)/ex_docmd.o \
685 $(OUTDIR)/ex_eval.o \
686 $(OUTDIR)/ex_getln.o \
Bram Moolenaar75464dc2016-07-02 20:27:50 +0200687 $(OUTDIR)/farsi.o \
Bram Moolenaar4f7e8212014-11-05 13:53:32 +0100688 $(OUTDIR)/fileio.o \
689 $(OUTDIR)/fold.o \
690 $(OUTDIR)/getchar.o \
691 $(OUTDIR)/hardcopy.o \
692 $(OUTDIR)/hashtab.o \
Bram Moolenaar520e1e42016-01-23 19:46:28 +0100693 $(OUTDIR)/json.o \
Bram Moolenaar6583c442016-07-17 18:41:47 +0200694 $(OUTDIR)/list.o \
Bram Moolenaar4f7e8212014-11-05 13:53:32 +0100695 $(OUTDIR)/main.o \
696 $(OUTDIR)/mark.o \
697 $(OUTDIR)/memfile.o \
698 $(OUTDIR)/memline.o \
699 $(OUTDIR)/menu.o \
700 $(OUTDIR)/message.o \
701 $(OUTDIR)/misc1.o \
702 $(OUTDIR)/misc2.o \
703 $(OUTDIR)/move.o \
704 $(OUTDIR)/mbyte.o \
705 $(OUTDIR)/normal.o \
706 $(OUTDIR)/ops.o \
707 $(OUTDIR)/option.o \
708 $(OUTDIR)/os_win32.o \
709 $(OUTDIR)/os_mswin.o \
710 $(OUTDIR)/winclip.o \
711 $(OUTDIR)/pathdef.o \
712 $(OUTDIR)/popupmnu.o \
713 $(OUTDIR)/quickfix.o \
714 $(OUTDIR)/regexp.o \
715 $(OUTDIR)/screen.o \
716 $(OUTDIR)/search.o \
717 $(OUTDIR)/sha256.o \
718 $(OUTDIR)/spell.o \
Bram Moolenaar9ccfebd2016-07-19 16:39:08 +0200719 $(OUTDIR)/spellfile.o \
Bram Moolenaar4f7e8212014-11-05 13:53:32 +0100720 $(OUTDIR)/syntax.o \
721 $(OUTDIR)/tag.o \
722 $(OUTDIR)/term.o \
723 $(OUTDIR)/ui.o \
724 $(OUTDIR)/undo.o \
Bram Moolenaar6583c442016-07-17 18:41:47 +0200725 $(OUTDIR)/userfunc.o \
Bram Moolenaar4f7e8212014-11-05 13:53:32 +0100726 $(OUTDIR)/version.o \
727 $(OUTDIR)/vimrc.o \
728 $(OUTDIR)/window.o
729
730ifdef PERL
731OBJ += $(OUTDIR)/if_perl.o
732endif
733ifdef LUA
734OBJ += $(OUTDIR)/if_lua.o
735endif
736ifdef MZSCHEME
737OBJ += $(OUTDIR)/if_mzsch.o
738MZSCHEME_INCL = if_mzsch.h
739ifeq (yes,$(MZSCHEME_GENERATE_BASE))
740CFLAGS += -DINCLUDE_MZSCHEME_BASE
741MZ_EXTRA_DEP += mzscheme_base.c
742endif
743ifeq (yes,$(MZSCHEME_PRECISE_GC))
744CFLAGS += -DMZ_PRECISE_GC
745endif
746endif
747ifdef PYTHON
748OBJ += $(OUTDIR)/if_python.o
749endif
750ifdef PYTHON3
751OBJ += $(OUTDIR)/if_python3.o
752endif
753ifdef RUBY
754OBJ += $(OUTDIR)/if_ruby.o
755endif
756ifdef TCL
757OBJ += $(OUTDIR)/if_tcl.o
758endif
759ifeq ($(CSCOPE),yes)
760OBJ += $(OUTDIR)/if_cscope.o
761endif
Bram Moolenaare0874f82016-01-24 20:36:41 +0100762
Bram Moolenaar4f7e8212014-11-05 13:53:32 +0100763ifeq ($(NETBEANS),yes)
Bram Moolenaare0874f82016-01-24 20:36:41 +0100764ifneq ($(CHANNEL),yes)
765# Cannot use Netbeans without CHANNEL
766NETBEANS=no
767else
Bram Moolenaar44d57182016-02-14 23:11:23 +0100768ifneq (yes, $(GUI))
769# Cannot use Netbeans without GUI.
770NETBEANS=no
771else
Bram Moolenaar4f7e8212014-11-05 13:53:32 +0100772OBJ += $(OUTDIR)/netbeans.o
Bram Moolenaar4f7e8212014-11-05 13:53:32 +0100773endif
774endif
Bram Moolenaare0874f82016-01-24 20:36:41 +0100775endif
776
777ifeq ($(CHANNEL),yes)
778OBJ += $(OUTDIR)/channel.o
Bram Moolenaare0874f82016-01-24 20:36:41 +0100779LIB += -lwsock32
780endif
Bram Moolenaare0874f82016-01-24 20:36:41 +0100781
Bram Moolenaar4f7e8212014-11-05 13:53:32 +0100782ifeq ($(DIRECTX),yes)
783# Only allow DIRECTX for a GUI build.
784ifeq (yes, $(GUI))
785OBJ += $(OUTDIR)/gui_dwrite.o
786LIB += -ld2d1 -ldwrite
787USE_STDCPLUS = yes
788endif
789endif
790ifneq ($(XPM),no)
791# Only allow XPM for a GUI build.
792ifeq (yes, $(GUI))
793OBJ += $(OUTDIR)/xpm_w32.o
794# You'll need libXpm.a from http://gnuwin32.sf.net
795LIB += -L$(XPM)/lib -lXpm
796endif
797endif
798
Bram Moolenaar4fc63502017-07-19 11:28:17 +0200799ifeq ($(TERMINAL),yes)
Bram Moolenaarf80451e2017-07-25 21:49:35 +0200800OBJ += $(OUTDIR)/terminal.o \
801 $(OUTDIR)/term_encoding.o \
802 $(OUTDIR)/term_keyboard.o \
803 $(OUTDIR)/term_mouse.o \
804 $(OUTDIR)/term_parser.o \
805 $(OUTDIR)/term_pen.o \
806 $(OUTDIR)/term_screen.o \
807 $(OUTDIR)/term_state.o \
808 $(OUTDIR)/term_unicode.o \
809 $(OUTDIR)/term_vterm.o
Bram Moolenaar4fc63502017-07-19 11:28:17 +0200810endif
811
Bram Moolenaar4f7e8212014-11-05 13:53:32 +0100812
813ifdef MZSCHEME
814MZSCHEME_SUFFIX = Z
815endif
816
817ifeq ($(GUI),yes)
818TARGET := gvim$(DEBUG_SUFFIX).exe
819DEFINES += $(DEF_GUI)
820OBJ += $(GUIOBJ)
821LFLAGS += -mwindows
822OUTDIR = gobj$(DEBUG_SUFFIX)$(MZSCHEME_SUFFIX)$(ARCH)
823else
Bram Moolenaar97ff9b92016-06-26 20:37:46 +0200824OBJ += $(CUIOBJ)
Bram Moolenaar4f7e8212014-11-05 13:53:32 +0100825TARGET := vim$(DEBUG_SUFFIX).exe
826OUTDIR = obj$(DEBUG_SUFFIX)$(MZSCHEME_SUFFIX)$(ARCH)
827endif
828
829ifdef GETTEXT
830ifneq (yes, $(GETTEXT))
831CFLAGS += -I$(GETTEXTINCLUDE)
832ifndef STATIC_GETTEXT
833LIB += -L$(GETTEXTLIB) -l$(INTLLIB)
834ifeq (USE_SAFE_GETTEXT_DLL, $(DYNAMIC_GETTEXT))
835OBJ+=$(SAFE_GETTEXT_DLL_OBJ)
836endif
837else
838LIB += -L$(GETTEXTLIB) -lintl
839endif
840endif
841endif
842
843ifdef PERL
844ifeq (no, $(DYNAMIC_PERL))
845LIB += -L$(PERLLIBS) -lperl$(PERL_VER)
846endif
847endif
848
849ifdef TCL
850LIB += -L$(TCL)/lib
851ifeq (yes, $(DYNAMIC_TCL))
852LIB += -ltclstub$(TCL_VER)
853else
854LIB += -ltcl$(TCL_VER)
855endif
856endif
857
858ifeq (yes, $(OLE))
859LIB += -loleaut32
860OBJ += $(OUTDIR)/if_ole.o
861USE_STDCPLUS = yes
862endif
863
864ifeq (yes, $(MBYTE))
865DEFINES += -DFEAT_MBYTE
866endif
867
868ifeq (yes, $(IME))
869DEFINES += -DFEAT_MBYTE_IME
870ifeq (yes, $(DYNAMIC_IME))
871DEFINES += -DDYNAMIC_IME
872else
873LIB += -limm32
874endif
875endif
876
877ifdef ICONV
878ifneq (yes, $(ICONV))
879LIB += -L$(ICONV)
880CFLAGS += -I$(ICONV)
881endif
882DEFINES+=-DDYNAMIC_ICONV
883endif
884
885ifeq (yes, $(USE_STDCPLUS))
886ifeq (yes, $(STATIC_STDCPLUS))
887LIB += -Wl,-Bstatic -lstdc++ -Wl,-Bdynamic
888else
889LIB += -lstdc++
890endif
891endif
892
Bram Moolenaare3af7632016-12-01 20:37:47 +0100893ifeq (yes, $(STATIC_WINPTHREAD))
894LIB += -Wl,-Bstatic -lwinpthread -Wl,-Bdynamic
895endif
896
Bram Moolenaar4f7e8212014-11-05 13:53:32 +0100897all: $(TARGET) vimrun.exe xxd/xxd.exe install.exe uninstal.exe GvimExt/gvimext.dll
898
899vimrun.exe: vimrun.c
900 $(CC) $(CFLAGS) -o vimrun.exe vimrun.c $(LIB)
901
902install.exe: dosinst.c
903 $(CC) $(CFLAGS) -o install.exe dosinst.c $(LIB) -lole32 -luuid
904
905uninstal.exe: uninstal.c
906 $(CC) $(CFLAGS) -o uninstal.exe uninstal.c $(LIB)
907
908$(TARGET): $(OUTDIR) $(OBJ)
Bram Moolenaarf80451e2017-07-25 21:49:35 +0200909 $(CC) $(CFLAGS) $(LFLAGS) -o $@ $(OBJ) $(LIB) -lole32 -luuid $(LUA_LIB) $(MZSCHEME_LIBDIR) $(MZSCHEME_LIB) $(PYTHONLIB) $(PYTHON3LIB) $(RUBYLIB)
Bram Moolenaar4f7e8212014-11-05 13:53:32 +0100910
911upx: exes
912 upx gvim.exe
913 upx vim.exe
914
915mpress: exes
916 mpress gvim.exe
917 mpress vim.exe
918
919xxd/xxd.exe: xxd/xxd.c
920 $(MAKE) -C xxd -f Make_ming.mak CC='$(CC)'
921
922GvimExt/gvimext.dll: GvimExt/gvimext.cpp GvimExt/gvimext.rc GvimExt/gvimext.h
923 $(MAKE) -C GvimExt -f Make_ming.mak CROSS=$(CROSS) CROSS_COMPILE=$(CROSS_COMPILE) CXX='$(CXX)' STATIC_STDCPLUS=$(STATIC_STDCPLUS)
924
Bram Moolenaar9ac9dfa2017-09-01 18:41:26 +0200925tags: notags
926 $(CTAGS) *.c *.cpp *.h if_perl.xs
927
928notags:
929 -$(DEL) tags
930
Bram Moolenaar4f7e8212014-11-05 13:53:32 +0100931clean:
932 -$(DEL) $(OUTDIR)$(DIRSLASH)*.o
933 -$(DEL) $(OUTDIR)$(DIRSLASH)*.res
934 -rmdir $(OUTDIR)
935 -$(DEL) *.exe
936 -$(DEL) pathdef.c
937ifdef PERL
938 -$(DEL) if_perl.c
939endif
940ifdef MZSCHEME
941 -$(DEL) mzscheme_base.c
942endif
943 $(MAKE) -C GvimExt -f Make_ming.mak clean
944 $(MAKE) -C xxd -f Make_ming.mak clean
945
946###########################################################################
Bram Moolenaar96e7a6e2017-09-23 19:48:29 +0200947INCL = vim.h alloc.h arabic.h ascii.h ex_cmds.h farsi.h feature.h globals.h \
948 keymap.h macros.h option.h os_dos.h os_win32.h proto.h regexp.h \
Bram Moolenaarc3719bd2017-11-18 22:13:31 +0100949 spell.h structs.h term.h beval.h $(NBDEBUG_INCL)
950GUI_INCL = gui.h
Bram Moolenaar97ff9b92016-06-26 20:37:46 +0200951CUI_INCL = iscygpty.h
Bram Moolenaar4f7e8212014-11-05 13:53:32 +0100952
Bram Moolenaar96e7a6e2017-09-23 19:48:29 +0200953$(OUTDIR)/if_python.o: if_python.c if_py_both.h $(INCL)
Bram Moolenaar449538c2016-01-09 17:49:15 +0100954 $(CC) -c $(CFLAGS) $(PYTHONINC) $(PYTHON_HOME_DEF) $< -o $@
Bram Moolenaar4f7e8212014-11-05 13:53:32 +0100955
Bram Moolenaar96e7a6e2017-09-23 19:48:29 +0200956$(OUTDIR)/if_python3.o: if_python3.c if_py_both.h $(INCL)
Bram Moolenaara7c37952016-01-20 22:23:15 +0100957 $(CC) -c $(CFLAGS) $(PYTHON3INC) $(PYTHON3_HOME_DEF) $< -o $@
Bram Moolenaar4f7e8212014-11-05 13:53:32 +0100958
959$(OUTDIR)/%.o : %.c $(INCL)
960 $(CC) -c $(CFLAGS) $< -o $@
961
Bram Moolenaar96e7a6e2017-09-23 19:48:29 +0200962$(OUTDIR)/vimrc.o: vim.rc version.h gui_w32_rc.h
Bram Moolenaar4f7e8212014-11-05 13:53:32 +0100963 $(WINDRES) $(WINDRES_FLAGS) $(DEFINES) \
964 --input-format=rc --output-format=coff -i vim.rc -o $@
965
966$(OUTDIR):
967 $(MKDIR) $(OUTDIR)
968
Bram Moolenaar4f7e8212014-11-05 13:53:32 +0100969$(OUTDIR)/gui_dwrite.o: gui_dwrite.cpp $(INCL) gui_dwrite.h
Bram Moolenaarcc6cf9b2016-03-19 20:51:35 +0100970 $(CC) -c $(CFLAGS) $(CXXFLAGS) gui_dwrite.cpp -o $(OUTDIR)/gui_dwrite.o
Bram Moolenaar4f7e8212014-11-05 13:53:32 +0100971
Bram Moolenaar96e7a6e2017-09-23 19:48:29 +0200972$(OUTDIR)/gui.o: gui.c $(INCL) $(GUI_INCL)
973 $(CC) -c $(CFLAGS) gui.c -o $(OUTDIR)/gui.o
974
Bram Moolenaarc3719bd2017-11-18 22:13:31 +0100975$(OUTDIR)/beval.o: beval.c $(INCL) $(GUI_INCL)
976 $(CC) -c $(CFLAGS) beval.c -o $(OUTDIR)/beval.o
977
Bram Moolenaar96e7a6e2017-09-23 19:48:29 +0200978$(OUTDIR)/gui_beval.o: gui_beval.c $(INCL) $(GUI_INCL)
979 $(CC) -c $(CFLAGS) gui_beval.c -o $(OUTDIR)/gui_beval.o
980
981$(OUTDIR)/gui_w32.o: gui_w32.c $(INCL) $(GUI_INCL)
Bram Moolenaarf80451e2017-07-25 21:49:35 +0200982 $(CC) -c $(CFLAGS) gui_w32.c -o $(OUTDIR)/gui_w32.o
983
Bram Moolenaar4f7e8212014-11-05 13:53:32 +0100984$(OUTDIR)/if_cscope.o: if_cscope.c $(INCL) if_cscope.h
985 $(CC) -c $(CFLAGS) if_cscope.c -o $(OUTDIR)/if_cscope.o
986
Bram Moolenaar96e7a6e2017-09-23 19:48:29 +0200987$(OUTDIR)/if_mzsch.o: if_mzsch.c $(INCL) $(MZSCHEME_INCL) $(MZ_EXTRA_DEP)
Bram Moolenaarf80451e2017-07-25 21:49:35 +0200988 $(CC) -c $(CFLAGS) if_mzsch.c -o $(OUTDIR)/if_mzsch.o
989
990mzscheme_base.c:
991 $(MZSCHEME)/mzc --c-mods mzscheme_base.c ++lib scheme/base
992
Bram Moolenaar4f7e8212014-11-05 13:53:32 +0100993# Remove -D__IID_DEFINED__ for newer versions of the w32api
Bram Moolenaar96e7a6e2017-09-23 19:48:29 +0200994$(OUTDIR)/if_ole.o: if_ole.cpp $(INCL) if_ole.h
Bram Moolenaarcc6cf9b2016-03-19 20:51:35 +0100995 $(CC) $(CFLAGS) $(CXXFLAGS) -c -o $(OUTDIR)/if_ole.o if_ole.cpp
Bram Moolenaar4f7e8212014-11-05 13:53:32 +0100996
Bram Moolenaar96e7a6e2017-09-23 19:48:29 +0200997if_perl.c: if_perl.xs typemap
Bram Moolenaarf80451e2017-07-25 21:49:35 +0200998 $(XSUBPP) -prototypes -typemap \
999 $(PERLTYPEMAP) if_perl.xs -output $@
1000
Bram Moolenaar96e7a6e2017-09-23 19:48:29 +02001001$(OUTDIR)/if_ruby.o: if_ruby.c $(INCL)
Bram Moolenaar4f7e8212014-11-05 13:53:32 +01001002ifeq (16, $(RUBY))
1003 $(CC) $(CFLAGS) -U_WIN32 -c -o $(OUTDIR)/if_ruby.o if_ruby.c
1004endif
1005
Bram Moolenaar97ff9b92016-06-26 20:37:46 +02001006$(OUTDIR)/iscygpty.o: iscygpty.c $(CUI_INCL)
Bram Moolenaar2bc127f2016-07-10 13:57:40 +02001007 $(CC) -c $(CFLAGS) iscygpty.c -o $(OUTDIR)/iscygpty.o -U_WIN32_WINNT -D_WIN32_WINNT=0x0600 -DUSE_DYNFILEID -DENABLE_STUB_IMPL
Bram Moolenaar97ff9b92016-06-26 20:37:46 +02001008
Bram Moolenaar96e7a6e2017-09-23 19:48:29 +02001009$(OUTDIR)/main.o: main.c $(INCL) $(CUI_INCL)
Bram Moolenaar97ff9b92016-06-26 20:37:46 +02001010 $(CC) -c $(CFLAGS) main.c -o $(OUTDIR)/main.o
1011
Bram Moolenaar4f7e8212014-11-05 13:53:32 +01001012$(OUTDIR)/netbeans.o: netbeans.c $(INCL) $(NBDEBUG_INCL) $(NBDEBUG_SRC)
1013 $(CC) -c $(CFLAGS) netbeans.c -o $(OUTDIR)/netbeans.o
1014
Bram Moolenaar96e7a6e2017-09-23 19:48:29 +02001015$(OUTDIR)/os_win32.o: os_win32.c $(INCL) $(MZSCHEME_INCL)
1016 $(CC) -c $(CFLAGS) os_win32.c -o $(OUTDIR)/os_win32.o
1017
1018$(OUTDIR)/regexp.o: regexp.c regexp_nfa.c $(INCL)
Bram Moolenaar4f7e8212014-11-05 13:53:32 +01001019 $(CC) -c $(CFLAGS) regexp.c -o $(OUTDIR)/regexp.o
1020
Bram Moolenaarf80451e2017-07-25 21:49:35 +02001021$(OUTDIR)/terminal.o: terminal.c $(INCL) $(TERM_DEPS)
1022 $(CC) -c $(CFLAGS) terminal.c -o $(OUTDIR)/terminal.o
Bram Moolenaar4f7e8212014-11-05 13:53:32 +01001023
Bram Moolenaarf80451e2017-07-25 21:49:35 +02001024
Bram Moolenaar6d0826d2017-08-22 22:12:17 +02001025CCCTERM = $(CC) -c $(CFLAGS) -Ilibvterm/include -DINLINE="" \
1026 -DVSNPRINTF=vim_vsnprintf \
1027 -DIS_COMBINING_FUNCTION=utf_iscomposing_uint \
1028 -DWCWIDTH_FUNCTION=utf_uint2cells
1029
Bram Moolenaarf80451e2017-07-25 21:49:35 +02001030$(OUTDIR)/term_encoding.o: libvterm/src/encoding.c $(TERM_DEPS)
1031 $(CCCTERM) libvterm/src/encoding.c -o $@
1032
1033$(OUTDIR)/term_keyboard.o: libvterm/src/keyboard.c $(TERM_DEPS)
1034 $(CCCTERM) libvterm/src/keyboard.c -o $@
1035
1036$(OUTDIR)/term_mouse.o: libvterm/src/mouse.c $(TERM_DEPS)
1037 $(CCCTERM) libvterm/src/mouse.c -o $@
1038
1039$(OUTDIR)/term_parser.o: libvterm/src/parser.c $(TERM_DEPS)
1040 $(CCCTERM) libvterm/src/parser.c -o $@
1041
1042$(OUTDIR)/term_pen.o: libvterm/src/pen.c $(TERM_DEPS)
1043 $(CCCTERM) libvterm/src/pen.c -o $@
1044
1045$(OUTDIR)/term_screen.o: libvterm/src/screen.c $(TERM_DEPS)
1046 $(CCCTERM) libvterm/src/screen.c -o $@
1047
1048$(OUTDIR)/term_state.o: libvterm/src/state.c $(TERM_DEPS)
1049 $(CCCTERM) libvterm/src/state.c -o $@
1050
1051$(OUTDIR)/term_unicode.o: libvterm/src/unicode.c $(TERM_DEPS)
1052 $(CCCTERM) libvterm/src/unicode.c -o $@
1053
1054$(OUTDIR)/term_vterm.o: libvterm/src/vterm.c $(TERM_DEPS)
1055 $(CCCTERM) libvterm/src/vterm.c -o $@
1056
Bram Moolenaar4f7e8212014-11-05 13:53:32 +01001057
1058pathdef.c: $(INCL)
1059ifneq (sh.exe, $(SHELL))
1060 @echo creating pathdef.c
1061 @echo '/* pathdef.c */' > pathdef.c
1062 @echo '#include "vim.h"' >> pathdef.c
1063 @echo 'char_u *default_vim_dir = (char_u *)"$(VIMRCLOC)";' >> pathdef.c
1064 @echo 'char_u *default_vimruntime_dir = (char_u *)"$(VIMRUNTIMEDIR)";' >> pathdef.c
1065 @echo 'char_u *all_cflags = (char_u *)"$(CC) $(CFLAGS)";' >> pathdef.c
1066 @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
1067 @echo 'char_u *compiled_user = (char_u *)"$(USERNAME)";' >> pathdef.c
1068 @echo 'char_u *compiled_sys = (char_u *)"$(USERDOMAIN)";' >> pathdef.c
1069else
1070 @echo creating pathdef.c
1071 @echo /* pathdef.c */ > pathdef.c
1072 @echo #include "vim.h" >> pathdef.c
1073 @echo char_u *default_vim_dir = (char_u *)"$(VIMRCLOC)"; >> pathdef.c
1074 @echo char_u *default_vimruntime_dir = (char_u *)"$(VIMRUNTIMEDIR)"; >> pathdef.c
1075 @echo char_u *all_cflags = (char_u *)"$(CC) $(CFLAGS)"; >> pathdef.c
1076 @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
1077 @echo char_u *compiled_user = (char_u *)"$(USERNAME)"; >> pathdef.c
1078 @echo char_u *compiled_sys = (char_u *)"$(USERDOMAIN)"; >> pathdef.c
1079endif
Bram Moolenaar96e7a6e2017-09-23 19:48:29 +02001080
1081# vim: set noet sw=8 ts=8 sts=0 wm=0 tw=0: