blob: f3819517ec71e2b02c3c72ef7d266d5324350774 [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
39# MAP=yes
40
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
47# set to no if you do not want to use DirectWrite (DirectX)
48# MinGW-w64 is needed, and ARCH should be set to i686 or x86-64.
49DIRECTX=yes
50
51# Disable Color emoji support
52# (default is yes if DIRECTX=yes, requires WinSDK 8.1 or later.)
53#COLOR_EMOJI=no
54
Bram Moolenaar4f7e8212014-11-05 13:53:32 +010055# Set to one of i386, i486, i586, i686 as the minimum target processor.
56# For amd64/x64 architecture set ARCH=x86-64 .
Bram Moolenaare0485392016-07-12 21:17:03 +020057# If not set, it will be automatically detected. (Normally i686 or x86-64.)
58#ARCH=i686
Bram Moolenaar4f7e8212014-11-05 13:53:32 +010059# Set to yes to cross-compile from unix; no=native Windows (and Cygwin).
60CROSS=no
Bram Moolenaarcccd62d2018-04-12 20:23:48 +020061
Bram Moolenaar4f7e8212014-11-05 13:53:32 +010062# Set to path to iconv.h and libiconv.a to enable using 'iconv.dll'.
Bram Moolenaarac8069b2017-10-14 20:24:19 +020063# Use "yes" when the path does not need to be define.
Bram Moolenaar4f7e8212014-11-05 13:53:32 +010064#ICONV="."
65ICONV=yes
66GETTEXT=yes
Bram Moolenaarcccd62d2018-04-12 20:23:48 +020067
Bram Moolenaar4f7e8212014-11-05 13:53:32 +010068# Set to yes to include multibyte support.
69MBYTE=yes
Bram Moolenaarcccd62d2018-04-12 20:23:48 +020070
Bram Moolenaar4f7e8212014-11-05 13:53:32 +010071# Set to yes to include IME support.
72IME=yes
73DYNAMIC_IME=yes
Bram Moolenaarcccd62d2018-04-12 20:23:48 +020074
Bram Moolenaar4f7e8212014-11-05 13:53:32 +010075# Set to yes to enable writing a postscript file with :hardcopy.
76POSTSCRIPT=no
Bram Moolenaarcccd62d2018-04-12 20:23:48 +020077
Bram Moolenaar4f7e8212014-11-05 13:53:32 +010078# Set to yes to enable OLE support.
79OLE=no
Bram Moolenaarcccd62d2018-04-12 20:23:48 +020080
Bram Moolenaar304925e2018-06-30 16:27:02 +020081# Set the default $(WINVER). Use 0x0501 to make it work with WinXP.
Bram Moolenaar4f7e8212014-11-05 13:53:32 +010082ifndef WINVER
Bram Moolenaar304925e2018-06-30 16:27:02 +020083# WINVER = 0x0501
84WINVER = 0x0600
Bram Moolenaar4f7e8212014-11-05 13:53:32 +010085endif
Bram Moolenaarcccd62d2018-04-12 20:23:48 +020086
Bram Moolenaar4f7e8212014-11-05 13:53:32 +010087# Set to yes to enable Cscope support.
88CSCOPE=yes
Bram Moolenaarcccd62d2018-04-12 20:23:48 +020089
Bram Moolenaare0874f82016-01-24 20:36:41 +010090# Set to yes to enable Netbeans support (requires CHANNEL).
Bram Moolenaar4f7e8212014-11-05 13:53:32 +010091NETBEANS=$(GUI)
Bram Moolenaarcccd62d2018-04-12 20:23:48 +020092
Bram Moolenaare0874f82016-01-24 20:36:41 +010093# Set to yes to enable inter process communication.
Bram Moolenaar1aa07bd2016-06-03 19:43:16 +020094ifeq (HUGE, $(FEATURES))
95CHANNEL=yes
96else
Bram Moolenaare0874f82016-01-24 20:36:41 +010097CHANNEL=$(GUI)
Bram Moolenaar1aa07bd2016-06-03 19:43:16 +020098endif
Bram Moolenaarcccd62d2018-04-12 20:23:48 +020099
Bram Moolenaar8a773062017-07-24 22:29:21 +0200100# Set to yes to enable terminal support.
Bram Moolenaarac8069b2017-10-14 20:24:19 +0200101ifeq (HUGE, $(FEATURES))
102TERMINAL=yes
103else
Bram Moolenaar4fc63502017-07-19 11:28:17 +0200104TERMINAL=no
Bram Moolenaarac8069b2017-10-14 20:24:19 +0200105endif
Bram Moolenaar4f7e8212014-11-05 13:53:32 +0100106
Bram Moolenaar9ac9dfa2017-09-01 18:41:26 +0200107ifndef CTAGS
108# this assumes ctags is Exuberant ctags
109CTAGS = ctags -I INIT+ --fields=+S
110endif
Bram Moolenaar4f7e8212014-11-05 13:53:32 +0100111
112# Link against the shared version of libstdc++ by default. Set
113# STATIC_STDCPLUS to "yes" to link against static version instead.
114ifndef STATIC_STDCPLUS
115STATIC_STDCPLUS=no
116endif
117
Bram Moolenaare3af7632016-12-01 20:37:47 +0100118
119# Link against the shared version of libwinpthread by default. Set
120# STATIC_WINPTHREAD to "yes" to link against static version instead.
121ifndef STATIC_WINPTHREAD
122STATIC_WINPTHREAD=$(STATIC_STDCPLUS)
123endif
124
Bram Moolenaar4f7e8212014-11-05 13:53:32 +0100125# If the user doesn't want gettext, undefine it.
126ifeq (no, $(GETTEXT))
127GETTEXT=
128endif
129# Added by E.F. Amatria <eferna1@platea.ptic.mec.es> 2001 Feb 23
130# Uncomment the first line and one of the following three if you want Native Language
131# Support. You'll need gnu_gettext.win32, a MINGW32 Windows PORT of gettext by
132# Franco Bez <franco.bez@gmx.de>. It may be found at
133# http://home.a-city.de/franco.bez/gettext/gettext_win32_en.html
134# Tested with mingw32 with GCC-2.95.2 on Win98
135# Updated 2001 Jun 9
136#GETTEXT=c:/gettext.win32.msvcrt
137#STATIC_GETTEXT=USE_STATIC_GETTEXT
138#DYNAMIC_GETTEXT=USE_GETTEXT_DLL
139#DYNAMIC_GETTEXT=USE_SAFE_GETTEXT_DLL
140SAFE_GETTEXT_DLL_OBJ = $(GETTEXT)/src/safe_gettext_dll/safe_gettext_dll.o
141# Alternatively, if you uncomment the two following lines, you get a "safe" version
142# without linking the safe_gettext_dll.o object file.
143#DYNAMIC_GETTEXT=DYNAMIC_GETTEXT
144#GETTEXT_DYNAMIC=gnu_gettext.dll
145INTLPATH=$(GETTEXT)/lib/mingw32
146INTLLIB=gnu_gettext
147
148# If you are using gettext-0.10.35 from http://sourceforge.net/projects/gettext
149# or gettext-0.10.37 from http://sourceforge.net/projects/mingwrep/
150# uncomment the following, but I can't build a static version with them, ?-(|
151#GETTEXT=c:/gettext-0.10.37-20010430
152#STATIC_GETTEXT=USE_STATIC_GETTEXT
153#DYNAMIC_GETTEXT=DYNAMIC_GETTEXT
154#INTLPATH=$(GETTEXT)/lib
155#INTLLIB=intl
156
Bram Moolenaare0485392016-07-12 21:17:03 +0200157
158# Command definitions (depends on cross-compiling and shell)
159ifeq ($(CROSS),yes)
160# cross-compiler prefix:
161ifndef CROSS_COMPILE
162CROSS_COMPILE = i586-pc-mingw32msvc-
163endif
164DEL = rm
165MKDIR = mkdir -p
166DIRSLASH = /
167else
168# normal (Windows) compilation:
169ifndef CROSS_COMPILE
170CROSS_COMPILE =
171endif
Bram Moolenaare828b762018-09-10 17:51:58 +0200172
173# About the "sh.exe" condition, as explained by Ken Takata:
174#
175# If the makefile is executed with mingw32-make and sh.exe is not found in
176# $PATH, then $SHELL is set to "sh.exe" (without any path). In this case,
177# unix-like commands might not work and a dos-style path is needed.
178#
179# If the makefile is executed with mingw32-make and sh.exe IS found in $PATH,
180# then $SHELL is set with the actual path of sh.exe (e.g.
181# "C:/msys64/usr/bin/sh.exe"). In this case, unix-like commands can be used.
182#
183# If it is executed by the "make" command from cmd.exe, $SHELL is set to
184# "/bin/sh". If the "make" command is in the $PATH, other unix-like commands
185# might also work.
186#
187# If it is executed by the "make" command from a unix-like shell,
188# $SHELL is set with the unix-style path (e.g. "/bin/bash").
189# In this case, unix-like commands can be used.
190#
Bram Moolenaare0485392016-07-12 21:17:03 +0200191ifneq (sh.exe, $(SHELL))
192DEL = rm
193MKDIR = mkdir -p
194DIRSLASH = /
195else
196DEL = del
197MKDIR = mkdir
198DIRSLASH = \\
199endif
200endif
201CC := $(CROSS_COMPILE)gcc
202CXX := $(CROSS_COMPILE)g++
203ifeq ($(UNDER_CYGWIN),yes)
204WINDRES := $(CROSS_COMPILE)windres
205else
206WINDRES := windres
207endif
208WINDRES_CC = $(CC)
209
210# Get the default ARCH.
211ifndef ARCH
Bram Moolenaarf62e7972016-07-14 20:25:03 +0200212ARCH := $(shell $(CC) -dumpmachine | sed -e 's/-.*//' -e 's/_/-/' -e 's/^mingw32$$/i686/')
Bram Moolenaare0485392016-07-12 21:17:03 +0200213endif
214
215
Bram Moolenaar4f7e8212014-11-05 13:53:32 +0100216# Perl interface:
217# PERL=[Path to Perl directory] (Set inside Make_cyg.mak or Make_ming.mak)
218# DYNAMIC_PERL=yes (to load the Perl DLL dynamically)
Bram Moolenaar0eaadec2016-09-08 20:28:45 +0200219# PERL_VER=[Perl version, eg 56, 58, 510] (default is 524)
Bram Moolenaar4f7e8212014-11-05 13:53:32 +0100220ifdef PERL
221ifndef PERL_VER
Bram Moolenaar0eaadec2016-09-08 20:28:45 +0200222PERL_VER=524
Bram Moolenaar4f7e8212014-11-05 13:53:32 +0100223endif
224ifndef DYNAMIC_PERL
225DYNAMIC_PERL=yes
226endif
227# on Linux, for cross-compile, it's here:
228#PERLLIB=/home/ron/ActivePerl/lib
229# on NT, it's here:
230PERLEXE=$(PERL)/bin/perl
231PERLLIB=$(PERL)/lib
232PERLLIBS=$(PERLLIB)/Core
233ifeq ($(UNDER_CYGWIN),yes)
234PERLTYPEMAP:=$(shell cygpath -m $(PERLLIB)/ExtUtils/typemap)
235XSUBPPTRY:=$(shell cygpath -m $(PERLLIB)/ExtUtils/xsubpp)
236else
237PERLTYPEMAP=$(PERLLIB)/ExtUtils/typemap
238XSUBPPTRY=$(PERLLIB)/ExtUtils/xsubpp
239endif
240XSUBPP_EXISTS=$(shell $(PERLEXE) -e "print 1 unless -e '$(XSUBPPTRY)'")
241ifeq "$(XSUBPP_EXISTS)" ""
Bram Moolenaar345326a2014-11-06 10:03:01 +0100242XSUBPP=$(PERLEXE) $(XSUBPPTRY)
Bram Moolenaar4f7e8212014-11-05 13:53:32 +0100243else
244XSUBPP=xsubpp
245endif
246endif
247
248# Lua interface:
249# LUA=[Path to Lua directory] (Set inside Make_cyg.mak or Make_ming.mak)
Bram Moolenaarb872e632018-09-21 13:44:09 +0200250# LUA_LIBDIR=[Path to Lua library directory] (default: $LUA/lib)
251# LUA_INCDIR=[Path to Lua include directory] (default: $LUA/include)
Bram Moolenaar4f7e8212014-11-05 13:53:32 +0100252# DYNAMIC_LUA=yes (to load the Lua DLL dynamically)
Bram Moolenaar0eaadec2016-09-08 20:28:45 +0200253# LUA_VER=[Lua version, eg 51, 52] (default is 53)
Bram Moolenaar4f7e8212014-11-05 13:53:32 +0100254ifdef LUA
255ifndef DYNAMIC_LUA
256DYNAMIC_LUA=yes
257endif
258
259ifndef LUA_VER
Bram Moolenaar0eaadec2016-09-08 20:28:45 +0200260LUA_VER=53
Bram Moolenaar4f7e8212014-11-05 13:53:32 +0100261endif
262
263ifeq (no,$(DYNAMIC_LUA))
Bram Moolenaarb872e632018-09-21 13:44:09 +0200264LUA_LIBDIR = $(LUA)/lib
265LUA_LIB = -L$(LUA_LIBDIR) -llua
Bram Moolenaar4f7e8212014-11-05 13:53:32 +0100266endif
267
268endif
269
270# MzScheme interface:
271# MZSCHEME=[Path to MzScheme directory] (Set inside Make_cyg.mak or Make_ming.mak)
272# DYNAMIC_MZSCHEME=yes (to load the MzScheme DLL dynamically)
Bram Moolenaar0eaadec2016-09-08 20:28:45 +0200273# MZSCHEME_VER=[MzScheme version] (default is 3m_a0solc (6.6))
Bram Moolenaarf16c71b2017-09-18 20:01:02 +0200274# Used for the DLL file name. E.g.:
275# C:\Program Files (x86)\Racket\lib\libracket3m_XXXXXX.dll
Bram Moolenaar4f7e8212014-11-05 13:53:32 +0100276# MZSCHEME_DEBUG=no
277ifdef MZSCHEME
278ifndef DYNAMIC_MZSCHEME
279DYNAMIC_MZSCHEME=yes
280endif
281
282ifndef MZSCHEME_VER
Bram Moolenaar0eaadec2016-09-08 20:28:45 +0200283MZSCHEME_VER=3m_a0solc
Bram Moolenaar4f7e8212014-11-05 13:53:32 +0100284endif
285
Bram Moolenaar4f7e8212014-11-05 13:53:32 +0100286# for version 4.x we need to generate byte-code for Scheme base
287ifndef MZSCHEME_GENERATE_BASE
288MZSCHEME_GENERATE_BASE=no
289endif
290
Bram Moolenaar4e640bd2016-01-16 16:20:38 +0100291ifneq ($(wildcard $(MZSCHEME)/lib/msvc/libmzsch$(MZSCHEME_VER).lib),)
Bram Moolenaar4f7e8212014-11-05 13:53:32 +0100292MZSCHEME_MAIN_LIB=mzsch
293else
294MZSCHEME_MAIN_LIB=racket
295endif
296
Bram Moolenaar4e640bd2016-01-16 16:20:38 +0100297ifndef MZSCHEME_PRECISE_GC
298MZSCHEME_PRECISE_GC=no
299ifneq ($(wildcard $(MZSCHEME)\lib\lib$(MZSCHEME_MAIN_LIB)$(MZSCHEME_VER).dll),)
300ifeq ($(wildcard $(MZSCHEME)\lib\libmzgc$(MZSCHEME_VER).dll),)
301MZSCHEME_PRECISE_GC=yes
302endif
303else
304ifneq ($(wildcard $(MZSCHEME)\lib\msvc\lib$(MZSCHEME_MAIN_LIB)$(MZSCHEME_VER).lib),)
305ifeq ($(wildcard $(MZSCHEME)\lib\msvc\libmzgc$(MZSCHEME_VER).lib),)
306MZSCHEME_PRECISE_GC=yes
307endif
308endif
309endif
310endif
311
Bram Moolenaar4f7e8212014-11-05 13:53:32 +0100312ifeq (no,$(DYNAMIC_MZSCHEME))
313ifeq (yes,$(MZSCHEME_PRECISE_GC))
314MZSCHEME_LIB=-l$(MZSCHEME_MAIN_LIB)$(MZSCHEME_VER)
315else
Bram Moolenaar4e640bd2016-01-16 16:20:38 +0100316MZSCHEME_LIB=-l$(MZSCHEME_MAIN_LIB)$(MZSCHEME_VER) -lmzgc$(MZSCHEME_VER)
Bram Moolenaar4f7e8212014-11-05 13:53:32 +0100317endif
318# the modern MinGW can dynamically link to dlls directly.
319# point MZSCHEME_DLLS to where you put libmzschXXXXXXX.dll and libgcXXXXXXX.dll
320ifndef MZSCHEME_DLLS
321MZSCHEME_DLLS=$(MZSCHEME)
322endif
323MZSCHEME_LIBDIR=-L$(MZSCHEME_DLLS) -L$(MZSCHEME_DLLS)\lib
324endif
325
326endif
327
328# Python interface:
329# PYTHON=[Path to Python directory] (Set inside Make_cyg.mak or Make_ming.mak)
330# DYNAMIC_PYTHON=yes (to load the Python DLL dynamically)
Bram Moolenaar0eaadec2016-09-08 20:28:45 +0200331# PYTHON_VER=[Python version, eg 22, 23, ..., 27] (default is 27)
Bram Moolenaar4f7e8212014-11-05 13:53:32 +0100332ifdef PYTHON
333ifndef DYNAMIC_PYTHON
334DYNAMIC_PYTHON=yes
335endif
336
337ifndef PYTHON_VER
Bram Moolenaar3c6f92e2016-01-02 20:26:36 +0100338PYTHON_VER=27
339endif
340ifndef DYNAMIC_PYTHON_DLL
341DYNAMIC_PYTHON_DLL=python$(PYTHON_VER).dll
342endif
343ifdef PYTHON_HOME
344PYTHON_HOME_DEF=-DPYTHON_HOME=\"$(PYTHON_HOME)\"
Bram Moolenaar4f7e8212014-11-05 13:53:32 +0100345endif
346
347ifeq (no,$(DYNAMIC_PYTHON))
348PYTHONLIB=-L$(PYTHON)/libs -lpython$(PYTHON_VER)
349endif
350# my include files are in 'win32inc' on Linux, and 'include' in the standard
351# NT distro (ActiveState)
Bram Moolenaar3c6f92e2016-01-02 20:26:36 +0100352ifndef PYTHONINC
Bram Moolenaar4f7e8212014-11-05 13:53:32 +0100353ifeq ($(CROSS),no)
354PYTHONINC=-I $(PYTHON)/include
355else
356PYTHONINC=-I $(PYTHON)/win32inc
357endif
358endif
Bram Moolenaar3c6f92e2016-01-02 20:26:36 +0100359endif
Bram Moolenaar4f7e8212014-11-05 13:53:32 +0100360
361# Python3 interface:
362# PYTHON3=[Path to Python3 directory] (Set inside Make_cyg.mak or Make_ming.mak)
363# DYNAMIC_PYTHON3=yes (to load the Python3 DLL dynamically)
Bram Moolenaar59eb0162017-12-10 18:17:44 +0100364# PYTHON3_VER=[Python3 version, eg 31, 32] (default is 36)
Bram Moolenaar4f7e8212014-11-05 13:53:32 +0100365ifdef PYTHON3
366ifndef DYNAMIC_PYTHON3
367DYNAMIC_PYTHON3=yes
368endif
369
370ifndef PYTHON3_VER
Bram Moolenaar59eb0162017-12-10 18:17:44 +0100371PYTHON3_VER=36
Bram Moolenaar4f7e8212014-11-05 13:53:32 +0100372endif
Bram Moolenaara7c37952016-01-20 22:23:15 +0100373ifndef DYNAMIC_PYTHON3_DLL
374DYNAMIC_PYTHON3_DLL=python$(PYTHON3_VER).dll
375endif
376ifdef PYTHON3_HOME
Bram Moolenaaracd58ef2016-02-16 13:42:24 +0100377PYTHON3_HOME_DEF=-DPYTHON3_HOME=L\"$(PYTHON3_HOME)\"
Bram Moolenaar4f7e8212014-11-05 13:53:32 +0100378endif
379
Bram Moolenaara7c37952016-01-20 22:23:15 +0100380ifeq (no,$(DYNAMIC_PYTHON3))
381PYTHON3LIB=-L$(PYTHON3)/libs -lpython$(PYTHON3_VER)
382endif
383
384ifndef PYTHON3INC
Bram Moolenaar4f7e8212014-11-05 13:53:32 +0100385ifeq ($(CROSS),no)
386PYTHON3INC=-I $(PYTHON3)/include
387else
388PYTHON3INC=-I $(PYTHON3)/win32inc
389endif
390endif
Bram Moolenaara7c37952016-01-20 22:23:15 +0100391endif
Bram Moolenaar4f7e8212014-11-05 13:53:32 +0100392
393# TCL interface:
394# TCL=[Path to TCL directory] (Set inside Make_cyg.mak or Make_ming.mak)
395# DYNAMIC_TCL=yes (to load the TCL DLL dynamically)
Bram Moolenaar0eaadec2016-09-08 20:28:45 +0200396# TCL_VER=[TCL version, eg 83, 84] (default is 86)
397# TCL_VER_LONG=[Tcl version, eg 8.3] (default is 8.6)
Bram Moolenaareca99bd2016-01-07 22:50:05 +0100398# You must set TCL_VER_LONG when you set TCL_VER.
Bram Moolenaar77f74742017-08-23 22:40:41 +0200399# TCL_DLL=[TCL dll name, eg tcl86.dll] (default is tcl86.dll)
Bram Moolenaar4f7e8212014-11-05 13:53:32 +0100400ifdef TCL
401ifndef DYNAMIC_TCL
402DYNAMIC_TCL=yes
403endif
404ifndef TCL_VER
Bram Moolenaar0eaadec2016-09-08 20:28:45 +0200405TCL_VER = 86
Bram Moolenaar4f7e8212014-11-05 13:53:32 +0100406endif
Bram Moolenaareca99bd2016-01-07 22:50:05 +0100407ifndef TCL_VER_LONG
Bram Moolenaar0eaadec2016-09-08 20:28:45 +0200408TCL_VER_LONG = 8.6
Bram Moolenaareca99bd2016-01-07 22:50:05 +0100409endif
Bram Moolenaar77f74742017-08-23 22:40:41 +0200410ifndef TCL_DLL
411TCL_DLL = tcl$(TCL_VER).dll
412endif
Bram Moolenaar4f7e8212014-11-05 13:53:32 +0100413TCLINC += -I$(TCL)/include
414endif
415
416
417# Ruby interface:
418# RUBY=[Path to Ruby directory] (Set inside Make_cyg.mak or Make_ming.mak)
Bram Moolenaar61766972018-04-20 22:31:41 +0200419# DYNAMIC_RUBY=yes (to load the Ruby DLL dynamically, "no" for static)
Bram Moolenaar6384c5d2016-09-06 22:06:35 +0200420# RUBY_VER=[Ruby version, eg 19, 22] (default is 22)
421# RUBY_API_VER_LONG=[Ruby API version, eg 1.8, 1.9.1, 2.2.0]
422# (default is 2.2.0)
423# You must set RUBY_API_VER_LONG when changing RUBY_VER.
Bram Moolenaar4f7e8212014-11-05 13:53:32 +0100424# Note: If you use Ruby 1.9.3, set as follows:
425# RUBY_VER=19
Bram Moolenaar6384c5d2016-09-06 22:06:35 +0200426# 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 +0100427ifdef RUBY
428ifndef DYNAMIC_RUBY
429DYNAMIC_RUBY=yes
430endif
431# Set default value
432ifndef RUBY_VER
Bram Moolenaar6384c5d2016-09-06 22:06:35 +0200433RUBY_VER = 22
Bram Moolenaar4f7e8212014-11-05 13:53:32 +0100434endif
435ifndef RUBY_VER_LONG
Bram Moolenaar6384c5d2016-09-06 22:06:35 +0200436RUBY_VER_LONG = 2.2.0
437endif
438ifndef RUBY_API_VER_LONG
Bram Moolenaar0eaadec2016-09-08 20:28:45 +0200439RUBY_API_VER_LONG = $(RUBY_VER_LONG)
Bram Moolenaar4f7e8212014-11-05 13:53:32 +0100440endif
441ifndef RUBY_API_VER
Bram Moolenaar6384c5d2016-09-06 22:06:35 +0200442RUBY_API_VER = $(subst .,,$(RUBY_API_VER_LONG))
Bram Moolenaar4f7e8212014-11-05 13:53:32 +0100443endif
444
445ifndef RUBY_PLATFORM
446ifeq ($(RUBY_VER), 16)
447RUBY_PLATFORM = i586-mswin32
448else
Bram Moolenaar6384c5d2016-09-06 22:06:35 +0200449ifneq ($(wildcard $(RUBY)/lib/ruby/$(RUBY_API_VER_LONG)/i386-mingw32),)
Bram Moolenaar4f7e8212014-11-05 13:53:32 +0100450RUBY_PLATFORM = i386-mingw32
451else
Bram Moolenaar6384c5d2016-09-06 22:06:35 +0200452ifneq ($(wildcard $(RUBY)/lib/ruby/$(RUBY_API_VER_LONG)/x64-mingw32),)
Bram Moolenaar4f7e8212014-11-05 13:53:32 +0100453RUBY_PLATFORM = x64-mingw32
454else
455RUBY_PLATFORM = i386-mswin32
456endif
457endif
458endif
459endif
460
461ifndef RUBY_INSTALL_NAME
462ifeq ($(RUBY_VER), 16)
463RUBY_INSTALL_NAME = mswin32-ruby$(RUBY_API_VER)
464else
Bram Moolenaar0bee2fe2016-01-07 22:45:09 +0100465ifndef RUBY_MSVCRT_NAME
466# Base name of msvcrXX.dll which is used by ruby's dll.
467RUBY_MSVCRT_NAME = msvcrt
468endif
Bram Moolenaar4f7e8212014-11-05 13:53:32 +0100469ifeq ($(ARCH),x86-64)
Bram Moolenaar0bee2fe2016-01-07 22:45:09 +0100470RUBY_INSTALL_NAME = x64-$(RUBY_MSVCRT_NAME)-ruby$(RUBY_API_VER)
Bram Moolenaar4f7e8212014-11-05 13:53:32 +0100471else
Bram Moolenaar0bee2fe2016-01-07 22:45:09 +0100472RUBY_INSTALL_NAME = $(RUBY_MSVCRT_NAME)-ruby$(RUBY_API_VER)
Bram Moolenaar4f7e8212014-11-05 13:53:32 +0100473endif
474endif
475endif
476
477ifeq (19, $(word 1,$(sort 19 $(RUBY_VER))))
478RUBY_19_OR_LATER = 1
479endif
480
Bram Moolenaar4f7e8212014-11-05 13:53:32 +0100481ifdef RUBY_19_OR_LATER
Bram Moolenaar76c612a2018-09-21 14:31:51 +0200482RUBYINC = -I $(RUBY)/include/ruby-$(RUBY_API_VER_LONG) -I $(RUBY)/include/ruby-$(RUBY_API_VER_LONG)/$(RUBY_PLATFORM)
483else
484RUBYINC = -I $(RUBY)/lib/ruby/$(RUBY_API_VER_LONG)/$(RUBY_PLATFORM)
Bram Moolenaar4f7e8212014-11-05 13:53:32 +0100485endif
486ifeq (no, $(DYNAMIC_RUBY))
487RUBYLIB = -L$(RUBY)/lib -l$(RUBY_INSTALL_NAME)
488endif
489
490endif # RUBY
491
492# See feature.h for a list of options.
493# Any other defines can be included here.
494DEF_GUI=-DFEAT_GUI_W32 -DFEAT_CLIPBOARD
495DEFINES=-DWIN32 -DWINVER=$(WINVER) -D_WIN32_WINNT=$(WINVER) \
Bram Moolenaar22fcfad2016-07-01 18:17:26 +0200496 -DHAVE_PATHDEF -DFEAT_$(FEATURES) -DHAVE_STDINT_H
Bram Moolenaar4f7e8212014-11-05 13:53:32 +0100497ifeq ($(ARCH),x86-64)
498DEFINES+=-DMS_WIN64
499endif
Bram Moolenaar4f7e8212014-11-05 13:53:32 +0100500
501#>>>>> end of choices
502###########################################################################
503
Bram Moolenaara971df82016-02-15 21:22:10 +0100504CFLAGS = -Iproto $(DEFINES) -pipe -march=$(ARCH) -Wall
Bram Moolenaar6c0e9842016-03-22 20:42:31 +0100505CXXFLAGS = -std=gnu++11
Bram Moolenaar4f7e8212014-11-05 13:53:32 +0100506WINDRES_FLAGS = --preprocessor="$(WINDRES_CC) -E -xc" -DRC_INVOKED
507EXTRA_LIBS =
508
509ifdef GETTEXT
510DEFINES += -DHAVE_GETTEXT -DHAVE_LOCALE_H
511GETTEXTINCLUDE = $(GETTEXT)/include
512GETTEXTLIB = $(INTLPATH)
513ifeq (yes, $(GETTEXT))
514DEFINES += -DDYNAMIC_GETTEXT
515else
516ifdef DYNAMIC_GETTEXT
517DEFINES += -D$(DYNAMIC_GETTEXT)
518ifdef GETTEXT_DYNAMIC
519DEFINES += -DGETTEXT_DYNAMIC -DGETTEXT_DLL=\"$(GETTEXT_DYNAMIC)\"
520endif
521endif
522endif
523endif
524
525ifdef PERL
Bram Moolenaar367fbf12015-06-25 16:13:46 +0200526CFLAGS += -I$(PERLLIBS) -DFEAT_PERL -DPERL_IMPLICIT_CONTEXT -DPERL_IMPLICIT_SYS
Bram Moolenaar4f7e8212014-11-05 13:53:32 +0100527ifeq (yes, $(DYNAMIC_PERL))
528CFLAGS += -DDYNAMIC_PERL -DDYNAMIC_PERL_DLL=\"perl$(PERL_VER).dll\"
529EXTRA_LIBS += -L$(PERLLIBS) -lperl$(PERL_VER)
530endif
531endif
532
533ifdef LUA
Bram Moolenaarb872e632018-09-21 13:44:09 +0200534LUA_INCDIR = $(LUA)/include
535CFLAGS += -I$(LUA_INCDIR) -I$(LUA) -DFEAT_LUA
Bram Moolenaar4f7e8212014-11-05 13:53:32 +0100536ifeq (yes, $(DYNAMIC_LUA))
537CFLAGS += -DDYNAMIC_LUA -DDYNAMIC_LUA_DLL=\"lua$(LUA_VER).dll\"
538endif
539endif
540
541ifdef MZSCHEME
Bram Moolenaar4e640bd2016-01-16 16:20:38 +0100542ifndef MZSCHEME_COLLECTS
543MZSCHEME_COLLECTS=$(MZSCHEME)/collects
544ifeq (yes, $(UNDER_CYGWIN))
545MZSCHEME_COLLECTS:=$(shell cygpath -m $(MZSCHEME_COLLECTS) | sed -e 's/ /\\ /g')
546endif
547endif
548CFLAGS += -I$(MZSCHEME)/include -DFEAT_MZSCHEME -DMZSCHEME_COLLECTS=\"$(MZSCHEME_COLLECTS)\"
Bram Moolenaar4f7e8212014-11-05 13:53:32 +0100549ifeq (yes, $(DYNAMIC_MZSCHEME))
Bram Moolenaar4e640bd2016-01-16 16:20:38 +0100550ifeq (yes, $(MZSCHEME_PRECISE_GC))
551# Precise GC does not use separate dll
552CFLAGS += -DDYNAMIC_MZSCHEME -DDYNAMIC_MZSCH_DLL=\"lib$(MZSCHEME_MAIN_LIB)$(MZSCHEME_VER).dll\" -DDYNAMIC_MZGC_DLL=\"lib$(MZSCHEME_MAIN_LIB)$(MZSCHEME_VER).dll\"
553else
Bram Moolenaar4f7e8212014-11-05 13:53:32 +0100554CFLAGS += -DDYNAMIC_MZSCHEME -DDYNAMIC_MZSCH_DLL=\"lib$(MZSCHEME_MAIN_LIB)$(MZSCHEME_VER).dll\" -DDYNAMIC_MZGC_DLL=\"libmzgc$(MZSCHEME_VER).dll\"
555endif
Bram Moolenaar4e640bd2016-01-16 16:20:38 +0100556endif
Bram Moolenaar4f7e8212014-11-05 13:53:32 +0100557ifeq (yes, "$(MZSCHEME_DEBUG)")
558CFLAGS += -DMZSCHEME_FORCE_GC
559endif
560endif
561
562ifdef RUBY
563CFLAGS += -DFEAT_RUBY $(RUBYINC)
564ifeq (yes, $(DYNAMIC_RUBY))
565CFLAGS += -DDYNAMIC_RUBY -DDYNAMIC_RUBY_DLL=\"$(RUBY_INSTALL_NAME).dll\"
566CFLAGS += -DDYNAMIC_RUBY_VER=$(RUBY_VER)
567endif
Bram Moolenaar259a90f2018-04-21 19:08:55 +0200568ifeq (no, $(DYNAMIC_RUBY))
569CFLAGS += -DRUBY_VERSION=$(RUBY_VER)
570endif
Bram Moolenaar4f7e8212014-11-05 13:53:32 +0100571ifneq ($(findstring w64-mingw32,$(CC)),)
572# A workaround for MinGW-w64
573CFLAGS += -DHAVE_STRUCT_TIMESPEC -DHAVE_STRUCT_TIMEZONE
574endif
575endif
576
577ifdef PYTHON
Bram Moolenaar223b7232016-02-19 19:43:49 +0100578CFLAGS += -DFEAT_PYTHON
Bram Moolenaar4f7e8212014-11-05 13:53:32 +0100579ifeq (yes, $(DYNAMIC_PYTHON))
Bram Moolenaar449538c2016-01-09 17:49:15 +0100580CFLAGS += -DDYNAMIC_PYTHON -DDYNAMIC_PYTHON_DLL=\"$(DYNAMIC_PYTHON_DLL)\"
Bram Moolenaar4f7e8212014-11-05 13:53:32 +0100581endif
582endif
583
Bram Moolenaar223b7232016-02-19 19:43:49 +0100584ifdef PYTHON3
585CFLAGS += -DFEAT_PYTHON3
Bram Moolenaar4f7e8212014-11-05 13:53:32 +0100586ifeq (yes, $(DYNAMIC_PYTHON3))
Bram Moolenaara7c37952016-01-20 22:23:15 +0100587CFLAGS += -DDYNAMIC_PYTHON3 -DDYNAMIC_PYTHON3_DLL=\"$(DYNAMIC_PYTHON3_DLL)\"
Bram Moolenaar4f7e8212014-11-05 13:53:32 +0100588endif
589endif
590
591ifdef TCL
592CFLAGS += -DFEAT_TCL $(TCLINC)
593ifeq (yes, $(DYNAMIC_TCL))
Bram Moolenaar77f74742017-08-23 22:40:41 +0200594CFLAGS += -DDYNAMIC_TCL -DDYNAMIC_TCL_DLL=\"$(TCL_DLL)\" -DDYNAMIC_TCL_VER=\"$(TCL_VER_LONG)\"
Bram Moolenaar4f7e8212014-11-05 13:53:32 +0100595endif
596endif
597
598ifeq ($(POSTSCRIPT),yes)
599DEFINES += -DMSWINPS
600endif
601
602ifeq (yes, $(OLE))
603DEFINES += -DFEAT_OLE
604endif
605
606ifeq ($(CSCOPE),yes)
607DEFINES += -DFEAT_CSCOPE
608endif
609
610ifeq ($(NETBEANS),yes)
611# Only allow NETBEANS for a GUI build.
612ifeq (yes, $(GUI))
613DEFINES += -DFEAT_NETBEANS_INTG
614
615ifeq ($(NBDEBUG), yes)
616DEFINES += -DNBDEBUG
617NBDEBUG_INCL = nbdebug.h
618NBDEBUG_SRC = nbdebug.c
619endif
620endif
621endif
622
Bram Moolenaare0874f82016-01-24 20:36:41 +0100623ifeq ($(CHANNEL),yes)
Bram Moolenaar509ce2a2016-03-11 22:52:15 +0100624DEFINES += -DFEAT_JOB_CHANNEL
Bram Moolenaare0874f82016-01-24 20:36:41 +0100625endif
626
Bram Moolenaar4fc63502017-07-19 11:28:17 +0200627ifeq ($(TERMINAL),yes)
628DEFINES += -DFEAT_TERMINAL
Bram Moolenaarf80451e2017-07-25 21:49:35 +0200629TERM_DEPS = \
630 libvterm/include/vterm.h \
631 libvterm/include/vterm_keycodes.h \
632 libvterm/src/rect.h \
633 libvterm/src/utf8.h \
634 libvterm/src/vterm_internal.h
Bram Moolenaar4fc63502017-07-19 11:28:17 +0200635endif
636
Bram Moolenaar4f7e8212014-11-05 13:53:32 +0100637# DirectWrite (DirectX)
638ifeq ($(DIRECTX),yes)
639# Only allow DirectWrite for a GUI build.
640ifeq (yes, $(GUI))
Bram Moolenaarcccd62d2018-04-12 20:23:48 +0200641DEFINES += -DFEAT_DIRECTX -DDYNAMIC_DIRECTX
642ifneq ($(COLOR_EMOJI),no)
643DEFINES += -DFEAT_DIRECTX_COLOR_EMOJI
644endif
Bram Moolenaar4f7e8212014-11-05 13:53:32 +0100645endif
646endif
647
648# Only allow XPM for a GUI build.
649ifeq (yes, $(GUI))
650
651ifndef XPM
652ifeq ($(ARCH),i386)
653XPM = xpm/x86
654endif
655ifeq ($(ARCH),i486)
656XPM = xpm/x86
657endif
658ifeq ($(ARCH),i586)
659XPM = xpm/x86
660endif
661ifeq ($(ARCH),i686)
662XPM = xpm/x86
663endif
664ifeq ($(ARCH),x86-64)
665XPM = xpm/x64
666endif
667endif
668ifdef XPM
669ifneq ($(XPM),no)
670CFLAGS += -DFEAT_XPM_W32 -I $(XPM)/include -I $(XPM)/../include
671endif
672endif
673
674endif
675
676ifeq ($(DEBUG),yes)
677CFLAGS += -g -fstack-check
678DEBUG_SUFFIX=d
679else
680ifeq ($(OPTIMIZE), SIZE)
681CFLAGS += -Os
682else
683ifeq ($(OPTIMIZE), MAXSPEED)
684CFLAGS += -O3
685CFLAGS += -fomit-frame-pointer -freg-struct-return
686else # SPEED
687CFLAGS += -O2
688endif
689endif
690CFLAGS += -s
691endif
692
Bram Moolenaar828c3d72018-06-19 18:58:07 +0200693LIB = -lkernel32 -luser32 -lgdi32 -ladvapi32 -lcomdlg32 -lcomctl32 -lnetapi32 -lversion
Bram Moolenaar4f7e8212014-11-05 13:53:32 +0100694GUIOBJ = $(OUTDIR)/gui.o $(OUTDIR)/gui_w32.o $(OUTDIR)/gui_beval.o $(OUTDIR)/os_w32exe.o
Bram Moolenaar97ff9b92016-06-26 20:37:46 +0200695CUIOBJ = $(OUTDIR)/iscygpty.o
Bram Moolenaar4f7e8212014-11-05 13:53:32 +0100696OBJ = \
Bram Moolenaar75464dc2016-07-02 20:27:50 +0200697 $(OUTDIR)/arabic.o \
Bram Moolenaarc3719bd2017-11-18 22:13:31 +0100698 $(OUTDIR)/beval.o \
Bram Moolenaar4f7e8212014-11-05 13:53:32 +0100699 $(OUTDIR)/blowfish.o \
700 $(OUTDIR)/buffer.o \
701 $(OUTDIR)/charset.o \
702 $(OUTDIR)/crypt.o \
703 $(OUTDIR)/crypt_zip.o \
Bram Moolenaar6583c442016-07-17 18:41:47 +0200704 $(OUTDIR)/dict.o \
Bram Moolenaar4f7e8212014-11-05 13:53:32 +0100705 $(OUTDIR)/diff.o \
706 $(OUTDIR)/digraph.o \
707 $(OUTDIR)/edit.o \
708 $(OUTDIR)/eval.o \
Bram Moolenaar73dad1e2016-07-17 22:13:49 +0200709 $(OUTDIR)/evalfunc.o \
Bram Moolenaar4f7e8212014-11-05 13:53:32 +0100710 $(OUTDIR)/ex_cmds.o \
711 $(OUTDIR)/ex_cmds2.o \
712 $(OUTDIR)/ex_docmd.o \
713 $(OUTDIR)/ex_eval.o \
714 $(OUTDIR)/ex_getln.o \
Bram Moolenaar75464dc2016-07-02 20:27:50 +0200715 $(OUTDIR)/farsi.o \
Bram Moolenaar4f7e8212014-11-05 13:53:32 +0100716 $(OUTDIR)/fileio.o \
717 $(OUTDIR)/fold.o \
718 $(OUTDIR)/getchar.o \
719 $(OUTDIR)/hardcopy.o \
720 $(OUTDIR)/hashtab.o \
Bram Moolenaar520e1e42016-01-23 19:46:28 +0100721 $(OUTDIR)/json.o \
Bram Moolenaar6583c442016-07-17 18:41:47 +0200722 $(OUTDIR)/list.o \
Bram Moolenaar4f7e8212014-11-05 13:53:32 +0100723 $(OUTDIR)/main.o \
724 $(OUTDIR)/mark.o \
725 $(OUTDIR)/memfile.o \
726 $(OUTDIR)/memline.o \
727 $(OUTDIR)/menu.o \
728 $(OUTDIR)/message.o \
729 $(OUTDIR)/misc1.o \
730 $(OUTDIR)/misc2.o \
731 $(OUTDIR)/move.o \
732 $(OUTDIR)/mbyte.o \
733 $(OUTDIR)/normal.o \
734 $(OUTDIR)/ops.o \
735 $(OUTDIR)/option.o \
736 $(OUTDIR)/os_win32.o \
737 $(OUTDIR)/os_mswin.o \
738 $(OUTDIR)/winclip.o \
739 $(OUTDIR)/pathdef.o \
740 $(OUTDIR)/popupmnu.o \
741 $(OUTDIR)/quickfix.o \
742 $(OUTDIR)/regexp.o \
743 $(OUTDIR)/screen.o \
744 $(OUTDIR)/search.o \
745 $(OUTDIR)/sha256.o \
746 $(OUTDIR)/spell.o \
Bram Moolenaar9ccfebd2016-07-19 16:39:08 +0200747 $(OUTDIR)/spellfile.o \
Bram Moolenaar4f7e8212014-11-05 13:53:32 +0100748 $(OUTDIR)/syntax.o \
749 $(OUTDIR)/tag.o \
750 $(OUTDIR)/term.o \
751 $(OUTDIR)/ui.o \
752 $(OUTDIR)/undo.o \
Bram Moolenaar6583c442016-07-17 18:41:47 +0200753 $(OUTDIR)/userfunc.o \
Bram Moolenaar4f7e8212014-11-05 13:53:32 +0100754 $(OUTDIR)/version.o \
755 $(OUTDIR)/vimrc.o \
756 $(OUTDIR)/window.o
757
758ifdef PERL
759OBJ += $(OUTDIR)/if_perl.o
760endif
761ifdef LUA
762OBJ += $(OUTDIR)/if_lua.o
763endif
764ifdef MZSCHEME
765OBJ += $(OUTDIR)/if_mzsch.o
766MZSCHEME_INCL = if_mzsch.h
767ifeq (yes,$(MZSCHEME_GENERATE_BASE))
768CFLAGS += -DINCLUDE_MZSCHEME_BASE
769MZ_EXTRA_DEP += mzscheme_base.c
770endif
771ifeq (yes,$(MZSCHEME_PRECISE_GC))
772CFLAGS += -DMZ_PRECISE_GC
773endif
774endif
775ifdef PYTHON
776OBJ += $(OUTDIR)/if_python.o
777endif
778ifdef PYTHON3
779OBJ += $(OUTDIR)/if_python3.o
780endif
781ifdef RUBY
782OBJ += $(OUTDIR)/if_ruby.o
783endif
784ifdef TCL
785OBJ += $(OUTDIR)/if_tcl.o
786endif
787ifeq ($(CSCOPE),yes)
788OBJ += $(OUTDIR)/if_cscope.o
789endif
Bram Moolenaare0874f82016-01-24 20:36:41 +0100790
Bram Moolenaar4f7e8212014-11-05 13:53:32 +0100791ifeq ($(NETBEANS),yes)
Bram Moolenaare0874f82016-01-24 20:36:41 +0100792ifneq ($(CHANNEL),yes)
793# Cannot use Netbeans without CHANNEL
794NETBEANS=no
795else
Bram Moolenaar44d57182016-02-14 23:11:23 +0100796ifneq (yes, $(GUI))
797# Cannot use Netbeans without GUI.
798NETBEANS=no
799else
Bram Moolenaar4f7e8212014-11-05 13:53:32 +0100800OBJ += $(OUTDIR)/netbeans.o
Bram Moolenaar4f7e8212014-11-05 13:53:32 +0100801endif
802endif
Bram Moolenaare0874f82016-01-24 20:36:41 +0100803endif
804
805ifeq ($(CHANNEL),yes)
806OBJ += $(OUTDIR)/channel.o
Bram Moolenaare0874f82016-01-24 20:36:41 +0100807LIB += -lwsock32
808endif
Bram Moolenaare0874f82016-01-24 20:36:41 +0100809
Bram Moolenaar4f7e8212014-11-05 13:53:32 +0100810ifeq ($(DIRECTX),yes)
811# Only allow DIRECTX for a GUI build.
812ifeq (yes, $(GUI))
813OBJ += $(OUTDIR)/gui_dwrite.o
814LIB += -ld2d1 -ldwrite
815USE_STDCPLUS = yes
816endif
817endif
818ifneq ($(XPM),no)
819# Only allow XPM for a GUI build.
820ifeq (yes, $(GUI))
821OBJ += $(OUTDIR)/xpm_w32.o
822# You'll need libXpm.a from http://gnuwin32.sf.net
823LIB += -L$(XPM)/lib -lXpm
824endif
825endif
826
Bram Moolenaar4fc63502017-07-19 11:28:17 +0200827ifeq ($(TERMINAL),yes)
Bram Moolenaarf80451e2017-07-25 21:49:35 +0200828OBJ += $(OUTDIR)/terminal.o \
Bram Moolenaar78dcd4f2018-09-13 17:23:28 +0200829 $(OUTDIR)/encoding.o \
830 $(OUTDIR)/keyboard.o \
831 $(OUTDIR)/mouse.o \
832 $(OUTDIR)/parser.o \
833 $(OUTDIR)/pen.o \
834 $(OUTDIR)/termscreen.o \
835 $(OUTDIR)/state.o \
836 $(OUTDIR)/unicode.o \
837 $(OUTDIR)/vterm.o
Bram Moolenaar4fc63502017-07-19 11:28:17 +0200838endif
839
Bram Moolenaare828b762018-09-10 17:51:58 +0200840# Include xdiff
841OBJ += $(OUTDIR)/xdiffi.o \
842 $(OUTDIR)/xemit.o \
843 $(OUTDIR)/xprepare.o \
844 $(OUTDIR)/xutils.o \
845 $(OUTDIR)/xhistogram.o \
846 $(OUTDIR)/xpatience.o
847
848XDIFF_DEPS = \
849 xdiff/xdiff.h \
850 xdiff/xdiffi.h \
851 xdiff/xemit.h \
852 xdiff/xinclude.h \
853 xdiff/xmacros.h \
854 xdiff/xprepare.h \
855 xdiff/xtypes.h \
856 xdiff/xutils.h
Bram Moolenaar4f7e8212014-11-05 13:53:32 +0100857
858ifdef MZSCHEME
859MZSCHEME_SUFFIX = Z
860endif
861
862ifeq ($(GUI),yes)
863TARGET := gvim$(DEBUG_SUFFIX).exe
864DEFINES += $(DEF_GUI)
865OBJ += $(GUIOBJ)
866LFLAGS += -mwindows
867OUTDIR = gobj$(DEBUG_SUFFIX)$(MZSCHEME_SUFFIX)$(ARCH)
868else
Bram Moolenaar97ff9b92016-06-26 20:37:46 +0200869OBJ += $(CUIOBJ)
Bram Moolenaar4f7e8212014-11-05 13:53:32 +0100870TARGET := vim$(DEBUG_SUFFIX).exe
871OUTDIR = obj$(DEBUG_SUFFIX)$(MZSCHEME_SUFFIX)$(ARCH)
872endif
873
874ifdef GETTEXT
875ifneq (yes, $(GETTEXT))
876CFLAGS += -I$(GETTEXTINCLUDE)
877ifndef STATIC_GETTEXT
878LIB += -L$(GETTEXTLIB) -l$(INTLLIB)
879ifeq (USE_SAFE_GETTEXT_DLL, $(DYNAMIC_GETTEXT))
880OBJ+=$(SAFE_GETTEXT_DLL_OBJ)
881endif
882else
883LIB += -L$(GETTEXTLIB) -lintl
884endif
885endif
886endif
887
888ifdef PERL
889ifeq (no, $(DYNAMIC_PERL))
890LIB += -L$(PERLLIBS) -lperl$(PERL_VER)
891endif
892endif
893
894ifdef TCL
895LIB += -L$(TCL)/lib
896ifeq (yes, $(DYNAMIC_TCL))
897LIB += -ltclstub$(TCL_VER)
898else
899LIB += -ltcl$(TCL_VER)
900endif
901endif
902
903ifeq (yes, $(OLE))
904LIB += -loleaut32
905OBJ += $(OUTDIR)/if_ole.o
906USE_STDCPLUS = yes
907endif
908
909ifeq (yes, $(MBYTE))
910DEFINES += -DFEAT_MBYTE
911endif
912
913ifeq (yes, $(IME))
914DEFINES += -DFEAT_MBYTE_IME
915ifeq (yes, $(DYNAMIC_IME))
916DEFINES += -DDYNAMIC_IME
917else
918LIB += -limm32
919endif
920endif
921
922ifdef ICONV
923ifneq (yes, $(ICONV))
924LIB += -L$(ICONV)
925CFLAGS += -I$(ICONV)
926endif
927DEFINES+=-DDYNAMIC_ICONV
928endif
929
930ifeq (yes, $(USE_STDCPLUS))
931ifeq (yes, $(STATIC_STDCPLUS))
932LIB += -Wl,-Bstatic -lstdc++ -Wl,-Bdynamic
933else
934LIB += -lstdc++
935endif
936endif
937
Bram Moolenaare3af7632016-12-01 20:37:47 +0100938ifeq (yes, $(STATIC_WINPTHREAD))
939LIB += -Wl,-Bstatic -lwinpthread -Wl,-Bdynamic
940endif
941
Bram Moolenaar4ff42902018-09-21 14:43:10 +0200942ifeq (yes, $(MAP))
943LFLAGS += -Wl,-Map=$(TARGET).map
944endif
945
Bram Moolenaar4f7e8212014-11-05 13:53:32 +0100946all: $(TARGET) vimrun.exe xxd/xxd.exe install.exe uninstal.exe GvimExt/gvimext.dll
947
948vimrun.exe: vimrun.c
949 $(CC) $(CFLAGS) -o vimrun.exe vimrun.c $(LIB)
950
951install.exe: dosinst.c
952 $(CC) $(CFLAGS) -o install.exe dosinst.c $(LIB) -lole32 -luuid
953
954uninstal.exe: uninstal.c
955 $(CC) $(CFLAGS) -o uninstal.exe uninstal.c $(LIB)
956
957$(TARGET): $(OUTDIR) $(OBJ)
Bram Moolenaarf80451e2017-07-25 21:49:35 +0200958 $(CC) $(CFLAGS) $(LFLAGS) -o $@ $(OBJ) $(LIB) -lole32 -luuid $(LUA_LIB) $(MZSCHEME_LIBDIR) $(MZSCHEME_LIB) $(PYTHONLIB) $(PYTHON3LIB) $(RUBYLIB)
Bram Moolenaar4f7e8212014-11-05 13:53:32 +0100959
960upx: exes
961 upx gvim.exe
962 upx vim.exe
963
964mpress: exes
965 mpress gvim.exe
966 mpress vim.exe
967
968xxd/xxd.exe: xxd/xxd.c
969 $(MAKE) -C xxd -f Make_ming.mak CC='$(CC)'
970
971GvimExt/gvimext.dll: GvimExt/gvimext.cpp GvimExt/gvimext.rc GvimExt/gvimext.h
972 $(MAKE) -C GvimExt -f Make_ming.mak CROSS=$(CROSS) CROSS_COMPILE=$(CROSS_COMPILE) CXX='$(CXX)' STATIC_STDCPLUS=$(STATIC_STDCPLUS)
973
Bram Moolenaar9ac9dfa2017-09-01 18:41:26 +0200974tags: notags
975 $(CTAGS) *.c *.cpp *.h if_perl.xs
976
977notags:
978 -$(DEL) tags
979
Bram Moolenaar4f7e8212014-11-05 13:53:32 +0100980clean:
981 -$(DEL) $(OUTDIR)$(DIRSLASH)*.o
982 -$(DEL) $(OUTDIR)$(DIRSLASH)*.res
983 -rmdir $(OUTDIR)
984 -$(DEL) *.exe
985 -$(DEL) pathdef.c
986ifdef PERL
987 -$(DEL) if_perl.c
988endif
989ifdef MZSCHEME
990 -$(DEL) mzscheme_base.c
991endif
992 $(MAKE) -C GvimExt -f Make_ming.mak clean
993 $(MAKE) -C xxd -f Make_ming.mak clean
994
995###########################################################################
Bram Moolenaar96e7a6e2017-09-23 19:48:29 +0200996INCL = vim.h alloc.h arabic.h ascii.h ex_cmds.h farsi.h feature.h globals.h \
997 keymap.h macros.h option.h os_dos.h os_win32.h proto.h regexp.h \
Bram Moolenaarc3719bd2017-11-18 22:13:31 +0100998 spell.h structs.h term.h beval.h $(NBDEBUG_INCL)
999GUI_INCL = gui.h
Bram Moolenaar97ff9b92016-06-26 20:37:46 +02001000CUI_INCL = iscygpty.h
Bram Moolenaar4f7e8212014-11-05 13:53:32 +01001001
Bram Moolenaar96e7a6e2017-09-23 19:48:29 +02001002$(OUTDIR)/if_python.o: if_python.c if_py_both.h $(INCL)
Bram Moolenaar449538c2016-01-09 17:49:15 +01001003 $(CC) -c $(CFLAGS) $(PYTHONINC) $(PYTHON_HOME_DEF) $< -o $@
Bram Moolenaar4f7e8212014-11-05 13:53:32 +01001004
Bram Moolenaar96e7a6e2017-09-23 19:48:29 +02001005$(OUTDIR)/if_python3.o: if_python3.c if_py_both.h $(INCL)
Bram Moolenaara7c37952016-01-20 22:23:15 +01001006 $(CC) -c $(CFLAGS) $(PYTHON3INC) $(PYTHON3_HOME_DEF) $< -o $@
Bram Moolenaar4f7e8212014-11-05 13:53:32 +01001007
1008$(OUTDIR)/%.o : %.c $(INCL)
1009 $(CC) -c $(CFLAGS) $< -o $@
1010
Bram Moolenaar96e7a6e2017-09-23 19:48:29 +02001011$(OUTDIR)/vimrc.o: vim.rc version.h gui_w32_rc.h
Bram Moolenaar4f7e8212014-11-05 13:53:32 +01001012 $(WINDRES) $(WINDRES_FLAGS) $(DEFINES) \
1013 --input-format=rc --output-format=coff -i vim.rc -o $@
1014
1015$(OUTDIR):
1016 $(MKDIR) $(OUTDIR)
1017
Bram Moolenaar4f7e8212014-11-05 13:53:32 +01001018$(OUTDIR)/gui_dwrite.o: gui_dwrite.cpp $(INCL) gui_dwrite.h
Bram Moolenaarcc6cf9b2016-03-19 20:51:35 +01001019 $(CC) -c $(CFLAGS) $(CXXFLAGS) gui_dwrite.cpp -o $(OUTDIR)/gui_dwrite.o
Bram Moolenaar4f7e8212014-11-05 13:53:32 +01001020
Bram Moolenaar96e7a6e2017-09-23 19:48:29 +02001021$(OUTDIR)/gui.o: gui.c $(INCL) $(GUI_INCL)
1022 $(CC) -c $(CFLAGS) gui.c -o $(OUTDIR)/gui.o
1023
Bram Moolenaarc3719bd2017-11-18 22:13:31 +01001024$(OUTDIR)/beval.o: beval.c $(INCL) $(GUI_INCL)
1025 $(CC) -c $(CFLAGS) beval.c -o $(OUTDIR)/beval.o
1026
Bram Moolenaar96e7a6e2017-09-23 19:48:29 +02001027$(OUTDIR)/gui_beval.o: gui_beval.c $(INCL) $(GUI_INCL)
1028 $(CC) -c $(CFLAGS) gui_beval.c -o $(OUTDIR)/gui_beval.o
1029
1030$(OUTDIR)/gui_w32.o: gui_w32.c $(INCL) $(GUI_INCL)
Bram Moolenaarf80451e2017-07-25 21:49:35 +02001031 $(CC) -c $(CFLAGS) gui_w32.c -o $(OUTDIR)/gui_w32.o
1032
Bram Moolenaar4f7e8212014-11-05 13:53:32 +01001033$(OUTDIR)/if_cscope.o: if_cscope.c $(INCL) if_cscope.h
1034 $(CC) -c $(CFLAGS) if_cscope.c -o $(OUTDIR)/if_cscope.o
1035
Bram Moolenaar96e7a6e2017-09-23 19:48:29 +02001036$(OUTDIR)/if_mzsch.o: if_mzsch.c $(INCL) $(MZSCHEME_INCL) $(MZ_EXTRA_DEP)
Bram Moolenaarf80451e2017-07-25 21:49:35 +02001037 $(CC) -c $(CFLAGS) if_mzsch.c -o $(OUTDIR)/if_mzsch.o
1038
1039mzscheme_base.c:
1040 $(MZSCHEME)/mzc --c-mods mzscheme_base.c ++lib scheme/base
1041
Bram Moolenaar4f7e8212014-11-05 13:53:32 +01001042# Remove -D__IID_DEFINED__ for newer versions of the w32api
Bram Moolenaar96e7a6e2017-09-23 19:48:29 +02001043$(OUTDIR)/if_ole.o: if_ole.cpp $(INCL) if_ole.h
Bram Moolenaarcc6cf9b2016-03-19 20:51:35 +01001044 $(CC) $(CFLAGS) $(CXXFLAGS) -c -o $(OUTDIR)/if_ole.o if_ole.cpp
Bram Moolenaar4f7e8212014-11-05 13:53:32 +01001045
Bram Moolenaar96e7a6e2017-09-23 19:48:29 +02001046if_perl.c: if_perl.xs typemap
Bram Moolenaarf80451e2017-07-25 21:49:35 +02001047 $(XSUBPP) -prototypes -typemap \
1048 $(PERLTYPEMAP) if_perl.xs -output $@
1049
Bram Moolenaar96e7a6e2017-09-23 19:48:29 +02001050$(OUTDIR)/if_ruby.o: if_ruby.c $(INCL)
Bram Moolenaar4f7e8212014-11-05 13:53:32 +01001051ifeq (16, $(RUBY))
1052 $(CC) $(CFLAGS) -U_WIN32 -c -o $(OUTDIR)/if_ruby.o if_ruby.c
1053endif
1054
Bram Moolenaar97ff9b92016-06-26 20:37:46 +02001055$(OUTDIR)/iscygpty.o: iscygpty.c $(CUI_INCL)
Bram Moolenaar2bc127f2016-07-10 13:57:40 +02001056 $(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 +02001057
Bram Moolenaar96e7a6e2017-09-23 19:48:29 +02001058$(OUTDIR)/main.o: main.c $(INCL) $(CUI_INCL)
Bram Moolenaar97ff9b92016-06-26 20:37:46 +02001059 $(CC) -c $(CFLAGS) main.c -o $(OUTDIR)/main.o
1060
Bram Moolenaar4f7e8212014-11-05 13:53:32 +01001061$(OUTDIR)/netbeans.o: netbeans.c $(INCL) $(NBDEBUG_INCL) $(NBDEBUG_SRC)
1062 $(CC) -c $(CFLAGS) netbeans.c -o $(OUTDIR)/netbeans.o
1063
Bram Moolenaar96e7a6e2017-09-23 19:48:29 +02001064$(OUTDIR)/os_win32.o: os_win32.c $(INCL) $(MZSCHEME_INCL)
1065 $(CC) -c $(CFLAGS) os_win32.c -o $(OUTDIR)/os_win32.o
1066
1067$(OUTDIR)/regexp.o: regexp.c regexp_nfa.c $(INCL)
Bram Moolenaar4f7e8212014-11-05 13:53:32 +01001068 $(CC) -c $(CFLAGS) regexp.c -o $(OUTDIR)/regexp.o
1069
Bram Moolenaarf80451e2017-07-25 21:49:35 +02001070$(OUTDIR)/terminal.o: terminal.c $(INCL) $(TERM_DEPS)
1071 $(CC) -c $(CFLAGS) terminal.c -o $(OUTDIR)/terminal.o
Bram Moolenaar4f7e8212014-11-05 13:53:32 +01001072
Bram Moolenaarf80451e2017-07-25 21:49:35 +02001073
Bram Moolenaar6d0826d2017-08-22 22:12:17 +02001074CCCTERM = $(CC) -c $(CFLAGS) -Ilibvterm/include -DINLINE="" \
1075 -DVSNPRINTF=vim_vsnprintf \
1076 -DIS_COMBINING_FUNCTION=utf_iscomposing_uint \
1077 -DWCWIDTH_FUNCTION=utf_uint2cells
1078
Bram Moolenaar78dcd4f2018-09-13 17:23:28 +02001079$(OUTDIR)/encoding.o: libvterm/src/encoding.c $(TERM_DEPS)
Bram Moolenaarf80451e2017-07-25 21:49:35 +02001080 $(CCCTERM) libvterm/src/encoding.c -o $@
1081
Bram Moolenaar78dcd4f2018-09-13 17:23:28 +02001082$(OUTDIR)/keyboard.o: libvterm/src/keyboard.c $(TERM_DEPS)
Bram Moolenaarf80451e2017-07-25 21:49:35 +02001083 $(CCCTERM) libvterm/src/keyboard.c -o $@
1084
Bram Moolenaar78dcd4f2018-09-13 17:23:28 +02001085$(OUTDIR)/mouse.o: libvterm/src/mouse.c $(TERM_DEPS)
Bram Moolenaarf80451e2017-07-25 21:49:35 +02001086 $(CCCTERM) libvterm/src/mouse.c -o $@
1087
Bram Moolenaar78dcd4f2018-09-13 17:23:28 +02001088$(OUTDIR)/parser.o: libvterm/src/parser.c $(TERM_DEPS)
Bram Moolenaarf80451e2017-07-25 21:49:35 +02001089 $(CCCTERM) libvterm/src/parser.c -o $@
1090
Bram Moolenaar78dcd4f2018-09-13 17:23:28 +02001091$(OUTDIR)/pen.o: libvterm/src/pen.c $(TERM_DEPS)
Bram Moolenaarf80451e2017-07-25 21:49:35 +02001092 $(CCCTERM) libvterm/src/pen.c -o $@
1093
Bram Moolenaar78dcd4f2018-09-13 17:23:28 +02001094$(OUTDIR)/termscreen.o: libvterm/src/termscreen.c $(TERM_DEPS)
1095 $(CCCTERM) libvterm/src/termscreen.c -o $@
Bram Moolenaarf80451e2017-07-25 21:49:35 +02001096
Bram Moolenaar78dcd4f2018-09-13 17:23:28 +02001097$(OUTDIR)/state.o: libvterm/src/state.c $(TERM_DEPS)
Bram Moolenaarf80451e2017-07-25 21:49:35 +02001098 $(CCCTERM) libvterm/src/state.c -o $@
1099
Bram Moolenaar78dcd4f2018-09-13 17:23:28 +02001100$(OUTDIR)/unicode.o: libvterm/src/unicode.c $(TERM_DEPS)
Bram Moolenaarf80451e2017-07-25 21:49:35 +02001101 $(CCCTERM) libvterm/src/unicode.c -o $@
1102
Bram Moolenaar78dcd4f2018-09-13 17:23:28 +02001103$(OUTDIR)/vterm.o: libvterm/src/vterm.c $(TERM_DEPS)
Bram Moolenaarf80451e2017-07-25 21:49:35 +02001104 $(CCCTERM) libvterm/src/vterm.c -o $@
1105
Bram Moolenaare828b762018-09-10 17:51:58 +02001106$(OUTDIR)/xdiffi.o: xdiff/xdiffi.c $(XDIFF_DEPS)
1107 $(CC) -c $(CFLAGS) xdiff/xdiffi.c -o $(OUTDIR)/xdiffi.o
1108
1109$(OUTDIR)/xemit.o: xdiff/xemit.c $(XDIFF_DEPS)
1110 $(CC) -c $(CFLAGS) xdiff/xemit.c -o $(OUTDIR)/xemit.o
1111
1112$(OUTDIR)/xprepare.o: xdiff/xprepare.c $(XDIFF_DEPS)
1113 $(CC) -c $(CFLAGS) xdiff/xprepare.c -o $(OUTDIR)/xprepare.o
1114
1115$(OUTDIR)/xutils.o: xdiff/xutils.c $(XDIFF_DEPS)
1116 $(CC) -c $(CFLAGS) xdiff/xutils.c -o $(OUTDIR)/xutils.o
1117
1118$(OUTDIR)/xhistogram.o: xdiff/xhistogram.c $(XDIFF_DEPS)
1119 $(CC) -c $(CFLAGS) xdiff/xhistogram.c -o $(OUTDIR)/xhistogram.o
1120
1121$(OUTDIR)/xpatience.o: xdiff/xpatience.c $(XDIFF_DEPS)
1122 $(CC) -c $(CFLAGS) xdiff/xpatience.c -o $(OUTDIR)/xpatience.o
Bram Moolenaar4f7e8212014-11-05 13:53:32 +01001123
1124pathdef.c: $(INCL)
1125ifneq (sh.exe, $(SHELL))
1126 @echo creating pathdef.c
1127 @echo '/* pathdef.c */' > pathdef.c
1128 @echo '#include "vim.h"' >> pathdef.c
1129 @echo 'char_u *default_vim_dir = (char_u *)"$(VIMRCLOC)";' >> pathdef.c
1130 @echo 'char_u *default_vimruntime_dir = (char_u *)"$(VIMRUNTIMEDIR)";' >> pathdef.c
1131 @echo 'char_u *all_cflags = (char_u *)"$(CC) $(CFLAGS)";' >> pathdef.c
1132 @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
1133 @echo 'char_u *compiled_user = (char_u *)"$(USERNAME)";' >> pathdef.c
1134 @echo 'char_u *compiled_sys = (char_u *)"$(USERDOMAIN)";' >> pathdef.c
1135else
1136 @echo creating pathdef.c
1137 @echo /* pathdef.c */ > pathdef.c
1138 @echo #include "vim.h" >> pathdef.c
1139 @echo char_u *default_vim_dir = (char_u *)"$(VIMRCLOC)"; >> pathdef.c
1140 @echo char_u *default_vimruntime_dir = (char_u *)"$(VIMRUNTIMEDIR)"; >> pathdef.c
1141 @echo char_u *all_cflags = (char_u *)"$(CC) $(CFLAGS)"; >> pathdef.c
1142 @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
1143 @echo char_u *compiled_user = (char_u *)"$(USERNAME)"; >> pathdef.c
1144 @echo char_u *compiled_sys = (char_u *)"$(USERDOMAIN)"; >> pathdef.c
1145endif
Bram Moolenaar96e7a6e2017-09-23 19:48:29 +02001146
1147# vim: set noet sw=8 ts=8 sts=0 wm=0 tw=0: