blob: 811f1985f38c7798afb1117f9a6455d281978ca7 [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
Bram Moolenaar4ff42902018-09-21 14:43:10 +020038# set to yes to create a mapfile
Bram Moolenaarafde13b2019-04-28 19:46:49 +020039#MAP=yes
Bram Moolenaar4ff42902018-09-21 14:43:10 +020040
Bram Moolenaarcccd62d2018-04-12 20:23:48 +020041# set to SIZE for size, SPEED for speed, MAXSPEED for maximum optimization
42OPTIMIZE=MAXSPEED
43
44# set to yes to make gvim, no for vim
45GUI=yes
46
Bram Moolenaarafde13b2019-04-28 19:46:49 +020047# set to yes to enable the DLL support (EXPERIMENTAL).
48# Creates vim{32,64}.dll, and stub gvim.exe and vim.exe.
49# "GUI" should be also set to "yes".
50#VIMDLL=yes
51
Bram Moolenaarcccd62d2018-04-12 20:23:48 +020052# set to no if you do not want to use DirectWrite (DirectX)
53# MinGW-w64 is needed, and ARCH should be set to i686 or x86-64.
54DIRECTX=yes
55
56# Disable Color emoji support
57# (default is yes if DIRECTX=yes, requires WinSDK 8.1 or later.)
58#COLOR_EMOJI=no
59
Bram Moolenaar4f7e8212014-11-05 13:53:32 +010060# Set to one of i386, i486, i586, i686 as the minimum target processor.
61# For amd64/x64 architecture set ARCH=x86-64 .
Bram Moolenaare0485392016-07-12 21:17:03 +020062# If not set, it will be automatically detected. (Normally i686 or x86-64.)
63#ARCH=i686
Bram Moolenaar4f7e8212014-11-05 13:53:32 +010064# Set to yes to cross-compile from unix; no=native Windows (and Cygwin).
65CROSS=no
Bram Moolenaarcccd62d2018-04-12 20:23:48 +020066
Bram Moolenaar4f7e8212014-11-05 13:53:32 +010067# Set to path to iconv.h and libiconv.a to enable using 'iconv.dll'.
Bram Moolenaarac8069b2017-10-14 20:24:19 +020068# Use "yes" when the path does not need to be define.
Bram Moolenaar4f7e8212014-11-05 13:53:32 +010069#ICONV="."
70ICONV=yes
71GETTEXT=yes
Bram Moolenaarcccd62d2018-04-12 20:23:48 +020072
Bram Moolenaar4f7e8212014-11-05 13:53:32 +010073# Set to yes to include IME support.
74IME=yes
75DYNAMIC_IME=yes
Bram Moolenaarcccd62d2018-04-12 20:23:48 +020076
Bram Moolenaar4f7e8212014-11-05 13:53:32 +010077# Set to yes to enable writing a postscript file with :hardcopy.
78POSTSCRIPT=no
Bram Moolenaarcccd62d2018-04-12 20:23:48 +020079
Bram Moolenaar4f7e8212014-11-05 13:53:32 +010080# Set to yes to enable OLE support.
81OLE=no
Bram Moolenaarcccd62d2018-04-12 20:23:48 +020082
Bram Moolenaar304925e2018-06-30 16:27:02 +020083# Set the default $(WINVER). Use 0x0501 to make it work with WinXP.
Bram Moolenaar4f7e8212014-11-05 13:53:32 +010084ifndef WINVER
Bram Moolenaar304925e2018-06-30 16:27:02 +020085# WINVER = 0x0501
86WINVER = 0x0600
Bram Moolenaar4f7e8212014-11-05 13:53:32 +010087endif
Bram Moolenaarcccd62d2018-04-12 20:23:48 +020088
Bram Moolenaar4f7e8212014-11-05 13:53:32 +010089# Set to yes to enable Cscope support.
90CSCOPE=yes
Bram Moolenaarcccd62d2018-04-12 20:23:48 +020091
Bram Moolenaare0874f82016-01-24 20:36:41 +010092# Set to yes to enable Netbeans support (requires CHANNEL).
Bram Moolenaar4f7e8212014-11-05 13:53:32 +010093NETBEANS=$(GUI)
Bram Moolenaarcccd62d2018-04-12 20:23:48 +020094
Bram Moolenaare0874f82016-01-24 20:36:41 +010095# Set to yes to enable inter process communication.
Bram Moolenaar1aa07bd2016-06-03 19:43:16 +020096ifeq (HUGE, $(FEATURES))
97CHANNEL=yes
98else
Bram Moolenaare0874f82016-01-24 20:36:41 +010099CHANNEL=$(GUI)
Bram Moolenaar1aa07bd2016-06-03 19:43:16 +0200100endif
Bram Moolenaarcccd62d2018-04-12 20:23:48 +0200101
Bram Moolenaar8a773062017-07-24 22:29:21 +0200102# Set to yes to enable terminal support.
Bram Moolenaarac8069b2017-10-14 20:24:19 +0200103ifeq (HUGE, $(FEATURES))
104TERMINAL=yes
105else
Bram Moolenaar4fc63502017-07-19 11:28:17 +0200106TERMINAL=no
Bram Moolenaarac8069b2017-10-14 20:24:19 +0200107endif
Bram Moolenaar4f7e8212014-11-05 13:53:32 +0100108
Bram Moolenaar9ac9dfa2017-09-01 18:41:26 +0200109ifndef CTAGS
110# this assumes ctags is Exuberant ctags
111CTAGS = ctags -I INIT+ --fields=+S
112endif
Bram Moolenaar4f7e8212014-11-05 13:53:32 +0100113
114# Link against the shared version of libstdc++ by default. Set
115# STATIC_STDCPLUS to "yes" to link against static version instead.
116ifndef STATIC_STDCPLUS
117STATIC_STDCPLUS=no
118endif
119
Bram Moolenaare3af7632016-12-01 20:37:47 +0100120
121# Link against the shared version of libwinpthread by default. Set
122# STATIC_WINPTHREAD to "yes" to link against static version instead.
123ifndef STATIC_WINPTHREAD
124STATIC_WINPTHREAD=$(STATIC_STDCPLUS)
125endif
Bram Moolenaareda9e9c2018-10-21 22:45:43 +0200126# If you use TDM-GCC(-64), change HAS_GCC_EH to "no".
127# This is used when STATIC_STDCPLUS=yes.
128HAS_GCC_EH=yes
Bram Moolenaare3af7632016-12-01 20:37:47 +0100129
Bram Moolenaar4f7e8212014-11-05 13:53:32 +0100130# If the user doesn't want gettext, undefine it.
131ifeq (no, $(GETTEXT))
132GETTEXT=
133endif
134# Added by E.F. Amatria <eferna1@platea.ptic.mec.es> 2001 Feb 23
135# Uncomment the first line and one of the following three if you want Native Language
136# Support. You'll need gnu_gettext.win32, a MINGW32 Windows PORT of gettext by
137# Franco Bez <franco.bez@gmx.de>. It may be found at
138# http://home.a-city.de/franco.bez/gettext/gettext_win32_en.html
139# Tested with mingw32 with GCC-2.95.2 on Win98
140# Updated 2001 Jun 9
141#GETTEXT=c:/gettext.win32.msvcrt
142#STATIC_GETTEXT=USE_STATIC_GETTEXT
143#DYNAMIC_GETTEXT=USE_GETTEXT_DLL
144#DYNAMIC_GETTEXT=USE_SAFE_GETTEXT_DLL
145SAFE_GETTEXT_DLL_OBJ = $(GETTEXT)/src/safe_gettext_dll/safe_gettext_dll.o
146# Alternatively, if you uncomment the two following lines, you get a "safe" version
147# without linking the safe_gettext_dll.o object file.
148#DYNAMIC_GETTEXT=DYNAMIC_GETTEXT
149#GETTEXT_DYNAMIC=gnu_gettext.dll
150INTLPATH=$(GETTEXT)/lib/mingw32
151INTLLIB=gnu_gettext
152
153# If you are using gettext-0.10.35 from http://sourceforge.net/projects/gettext
154# or gettext-0.10.37 from http://sourceforge.net/projects/mingwrep/
155# uncomment the following, but I can't build a static version with them, ?-(|
156#GETTEXT=c:/gettext-0.10.37-20010430
157#STATIC_GETTEXT=USE_STATIC_GETTEXT
158#DYNAMIC_GETTEXT=DYNAMIC_GETTEXT
159#INTLPATH=$(GETTEXT)/lib
160#INTLLIB=intl
161
Bram Moolenaare0485392016-07-12 21:17:03 +0200162
163# Command definitions (depends on cross-compiling and shell)
164ifeq ($(CROSS),yes)
165# cross-compiler prefix:
Bram Moolenaar6e75e0a2019-05-11 21:24:26 +0200166 ifndef CROSS_COMPILE
Bram Moolenaare0485392016-07-12 21:17:03 +0200167CROSS_COMPILE = i586-pc-mingw32msvc-
Bram Moolenaar6e75e0a2019-05-11 21:24:26 +0200168 endif
Bram Moolenaare0485392016-07-12 21:17:03 +0200169DEL = rm
170MKDIR = mkdir -p
171DIRSLASH = /
172else
173# normal (Windows) compilation:
Bram Moolenaar6e75e0a2019-05-11 21:24:26 +0200174 ifndef CROSS_COMPILE
Bram Moolenaare0485392016-07-12 21:17:03 +0200175CROSS_COMPILE =
Bram Moolenaar6e75e0a2019-05-11 21:24:26 +0200176 endif
Bram Moolenaare828b762018-09-10 17:51:58 +0200177
178# About the "sh.exe" condition, as explained by Ken Takata:
179#
180# If the makefile is executed with mingw32-make and sh.exe is not found in
181# $PATH, then $SHELL is set to "sh.exe" (without any path). In this case,
182# unix-like commands might not work and a dos-style path is needed.
183#
184# If the makefile is executed with mingw32-make and sh.exe IS found in $PATH,
185# then $SHELL is set with the actual path of sh.exe (e.g.
186# "C:/msys64/usr/bin/sh.exe"). In this case, unix-like commands can be used.
187#
188# If it is executed by the "make" command from cmd.exe, $SHELL is set to
189# "/bin/sh". If the "make" command is in the $PATH, other unix-like commands
190# might also work.
191#
192# If it is executed by the "make" command from a unix-like shell,
193# $SHELL is set with the unix-style path (e.g. "/bin/bash").
194# In this case, unix-like commands can be used.
195#
Bram Moolenaar6e75e0a2019-05-11 21:24:26 +0200196 ifneq (sh.exe, $(SHELL))
Bram Moolenaare0485392016-07-12 21:17:03 +0200197DEL = rm
198MKDIR = mkdir -p
199DIRSLASH = /
Bram Moolenaar6e75e0a2019-05-11 21:24:26 +0200200 else
Bram Moolenaare0485392016-07-12 21:17:03 +0200201DEL = del
202MKDIR = mkdir
203DIRSLASH = \\
Bram Moolenaar6e75e0a2019-05-11 21:24:26 +0200204 endif
Bram Moolenaare0485392016-07-12 21:17:03 +0200205endif
206CC := $(CROSS_COMPILE)gcc
207CXX := $(CROSS_COMPILE)g++
208ifeq ($(UNDER_CYGWIN),yes)
209WINDRES := $(CROSS_COMPILE)windres
210else
211WINDRES := windres
212endif
213WINDRES_CC = $(CC)
214
215# Get the default ARCH.
216ifndef ARCH
Bram Moolenaarf62e7972016-07-14 20:25:03 +0200217ARCH := $(shell $(CC) -dumpmachine | sed -e 's/-.*//' -e 's/_/-/' -e 's/^mingw32$$/i686/')
Bram Moolenaare0485392016-07-12 21:17:03 +0200218endif
219
220
Bram Moolenaar4f7e8212014-11-05 13:53:32 +0100221# Perl interface:
222# PERL=[Path to Perl directory] (Set inside Make_cyg.mak or Make_ming.mak)
223# DYNAMIC_PERL=yes (to load the Perl DLL dynamically)
Bram Moolenaar0eaadec2016-09-08 20:28:45 +0200224# PERL_VER=[Perl version, eg 56, 58, 510] (default is 524)
Bram Moolenaar4f7e8212014-11-05 13:53:32 +0100225ifdef PERL
Bram Moolenaar6e75e0a2019-05-11 21:24:26 +0200226 ifndef PERL_VER
Bram Moolenaar0eaadec2016-09-08 20:28:45 +0200227PERL_VER=524
Bram Moolenaar6e75e0a2019-05-11 21:24:26 +0200228 endif
229 ifndef DYNAMIC_PERL
Bram Moolenaar4f7e8212014-11-05 13:53:32 +0100230DYNAMIC_PERL=yes
Bram Moolenaar6e75e0a2019-05-11 21:24:26 +0200231 endif
Bram Moolenaar4f7e8212014-11-05 13:53:32 +0100232# on Linux, for cross-compile, it's here:
233#PERLLIB=/home/ron/ActivePerl/lib
234# on NT, it's here:
235PERLEXE=$(PERL)/bin/perl
236PERLLIB=$(PERL)/lib
237PERLLIBS=$(PERLLIB)/Core
Bram Moolenaar6e75e0a2019-05-11 21:24:26 +0200238 ifeq ($(UNDER_CYGWIN),yes)
Bram Moolenaar4f7e8212014-11-05 13:53:32 +0100239PERLTYPEMAP:=$(shell cygpath -m $(PERLLIB)/ExtUtils/typemap)
240XSUBPPTRY:=$(shell cygpath -m $(PERLLIB)/ExtUtils/xsubpp)
Bram Moolenaar6e75e0a2019-05-11 21:24:26 +0200241 else
Bram Moolenaar4f7e8212014-11-05 13:53:32 +0100242PERLTYPEMAP=$(PERLLIB)/ExtUtils/typemap
243XSUBPPTRY=$(PERLLIB)/ExtUtils/xsubpp
Bram Moolenaar6e75e0a2019-05-11 21:24:26 +0200244 endif
Bram Moolenaar4f7e8212014-11-05 13:53:32 +0100245XSUBPP_EXISTS=$(shell $(PERLEXE) -e "print 1 unless -e '$(XSUBPPTRY)'")
Bram Moolenaar6e75e0a2019-05-11 21:24:26 +0200246 ifeq "$(XSUBPP_EXISTS)" ""
Bram Moolenaar345326a2014-11-06 10:03:01 +0100247XSUBPP=$(PERLEXE) $(XSUBPPTRY)
Bram Moolenaar6e75e0a2019-05-11 21:24:26 +0200248 else
Bram Moolenaar4f7e8212014-11-05 13:53:32 +0100249XSUBPP=xsubpp
Bram Moolenaar6e75e0a2019-05-11 21:24:26 +0200250 endif
Bram Moolenaar4f7e8212014-11-05 13:53:32 +0100251endif
252
253# Lua interface:
254# LUA=[Path to Lua directory] (Set inside Make_cyg.mak or Make_ming.mak)
Bram Moolenaarb872e632018-09-21 13:44:09 +0200255# LUA_LIBDIR=[Path to Lua library directory] (default: $LUA/lib)
256# LUA_INCDIR=[Path to Lua include directory] (default: $LUA/include)
Bram Moolenaar4f7e8212014-11-05 13:53:32 +0100257# DYNAMIC_LUA=yes (to load the Lua DLL dynamically)
Bram Moolenaar0eaadec2016-09-08 20:28:45 +0200258# LUA_VER=[Lua version, eg 51, 52] (default is 53)
Bram Moolenaar4f7e8212014-11-05 13:53:32 +0100259ifdef LUA
Bram Moolenaar6e75e0a2019-05-11 21:24:26 +0200260 ifndef DYNAMIC_LUA
Bram Moolenaar4f7e8212014-11-05 13:53:32 +0100261DYNAMIC_LUA=yes
Bram Moolenaar6e75e0a2019-05-11 21:24:26 +0200262 endif
Bram Moolenaar4f7e8212014-11-05 13:53:32 +0100263
Bram Moolenaar6e75e0a2019-05-11 21:24:26 +0200264 ifndef LUA_VER
Bram Moolenaar0eaadec2016-09-08 20:28:45 +0200265LUA_VER=53
Bram Moolenaar6e75e0a2019-05-11 21:24:26 +0200266 endif
Bram Moolenaar4f7e8212014-11-05 13:53:32 +0100267
Bram Moolenaar6e75e0a2019-05-11 21:24:26 +0200268 ifeq (no,$(DYNAMIC_LUA))
Bram Moolenaarb872e632018-09-21 13:44:09 +0200269LUA_LIBDIR = $(LUA)/lib
270LUA_LIB = -L$(LUA_LIBDIR) -llua
Bram Moolenaar6e75e0a2019-05-11 21:24:26 +0200271 endif
Bram Moolenaar4f7e8212014-11-05 13:53:32 +0100272
273endif
274
275# MzScheme interface:
276# MZSCHEME=[Path to MzScheme directory] (Set inside Make_cyg.mak or Make_ming.mak)
277# DYNAMIC_MZSCHEME=yes (to load the MzScheme DLL dynamically)
Bram Moolenaar0eaadec2016-09-08 20:28:45 +0200278# MZSCHEME_VER=[MzScheme version] (default is 3m_a0solc (6.6))
Bram Moolenaarf16c71b2017-09-18 20:01:02 +0200279# Used for the DLL file name. E.g.:
280# C:\Program Files (x86)\Racket\lib\libracket3m_XXXXXX.dll
Bram Moolenaar4f7e8212014-11-05 13:53:32 +0100281# MZSCHEME_DEBUG=no
282ifdef MZSCHEME
Bram Moolenaar6e75e0a2019-05-11 21:24:26 +0200283 ifndef DYNAMIC_MZSCHEME
Bram Moolenaar4f7e8212014-11-05 13:53:32 +0100284DYNAMIC_MZSCHEME=yes
Bram Moolenaar6e75e0a2019-05-11 21:24:26 +0200285 endif
Bram Moolenaar4f7e8212014-11-05 13:53:32 +0100286
Bram Moolenaar6e75e0a2019-05-11 21:24:26 +0200287 ifndef MZSCHEME_VER
Bram Moolenaar0eaadec2016-09-08 20:28:45 +0200288MZSCHEME_VER=3m_a0solc
Bram Moolenaar6e75e0a2019-05-11 21:24:26 +0200289 endif
Bram Moolenaar4f7e8212014-11-05 13:53:32 +0100290
Bram Moolenaar4f7e8212014-11-05 13:53:32 +0100291# for version 4.x we need to generate byte-code for Scheme base
Bram Moolenaar6e75e0a2019-05-11 21:24:26 +0200292 ifndef MZSCHEME_GENERATE_BASE
Bram Moolenaar4f7e8212014-11-05 13:53:32 +0100293MZSCHEME_GENERATE_BASE=no
Bram Moolenaar6e75e0a2019-05-11 21:24:26 +0200294 endif
Bram Moolenaar4f7e8212014-11-05 13:53:32 +0100295
Bram Moolenaar6e75e0a2019-05-11 21:24:26 +0200296 ifneq ($(wildcard $(MZSCHEME)/lib/msvc/libmzsch$(MZSCHEME_VER).lib),)
Bram Moolenaar4f7e8212014-11-05 13:53:32 +0100297MZSCHEME_MAIN_LIB=mzsch
Bram Moolenaar6e75e0a2019-05-11 21:24:26 +0200298 else
Bram Moolenaar4f7e8212014-11-05 13:53:32 +0100299MZSCHEME_MAIN_LIB=racket
Bram Moolenaar6e75e0a2019-05-11 21:24:26 +0200300 endif
Bram Moolenaar4f7e8212014-11-05 13:53:32 +0100301
Bram Moolenaar6e75e0a2019-05-11 21:24:26 +0200302 ifndef MZSCHEME_PRECISE_GC
Bram Moolenaar4e640bd2016-01-16 16:20:38 +0100303MZSCHEME_PRECISE_GC=no
Bram Moolenaar6e75e0a2019-05-11 21:24:26 +0200304 ifneq ($(wildcard $(MZSCHEME)\lib\lib$(MZSCHEME_MAIN_LIB)$(MZSCHEME_VER).dll),)
305 ifeq ($(wildcard $(MZSCHEME)\lib\libmzgc$(MZSCHEME_VER).dll),)
Bram Moolenaar4e640bd2016-01-16 16:20:38 +0100306MZSCHEME_PRECISE_GC=yes
Bram Moolenaar6e75e0a2019-05-11 21:24:26 +0200307 endif
308 else
309 ifneq ($(wildcard $(MZSCHEME)\lib\msvc\lib$(MZSCHEME_MAIN_LIB)$(MZSCHEME_VER).lib),)
310 ifeq ($(wildcard $(MZSCHEME)\lib\msvc\libmzgc$(MZSCHEME_VER).lib),)
Bram Moolenaar4e640bd2016-01-16 16:20:38 +0100311MZSCHEME_PRECISE_GC=yes
Bram Moolenaar6e75e0a2019-05-11 21:24:26 +0200312 endif
313 endif
314 endif
315 endif
Bram Moolenaar4e640bd2016-01-16 16:20:38 +0100316
Bram Moolenaar6e75e0a2019-05-11 21:24:26 +0200317 ifeq (no,$(DYNAMIC_MZSCHEME))
318 ifeq (yes,$(MZSCHEME_PRECISE_GC))
Bram Moolenaar4f7e8212014-11-05 13:53:32 +0100319MZSCHEME_LIB=-l$(MZSCHEME_MAIN_LIB)$(MZSCHEME_VER)
Bram Moolenaar6e75e0a2019-05-11 21:24:26 +0200320 else
Bram Moolenaar4e640bd2016-01-16 16:20:38 +0100321MZSCHEME_LIB=-l$(MZSCHEME_MAIN_LIB)$(MZSCHEME_VER) -lmzgc$(MZSCHEME_VER)
Bram Moolenaar6e75e0a2019-05-11 21:24:26 +0200322 endif
Bram Moolenaar4f7e8212014-11-05 13:53:32 +0100323# the modern MinGW can dynamically link to dlls directly.
324# point MZSCHEME_DLLS to where you put libmzschXXXXXXX.dll and libgcXXXXXXX.dll
Bram Moolenaar6e75e0a2019-05-11 21:24:26 +0200325 ifndef MZSCHEME_DLLS
Bram Moolenaar4f7e8212014-11-05 13:53:32 +0100326MZSCHEME_DLLS=$(MZSCHEME)
Bram Moolenaar6e75e0a2019-05-11 21:24:26 +0200327 endif
Bram Moolenaar4f7e8212014-11-05 13:53:32 +0100328MZSCHEME_LIBDIR=-L$(MZSCHEME_DLLS) -L$(MZSCHEME_DLLS)\lib
Bram Moolenaar6e75e0a2019-05-11 21:24:26 +0200329 endif
Bram Moolenaar4f7e8212014-11-05 13:53:32 +0100330
331endif
332
333# Python interface:
334# PYTHON=[Path to Python directory] (Set inside Make_cyg.mak or Make_ming.mak)
335# DYNAMIC_PYTHON=yes (to load the Python DLL dynamically)
Bram Moolenaar0eaadec2016-09-08 20:28:45 +0200336# PYTHON_VER=[Python version, eg 22, 23, ..., 27] (default is 27)
Bram Moolenaar4f7e8212014-11-05 13:53:32 +0100337ifdef PYTHON
Bram Moolenaar6e75e0a2019-05-11 21:24:26 +0200338 ifndef DYNAMIC_PYTHON
Bram Moolenaar4f7e8212014-11-05 13:53:32 +0100339DYNAMIC_PYTHON=yes
Bram Moolenaar6e75e0a2019-05-11 21:24:26 +0200340 endif
Bram Moolenaar4f7e8212014-11-05 13:53:32 +0100341
Bram Moolenaar6e75e0a2019-05-11 21:24:26 +0200342 ifndef PYTHON_VER
Bram Moolenaar3c6f92e2016-01-02 20:26:36 +0100343PYTHON_VER=27
Bram Moolenaar6e75e0a2019-05-11 21:24:26 +0200344 endif
345 ifndef DYNAMIC_PYTHON_DLL
Bram Moolenaar3c6f92e2016-01-02 20:26:36 +0100346DYNAMIC_PYTHON_DLL=python$(PYTHON_VER).dll
Bram Moolenaar6e75e0a2019-05-11 21:24:26 +0200347 endif
348 ifdef PYTHON_HOME
Bram Moolenaar3c6f92e2016-01-02 20:26:36 +0100349PYTHON_HOME_DEF=-DPYTHON_HOME=\"$(PYTHON_HOME)\"
Bram Moolenaar6e75e0a2019-05-11 21:24:26 +0200350 endif
Bram Moolenaar4f7e8212014-11-05 13:53:32 +0100351
Bram Moolenaar6e75e0a2019-05-11 21:24:26 +0200352 ifeq (no,$(DYNAMIC_PYTHON))
Bram Moolenaar4f7e8212014-11-05 13:53:32 +0100353PYTHONLIB=-L$(PYTHON)/libs -lpython$(PYTHON_VER)
Bram Moolenaar6e75e0a2019-05-11 21:24:26 +0200354 endif
Bram Moolenaar4f7e8212014-11-05 13:53:32 +0100355# my include files are in 'win32inc' on Linux, and 'include' in the standard
356# NT distro (ActiveState)
Bram Moolenaar6e75e0a2019-05-11 21:24:26 +0200357 ifndef PYTHONINC
358 ifeq ($(CROSS),no)
Bram Moolenaar4f7e8212014-11-05 13:53:32 +0100359PYTHONINC=-I $(PYTHON)/include
Bram Moolenaar6e75e0a2019-05-11 21:24:26 +0200360 else
Bram Moolenaar4f7e8212014-11-05 13:53:32 +0100361PYTHONINC=-I $(PYTHON)/win32inc
Bram Moolenaar6e75e0a2019-05-11 21:24:26 +0200362 endif
363 endif
Bram Moolenaar3c6f92e2016-01-02 20:26:36 +0100364endif
Bram Moolenaar4f7e8212014-11-05 13:53:32 +0100365
366# Python3 interface:
367# PYTHON3=[Path to Python3 directory] (Set inside Make_cyg.mak or Make_ming.mak)
368# DYNAMIC_PYTHON3=yes (to load the Python3 DLL dynamically)
Bram Moolenaar59eb0162017-12-10 18:17:44 +0100369# PYTHON3_VER=[Python3 version, eg 31, 32] (default is 36)
Bram Moolenaar4f7e8212014-11-05 13:53:32 +0100370ifdef PYTHON3
Bram Moolenaar6e75e0a2019-05-11 21:24:26 +0200371 ifndef DYNAMIC_PYTHON3
Bram Moolenaar4f7e8212014-11-05 13:53:32 +0100372DYNAMIC_PYTHON3=yes
Bram Moolenaar6e75e0a2019-05-11 21:24:26 +0200373 endif
Bram Moolenaar4f7e8212014-11-05 13:53:32 +0100374
Bram Moolenaar6e75e0a2019-05-11 21:24:26 +0200375 ifndef PYTHON3_VER
Bram Moolenaar59eb0162017-12-10 18:17:44 +0100376PYTHON3_VER=36
Bram Moolenaar6e75e0a2019-05-11 21:24:26 +0200377 endif
378 ifndef DYNAMIC_PYTHON3_DLL
Bram Moolenaara7c37952016-01-20 22:23:15 +0100379DYNAMIC_PYTHON3_DLL=python$(PYTHON3_VER).dll
Bram Moolenaar6e75e0a2019-05-11 21:24:26 +0200380 endif
381 ifdef PYTHON3_HOME
Bram Moolenaaracd58ef2016-02-16 13:42:24 +0100382PYTHON3_HOME_DEF=-DPYTHON3_HOME=L\"$(PYTHON3_HOME)\"
Bram Moolenaar6e75e0a2019-05-11 21:24:26 +0200383 endif
Bram Moolenaar4f7e8212014-11-05 13:53:32 +0100384
Bram Moolenaar6e75e0a2019-05-11 21:24:26 +0200385 ifeq (no,$(DYNAMIC_PYTHON3))
Bram Moolenaara7c37952016-01-20 22:23:15 +0100386PYTHON3LIB=-L$(PYTHON3)/libs -lpython$(PYTHON3_VER)
Bram Moolenaar6e75e0a2019-05-11 21:24:26 +0200387 endif
Bram Moolenaara7c37952016-01-20 22:23:15 +0100388
Bram Moolenaar6e75e0a2019-05-11 21:24:26 +0200389 ifndef PYTHON3INC
390 ifeq ($(CROSS),no)
Bram Moolenaar4f7e8212014-11-05 13:53:32 +0100391PYTHON3INC=-I $(PYTHON3)/include
Bram Moolenaar6e75e0a2019-05-11 21:24:26 +0200392 else
Bram Moolenaar4f7e8212014-11-05 13:53:32 +0100393PYTHON3INC=-I $(PYTHON3)/win32inc
Bram Moolenaar6e75e0a2019-05-11 21:24:26 +0200394 endif
395 endif
Bram Moolenaara7c37952016-01-20 22:23:15 +0100396endif
Bram Moolenaar4f7e8212014-11-05 13:53:32 +0100397
398# TCL interface:
399# TCL=[Path to TCL directory] (Set inside Make_cyg.mak or Make_ming.mak)
400# DYNAMIC_TCL=yes (to load the TCL DLL dynamically)
Bram Moolenaar0eaadec2016-09-08 20:28:45 +0200401# TCL_VER=[TCL version, eg 83, 84] (default is 86)
402# TCL_VER_LONG=[Tcl version, eg 8.3] (default is 8.6)
Bram Moolenaareca99bd2016-01-07 22:50:05 +0100403# You must set TCL_VER_LONG when you set TCL_VER.
Bram Moolenaar77f74742017-08-23 22:40:41 +0200404# TCL_DLL=[TCL dll name, eg tcl86.dll] (default is tcl86.dll)
Bram Moolenaar4f7e8212014-11-05 13:53:32 +0100405ifdef TCL
Bram Moolenaar6e75e0a2019-05-11 21:24:26 +0200406 ifndef DYNAMIC_TCL
Bram Moolenaar4f7e8212014-11-05 13:53:32 +0100407DYNAMIC_TCL=yes
Bram Moolenaar6e75e0a2019-05-11 21:24:26 +0200408 endif
409 ifndef TCL_VER
Bram Moolenaar0eaadec2016-09-08 20:28:45 +0200410TCL_VER = 86
Bram Moolenaar6e75e0a2019-05-11 21:24:26 +0200411 endif
412 ifndef TCL_VER_LONG
Bram Moolenaar0eaadec2016-09-08 20:28:45 +0200413TCL_VER_LONG = 8.6
Bram Moolenaar6e75e0a2019-05-11 21:24:26 +0200414 endif
415 ifndef TCL_DLL
Bram Moolenaar77f74742017-08-23 22:40:41 +0200416TCL_DLL = tcl$(TCL_VER).dll
Bram Moolenaar6e75e0a2019-05-11 21:24:26 +0200417 endif
Bram Moolenaar4f7e8212014-11-05 13:53:32 +0100418TCLINC += -I$(TCL)/include
419endif
420
421
422# Ruby interface:
423# RUBY=[Path to Ruby directory] (Set inside Make_cyg.mak or Make_ming.mak)
Bram Moolenaar61766972018-04-20 22:31:41 +0200424# DYNAMIC_RUBY=yes (to load the Ruby DLL dynamically, "no" for static)
Bram Moolenaar6384c5d2016-09-06 22:06:35 +0200425# RUBY_VER=[Ruby version, eg 19, 22] (default is 22)
426# RUBY_API_VER_LONG=[Ruby API version, eg 1.8, 1.9.1, 2.2.0]
427# (default is 2.2.0)
428# You must set RUBY_API_VER_LONG when changing RUBY_VER.
Bram Moolenaar4f7e8212014-11-05 13:53:32 +0100429# Note: If you use Ruby 1.9.3, set as follows:
430# RUBY_VER=19
Bram Moolenaar6384c5d2016-09-06 22:06:35 +0200431# 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 +0100432ifdef RUBY
Bram Moolenaar6e75e0a2019-05-11 21:24:26 +0200433 ifndef DYNAMIC_RUBY
Bram Moolenaar4f7e8212014-11-05 13:53:32 +0100434DYNAMIC_RUBY=yes
Bram Moolenaar6e75e0a2019-05-11 21:24:26 +0200435 endif
Bram Moolenaar4f7e8212014-11-05 13:53:32 +0100436# Set default value
Bram Moolenaar6e75e0a2019-05-11 21:24:26 +0200437 ifndef RUBY_VER
Bram Moolenaar6384c5d2016-09-06 22:06:35 +0200438RUBY_VER = 22
Bram Moolenaar6e75e0a2019-05-11 21:24:26 +0200439 endif
440 ifndef RUBY_VER_LONG
Bram Moolenaar6384c5d2016-09-06 22:06:35 +0200441RUBY_VER_LONG = 2.2.0
Bram Moolenaar6e75e0a2019-05-11 21:24:26 +0200442 endif
443 ifndef RUBY_API_VER_LONG
Bram Moolenaar0eaadec2016-09-08 20:28:45 +0200444RUBY_API_VER_LONG = $(RUBY_VER_LONG)
Bram Moolenaar6e75e0a2019-05-11 21:24:26 +0200445 endif
446 ifndef RUBY_API_VER
Bram Moolenaar6384c5d2016-09-06 22:06:35 +0200447RUBY_API_VER = $(subst .,,$(RUBY_API_VER_LONG))
Bram Moolenaar6e75e0a2019-05-11 21:24:26 +0200448 endif
Bram Moolenaar4f7e8212014-11-05 13:53:32 +0100449
Bram Moolenaar6e75e0a2019-05-11 21:24:26 +0200450 ifndef RUBY_PLATFORM
451 ifeq ($(RUBY_VER), 16)
Bram Moolenaar4f7e8212014-11-05 13:53:32 +0100452RUBY_PLATFORM = i586-mswin32
Bram Moolenaar6e75e0a2019-05-11 21:24:26 +0200453 else ifneq ($(wildcard $(RUBY)/lib/ruby/$(RUBY_API_VER_LONG)/i386-mingw32),)
Bram Moolenaar4f7e8212014-11-05 13:53:32 +0100454RUBY_PLATFORM = i386-mingw32
Bram Moolenaar6e75e0a2019-05-11 21:24:26 +0200455 else ifneq ($(wildcard $(RUBY)/lib/ruby/$(RUBY_API_VER_LONG)/x64-mingw32),)
Bram Moolenaar4f7e8212014-11-05 13:53:32 +0100456RUBY_PLATFORM = x64-mingw32
Bram Moolenaar6e75e0a2019-05-11 21:24:26 +0200457 else
Bram Moolenaar4f7e8212014-11-05 13:53:32 +0100458RUBY_PLATFORM = i386-mswin32
Bram Moolenaar6e75e0a2019-05-11 21:24:26 +0200459 endif
460 endif
Bram Moolenaar4f7e8212014-11-05 13:53:32 +0100461
Bram Moolenaar6e75e0a2019-05-11 21:24:26 +0200462 ifndef RUBY_INSTALL_NAME
463 ifeq ($(RUBY_VER), 16)
Bram Moolenaar4f7e8212014-11-05 13:53:32 +0100464RUBY_INSTALL_NAME = mswin32-ruby$(RUBY_API_VER)
Bram Moolenaar6e75e0a2019-05-11 21:24:26 +0200465 else
466 ifndef RUBY_MSVCRT_NAME
Bram Moolenaar0bee2fe2016-01-07 22:45:09 +0100467# Base name of msvcrXX.dll which is used by ruby's dll.
468RUBY_MSVCRT_NAME = msvcrt
Bram Moolenaar6e75e0a2019-05-11 21:24:26 +0200469 endif
470 ifeq ($(ARCH),x86-64)
Bram Moolenaar0bee2fe2016-01-07 22:45:09 +0100471RUBY_INSTALL_NAME = x64-$(RUBY_MSVCRT_NAME)-ruby$(RUBY_API_VER)
Bram Moolenaar6e75e0a2019-05-11 21:24:26 +0200472 else
Bram Moolenaar0bee2fe2016-01-07 22:45:09 +0100473RUBY_INSTALL_NAME = $(RUBY_MSVCRT_NAME)-ruby$(RUBY_API_VER)
Bram Moolenaar6e75e0a2019-05-11 21:24:26 +0200474 endif
475 endif
476 endif
Bram Moolenaar4f7e8212014-11-05 13:53:32 +0100477
Bram Moolenaar6e75e0a2019-05-11 21:24:26 +0200478 ifeq (19, $(word 1,$(sort 19 $(RUBY_VER))))
Bram Moolenaar4f7e8212014-11-05 13:53:32 +0100479RUBY_19_OR_LATER = 1
Bram Moolenaar6e75e0a2019-05-11 21:24:26 +0200480 endif
Bram Moolenaar4f7e8212014-11-05 13:53:32 +0100481
Bram Moolenaar6e75e0a2019-05-11 21:24:26 +0200482 ifdef RUBY_19_OR_LATER
Bram Moolenaar76c612a2018-09-21 14:31:51 +0200483RUBYINC = -I $(RUBY)/include/ruby-$(RUBY_API_VER_LONG) -I $(RUBY)/include/ruby-$(RUBY_API_VER_LONG)/$(RUBY_PLATFORM)
Bram Moolenaar6e75e0a2019-05-11 21:24:26 +0200484 else
Bram Moolenaar76c612a2018-09-21 14:31:51 +0200485RUBYINC = -I $(RUBY)/lib/ruby/$(RUBY_API_VER_LONG)/$(RUBY_PLATFORM)
Bram Moolenaar6e75e0a2019-05-11 21:24:26 +0200486 endif
487 ifeq (no, $(DYNAMIC_RUBY))
Bram Moolenaar4f7e8212014-11-05 13:53:32 +0100488RUBYLIB = -L$(RUBY)/lib -l$(RUBY_INSTALL_NAME)
Bram Moolenaar6e75e0a2019-05-11 21:24:26 +0200489 endif
Bram Moolenaar4f7e8212014-11-05 13:53:32 +0100490
491endif # RUBY
492
493# See feature.h for a list of options.
494# Any other defines can be included here.
Bram Moolenaar0472b6d2019-02-18 21:41:37 +0100495DEF_GUI=-DFEAT_GUI_MSWIN -DFEAT_CLIPBOARD
Bram Moolenaar4f7e8212014-11-05 13:53:32 +0100496DEFINES=-DWIN32 -DWINVER=$(WINVER) -D_WIN32_WINNT=$(WINVER) \
Bram Moolenaar22fcfad2016-07-01 18:17:26 +0200497 -DHAVE_PATHDEF -DFEAT_$(FEATURES) -DHAVE_STDINT_H
Bram Moolenaar4f7e8212014-11-05 13:53:32 +0100498ifeq ($(ARCH),x86-64)
499DEFINES+=-DMS_WIN64
500endif
Bram Moolenaar4f7e8212014-11-05 13:53:32 +0100501
502#>>>>> end of choices
503###########################################################################
504
Bram Moolenaarb361db02018-10-16 21:13:14 +0200505CFLAGS = -I. -Iproto $(DEFINES) -pipe -march=$(ARCH) -Wall
Bram Moolenaar6c0e9842016-03-22 20:42:31 +0100506CXXFLAGS = -std=gnu++11
Bram Moolenaar4f7e8212014-11-05 13:53:32 +0100507WINDRES_FLAGS = --preprocessor="$(WINDRES_CC) -E -xc" -DRC_INVOKED
508EXTRA_LIBS =
509
510ifdef GETTEXT
511DEFINES += -DHAVE_GETTEXT -DHAVE_LOCALE_H
512GETTEXTINCLUDE = $(GETTEXT)/include
513GETTEXTLIB = $(INTLPATH)
Bram Moolenaar6e75e0a2019-05-11 21:24:26 +0200514 ifeq (yes, $(GETTEXT))
Bram Moolenaar4f7e8212014-11-05 13:53:32 +0100515DEFINES += -DDYNAMIC_GETTEXT
Bram Moolenaar6e75e0a2019-05-11 21:24:26 +0200516 else ifdef DYNAMIC_GETTEXT
Bram Moolenaar4f7e8212014-11-05 13:53:32 +0100517DEFINES += -D$(DYNAMIC_GETTEXT)
Bram Moolenaar6e75e0a2019-05-11 21:24:26 +0200518 ifdef GETTEXT_DYNAMIC
Bram Moolenaar4f7e8212014-11-05 13:53:32 +0100519DEFINES += -DGETTEXT_DYNAMIC -DGETTEXT_DLL=\"$(GETTEXT_DYNAMIC)\"
Bram Moolenaar6e75e0a2019-05-11 21:24:26 +0200520 endif
521 endif
Bram Moolenaar4f7e8212014-11-05 13:53:32 +0100522endif
523
524ifdef PERL
Bram Moolenaar367fbf12015-06-25 16:13:46 +0200525CFLAGS += -I$(PERLLIBS) -DFEAT_PERL -DPERL_IMPLICIT_CONTEXT -DPERL_IMPLICIT_SYS
Bram Moolenaar6e75e0a2019-05-11 21:24:26 +0200526 ifeq (yes, $(DYNAMIC_PERL))
Bram Moolenaar4f7e8212014-11-05 13:53:32 +0100527CFLAGS += -DDYNAMIC_PERL -DDYNAMIC_PERL_DLL=\"perl$(PERL_VER).dll\"
528EXTRA_LIBS += -L$(PERLLIBS) -lperl$(PERL_VER)
Bram Moolenaar6e75e0a2019-05-11 21:24:26 +0200529 endif
Bram Moolenaar4f7e8212014-11-05 13:53:32 +0100530endif
531
532ifdef LUA
Bram Moolenaarb872e632018-09-21 13:44:09 +0200533LUA_INCDIR = $(LUA)/include
534CFLAGS += -I$(LUA_INCDIR) -I$(LUA) -DFEAT_LUA
Bram Moolenaar6e75e0a2019-05-11 21:24:26 +0200535 ifeq (yes, $(DYNAMIC_LUA))
Bram Moolenaar4f7e8212014-11-05 13:53:32 +0100536CFLAGS += -DDYNAMIC_LUA -DDYNAMIC_LUA_DLL=\"lua$(LUA_VER).dll\"
Bram Moolenaar6e75e0a2019-05-11 21:24:26 +0200537 endif
Bram Moolenaar4f7e8212014-11-05 13:53:32 +0100538endif
539
540ifdef MZSCHEME
Bram Moolenaar6e75e0a2019-05-11 21:24:26 +0200541 ifndef MZSCHEME_COLLECTS
Bram Moolenaar4e640bd2016-01-16 16:20:38 +0100542MZSCHEME_COLLECTS=$(MZSCHEME)/collects
Bram Moolenaar6e75e0a2019-05-11 21:24:26 +0200543 ifeq (yes, $(UNDER_CYGWIN))
Bram Moolenaar4e640bd2016-01-16 16:20:38 +0100544MZSCHEME_COLLECTS:=$(shell cygpath -m $(MZSCHEME_COLLECTS) | sed -e 's/ /\\ /g')
Bram Moolenaar6e75e0a2019-05-11 21:24:26 +0200545 endif
546 endif
Bram Moolenaar4e640bd2016-01-16 16:20:38 +0100547CFLAGS += -I$(MZSCHEME)/include -DFEAT_MZSCHEME -DMZSCHEME_COLLECTS=\"$(MZSCHEME_COLLECTS)\"
Bram Moolenaar6e75e0a2019-05-11 21:24:26 +0200548 ifeq (yes, $(DYNAMIC_MZSCHEME))
549 ifeq (yes, $(MZSCHEME_PRECISE_GC))
Bram Moolenaar4e640bd2016-01-16 16:20:38 +0100550# Precise GC does not use separate dll
551CFLAGS += -DDYNAMIC_MZSCHEME -DDYNAMIC_MZSCH_DLL=\"lib$(MZSCHEME_MAIN_LIB)$(MZSCHEME_VER).dll\" -DDYNAMIC_MZGC_DLL=\"lib$(MZSCHEME_MAIN_LIB)$(MZSCHEME_VER).dll\"
Bram Moolenaar6e75e0a2019-05-11 21:24:26 +0200552 else
Bram Moolenaar4f7e8212014-11-05 13:53:32 +0100553CFLAGS += -DDYNAMIC_MZSCHEME -DDYNAMIC_MZSCH_DLL=\"lib$(MZSCHEME_MAIN_LIB)$(MZSCHEME_VER).dll\" -DDYNAMIC_MZGC_DLL=\"libmzgc$(MZSCHEME_VER).dll\"
Bram Moolenaar6e75e0a2019-05-11 21:24:26 +0200554 endif
555 endif
556 ifeq (yes, "$(MZSCHEME_DEBUG)")
Bram Moolenaar4f7e8212014-11-05 13:53:32 +0100557CFLAGS += -DMZSCHEME_FORCE_GC
Bram Moolenaar6e75e0a2019-05-11 21:24:26 +0200558 endif
Bram Moolenaar4f7e8212014-11-05 13:53:32 +0100559endif
560
561ifdef RUBY
562CFLAGS += -DFEAT_RUBY $(RUBYINC)
Bram Moolenaar6e75e0a2019-05-11 21:24:26 +0200563 ifeq (yes, $(DYNAMIC_RUBY))
Bram Moolenaar4f7e8212014-11-05 13:53:32 +0100564CFLAGS += -DDYNAMIC_RUBY -DDYNAMIC_RUBY_DLL=\"$(RUBY_INSTALL_NAME).dll\"
565CFLAGS += -DDYNAMIC_RUBY_VER=$(RUBY_VER)
Bram Moolenaar6e75e0a2019-05-11 21:24:26 +0200566 endif
567 ifeq (no, $(DYNAMIC_RUBY))
Bram Moolenaar259a90f2018-04-21 19:08:55 +0200568CFLAGS += -DRUBY_VERSION=$(RUBY_VER)
Bram Moolenaar6e75e0a2019-05-11 21:24:26 +0200569 endif
570 ifneq ($(findstring w64-mingw32,$(CC)),)
Bram Moolenaar4f7e8212014-11-05 13:53:32 +0100571# A workaround for MinGW-w64
572CFLAGS += -DHAVE_STRUCT_TIMESPEC -DHAVE_STRUCT_TIMEZONE
Bram Moolenaar6e75e0a2019-05-11 21:24:26 +0200573 endif
Bram Moolenaar4f7e8212014-11-05 13:53:32 +0100574endif
575
576ifdef PYTHON
Bram Moolenaar223b7232016-02-19 19:43:49 +0100577CFLAGS += -DFEAT_PYTHON
Bram Moolenaar6e75e0a2019-05-11 21:24:26 +0200578 ifeq (yes, $(DYNAMIC_PYTHON))
Bram Moolenaar449538c2016-01-09 17:49:15 +0100579CFLAGS += -DDYNAMIC_PYTHON -DDYNAMIC_PYTHON_DLL=\"$(DYNAMIC_PYTHON_DLL)\"
Bram Moolenaar6e75e0a2019-05-11 21:24:26 +0200580 endif
Bram Moolenaar4f7e8212014-11-05 13:53:32 +0100581endif
582
Bram Moolenaar223b7232016-02-19 19:43:49 +0100583ifdef PYTHON3
584CFLAGS += -DFEAT_PYTHON3
Bram Moolenaar6e75e0a2019-05-11 21:24:26 +0200585 ifeq (yes, $(DYNAMIC_PYTHON3))
Bram Moolenaara7c37952016-01-20 22:23:15 +0100586CFLAGS += -DDYNAMIC_PYTHON3 -DDYNAMIC_PYTHON3_DLL=\"$(DYNAMIC_PYTHON3_DLL)\"
Bram Moolenaar6e75e0a2019-05-11 21:24:26 +0200587 endif
Bram Moolenaar4f7e8212014-11-05 13:53:32 +0100588endif
589
590ifdef TCL
591CFLAGS += -DFEAT_TCL $(TCLINC)
Bram Moolenaar6e75e0a2019-05-11 21:24:26 +0200592 ifeq (yes, $(DYNAMIC_TCL))
Bram Moolenaar77f74742017-08-23 22:40:41 +0200593CFLAGS += -DDYNAMIC_TCL -DDYNAMIC_TCL_DLL=\"$(TCL_DLL)\" -DDYNAMIC_TCL_VER=\"$(TCL_VER_LONG)\"
Bram Moolenaar6e75e0a2019-05-11 21:24:26 +0200594 endif
Bram Moolenaar4f7e8212014-11-05 13:53:32 +0100595endif
596
597ifeq ($(POSTSCRIPT),yes)
598DEFINES += -DMSWINPS
599endif
600
601ifeq (yes, $(OLE))
602DEFINES += -DFEAT_OLE
603endif
604
605ifeq ($(CSCOPE),yes)
606DEFINES += -DFEAT_CSCOPE
607endif
608
609ifeq ($(NETBEANS),yes)
610# Only allow NETBEANS for a GUI build.
Bram Moolenaar6e75e0a2019-05-11 21:24:26 +0200611 ifeq (yes, $(GUI))
Bram Moolenaar4f7e8212014-11-05 13:53:32 +0100612DEFINES += -DFEAT_NETBEANS_INTG
613
Bram Moolenaar6e75e0a2019-05-11 21:24:26 +0200614 ifeq ($(NBDEBUG), yes)
Bram Moolenaar4f7e8212014-11-05 13:53:32 +0100615DEFINES += -DNBDEBUG
616NBDEBUG_INCL = nbdebug.h
617NBDEBUG_SRC = nbdebug.c
Bram Moolenaar6e75e0a2019-05-11 21:24:26 +0200618 endif
619 endif
Bram Moolenaar4f7e8212014-11-05 13:53:32 +0100620endif
621
Bram Moolenaare0874f82016-01-24 20:36:41 +0100622ifeq ($(CHANNEL),yes)
Bram Moolenaar509ce2a2016-03-11 22:52:15 +0100623DEFINES += -DFEAT_JOB_CHANNEL
Bram Moolenaare0874f82016-01-24 20:36:41 +0100624endif
625
Bram Moolenaar4fc63502017-07-19 11:28:17 +0200626ifeq ($(TERMINAL),yes)
627DEFINES += -DFEAT_TERMINAL
Bram Moolenaarf80451e2017-07-25 21:49:35 +0200628TERM_DEPS = \
629 libvterm/include/vterm.h \
630 libvterm/include/vterm_keycodes.h \
631 libvterm/src/rect.h \
632 libvterm/src/utf8.h \
633 libvterm/src/vterm_internal.h
Bram Moolenaar4fc63502017-07-19 11:28:17 +0200634endif
635
Bram Moolenaar4f7e8212014-11-05 13:53:32 +0100636# DirectWrite (DirectX)
637ifeq ($(DIRECTX),yes)
638# Only allow DirectWrite for a GUI build.
Bram Moolenaar6e75e0a2019-05-11 21:24:26 +0200639 ifeq (yes, $(GUI))
Bram Moolenaarcccd62d2018-04-12 20:23:48 +0200640DEFINES += -DFEAT_DIRECTX -DDYNAMIC_DIRECTX
Bram Moolenaar6e75e0a2019-05-11 21:24:26 +0200641 ifneq ($(COLOR_EMOJI),no)
Bram Moolenaarcccd62d2018-04-12 20:23:48 +0200642DEFINES += -DFEAT_DIRECTX_COLOR_EMOJI
Bram Moolenaar6e75e0a2019-05-11 21:24:26 +0200643 endif
644 endif
Bram Moolenaar4f7e8212014-11-05 13:53:32 +0100645endif
646
647# Only allow XPM for a GUI build.
648ifeq (yes, $(GUI))
649
Bram Moolenaar6e75e0a2019-05-11 21:24:26 +0200650 ifndef XPM
651 ifeq ($(ARCH),i386)
Bram Moolenaar4f7e8212014-11-05 13:53:32 +0100652XPM = xpm/x86
Bram Moolenaar6e75e0a2019-05-11 21:24:26 +0200653 endif
654 ifeq ($(ARCH),i486)
Bram Moolenaar4f7e8212014-11-05 13:53:32 +0100655XPM = xpm/x86
Bram Moolenaar6e75e0a2019-05-11 21:24:26 +0200656 endif
657 ifeq ($(ARCH),i586)
Bram Moolenaar4f7e8212014-11-05 13:53:32 +0100658XPM = xpm/x86
Bram Moolenaar6e75e0a2019-05-11 21:24:26 +0200659 endif
660 ifeq ($(ARCH),i686)
Bram Moolenaar4f7e8212014-11-05 13:53:32 +0100661XPM = xpm/x86
Bram Moolenaar6e75e0a2019-05-11 21:24:26 +0200662 endif
663 ifeq ($(ARCH),x86-64)
Bram Moolenaar4f7e8212014-11-05 13:53:32 +0100664XPM = xpm/x64
Bram Moolenaar6e75e0a2019-05-11 21:24:26 +0200665 endif
666 endif
667 ifdef XPM
668 ifneq ($(XPM),no)
Bram Moolenaar4f7e8212014-11-05 13:53:32 +0100669CFLAGS += -DFEAT_XPM_W32 -I $(XPM)/include -I $(XPM)/../include
Bram Moolenaar6e75e0a2019-05-11 21:24:26 +0200670 endif
671 endif
Bram Moolenaar4f7e8212014-11-05 13:53:32 +0100672
673endif
674
675ifeq ($(DEBUG),yes)
676CFLAGS += -g -fstack-check
677DEBUG_SUFFIX=d
678else
Bram Moolenaar6e75e0a2019-05-11 21:24:26 +0200679 ifeq ($(OPTIMIZE), SIZE)
Bram Moolenaar4f7e8212014-11-05 13:53:32 +0100680CFLAGS += -Os
Bram Moolenaar6e75e0a2019-05-11 21:24:26 +0200681 else ifeq ($(OPTIMIZE), MAXSPEED)
Bram Moolenaar4f7e8212014-11-05 13:53:32 +0100682CFLAGS += -O3
683CFLAGS += -fomit-frame-pointer -freg-struct-return
Bram Moolenaar6e75e0a2019-05-11 21:24:26 +0200684 else # SPEED
Bram Moolenaar4f7e8212014-11-05 13:53:32 +0100685CFLAGS += -O2
Bram Moolenaar6e75e0a2019-05-11 21:24:26 +0200686 endif
Bram Moolenaarafde13b2019-04-28 19:46:49 +0200687LFLAGS += -s
Bram Moolenaar4f7e8212014-11-05 13:53:32 +0100688endif
689
Bram Moolenaar828c3d72018-06-19 18:58:07 +0200690LIB = -lkernel32 -luser32 -lgdi32 -ladvapi32 -lcomdlg32 -lcomctl32 -lnetapi32 -lversion
Bram Moolenaar796cc422019-04-03 20:31:00 +0200691GUIOBJ = $(OUTDIR)/gui.o $(OUTDIR)/gui_w32.o $(OUTDIR)/gui_beval.o
Bram Moolenaar97ff9b92016-06-26 20:37:46 +0200692CUIOBJ = $(OUTDIR)/iscygpty.o
Bram Moolenaar4f7e8212014-11-05 13:53:32 +0100693OBJ = \
Bram Moolenaar75464dc2016-07-02 20:27:50 +0200694 $(OUTDIR)/arabic.o \
Bram Moolenaar3e460fd2019-01-26 16:21:07 +0100695 $(OUTDIR)/autocmd.o \
Bram Moolenaarc3719bd2017-11-18 22:13:31 +0100696 $(OUTDIR)/beval.o \
Bram Moolenaar6e5ea8d2019-01-12 22:47:31 +0100697 $(OUTDIR)/blob.o \
Bram Moolenaar4f7e8212014-11-05 13:53:32 +0100698 $(OUTDIR)/blowfish.o \
699 $(OUTDIR)/buffer.o \
Bram Moolenaarec28d152019-05-11 18:36:34 +0200700 $(OUTDIR)/change.o \
Bram Moolenaar4f7e8212014-11-05 13:53:32 +0100701 $(OUTDIR)/charset.o \
702 $(OUTDIR)/crypt.o \
703 $(OUTDIR)/crypt_zip.o \
Bram Moolenaareead75c2019-04-21 11:35:00 +0200704 $(OUTDIR)/debugger.o \
Bram Moolenaar6583c442016-07-17 18:41:47 +0200705 $(OUTDIR)/dict.o \
Bram Moolenaar4f7e8212014-11-05 13:53:32 +0100706 $(OUTDIR)/diff.o \
707 $(OUTDIR)/digraph.o \
708 $(OUTDIR)/edit.o \
709 $(OUTDIR)/eval.o \
Bram Moolenaar73dad1e2016-07-17 22:13:49 +0200710 $(OUTDIR)/evalfunc.o \
Bram Moolenaar4f7e8212014-11-05 13:53:32 +0100711 $(OUTDIR)/ex_cmds.o \
712 $(OUTDIR)/ex_cmds2.o \
713 $(OUTDIR)/ex_docmd.o \
714 $(OUTDIR)/ex_eval.o \
715 $(OUTDIR)/ex_getln.o \
716 $(OUTDIR)/fileio.o \
Bram Moolenaar5fd0f502019-02-13 23:13:28 +0100717 $(OUTDIR)/findfile.o \
Bram Moolenaar4f7e8212014-11-05 13:53:32 +0100718 $(OUTDIR)/fold.o \
719 $(OUTDIR)/getchar.o \
720 $(OUTDIR)/hardcopy.o \
721 $(OUTDIR)/hashtab.o \
Bram Moolenaar4b471622019-01-31 13:48:09 +0100722 $(OUTDIR)/indent.o \
Bram Moolenaar7591bb32019-03-30 13:53:47 +0100723 $(OUTDIR)/insexpand.o \
Bram Moolenaar520e1e42016-01-23 19:46:28 +0100724 $(OUTDIR)/json.o \
Bram Moolenaar6583c442016-07-17 18:41:47 +0200725 $(OUTDIR)/list.o \
Bram Moolenaar4f7e8212014-11-05 13:53:32 +0100726 $(OUTDIR)/main.o \
727 $(OUTDIR)/mark.o \
728 $(OUTDIR)/memfile.o \
729 $(OUTDIR)/memline.o \
730 $(OUTDIR)/menu.o \
731 $(OUTDIR)/message.o \
732 $(OUTDIR)/misc1.o \
733 $(OUTDIR)/misc2.o \
734 $(OUTDIR)/move.o \
735 $(OUTDIR)/mbyte.o \
736 $(OUTDIR)/normal.o \
737 $(OUTDIR)/ops.o \
738 $(OUTDIR)/option.o \
Bram Moolenaar4f7e8212014-11-05 13:53:32 +0100739 $(OUTDIR)/os_mswin.o \
Bram Moolenaar796cc422019-04-03 20:31:00 +0200740 $(OUTDIR)/os_win32.o \
Bram Moolenaar4f7e8212014-11-05 13:53:32 +0100741 $(OUTDIR)/pathdef.o \
742 $(OUTDIR)/popupmnu.o \
743 $(OUTDIR)/quickfix.o \
744 $(OUTDIR)/regexp.o \
745 $(OUTDIR)/screen.o \
746 $(OUTDIR)/search.o \
747 $(OUTDIR)/sha256.o \
Bram Moolenaarbbea4702019-01-01 13:20:31 +0100748 $(OUTDIR)/sign.o \
Bram Moolenaar4f7e8212014-11-05 13:53:32 +0100749 $(OUTDIR)/spell.o \
Bram Moolenaar9ccfebd2016-07-19 16:39:08 +0200750 $(OUTDIR)/spellfile.o \
Bram Moolenaar4f7e8212014-11-05 13:53:32 +0100751 $(OUTDIR)/syntax.o \
752 $(OUTDIR)/tag.o \
753 $(OUTDIR)/term.o \
Bram Moolenaar98aefe72018-12-13 22:20:09 +0100754 $(OUTDIR)/textprop.o \
Bram Moolenaar4f7e8212014-11-05 13:53:32 +0100755 $(OUTDIR)/ui.o \
756 $(OUTDIR)/undo.o \
Bram Moolenaarac9fb182019-04-27 13:04:13 +0200757 $(OUTDIR)/usercmd.o \
Bram Moolenaar6583c442016-07-17 18:41:47 +0200758 $(OUTDIR)/userfunc.o \
Bram Moolenaar4f7e8212014-11-05 13:53:32 +0100759 $(OUTDIR)/version.o \
Bram Moolenaar796cc422019-04-03 20:31:00 +0200760 $(OUTDIR)/winclip.o \
Bram Moolenaar4f7e8212014-11-05 13:53:32 +0100761 $(OUTDIR)/window.o
762
Bram Moolenaarafde13b2019-04-28 19:46:49 +0200763ifeq ($(VIMDLL),yes)
764OBJ += $(OUTDIR)/os_w32dll.o $(OUTDIR)/vimrcd.o
765EXEOBJC = $(OUTDIR)/os_w32exec.o $(OUTDIR)/vimrcc.o
766EXEOBJG = $(OUTDIR)/os_w32exeg.o $(OUTDIR)/vimrcg.o
767else
768OBJ += $(OUTDIR)/os_w32exe.o $(OUTDIR)/vimrc.o
769endif
770
Bram Moolenaar4f7e8212014-11-05 13:53:32 +0100771ifdef PERL
772OBJ += $(OUTDIR)/if_perl.o
773endif
774ifdef LUA
775OBJ += $(OUTDIR)/if_lua.o
776endif
777ifdef MZSCHEME
778OBJ += $(OUTDIR)/if_mzsch.o
779MZSCHEME_INCL = if_mzsch.h
Bram Moolenaar6e75e0a2019-05-11 21:24:26 +0200780 ifeq (yes,$(MZSCHEME_GENERATE_BASE))
Bram Moolenaar4f7e8212014-11-05 13:53:32 +0100781CFLAGS += -DINCLUDE_MZSCHEME_BASE
782MZ_EXTRA_DEP += mzscheme_base.c
Bram Moolenaar6e75e0a2019-05-11 21:24:26 +0200783 endif
784 ifeq (yes,$(MZSCHEME_PRECISE_GC))
Bram Moolenaar4f7e8212014-11-05 13:53:32 +0100785CFLAGS += -DMZ_PRECISE_GC
Bram Moolenaar6e75e0a2019-05-11 21:24:26 +0200786 endif
Bram Moolenaar4f7e8212014-11-05 13:53:32 +0100787endif
788ifdef PYTHON
789OBJ += $(OUTDIR)/if_python.o
790endif
791ifdef PYTHON3
792OBJ += $(OUTDIR)/if_python3.o
793endif
794ifdef RUBY
795OBJ += $(OUTDIR)/if_ruby.o
796endif
797ifdef TCL
798OBJ += $(OUTDIR)/if_tcl.o
799endif
800ifeq ($(CSCOPE),yes)
801OBJ += $(OUTDIR)/if_cscope.o
802endif
Bram Moolenaare0874f82016-01-24 20:36:41 +0100803
Bram Moolenaar4f7e8212014-11-05 13:53:32 +0100804ifeq ($(NETBEANS),yes)
Bram Moolenaar6e75e0a2019-05-11 21:24:26 +0200805 ifneq ($(CHANNEL),yes)
Bram Moolenaare0874f82016-01-24 20:36:41 +0100806# Cannot use Netbeans without CHANNEL
807NETBEANS=no
Bram Moolenaar6e75e0a2019-05-11 21:24:26 +0200808 else ifneq (yes, $(GUI))
Bram Moolenaar44d57182016-02-14 23:11:23 +0100809# Cannot use Netbeans without GUI.
810NETBEANS=no
Bram Moolenaar6e75e0a2019-05-11 21:24:26 +0200811 else
Bram Moolenaar4f7e8212014-11-05 13:53:32 +0100812OBJ += $(OUTDIR)/netbeans.o
Bram Moolenaar6e75e0a2019-05-11 21:24:26 +0200813 endif
Bram Moolenaare0874f82016-01-24 20:36:41 +0100814endif
815
816ifeq ($(CHANNEL),yes)
817OBJ += $(OUTDIR)/channel.o
Bram Moolenaare0874f82016-01-24 20:36:41 +0100818LIB += -lwsock32
819endif
Bram Moolenaare0874f82016-01-24 20:36:41 +0100820
Bram Moolenaar4f7e8212014-11-05 13:53:32 +0100821ifeq ($(DIRECTX),yes)
822# Only allow DIRECTX for a GUI build.
Bram Moolenaar6e75e0a2019-05-11 21:24:26 +0200823 ifeq (yes, $(GUI))
Bram Moolenaar4f7e8212014-11-05 13:53:32 +0100824OBJ += $(OUTDIR)/gui_dwrite.o
825LIB += -ld2d1 -ldwrite
826USE_STDCPLUS = yes
Bram Moolenaar6e75e0a2019-05-11 21:24:26 +0200827 endif
Bram Moolenaar4f7e8212014-11-05 13:53:32 +0100828endif
829ifneq ($(XPM),no)
830# Only allow XPM for a GUI build.
Bram Moolenaar6e75e0a2019-05-11 21:24:26 +0200831 ifeq (yes, $(GUI))
Bram Moolenaar4f7e8212014-11-05 13:53:32 +0100832OBJ += $(OUTDIR)/xpm_w32.o
833# You'll need libXpm.a from http://gnuwin32.sf.net
834LIB += -L$(XPM)/lib -lXpm
Bram Moolenaar6e75e0a2019-05-11 21:24:26 +0200835 endif
Bram Moolenaar4f7e8212014-11-05 13:53:32 +0100836endif
837
Bram Moolenaar4fc63502017-07-19 11:28:17 +0200838ifeq ($(TERMINAL),yes)
Bram Moolenaarf80451e2017-07-25 21:49:35 +0200839OBJ += $(OUTDIR)/terminal.o \
Bram Moolenaar78dcd4f2018-09-13 17:23:28 +0200840 $(OUTDIR)/encoding.o \
841 $(OUTDIR)/keyboard.o \
842 $(OUTDIR)/mouse.o \
843 $(OUTDIR)/parser.o \
844 $(OUTDIR)/pen.o \
845 $(OUTDIR)/termscreen.o \
846 $(OUTDIR)/state.o \
847 $(OUTDIR)/unicode.o \
848 $(OUTDIR)/vterm.o
Bram Moolenaar4fc63502017-07-19 11:28:17 +0200849endif
850
Bram Moolenaare828b762018-09-10 17:51:58 +0200851# Include xdiff
852OBJ += $(OUTDIR)/xdiffi.o \
853 $(OUTDIR)/xemit.o \
854 $(OUTDIR)/xprepare.o \
855 $(OUTDIR)/xutils.o \
856 $(OUTDIR)/xhistogram.o \
857 $(OUTDIR)/xpatience.o
858
859XDIFF_DEPS = \
860 xdiff/xdiff.h \
861 xdiff/xdiffi.h \
862 xdiff/xemit.h \
863 xdiff/xinclude.h \
864 xdiff/xmacros.h \
865 xdiff/xprepare.h \
866 xdiff/xtypes.h \
867 xdiff/xutils.h
Bram Moolenaar4f7e8212014-11-05 13:53:32 +0100868
869ifdef MZSCHEME
870MZSCHEME_SUFFIX = Z
871endif
872
Bram Moolenaar796cc422019-04-03 20:31:00 +0200873LFLAGS += -municode
874
Bram Moolenaarafde13b2019-04-28 19:46:49 +0200875ifeq ($(VIMDLL),yes)
876VIMEXE := vim$(DEBUG_SUFFIX).exe
877GVIMEXE := gvim$(DEBUG_SUFFIX).exe
878 ifeq ($(ARCH),x86-64)
879VIMDLLBASE := vim64$(DEBUG_SUFFIX)
880 else
881VIMDLLBASE := vim32$(DEBUG_SUFFIX)
882 endif
883TARGET = $(VIMDLLBASE).dll
884LFLAGS += -shared
885EXELFLAGS += -municode
886 ifneq ($(DEBUG),yes)
887EXELFLAGS += -s
888 endif
889DEFINES += $(DEF_GUI) -DVIMDLL
890OBJ += $(GUIOBJ) $(CUIOBJ)
891OUTDIR = dobj$(DEBUG_SUFFIX)$(MZSCHEME_SUFFIX)$(ARCH)
892MAIN_TARGET = $(GVIMEXE) $(VIMEXE) $(VIMDLLBASE).dll
893else ifeq ($(GUI),yes)
Bram Moolenaar4f7e8212014-11-05 13:53:32 +0100894TARGET := gvim$(DEBUG_SUFFIX).exe
895DEFINES += $(DEF_GUI)
896OBJ += $(GUIOBJ)
897LFLAGS += -mwindows
898OUTDIR = gobj$(DEBUG_SUFFIX)$(MZSCHEME_SUFFIX)$(ARCH)
Bram Moolenaarafde13b2019-04-28 19:46:49 +0200899MAIN_TARGET = $(TARGET)
Bram Moolenaar4f7e8212014-11-05 13:53:32 +0100900else
Bram Moolenaar97ff9b92016-06-26 20:37:46 +0200901OBJ += $(CUIOBJ)
Bram Moolenaar4f7e8212014-11-05 13:53:32 +0100902TARGET := vim$(DEBUG_SUFFIX).exe
903OUTDIR = obj$(DEBUG_SUFFIX)$(MZSCHEME_SUFFIX)$(ARCH)
Bram Moolenaarafde13b2019-04-28 19:46:49 +0200904MAIN_TARGET = $(TARGET)
Bram Moolenaar4f7e8212014-11-05 13:53:32 +0100905endif
906
907ifdef GETTEXT
Bram Moolenaar6e75e0a2019-05-11 21:24:26 +0200908 ifneq (yes, $(GETTEXT))
Bram Moolenaar4f7e8212014-11-05 13:53:32 +0100909CFLAGS += -I$(GETTEXTINCLUDE)
Bram Moolenaar6e75e0a2019-05-11 21:24:26 +0200910 ifndef STATIC_GETTEXT
Bram Moolenaar4f7e8212014-11-05 13:53:32 +0100911LIB += -L$(GETTEXTLIB) -l$(INTLLIB)
Bram Moolenaar6e75e0a2019-05-11 21:24:26 +0200912 ifeq (USE_SAFE_GETTEXT_DLL, $(DYNAMIC_GETTEXT))
Bram Moolenaar4f7e8212014-11-05 13:53:32 +0100913OBJ+=$(SAFE_GETTEXT_DLL_OBJ)
Bram Moolenaar6e75e0a2019-05-11 21:24:26 +0200914 endif
915 else
Bram Moolenaar4f7e8212014-11-05 13:53:32 +0100916LIB += -L$(GETTEXTLIB) -lintl
Bram Moolenaar6e75e0a2019-05-11 21:24:26 +0200917 endif
918 endif
Bram Moolenaar4f7e8212014-11-05 13:53:32 +0100919endif
920
921ifdef PERL
Bram Moolenaar6e75e0a2019-05-11 21:24:26 +0200922 ifeq (no, $(DYNAMIC_PERL))
Bram Moolenaar4f7e8212014-11-05 13:53:32 +0100923LIB += -L$(PERLLIBS) -lperl$(PERL_VER)
Bram Moolenaar6e75e0a2019-05-11 21:24:26 +0200924 endif
Bram Moolenaar4f7e8212014-11-05 13:53:32 +0100925endif
926
927ifdef TCL
928LIB += -L$(TCL)/lib
Bram Moolenaar6e75e0a2019-05-11 21:24:26 +0200929 ifeq (yes, $(DYNAMIC_TCL))
Bram Moolenaar4f7e8212014-11-05 13:53:32 +0100930LIB += -ltclstub$(TCL_VER)
Bram Moolenaar6e75e0a2019-05-11 21:24:26 +0200931 else
Bram Moolenaar4f7e8212014-11-05 13:53:32 +0100932LIB += -ltcl$(TCL_VER)
Bram Moolenaar6e75e0a2019-05-11 21:24:26 +0200933 endif
Bram Moolenaar4f7e8212014-11-05 13:53:32 +0100934endif
935
936ifeq (yes, $(OLE))
937LIB += -loleaut32
938OBJ += $(OUTDIR)/if_ole.o
939USE_STDCPLUS = yes
940endif
941
Bram Moolenaar4f7e8212014-11-05 13:53:32 +0100942ifeq (yes, $(IME))
943DEFINES += -DFEAT_MBYTE_IME
Bram Moolenaar6e75e0a2019-05-11 21:24:26 +0200944 ifeq (yes, $(DYNAMIC_IME))
Bram Moolenaar4f7e8212014-11-05 13:53:32 +0100945DEFINES += -DDYNAMIC_IME
Bram Moolenaar6e75e0a2019-05-11 21:24:26 +0200946 else
Bram Moolenaar4f7e8212014-11-05 13:53:32 +0100947LIB += -limm32
Bram Moolenaar6e75e0a2019-05-11 21:24:26 +0200948 endif
Bram Moolenaar4f7e8212014-11-05 13:53:32 +0100949endif
950
951ifdef ICONV
Bram Moolenaar6e75e0a2019-05-11 21:24:26 +0200952 ifneq (yes, $(ICONV))
Bram Moolenaar4f7e8212014-11-05 13:53:32 +0100953LIB += -L$(ICONV)
954CFLAGS += -I$(ICONV)
Bram Moolenaar6e75e0a2019-05-11 21:24:26 +0200955 endif
Bram Moolenaar4f7e8212014-11-05 13:53:32 +0100956DEFINES+=-DDYNAMIC_ICONV
957endif
958
959ifeq (yes, $(USE_STDCPLUS))
Bram Moolenaareda9e9c2018-10-21 22:45:43 +0200960LINK = $(CXX)
Bram Moolenaar6e75e0a2019-05-11 21:24:26 +0200961 ifeq (yes, $(STATIC_STDCPLUS))
Bram Moolenaar60f807b2019-01-31 14:43:19 +0100962#LIB += -static-libstdc++ -static-libgcc
Bram Moolenaard91e5da2019-02-21 13:34:07 +0100963LIB += -Wl,-Bstatic -lstdc++ -lgcc -Wl,-Bdynamic
Bram Moolenaar6e75e0a2019-05-11 21:24:26 +0200964 endif
Bram Moolenaareda9e9c2018-10-21 22:45:43 +0200965else
966LINK = $(CC)
Bram Moolenaar4f7e8212014-11-05 13:53:32 +0100967endif
968
Bram Moolenaare3af7632016-12-01 20:37:47 +0100969ifeq (yes, $(STATIC_WINPTHREAD))
Bram Moolenaar6e75e0a2019-05-11 21:24:26 +0200970 ifeq (yes, $(HAS_GCC_EH))
Bram Moolenaareda9e9c2018-10-21 22:45:43 +0200971LIB += -lgcc_eh
Bram Moolenaar6e75e0a2019-05-11 21:24:26 +0200972 endif
Bram Moolenaare3af7632016-12-01 20:37:47 +0100973LIB += -Wl,-Bstatic -lwinpthread -Wl,-Bdynamic
974endif
975
Bram Moolenaar4ff42902018-09-21 14:43:10 +0200976ifeq (yes, $(MAP))
977LFLAGS += -Wl,-Map=$(TARGET).map
978endif
979
Bram Moolenaarafde13b2019-04-28 19:46:49 +0200980all: $(MAIN_TARGET) vimrun.exe xxd/xxd.exe tee/tee.exe install.exe uninstal.exe GvimExt/gvimext.dll
Bram Moolenaar4f7e8212014-11-05 13:53:32 +0100981
982vimrun.exe: vimrun.c
983 $(CC) $(CFLAGS) -o vimrun.exe vimrun.c $(LIB)
984
985install.exe: dosinst.c
986 $(CC) $(CFLAGS) -o install.exe dosinst.c $(LIB) -lole32 -luuid
987
988uninstal.exe: uninstal.c
989 $(CC) $(CFLAGS) -o uninstal.exe uninstal.c $(LIB)
990
Bram Moolenaarafde13b2019-04-28 19:46:49 +0200991ifeq ($(VIMDLL),yes)
992$(TARGET): $(OUTDIR) $(OBJ)
993 $(LINK) $(CFLAGS) $(LFLAGS) -o $@ $(OBJ) $(LIB) -lole32 -luuid -lgdi32 $(LUA_LIB) $(MZSCHEME_LIBDIR) $(MZSCHEME_LIB) $(PYTHONLIB) $(PYTHON3LIB) $(RUBYLIB)
994
995$(GVIMEXE): $(OUTDIR) $(EXEOBJG) $(VIMDLLBASE).dll
996 $(CC) -L. $(EXELFLAGS) -mwindows -o $@ $(EXEOBJG) -l$(VIMDLLBASE)
997
998$(VIMEXE): $(OUTDIR) $(EXEOBJC) $(VIMDLLBASE).dll
999 $(CC) -L. $(EXELFLAGS) -o $@ $(EXEOBJC) -l$(VIMDLLBASE)
1000else
Bram Moolenaar4f7e8212014-11-05 13:53:32 +01001001$(TARGET): $(OUTDIR) $(OBJ)
Bram Moolenaareda9e9c2018-10-21 22:45:43 +02001002 $(LINK) $(CFLAGS) $(LFLAGS) -o $@ $(OBJ) $(LIB) -lole32 -luuid $(LUA_LIB) $(MZSCHEME_LIBDIR) $(MZSCHEME_LIB) $(PYTHONLIB) $(PYTHON3LIB) $(RUBYLIB)
Bram Moolenaarafde13b2019-04-28 19:46:49 +02001003endif
Bram Moolenaar4f7e8212014-11-05 13:53:32 +01001004
1005upx: exes
1006 upx gvim.exe
1007 upx vim.exe
1008
1009mpress: exes
1010 mpress gvim.exe
1011 mpress vim.exe
1012
1013xxd/xxd.exe: xxd/xxd.c
1014 $(MAKE) -C xxd -f Make_ming.mak CC='$(CC)'
1015
Bram Moolenaar04c86d22018-10-17 22:45:54 +02001016tee/tee.exe: tee/tee.c
1017 $(MAKE) -C tee CC='$(CC)'
1018
Bram Moolenaar4f7e8212014-11-05 13:53:32 +01001019GvimExt/gvimext.dll: GvimExt/gvimext.cpp GvimExt/gvimext.rc GvimExt/gvimext.h
1020 $(MAKE) -C GvimExt -f Make_ming.mak CROSS=$(CROSS) CROSS_COMPILE=$(CROSS_COMPILE) CXX='$(CXX)' STATIC_STDCPLUS=$(STATIC_STDCPLUS)
1021
Bram Moolenaar9ac9dfa2017-09-01 18:41:26 +02001022tags: notags
Bram Moolenaar6dc67032018-12-19 21:05:57 +01001023 $(CTAGS) $(TAGS_FILES)
Bram Moolenaar9ac9dfa2017-09-01 18:41:26 +02001024
1025notags:
1026 -$(DEL) tags
1027
Bram Moolenaar4f7e8212014-11-05 13:53:32 +01001028clean:
1029 -$(DEL) $(OUTDIR)$(DIRSLASH)*.o
1030 -$(DEL) $(OUTDIR)$(DIRSLASH)*.res
1031 -rmdir $(OUTDIR)
Bram Moolenaarafde13b2019-04-28 19:46:49 +02001032 -$(DEL) $(MAIN_TARGET) vimrun.exe install.exe uninstal.exe
Bram Moolenaar4f7e8212014-11-05 13:53:32 +01001033 -$(DEL) pathdef.c
1034ifdef PERL
1035 -$(DEL) if_perl.c
Bram Moolenaara16bc542018-10-14 16:25:10 +02001036 -$(DEL) auto$(DIRSLASH)if_perl.c
Bram Moolenaar4f7e8212014-11-05 13:53:32 +01001037endif
1038ifdef MZSCHEME
1039 -$(DEL) mzscheme_base.c
1040endif
1041 $(MAKE) -C GvimExt -f Make_ming.mak clean
1042 $(MAKE) -C xxd -f Make_ming.mak clean
Bram Moolenaar04c86d22018-10-17 22:45:54 +02001043 $(MAKE) -C tee clean
Bram Moolenaar4f7e8212014-11-05 13:53:32 +01001044
1045###########################################################################
Bram Moolenaare37368c2019-03-22 16:57:45 +01001046INCL = vim.h alloc.h ascii.h ex_cmds.h feature.h globals.h \
Bram Moolenaar96e7a6e2017-09-23 19:48:29 +02001047 keymap.h macros.h option.h os_dos.h os_win32.h proto.h regexp.h \
Bram Moolenaarc3719bd2017-11-18 22:13:31 +01001048 spell.h structs.h term.h beval.h $(NBDEBUG_INCL)
1049GUI_INCL = gui.h
Bram Moolenaar97ff9b92016-06-26 20:37:46 +02001050CUI_INCL = iscygpty.h
Bram Moolenaar4f7e8212014-11-05 13:53:32 +01001051
Bram Moolenaar96e7a6e2017-09-23 19:48:29 +02001052$(OUTDIR)/if_python.o: if_python.c if_py_both.h $(INCL)
Bram Moolenaar449538c2016-01-09 17:49:15 +01001053 $(CC) -c $(CFLAGS) $(PYTHONINC) $(PYTHON_HOME_DEF) $< -o $@
Bram Moolenaar4f7e8212014-11-05 13:53:32 +01001054
Bram Moolenaar96e7a6e2017-09-23 19:48:29 +02001055$(OUTDIR)/if_python3.o: if_python3.c if_py_both.h $(INCL)
Bram Moolenaara7c37952016-01-20 22:23:15 +01001056 $(CC) -c $(CFLAGS) $(PYTHON3INC) $(PYTHON3_HOME_DEF) $< -o $@
Bram Moolenaar4f7e8212014-11-05 13:53:32 +01001057
1058$(OUTDIR)/%.o : %.c $(INCL)
1059 $(CC) -c $(CFLAGS) $< -o $@
1060
Bram Moolenaarafde13b2019-04-28 19:46:49 +02001061ifeq ($(VIMDLL),yes)
1062$(OUTDIR)/vimrcc.o: vim.rc gvim.exe.mnf version.h gui_w32_rc.h vim.ico
1063 $(WINDRES) $(WINDRES_FLAGS) $(DEFINES) -UFEAT_GUI_MSWIN \
1064 --input-format=rc --output-format=coff -i vim.rc -o $@
1065
1066$(OUTDIR)/vimrcg.o: vim.rc gvim.exe.mnf version.h gui_w32_rc.h vim.ico
Bram Moolenaar4f7e8212014-11-05 13:53:32 +01001067 $(WINDRES) $(WINDRES_FLAGS) $(DEFINES) \
1068 --input-format=rc --output-format=coff -i vim.rc -o $@
1069
Bram Moolenaarafde13b2019-04-28 19:46:49 +02001070$(OUTDIR)/vimrcd.o: vim.rc version.h gui_w32_rc.h \
1071 tools.bmp tearoff.bmp vim.ico vim_error.ico \
1072 vim_alert.ico vim_info.ico vim_quest.ico
1073 $(WINDRES) $(WINDRES_FLAGS) $(DEFINES) -DRCDLL -DVIMDLLBASE=\\\"$(VIMDLLBASE)\\\" \
1074 --input-format=rc --output-format=coff -i vim.rc -o $@
1075else
1076$(OUTDIR)/vimrc.o: vim.rc gvim.exe.mnf version.h gui_w32_rc.h \
1077 tools.bmp tearoff.bmp vim.ico vim_error.ico \
1078 vim_alert.ico vim_info.ico vim_quest.ico
1079 $(WINDRES) $(WINDRES_FLAGS) $(DEFINES) \
1080 --input-format=rc --output-format=coff -i vim.rc -o $@
1081endif
1082
Bram Moolenaar4f7e8212014-11-05 13:53:32 +01001083$(OUTDIR):
1084 $(MKDIR) $(OUTDIR)
1085
Bram Moolenaar4f7e8212014-11-05 13:53:32 +01001086$(OUTDIR)/gui_dwrite.o: gui_dwrite.cpp $(INCL) gui_dwrite.h
Bram Moolenaarafde13b2019-04-28 19:46:49 +02001087 $(CC) -c $(CFLAGS) $(CXXFLAGS) gui_dwrite.cpp -o $@
Bram Moolenaar4f7e8212014-11-05 13:53:32 +01001088
Bram Moolenaar96e7a6e2017-09-23 19:48:29 +02001089$(OUTDIR)/gui.o: gui.c $(INCL) $(GUI_INCL)
Bram Moolenaarafde13b2019-04-28 19:46:49 +02001090 $(CC) -c $(CFLAGS) gui.c -o $@
Bram Moolenaar96e7a6e2017-09-23 19:48:29 +02001091
Bram Moolenaarc3719bd2017-11-18 22:13:31 +01001092$(OUTDIR)/beval.o: beval.c $(INCL) $(GUI_INCL)
Bram Moolenaarafde13b2019-04-28 19:46:49 +02001093 $(CC) -c $(CFLAGS) beval.c -o $@
Bram Moolenaarc3719bd2017-11-18 22:13:31 +01001094
Bram Moolenaar96e7a6e2017-09-23 19:48:29 +02001095$(OUTDIR)/gui_beval.o: gui_beval.c $(INCL) $(GUI_INCL)
Bram Moolenaarafde13b2019-04-28 19:46:49 +02001096 $(CC) -c $(CFLAGS) gui_beval.c -o $@
Bram Moolenaar96e7a6e2017-09-23 19:48:29 +02001097
1098$(OUTDIR)/gui_w32.o: gui_w32.c $(INCL) $(GUI_INCL)
Bram Moolenaarafde13b2019-04-28 19:46:49 +02001099 $(CC) -c $(CFLAGS) gui_w32.c -o $@
Bram Moolenaarf80451e2017-07-25 21:49:35 +02001100
Bram Moolenaar4f7e8212014-11-05 13:53:32 +01001101$(OUTDIR)/if_cscope.o: if_cscope.c $(INCL) if_cscope.h
Bram Moolenaarafde13b2019-04-28 19:46:49 +02001102 $(CC) -c $(CFLAGS) if_cscope.c -o $@
Bram Moolenaar4f7e8212014-11-05 13:53:32 +01001103
Bram Moolenaar96e7a6e2017-09-23 19:48:29 +02001104$(OUTDIR)/if_mzsch.o: if_mzsch.c $(INCL) $(MZSCHEME_INCL) $(MZ_EXTRA_DEP)
Bram Moolenaarafde13b2019-04-28 19:46:49 +02001105 $(CC) -c $(CFLAGS) if_mzsch.c -o $@
Bram Moolenaarf80451e2017-07-25 21:49:35 +02001106
1107mzscheme_base.c:
1108 $(MZSCHEME)/mzc --c-mods mzscheme_base.c ++lib scheme/base
1109
Bram Moolenaar4f7e8212014-11-05 13:53:32 +01001110# Remove -D__IID_DEFINED__ for newer versions of the w32api
Bram Moolenaar96e7a6e2017-09-23 19:48:29 +02001111$(OUTDIR)/if_ole.o: if_ole.cpp $(INCL) if_ole.h
Bram Moolenaarafde13b2019-04-28 19:46:49 +02001112 $(CC) -c $(CFLAGS) $(CXXFLAGS) if_ole.cpp -o $@
Bram Moolenaar4f7e8212014-11-05 13:53:32 +01001113
Bram Moolenaara16bc542018-10-14 16:25:10 +02001114auto/if_perl.c: if_perl.xs typemap
Bram Moolenaarf80451e2017-07-25 21:49:35 +02001115 $(XSUBPP) -prototypes -typemap \
1116 $(PERLTYPEMAP) if_perl.xs -output $@
1117
Bram Moolenaara16bc542018-10-14 16:25:10 +02001118$(OUTDIR)/if_perl.o: auto/if_perl.c $(INCL)
Bram Moolenaarafde13b2019-04-28 19:46:49 +02001119 $(CC) -c $(CFLAGS) auto/if_perl.c -o $@
Bram Moolenaara16bc542018-10-14 16:25:10 +02001120
1121
Bram Moolenaar96e7a6e2017-09-23 19:48:29 +02001122$(OUTDIR)/if_ruby.o: if_ruby.c $(INCL)
Bram Moolenaar4f7e8212014-11-05 13:53:32 +01001123ifeq (16, $(RUBY))
Bram Moolenaarafde13b2019-04-28 19:46:49 +02001124 $(CC) $(CFLAGS) -U_WIN32 -c -o $@ if_ruby.c
Bram Moolenaar4f7e8212014-11-05 13:53:32 +01001125endif
1126
Bram Moolenaar97ff9b92016-06-26 20:37:46 +02001127$(OUTDIR)/iscygpty.o: iscygpty.c $(CUI_INCL)
Bram Moolenaar2bc127f2016-07-10 13:57:40 +02001128 $(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 +02001129
Bram Moolenaar96e7a6e2017-09-23 19:48:29 +02001130$(OUTDIR)/main.o: main.c $(INCL) $(CUI_INCL)
Bram Moolenaarafde13b2019-04-28 19:46:49 +02001131 $(CC) -c $(CFLAGS) main.c -o $@
Bram Moolenaar97ff9b92016-06-26 20:37:46 +02001132
Bram Moolenaar4f7e8212014-11-05 13:53:32 +01001133$(OUTDIR)/netbeans.o: netbeans.c $(INCL) $(NBDEBUG_INCL) $(NBDEBUG_SRC)
Bram Moolenaarafde13b2019-04-28 19:46:49 +02001134 $(CC) -c $(CFLAGS) netbeans.c -o $@
1135
1136$(OUTDIR)/os_w32exec.o: os_w32exe.c $(INCL)
1137 $(CC) -c $(CFLAGS) -UFEAT_GUI_MSWIN os_w32exe.c -o $@
1138
1139$(OUTDIR)/os_w32exeg.o: os_w32exe.c $(INCL)
1140 $(CC) -c $(CFLAGS) os_w32exe.c -o $@
Bram Moolenaar4f7e8212014-11-05 13:53:32 +01001141
Bram Moolenaar96e7a6e2017-09-23 19:48:29 +02001142$(OUTDIR)/os_win32.o: os_win32.c $(INCL) $(MZSCHEME_INCL)
Bram Moolenaarafde13b2019-04-28 19:46:49 +02001143 $(CC) -c $(CFLAGS) os_win32.c -o $@
Bram Moolenaar96e7a6e2017-09-23 19:48:29 +02001144
1145$(OUTDIR)/regexp.o: regexp.c regexp_nfa.c $(INCL)
Bram Moolenaarafde13b2019-04-28 19:46:49 +02001146 $(CC) -c $(CFLAGS) regexp.c -o $@
Bram Moolenaar4f7e8212014-11-05 13:53:32 +01001147
Bram Moolenaarf80451e2017-07-25 21:49:35 +02001148$(OUTDIR)/terminal.o: terminal.c $(INCL) $(TERM_DEPS)
Bram Moolenaarafde13b2019-04-28 19:46:49 +02001149 $(CC) -c $(CFLAGS) terminal.c -o $@
Bram Moolenaar98aefe72018-12-13 22:20:09 +01001150
Bram Moolenaarf80451e2017-07-25 21:49:35 +02001151
Bram Moolenaar6d0826d2017-08-22 22:12:17 +02001152CCCTERM = $(CC) -c $(CFLAGS) -Ilibvterm/include -DINLINE="" \
1153 -DVSNPRINTF=vim_vsnprintf \
1154 -DIS_COMBINING_FUNCTION=utf_iscomposing_uint \
1155 -DWCWIDTH_FUNCTION=utf_uint2cells
1156
Bram Moolenaarafde13b2019-04-28 19:46:49 +02001157$(OUTDIR)/%.o : libvterm/src/%.c $(TERM_DEPS)
1158 $(CCCTERM) $< -o $@
Bram Moolenaarf80451e2017-07-25 21:49:35 +02001159
Bram Moolenaarf80451e2017-07-25 21:49:35 +02001160
Bram Moolenaarafde13b2019-04-28 19:46:49 +02001161$(OUTDIR)/%.o : xdiff/%.c $(XDIFF_DEPS)
1162 $(CC) -c $(CFLAGS) $< -o $@
Bram Moolenaarf80451e2017-07-25 21:49:35 +02001163
Bram Moolenaar4f7e8212014-11-05 13:53:32 +01001164
1165pathdef.c: $(INCL)
1166ifneq (sh.exe, $(SHELL))
1167 @echo creating pathdef.c
1168 @echo '/* pathdef.c */' > pathdef.c
1169 @echo '#include "vim.h"' >> pathdef.c
1170 @echo 'char_u *default_vim_dir = (char_u *)"$(VIMRCLOC)";' >> pathdef.c
1171 @echo 'char_u *default_vimruntime_dir = (char_u *)"$(VIMRUNTIMEDIR)";' >> pathdef.c
1172 @echo 'char_u *all_cflags = (char_u *)"$(CC) $(CFLAGS)";' >> pathdef.c
Bram Moolenaareda9e9c2018-10-21 22:45:43 +02001173 @echo 'char_u *all_lflags = (char_u *)"$(LINK) $(CFLAGS) $(LFLAGS) -o $(TARGET) $(LIB) -lole32 -luuid $(LUA_LIB) $(MZSCHEME_LIBDIR) $(MZSCHEME_LIB) $(PYTHONLIB) $(PYTHON3LIB) $(RUBYLIB)";' >> pathdef.c
Bram Moolenaar4f7e8212014-11-05 13:53:32 +01001174 @echo 'char_u *compiled_user = (char_u *)"$(USERNAME)";' >> pathdef.c
1175 @echo 'char_u *compiled_sys = (char_u *)"$(USERDOMAIN)";' >> pathdef.c
1176else
1177 @echo creating pathdef.c
1178 @echo /* pathdef.c */ > pathdef.c
1179 @echo #include "vim.h" >> pathdef.c
1180 @echo char_u *default_vim_dir = (char_u *)"$(VIMRCLOC)"; >> pathdef.c
1181 @echo char_u *default_vimruntime_dir = (char_u *)"$(VIMRUNTIMEDIR)"; >> pathdef.c
1182 @echo char_u *all_cflags = (char_u *)"$(CC) $(CFLAGS)"; >> pathdef.c
1183 @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
1184 @echo char_u *compiled_user = (char_u *)"$(USERNAME)"; >> pathdef.c
1185 @echo char_u *compiled_sys = (char_u *)"$(USERDOMAIN)"; >> pathdef.c
1186endif
Bram Moolenaar96e7a6e2017-09-23 19:48:29 +02001187
1188# vim: set noet sw=8 ts=8 sts=0 wm=0 tw=0: