blob: ca0fa97a3c9b2baeee56e50ec4aa29068fb77d60 [file] [log] [blame]
Bram Moolenaar4f7e8212014-11-05 13:53:32 +01001# Makefile for VIM on Win32 (Cygwin and MinGW)
2#
3# This file contains common part for Cygwin and MinGW and it is included
4# from Make_cyg.mak and Make_ming.mak.
5#
6# Info at http://www.mingw.org
7# Alternative x86 and 64-builds: http://mingw-w64.sourceforge.net
8# Also requires GNU make, which you can download from the same sites.
9# Get missing libraries from http://gnuwin32.sf.net.
10#
11# Tested on Win32 NT 4 and Win95.
12#
13# To make everything, just 'make -f Make_ming.mak'.
14# To make just e.g. gvim.exe, 'make -f Make_ming.mak gvim.exe'.
15# After a run, you can 'make -f Make_ming.mak clean' to clean up.
16#
17# NOTE: Sometimes 'GNU Make' will stop after building vimrun.exe -- I think
18# it's just run out of memory or something. Run again, and it will continue
19# with 'xxd'.
20#
21# "make upx" makes *compressed* versions of the 32 bit GUI and console EXEs,
22# using the excellent UPX compressor:
Bram Moolenaar43cb6262018-03-14 21:39:02 +010023# https://upx.github.io/
Bram Moolenaar4f7e8212014-11-05 13:53:32 +010024# "make mpress" uses the MPRESS compressor for 32- and 64-bit EXEs:
25# http://www.matcode.com/mpress.htm
26#
27# Maintained by Ron Aaron <ronaharon@yahoo.com> et al.
28# Updated 2014 Oct 13.
29
30#>>>>> choose options:
Bram Moolenaar4f7e8212014-11-05 13:53:32 +010031# FEATURES=[TINY | SMALL | NORMAL | BIG | HUGE]
32# Set to TINY to make minimal version (few features).
Bram Moolenaare5f2be62016-01-21 20:24:34 +010033FEATURES=HUGE
Bram Moolenaarcccd62d2018-04-12 20:23:48 +020034
35# set to yes for a debug build
36DEBUG=no
37
38# set to SIZE for size, SPEED for speed, MAXSPEED for maximum optimization
39OPTIMIZE=MAXSPEED
40
41# set to yes to make gvim, no for vim
42GUI=yes
43
44# set to no if you do not want to use DirectWrite (DirectX)
45# MinGW-w64 is needed, and ARCH should be set to i686 or x86-64.
46DIRECTX=yes
47
48# Disable Color emoji support
49# (default is yes if DIRECTX=yes, requires WinSDK 8.1 or later.)
50#COLOR_EMOJI=no
51
Bram Moolenaar4f7e8212014-11-05 13:53:32 +010052# Set to one of i386, i486, i586, i686 as the minimum target processor.
53# For amd64/x64 architecture set ARCH=x86-64 .
Bram Moolenaare0485392016-07-12 21:17:03 +020054# If not set, it will be automatically detected. (Normally i686 or x86-64.)
55#ARCH=i686
Bram Moolenaar4f7e8212014-11-05 13:53:32 +010056# Set to yes to cross-compile from unix; no=native Windows (and Cygwin).
57CROSS=no
Bram Moolenaarcccd62d2018-04-12 20:23:48 +020058
Bram Moolenaar4f7e8212014-11-05 13:53:32 +010059# Set to path to iconv.h and libiconv.a to enable using 'iconv.dll'.
Bram Moolenaarac8069b2017-10-14 20:24:19 +020060# Use "yes" when the path does not need to be define.
Bram Moolenaar4f7e8212014-11-05 13:53:32 +010061#ICONV="."
62ICONV=yes
63GETTEXT=yes
Bram Moolenaarcccd62d2018-04-12 20:23:48 +020064
Bram Moolenaar4f7e8212014-11-05 13:53:32 +010065# Set to yes to include multibyte support.
66MBYTE=yes
Bram Moolenaarcccd62d2018-04-12 20:23:48 +020067
Bram Moolenaar4f7e8212014-11-05 13:53:32 +010068# Set to yes to include IME support.
69IME=yes
70DYNAMIC_IME=yes
Bram Moolenaarcccd62d2018-04-12 20:23:48 +020071
Bram Moolenaar4f7e8212014-11-05 13:53:32 +010072# Set to yes to enable writing a postscript file with :hardcopy.
73POSTSCRIPT=no
Bram Moolenaarcccd62d2018-04-12 20:23:48 +020074
Bram Moolenaar4f7e8212014-11-05 13:53:32 +010075# Set to yes to enable OLE support.
76OLE=no
Bram Moolenaarcccd62d2018-04-12 20:23:48 +020077
Bram Moolenaar304925e2018-06-30 16:27:02 +020078# Set the default $(WINVER). Use 0x0501 to make it work with WinXP.
Bram Moolenaar4f7e8212014-11-05 13:53:32 +010079ifndef WINVER
Bram Moolenaar304925e2018-06-30 16:27:02 +020080# WINVER = 0x0501
81WINVER = 0x0600
Bram Moolenaar4f7e8212014-11-05 13:53:32 +010082endif
Bram Moolenaarcccd62d2018-04-12 20:23:48 +020083
Bram Moolenaar4f7e8212014-11-05 13:53:32 +010084# Set to yes to enable Cscope support.
85CSCOPE=yes
Bram Moolenaarcccd62d2018-04-12 20:23:48 +020086
Bram Moolenaare0874f82016-01-24 20:36:41 +010087# Set to yes to enable Netbeans support (requires CHANNEL).
Bram Moolenaar4f7e8212014-11-05 13:53:32 +010088NETBEANS=$(GUI)
Bram Moolenaarcccd62d2018-04-12 20:23:48 +020089
Bram Moolenaare0874f82016-01-24 20:36:41 +010090# Set to yes to enable inter process communication.
Bram Moolenaar1aa07bd2016-06-03 19:43:16 +020091ifeq (HUGE, $(FEATURES))
92CHANNEL=yes
93else
Bram Moolenaare0874f82016-01-24 20:36:41 +010094CHANNEL=$(GUI)
Bram Moolenaar1aa07bd2016-06-03 19:43:16 +020095endif
Bram Moolenaarcccd62d2018-04-12 20:23:48 +020096
Bram Moolenaar8a773062017-07-24 22:29:21 +020097# Set to yes to enable terminal support.
Bram Moolenaarac8069b2017-10-14 20:24:19 +020098ifeq (HUGE, $(FEATURES))
99TERMINAL=yes
100else
Bram Moolenaar4fc63502017-07-19 11:28:17 +0200101TERMINAL=no
Bram Moolenaarac8069b2017-10-14 20:24:19 +0200102endif
Bram Moolenaar4f7e8212014-11-05 13:53:32 +0100103
Bram Moolenaar9ac9dfa2017-09-01 18:41:26 +0200104ifndef CTAGS
105# this assumes ctags is Exuberant ctags
106CTAGS = ctags -I INIT+ --fields=+S
107endif
Bram Moolenaar4f7e8212014-11-05 13:53:32 +0100108
109# Link against the shared version of libstdc++ by default. Set
110# STATIC_STDCPLUS to "yes" to link against static version instead.
111ifndef STATIC_STDCPLUS
112STATIC_STDCPLUS=no
113endif
114
Bram Moolenaare3af7632016-12-01 20:37:47 +0100115
116# Link against the shared version of libwinpthread by default. Set
117# STATIC_WINPTHREAD to "yes" to link against static version instead.
118ifndef STATIC_WINPTHREAD
119STATIC_WINPTHREAD=$(STATIC_STDCPLUS)
120endif
121
Bram Moolenaar4f7e8212014-11-05 13:53:32 +0100122# If the user doesn't want gettext, undefine it.
123ifeq (no, $(GETTEXT))
124GETTEXT=
125endif
126# Added by E.F. Amatria <eferna1@platea.ptic.mec.es> 2001 Feb 23
127# Uncomment the first line and one of the following three if you want Native Language
128# Support. You'll need gnu_gettext.win32, a MINGW32 Windows PORT of gettext by
129# Franco Bez <franco.bez@gmx.de>. It may be found at
130# http://home.a-city.de/franco.bez/gettext/gettext_win32_en.html
131# Tested with mingw32 with GCC-2.95.2 on Win98
132# Updated 2001 Jun 9
133#GETTEXT=c:/gettext.win32.msvcrt
134#STATIC_GETTEXT=USE_STATIC_GETTEXT
135#DYNAMIC_GETTEXT=USE_GETTEXT_DLL
136#DYNAMIC_GETTEXT=USE_SAFE_GETTEXT_DLL
137SAFE_GETTEXT_DLL_OBJ = $(GETTEXT)/src/safe_gettext_dll/safe_gettext_dll.o
138# Alternatively, if you uncomment the two following lines, you get a "safe" version
139# without linking the safe_gettext_dll.o object file.
140#DYNAMIC_GETTEXT=DYNAMIC_GETTEXT
141#GETTEXT_DYNAMIC=gnu_gettext.dll
142INTLPATH=$(GETTEXT)/lib/mingw32
143INTLLIB=gnu_gettext
144
145# If you are using gettext-0.10.35 from http://sourceforge.net/projects/gettext
146# or gettext-0.10.37 from http://sourceforge.net/projects/mingwrep/
147# uncomment the following, but I can't build a static version with them, ?-(|
148#GETTEXT=c:/gettext-0.10.37-20010430
149#STATIC_GETTEXT=USE_STATIC_GETTEXT
150#DYNAMIC_GETTEXT=DYNAMIC_GETTEXT
151#INTLPATH=$(GETTEXT)/lib
152#INTLLIB=intl
153
Bram Moolenaare0485392016-07-12 21:17:03 +0200154
155# Command definitions (depends on cross-compiling and shell)
156ifeq ($(CROSS),yes)
157# cross-compiler prefix:
158ifndef CROSS_COMPILE
159CROSS_COMPILE = i586-pc-mingw32msvc-
160endif
161DEL = rm
162MKDIR = mkdir -p
163DIRSLASH = /
164else
165# normal (Windows) compilation:
166ifndef CROSS_COMPILE
167CROSS_COMPILE =
168endif
Bram Moolenaare828b762018-09-10 17:51:58 +0200169
170# About the "sh.exe" condition, as explained by Ken Takata:
171#
172# If the makefile is executed with mingw32-make and sh.exe is not found in
173# $PATH, then $SHELL is set to "sh.exe" (without any path). In this case,
174# unix-like commands might not work and a dos-style path is needed.
175#
176# If the makefile is executed with mingw32-make and sh.exe IS found in $PATH,
177# then $SHELL is set with the actual path of sh.exe (e.g.
178# "C:/msys64/usr/bin/sh.exe"). In this case, unix-like commands can be used.
179#
180# If it is executed by the "make" command from cmd.exe, $SHELL is set to
181# "/bin/sh". If the "make" command is in the $PATH, other unix-like commands
182# might also work.
183#
184# If it is executed by the "make" command from a unix-like shell,
185# $SHELL is set with the unix-style path (e.g. "/bin/bash").
186# In this case, unix-like commands can be used.
187#
Bram Moolenaare0485392016-07-12 21:17:03 +0200188ifneq (sh.exe, $(SHELL))
189DEL = rm
190MKDIR = mkdir -p
191DIRSLASH = /
192else
193DEL = del
194MKDIR = mkdir
195DIRSLASH = \\
196endif
197endif
198CC := $(CROSS_COMPILE)gcc
199CXX := $(CROSS_COMPILE)g++
200ifeq ($(UNDER_CYGWIN),yes)
201WINDRES := $(CROSS_COMPILE)windres
202else
203WINDRES := windres
204endif
205WINDRES_CC = $(CC)
206
207# Get the default ARCH.
208ifndef ARCH
Bram Moolenaarf62e7972016-07-14 20:25:03 +0200209ARCH := $(shell $(CC) -dumpmachine | sed -e 's/-.*//' -e 's/_/-/' -e 's/^mingw32$$/i686/')
Bram Moolenaare0485392016-07-12 21:17:03 +0200210endif
211
212
Bram Moolenaar4f7e8212014-11-05 13:53:32 +0100213# Perl interface:
214# PERL=[Path to Perl directory] (Set inside Make_cyg.mak or Make_ming.mak)
215# DYNAMIC_PERL=yes (to load the Perl DLL dynamically)
Bram Moolenaar0eaadec2016-09-08 20:28:45 +0200216# PERL_VER=[Perl version, eg 56, 58, 510] (default is 524)
Bram Moolenaar4f7e8212014-11-05 13:53:32 +0100217ifdef PERL
218ifndef PERL_VER
Bram Moolenaar0eaadec2016-09-08 20:28:45 +0200219PERL_VER=524
Bram Moolenaar4f7e8212014-11-05 13:53:32 +0100220endif
221ifndef DYNAMIC_PERL
222DYNAMIC_PERL=yes
223endif
224# on Linux, for cross-compile, it's here:
225#PERLLIB=/home/ron/ActivePerl/lib
226# on NT, it's here:
227PERLEXE=$(PERL)/bin/perl
228PERLLIB=$(PERL)/lib
229PERLLIBS=$(PERLLIB)/Core
230ifeq ($(UNDER_CYGWIN),yes)
231PERLTYPEMAP:=$(shell cygpath -m $(PERLLIB)/ExtUtils/typemap)
232XSUBPPTRY:=$(shell cygpath -m $(PERLLIB)/ExtUtils/xsubpp)
233else
234PERLTYPEMAP=$(PERLLIB)/ExtUtils/typemap
235XSUBPPTRY=$(PERLLIB)/ExtUtils/xsubpp
236endif
237XSUBPP_EXISTS=$(shell $(PERLEXE) -e "print 1 unless -e '$(XSUBPPTRY)'")
238ifeq "$(XSUBPP_EXISTS)" ""
Bram Moolenaar345326a2014-11-06 10:03:01 +0100239XSUBPP=$(PERLEXE) $(XSUBPPTRY)
Bram Moolenaar4f7e8212014-11-05 13:53:32 +0100240else
241XSUBPP=xsubpp
242endif
243endif
244
245# Lua interface:
246# LUA=[Path to Lua directory] (Set inside Make_cyg.mak or Make_ming.mak)
Bram Moolenaarb872e632018-09-21 13:44:09 +0200247# LUA_LIBDIR=[Path to Lua library directory] (default: $LUA/lib)
248# LUA_INCDIR=[Path to Lua include directory] (default: $LUA/include)
Bram Moolenaar4f7e8212014-11-05 13:53:32 +0100249# DYNAMIC_LUA=yes (to load the Lua DLL dynamically)
Bram Moolenaar0eaadec2016-09-08 20:28:45 +0200250# LUA_VER=[Lua version, eg 51, 52] (default is 53)
Bram Moolenaar4f7e8212014-11-05 13:53:32 +0100251ifdef LUA
252ifndef DYNAMIC_LUA
253DYNAMIC_LUA=yes
254endif
255
256ifndef LUA_VER
Bram Moolenaar0eaadec2016-09-08 20:28:45 +0200257LUA_VER=53
Bram Moolenaar4f7e8212014-11-05 13:53:32 +0100258endif
259
260ifeq (no,$(DYNAMIC_LUA))
Bram Moolenaarb872e632018-09-21 13:44:09 +0200261LUA_LIBDIR = $(LUA)/lib
262LUA_LIB = -L$(LUA_LIBDIR) -llua
Bram Moolenaar4f7e8212014-11-05 13:53:32 +0100263endif
264
265endif
266
267# MzScheme interface:
268# MZSCHEME=[Path to MzScheme directory] (Set inside Make_cyg.mak or Make_ming.mak)
269# DYNAMIC_MZSCHEME=yes (to load the MzScheme DLL dynamically)
Bram Moolenaar0eaadec2016-09-08 20:28:45 +0200270# MZSCHEME_VER=[MzScheme version] (default is 3m_a0solc (6.6))
Bram Moolenaarf16c71b2017-09-18 20:01:02 +0200271# Used for the DLL file name. E.g.:
272# C:\Program Files (x86)\Racket\lib\libracket3m_XXXXXX.dll
Bram Moolenaar4f7e8212014-11-05 13:53:32 +0100273# MZSCHEME_DEBUG=no
274ifdef MZSCHEME
275ifndef DYNAMIC_MZSCHEME
276DYNAMIC_MZSCHEME=yes
277endif
278
279ifndef MZSCHEME_VER
Bram Moolenaar0eaadec2016-09-08 20:28:45 +0200280MZSCHEME_VER=3m_a0solc
Bram Moolenaar4f7e8212014-11-05 13:53:32 +0100281endif
282
Bram Moolenaar4f7e8212014-11-05 13:53:32 +0100283# for version 4.x we need to generate byte-code for Scheme base
284ifndef MZSCHEME_GENERATE_BASE
285MZSCHEME_GENERATE_BASE=no
286endif
287
Bram Moolenaar4e640bd2016-01-16 16:20:38 +0100288ifneq ($(wildcard $(MZSCHEME)/lib/msvc/libmzsch$(MZSCHEME_VER).lib),)
Bram Moolenaar4f7e8212014-11-05 13:53:32 +0100289MZSCHEME_MAIN_LIB=mzsch
290else
291MZSCHEME_MAIN_LIB=racket
292endif
293
Bram Moolenaar4e640bd2016-01-16 16:20:38 +0100294ifndef MZSCHEME_PRECISE_GC
295MZSCHEME_PRECISE_GC=no
296ifneq ($(wildcard $(MZSCHEME)\lib\lib$(MZSCHEME_MAIN_LIB)$(MZSCHEME_VER).dll),)
297ifeq ($(wildcard $(MZSCHEME)\lib\libmzgc$(MZSCHEME_VER).dll),)
298MZSCHEME_PRECISE_GC=yes
299endif
300else
301ifneq ($(wildcard $(MZSCHEME)\lib\msvc\lib$(MZSCHEME_MAIN_LIB)$(MZSCHEME_VER).lib),)
302ifeq ($(wildcard $(MZSCHEME)\lib\msvc\libmzgc$(MZSCHEME_VER).lib),)
303MZSCHEME_PRECISE_GC=yes
304endif
305endif
306endif
307endif
308
Bram Moolenaar4f7e8212014-11-05 13:53:32 +0100309ifeq (no,$(DYNAMIC_MZSCHEME))
310ifeq (yes,$(MZSCHEME_PRECISE_GC))
311MZSCHEME_LIB=-l$(MZSCHEME_MAIN_LIB)$(MZSCHEME_VER)
312else
Bram Moolenaar4e640bd2016-01-16 16:20:38 +0100313MZSCHEME_LIB=-l$(MZSCHEME_MAIN_LIB)$(MZSCHEME_VER) -lmzgc$(MZSCHEME_VER)
Bram Moolenaar4f7e8212014-11-05 13:53:32 +0100314endif
315# the modern MinGW can dynamically link to dlls directly.
316# point MZSCHEME_DLLS to where you put libmzschXXXXXXX.dll and libgcXXXXXXX.dll
317ifndef MZSCHEME_DLLS
318MZSCHEME_DLLS=$(MZSCHEME)
319endif
320MZSCHEME_LIBDIR=-L$(MZSCHEME_DLLS) -L$(MZSCHEME_DLLS)\lib
321endif
322
323endif
324
325# Python interface:
326# PYTHON=[Path to Python directory] (Set inside Make_cyg.mak or Make_ming.mak)
327# DYNAMIC_PYTHON=yes (to load the Python DLL dynamically)
Bram Moolenaar0eaadec2016-09-08 20:28:45 +0200328# PYTHON_VER=[Python version, eg 22, 23, ..., 27] (default is 27)
Bram Moolenaar4f7e8212014-11-05 13:53:32 +0100329ifdef PYTHON
330ifndef DYNAMIC_PYTHON
331DYNAMIC_PYTHON=yes
332endif
333
334ifndef PYTHON_VER
Bram Moolenaar3c6f92e2016-01-02 20:26:36 +0100335PYTHON_VER=27
336endif
337ifndef DYNAMIC_PYTHON_DLL
338DYNAMIC_PYTHON_DLL=python$(PYTHON_VER).dll
339endif
340ifdef PYTHON_HOME
341PYTHON_HOME_DEF=-DPYTHON_HOME=\"$(PYTHON_HOME)\"
Bram Moolenaar4f7e8212014-11-05 13:53:32 +0100342endif
343
344ifeq (no,$(DYNAMIC_PYTHON))
345PYTHONLIB=-L$(PYTHON)/libs -lpython$(PYTHON_VER)
346endif
347# my include files are in 'win32inc' on Linux, and 'include' in the standard
348# NT distro (ActiveState)
Bram Moolenaar3c6f92e2016-01-02 20:26:36 +0100349ifndef PYTHONINC
Bram Moolenaar4f7e8212014-11-05 13:53:32 +0100350ifeq ($(CROSS),no)
351PYTHONINC=-I $(PYTHON)/include
352else
353PYTHONINC=-I $(PYTHON)/win32inc
354endif
355endif
Bram Moolenaar3c6f92e2016-01-02 20:26:36 +0100356endif
Bram Moolenaar4f7e8212014-11-05 13:53:32 +0100357
358# Python3 interface:
359# PYTHON3=[Path to Python3 directory] (Set inside Make_cyg.mak or Make_ming.mak)
360# DYNAMIC_PYTHON3=yes (to load the Python3 DLL dynamically)
Bram Moolenaar59eb0162017-12-10 18:17:44 +0100361# PYTHON3_VER=[Python3 version, eg 31, 32] (default is 36)
Bram Moolenaar4f7e8212014-11-05 13:53:32 +0100362ifdef PYTHON3
363ifndef DYNAMIC_PYTHON3
364DYNAMIC_PYTHON3=yes
365endif
366
367ifndef PYTHON3_VER
Bram Moolenaar59eb0162017-12-10 18:17:44 +0100368PYTHON3_VER=36
Bram Moolenaar4f7e8212014-11-05 13:53:32 +0100369endif
Bram Moolenaara7c37952016-01-20 22:23:15 +0100370ifndef DYNAMIC_PYTHON3_DLL
371DYNAMIC_PYTHON3_DLL=python$(PYTHON3_VER).dll
372endif
373ifdef PYTHON3_HOME
Bram Moolenaaracd58ef2016-02-16 13:42:24 +0100374PYTHON3_HOME_DEF=-DPYTHON3_HOME=L\"$(PYTHON3_HOME)\"
Bram Moolenaar4f7e8212014-11-05 13:53:32 +0100375endif
376
Bram Moolenaara7c37952016-01-20 22:23:15 +0100377ifeq (no,$(DYNAMIC_PYTHON3))
378PYTHON3LIB=-L$(PYTHON3)/libs -lpython$(PYTHON3_VER)
379endif
380
381ifndef PYTHON3INC
Bram Moolenaar4f7e8212014-11-05 13:53:32 +0100382ifeq ($(CROSS),no)
383PYTHON3INC=-I $(PYTHON3)/include
384else
385PYTHON3INC=-I $(PYTHON3)/win32inc
386endif
387endif
Bram Moolenaara7c37952016-01-20 22:23:15 +0100388endif
Bram Moolenaar4f7e8212014-11-05 13:53:32 +0100389
390# TCL interface:
391# TCL=[Path to TCL directory] (Set inside Make_cyg.mak or Make_ming.mak)
392# DYNAMIC_TCL=yes (to load the TCL DLL dynamically)
Bram Moolenaar0eaadec2016-09-08 20:28:45 +0200393# TCL_VER=[TCL version, eg 83, 84] (default is 86)
394# TCL_VER_LONG=[Tcl version, eg 8.3] (default is 8.6)
Bram Moolenaareca99bd2016-01-07 22:50:05 +0100395# You must set TCL_VER_LONG when you set TCL_VER.
Bram Moolenaar77f74742017-08-23 22:40:41 +0200396# TCL_DLL=[TCL dll name, eg tcl86.dll] (default is tcl86.dll)
Bram Moolenaar4f7e8212014-11-05 13:53:32 +0100397ifdef TCL
398ifndef DYNAMIC_TCL
399DYNAMIC_TCL=yes
400endif
401ifndef TCL_VER
Bram Moolenaar0eaadec2016-09-08 20:28:45 +0200402TCL_VER = 86
Bram Moolenaar4f7e8212014-11-05 13:53:32 +0100403endif
Bram Moolenaareca99bd2016-01-07 22:50:05 +0100404ifndef TCL_VER_LONG
Bram Moolenaar0eaadec2016-09-08 20:28:45 +0200405TCL_VER_LONG = 8.6
Bram Moolenaareca99bd2016-01-07 22:50:05 +0100406endif
Bram Moolenaar77f74742017-08-23 22:40:41 +0200407ifndef TCL_DLL
408TCL_DLL = tcl$(TCL_VER).dll
409endif
Bram Moolenaar4f7e8212014-11-05 13:53:32 +0100410TCLINC += -I$(TCL)/include
411endif
412
413
414# Ruby interface:
415# RUBY=[Path to Ruby directory] (Set inside Make_cyg.mak or Make_ming.mak)
Bram Moolenaar61766972018-04-20 22:31:41 +0200416# DYNAMIC_RUBY=yes (to load the Ruby DLL dynamically, "no" for static)
Bram Moolenaar6384c5d2016-09-06 22:06:35 +0200417# RUBY_VER=[Ruby version, eg 19, 22] (default is 22)
418# RUBY_API_VER_LONG=[Ruby API version, eg 1.8, 1.9.1, 2.2.0]
419# (default is 2.2.0)
420# You must set RUBY_API_VER_LONG when changing RUBY_VER.
Bram Moolenaar4f7e8212014-11-05 13:53:32 +0100421# Note: If you use Ruby 1.9.3, set as follows:
422# RUBY_VER=19
Bram Moolenaar6384c5d2016-09-06 22:06:35 +0200423# 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 +0100424ifdef RUBY
425ifndef DYNAMIC_RUBY
426DYNAMIC_RUBY=yes
427endif
428# Set default value
429ifndef RUBY_VER
Bram Moolenaar6384c5d2016-09-06 22:06:35 +0200430RUBY_VER = 22
Bram Moolenaar4f7e8212014-11-05 13:53:32 +0100431endif
432ifndef RUBY_VER_LONG
Bram Moolenaar6384c5d2016-09-06 22:06:35 +0200433RUBY_VER_LONG = 2.2.0
434endif
435ifndef RUBY_API_VER_LONG
Bram Moolenaar0eaadec2016-09-08 20:28:45 +0200436RUBY_API_VER_LONG = $(RUBY_VER_LONG)
Bram Moolenaar4f7e8212014-11-05 13:53:32 +0100437endif
438ifndef RUBY_API_VER
Bram Moolenaar6384c5d2016-09-06 22:06:35 +0200439RUBY_API_VER = $(subst .,,$(RUBY_API_VER_LONG))
Bram Moolenaar4f7e8212014-11-05 13:53:32 +0100440endif
441
442ifndef RUBY_PLATFORM
443ifeq ($(RUBY_VER), 16)
444RUBY_PLATFORM = i586-mswin32
445else
Bram Moolenaar6384c5d2016-09-06 22:06:35 +0200446ifneq ($(wildcard $(RUBY)/lib/ruby/$(RUBY_API_VER_LONG)/i386-mingw32),)
Bram Moolenaar4f7e8212014-11-05 13:53:32 +0100447RUBY_PLATFORM = i386-mingw32
448else
Bram Moolenaar6384c5d2016-09-06 22:06:35 +0200449ifneq ($(wildcard $(RUBY)/lib/ruby/$(RUBY_API_VER_LONG)/x64-mingw32),)
Bram Moolenaar4f7e8212014-11-05 13:53:32 +0100450RUBY_PLATFORM = x64-mingw32
451else
452RUBY_PLATFORM = i386-mswin32
453endif
454endif
455endif
456endif
457
458ifndef RUBY_INSTALL_NAME
459ifeq ($(RUBY_VER), 16)
460RUBY_INSTALL_NAME = mswin32-ruby$(RUBY_API_VER)
461else
Bram Moolenaar0bee2fe2016-01-07 22:45:09 +0100462ifndef RUBY_MSVCRT_NAME
463# Base name of msvcrXX.dll which is used by ruby's dll.
464RUBY_MSVCRT_NAME = msvcrt
465endif
Bram Moolenaar4f7e8212014-11-05 13:53:32 +0100466ifeq ($(ARCH),x86-64)
Bram Moolenaar0bee2fe2016-01-07 22:45:09 +0100467RUBY_INSTALL_NAME = x64-$(RUBY_MSVCRT_NAME)-ruby$(RUBY_API_VER)
Bram Moolenaar4f7e8212014-11-05 13:53:32 +0100468else
Bram Moolenaar0bee2fe2016-01-07 22:45:09 +0100469RUBY_INSTALL_NAME = $(RUBY_MSVCRT_NAME)-ruby$(RUBY_API_VER)
Bram Moolenaar4f7e8212014-11-05 13:53:32 +0100470endif
471endif
472endif
473
474ifeq (19, $(word 1,$(sort 19 $(RUBY_VER))))
475RUBY_19_OR_LATER = 1
476endif
477
Bram Moolenaar4f7e8212014-11-05 13:53:32 +0100478ifdef RUBY_19_OR_LATER
Bram Moolenaar76c612a2018-09-21 14:31:51 +0200479RUBYINC = -I $(RUBY)/include/ruby-$(RUBY_API_VER_LONG) -I $(RUBY)/include/ruby-$(RUBY_API_VER_LONG)/$(RUBY_PLATFORM)
480else
481RUBYINC = -I $(RUBY)/lib/ruby/$(RUBY_API_VER_LONG)/$(RUBY_PLATFORM)
Bram Moolenaar4f7e8212014-11-05 13:53:32 +0100482endif
483ifeq (no, $(DYNAMIC_RUBY))
484RUBYLIB = -L$(RUBY)/lib -l$(RUBY_INSTALL_NAME)
485endif
486
487endif # RUBY
488
489# See feature.h for a list of options.
490# Any other defines can be included here.
491DEF_GUI=-DFEAT_GUI_W32 -DFEAT_CLIPBOARD
492DEFINES=-DWIN32 -DWINVER=$(WINVER) -D_WIN32_WINNT=$(WINVER) \
Bram Moolenaar22fcfad2016-07-01 18:17:26 +0200493 -DHAVE_PATHDEF -DFEAT_$(FEATURES) -DHAVE_STDINT_H
Bram Moolenaar4f7e8212014-11-05 13:53:32 +0100494ifeq ($(ARCH),x86-64)
495DEFINES+=-DMS_WIN64
496endif
Bram Moolenaar4f7e8212014-11-05 13:53:32 +0100497
498#>>>>> end of choices
499###########################################################################
500
Bram Moolenaara971df82016-02-15 21:22:10 +0100501CFLAGS = -Iproto $(DEFINES) -pipe -march=$(ARCH) -Wall
Bram Moolenaar6c0e9842016-03-22 20:42:31 +0100502CXXFLAGS = -std=gnu++11
Bram Moolenaar4f7e8212014-11-05 13:53:32 +0100503WINDRES_FLAGS = --preprocessor="$(WINDRES_CC) -E -xc" -DRC_INVOKED
504EXTRA_LIBS =
505
506ifdef GETTEXT
507DEFINES += -DHAVE_GETTEXT -DHAVE_LOCALE_H
508GETTEXTINCLUDE = $(GETTEXT)/include
509GETTEXTLIB = $(INTLPATH)
510ifeq (yes, $(GETTEXT))
511DEFINES += -DDYNAMIC_GETTEXT
512else
513ifdef DYNAMIC_GETTEXT
514DEFINES += -D$(DYNAMIC_GETTEXT)
515ifdef GETTEXT_DYNAMIC
516DEFINES += -DGETTEXT_DYNAMIC -DGETTEXT_DLL=\"$(GETTEXT_DYNAMIC)\"
517endif
518endif
519endif
520endif
521
522ifdef PERL
Bram Moolenaar367fbf12015-06-25 16:13:46 +0200523CFLAGS += -I$(PERLLIBS) -DFEAT_PERL -DPERL_IMPLICIT_CONTEXT -DPERL_IMPLICIT_SYS
Bram Moolenaar4f7e8212014-11-05 13:53:32 +0100524ifeq (yes, $(DYNAMIC_PERL))
525CFLAGS += -DDYNAMIC_PERL -DDYNAMIC_PERL_DLL=\"perl$(PERL_VER).dll\"
526EXTRA_LIBS += -L$(PERLLIBS) -lperl$(PERL_VER)
527endif
528endif
529
530ifdef LUA
Bram Moolenaarb872e632018-09-21 13:44:09 +0200531LUA_INCDIR = $(LUA)/include
532CFLAGS += -I$(LUA_INCDIR) -I$(LUA) -DFEAT_LUA
Bram Moolenaar4f7e8212014-11-05 13:53:32 +0100533ifeq (yes, $(DYNAMIC_LUA))
534CFLAGS += -DDYNAMIC_LUA -DDYNAMIC_LUA_DLL=\"lua$(LUA_VER).dll\"
535endif
536endif
537
538ifdef MZSCHEME
Bram Moolenaar4e640bd2016-01-16 16:20:38 +0100539ifndef MZSCHEME_COLLECTS
540MZSCHEME_COLLECTS=$(MZSCHEME)/collects
541ifeq (yes, $(UNDER_CYGWIN))
542MZSCHEME_COLLECTS:=$(shell cygpath -m $(MZSCHEME_COLLECTS) | sed -e 's/ /\\ /g')
543endif
544endif
545CFLAGS += -I$(MZSCHEME)/include -DFEAT_MZSCHEME -DMZSCHEME_COLLECTS=\"$(MZSCHEME_COLLECTS)\"
Bram Moolenaar4f7e8212014-11-05 13:53:32 +0100546ifeq (yes, $(DYNAMIC_MZSCHEME))
Bram Moolenaar4e640bd2016-01-16 16:20:38 +0100547ifeq (yes, $(MZSCHEME_PRECISE_GC))
548# Precise GC does not use separate dll
549CFLAGS += -DDYNAMIC_MZSCHEME -DDYNAMIC_MZSCH_DLL=\"lib$(MZSCHEME_MAIN_LIB)$(MZSCHEME_VER).dll\" -DDYNAMIC_MZGC_DLL=\"lib$(MZSCHEME_MAIN_LIB)$(MZSCHEME_VER).dll\"
550else
Bram Moolenaar4f7e8212014-11-05 13:53:32 +0100551CFLAGS += -DDYNAMIC_MZSCHEME -DDYNAMIC_MZSCH_DLL=\"lib$(MZSCHEME_MAIN_LIB)$(MZSCHEME_VER).dll\" -DDYNAMIC_MZGC_DLL=\"libmzgc$(MZSCHEME_VER).dll\"
552endif
Bram Moolenaar4e640bd2016-01-16 16:20:38 +0100553endif
Bram Moolenaar4f7e8212014-11-05 13:53:32 +0100554ifeq (yes, "$(MZSCHEME_DEBUG)")
555CFLAGS += -DMZSCHEME_FORCE_GC
556endif
557endif
558
559ifdef RUBY
560CFLAGS += -DFEAT_RUBY $(RUBYINC)
561ifeq (yes, $(DYNAMIC_RUBY))
562CFLAGS += -DDYNAMIC_RUBY -DDYNAMIC_RUBY_DLL=\"$(RUBY_INSTALL_NAME).dll\"
563CFLAGS += -DDYNAMIC_RUBY_VER=$(RUBY_VER)
564endif
Bram Moolenaar259a90f2018-04-21 19:08:55 +0200565ifeq (no, $(DYNAMIC_RUBY))
566CFLAGS += -DRUBY_VERSION=$(RUBY_VER)
567endif
Bram Moolenaar4f7e8212014-11-05 13:53:32 +0100568ifneq ($(findstring w64-mingw32,$(CC)),)
569# A workaround for MinGW-w64
570CFLAGS += -DHAVE_STRUCT_TIMESPEC -DHAVE_STRUCT_TIMEZONE
571endif
572endif
573
574ifdef PYTHON
Bram Moolenaar223b7232016-02-19 19:43:49 +0100575CFLAGS += -DFEAT_PYTHON
Bram Moolenaar4f7e8212014-11-05 13:53:32 +0100576ifeq (yes, $(DYNAMIC_PYTHON))
Bram Moolenaar449538c2016-01-09 17:49:15 +0100577CFLAGS += -DDYNAMIC_PYTHON -DDYNAMIC_PYTHON_DLL=\"$(DYNAMIC_PYTHON_DLL)\"
Bram Moolenaar4f7e8212014-11-05 13:53:32 +0100578endif
579endif
580
Bram Moolenaar223b7232016-02-19 19:43:49 +0100581ifdef PYTHON3
582CFLAGS += -DFEAT_PYTHON3
Bram Moolenaar4f7e8212014-11-05 13:53:32 +0100583ifeq (yes, $(DYNAMIC_PYTHON3))
Bram Moolenaara7c37952016-01-20 22:23:15 +0100584CFLAGS += -DDYNAMIC_PYTHON3 -DDYNAMIC_PYTHON3_DLL=\"$(DYNAMIC_PYTHON3_DLL)\"
Bram Moolenaar4f7e8212014-11-05 13:53:32 +0100585endif
586endif
587
588ifdef TCL
589CFLAGS += -DFEAT_TCL $(TCLINC)
590ifeq (yes, $(DYNAMIC_TCL))
Bram Moolenaar77f74742017-08-23 22:40:41 +0200591CFLAGS += -DDYNAMIC_TCL -DDYNAMIC_TCL_DLL=\"$(TCL_DLL)\" -DDYNAMIC_TCL_VER=\"$(TCL_VER_LONG)\"
Bram Moolenaar4f7e8212014-11-05 13:53:32 +0100592endif
593endif
594
595ifeq ($(POSTSCRIPT),yes)
596DEFINES += -DMSWINPS
597endif
598
599ifeq (yes, $(OLE))
600DEFINES += -DFEAT_OLE
601endif
602
603ifeq ($(CSCOPE),yes)
604DEFINES += -DFEAT_CSCOPE
605endif
606
607ifeq ($(NETBEANS),yes)
608# Only allow NETBEANS for a GUI build.
609ifeq (yes, $(GUI))
610DEFINES += -DFEAT_NETBEANS_INTG
611
612ifeq ($(NBDEBUG), yes)
613DEFINES += -DNBDEBUG
614NBDEBUG_INCL = nbdebug.h
615NBDEBUG_SRC = nbdebug.c
616endif
617endif
618endif
619
Bram Moolenaare0874f82016-01-24 20:36:41 +0100620ifeq ($(CHANNEL),yes)
Bram Moolenaar509ce2a2016-03-11 22:52:15 +0100621DEFINES += -DFEAT_JOB_CHANNEL
Bram Moolenaare0874f82016-01-24 20:36:41 +0100622endif
623
Bram Moolenaar4fc63502017-07-19 11:28:17 +0200624ifeq ($(TERMINAL),yes)
625DEFINES += -DFEAT_TERMINAL
Bram Moolenaarf80451e2017-07-25 21:49:35 +0200626TERM_DEPS = \
627 libvterm/include/vterm.h \
628 libvterm/include/vterm_keycodes.h \
629 libvterm/src/rect.h \
630 libvterm/src/utf8.h \
631 libvterm/src/vterm_internal.h
Bram Moolenaar4fc63502017-07-19 11:28:17 +0200632endif
633
Bram Moolenaar4f7e8212014-11-05 13:53:32 +0100634# DirectWrite (DirectX)
635ifeq ($(DIRECTX),yes)
636# Only allow DirectWrite for a GUI build.
637ifeq (yes, $(GUI))
Bram Moolenaarcccd62d2018-04-12 20:23:48 +0200638DEFINES += -DFEAT_DIRECTX -DDYNAMIC_DIRECTX
639ifneq ($(COLOR_EMOJI),no)
640DEFINES += -DFEAT_DIRECTX_COLOR_EMOJI
641endif
Bram Moolenaar4f7e8212014-11-05 13:53:32 +0100642endif
643endif
644
645# Only allow XPM for a GUI build.
646ifeq (yes, $(GUI))
647
648ifndef XPM
649ifeq ($(ARCH),i386)
650XPM = xpm/x86
651endif
652ifeq ($(ARCH),i486)
653XPM = xpm/x86
654endif
655ifeq ($(ARCH),i586)
656XPM = xpm/x86
657endif
658ifeq ($(ARCH),i686)
659XPM = xpm/x86
660endif
661ifeq ($(ARCH),x86-64)
662XPM = xpm/x64
663endif
664endif
665ifdef XPM
666ifneq ($(XPM),no)
667CFLAGS += -DFEAT_XPM_W32 -I $(XPM)/include -I $(XPM)/../include
668endif
669endif
670
671endif
672
673ifeq ($(DEBUG),yes)
674CFLAGS += -g -fstack-check
675DEBUG_SUFFIX=d
676else
677ifeq ($(OPTIMIZE), SIZE)
678CFLAGS += -Os
679else
680ifeq ($(OPTIMIZE), MAXSPEED)
681CFLAGS += -O3
682CFLAGS += -fomit-frame-pointer -freg-struct-return
683else # SPEED
684CFLAGS += -O2
685endif
686endif
687CFLAGS += -s
688endif
689
Bram Moolenaar828c3d72018-06-19 18:58:07 +0200690LIB = -lkernel32 -luser32 -lgdi32 -ladvapi32 -lcomdlg32 -lcomctl32 -lnetapi32 -lversion
Bram Moolenaar4f7e8212014-11-05 13:53:32 +0100691GUIOBJ = $(OUTDIR)/gui.o $(OUTDIR)/gui_w32.o $(OUTDIR)/gui_beval.o $(OUTDIR)/os_w32exe.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 Moolenaarc3719bd2017-11-18 22:13:31 +0100695 $(OUTDIR)/beval.o \
Bram Moolenaar4f7e8212014-11-05 13:53:32 +0100696 $(OUTDIR)/blowfish.o \
697 $(OUTDIR)/buffer.o \
698 $(OUTDIR)/charset.o \
699 $(OUTDIR)/crypt.o \
700 $(OUTDIR)/crypt_zip.o \
Bram Moolenaar6583c442016-07-17 18:41:47 +0200701 $(OUTDIR)/dict.o \
Bram Moolenaar4f7e8212014-11-05 13:53:32 +0100702 $(OUTDIR)/diff.o \
703 $(OUTDIR)/digraph.o \
704 $(OUTDIR)/edit.o \
705 $(OUTDIR)/eval.o \
Bram Moolenaar73dad1e2016-07-17 22:13:49 +0200706 $(OUTDIR)/evalfunc.o \
Bram Moolenaar4f7e8212014-11-05 13:53:32 +0100707 $(OUTDIR)/ex_cmds.o \
708 $(OUTDIR)/ex_cmds2.o \
709 $(OUTDIR)/ex_docmd.o \
710 $(OUTDIR)/ex_eval.o \
711 $(OUTDIR)/ex_getln.o \
Bram Moolenaar75464dc2016-07-02 20:27:50 +0200712 $(OUTDIR)/farsi.o \
Bram Moolenaar4f7e8212014-11-05 13:53:32 +0100713 $(OUTDIR)/fileio.o \
714 $(OUTDIR)/fold.o \
715 $(OUTDIR)/getchar.o \
716 $(OUTDIR)/hardcopy.o \
717 $(OUTDIR)/hashtab.o \
Bram Moolenaar520e1e42016-01-23 19:46:28 +0100718 $(OUTDIR)/json.o \
Bram Moolenaar6583c442016-07-17 18:41:47 +0200719 $(OUTDIR)/list.o \
Bram Moolenaar4f7e8212014-11-05 13:53:32 +0100720 $(OUTDIR)/main.o \
721 $(OUTDIR)/mark.o \
722 $(OUTDIR)/memfile.o \
723 $(OUTDIR)/memline.o \
724 $(OUTDIR)/menu.o \
725 $(OUTDIR)/message.o \
726 $(OUTDIR)/misc1.o \
727 $(OUTDIR)/misc2.o \
728 $(OUTDIR)/move.o \
729 $(OUTDIR)/mbyte.o \
730 $(OUTDIR)/normal.o \
731 $(OUTDIR)/ops.o \
732 $(OUTDIR)/option.o \
733 $(OUTDIR)/os_win32.o \
734 $(OUTDIR)/os_mswin.o \
735 $(OUTDIR)/winclip.o \
736 $(OUTDIR)/pathdef.o \
737 $(OUTDIR)/popupmnu.o \
738 $(OUTDIR)/quickfix.o \
739 $(OUTDIR)/regexp.o \
740 $(OUTDIR)/screen.o \
741 $(OUTDIR)/search.o \
742 $(OUTDIR)/sha256.o \
743 $(OUTDIR)/spell.o \
Bram Moolenaar9ccfebd2016-07-19 16:39:08 +0200744 $(OUTDIR)/spellfile.o \
Bram Moolenaar4f7e8212014-11-05 13:53:32 +0100745 $(OUTDIR)/syntax.o \
746 $(OUTDIR)/tag.o \
747 $(OUTDIR)/term.o \
748 $(OUTDIR)/ui.o \
749 $(OUTDIR)/undo.o \
Bram Moolenaar6583c442016-07-17 18:41:47 +0200750 $(OUTDIR)/userfunc.o \
Bram Moolenaar4f7e8212014-11-05 13:53:32 +0100751 $(OUTDIR)/version.o \
752 $(OUTDIR)/vimrc.o \
753 $(OUTDIR)/window.o
754
755ifdef PERL
756OBJ += $(OUTDIR)/if_perl.o
757endif
758ifdef LUA
759OBJ += $(OUTDIR)/if_lua.o
760endif
761ifdef MZSCHEME
762OBJ += $(OUTDIR)/if_mzsch.o
763MZSCHEME_INCL = if_mzsch.h
764ifeq (yes,$(MZSCHEME_GENERATE_BASE))
765CFLAGS += -DINCLUDE_MZSCHEME_BASE
766MZ_EXTRA_DEP += mzscheme_base.c
767endif
768ifeq (yes,$(MZSCHEME_PRECISE_GC))
769CFLAGS += -DMZ_PRECISE_GC
770endif
771endif
772ifdef PYTHON
773OBJ += $(OUTDIR)/if_python.o
774endif
775ifdef PYTHON3
776OBJ += $(OUTDIR)/if_python3.o
777endif
778ifdef RUBY
779OBJ += $(OUTDIR)/if_ruby.o
780endif
781ifdef TCL
782OBJ += $(OUTDIR)/if_tcl.o
783endif
784ifeq ($(CSCOPE),yes)
785OBJ += $(OUTDIR)/if_cscope.o
786endif
Bram Moolenaare0874f82016-01-24 20:36:41 +0100787
Bram Moolenaar4f7e8212014-11-05 13:53:32 +0100788ifeq ($(NETBEANS),yes)
Bram Moolenaare0874f82016-01-24 20:36:41 +0100789ifneq ($(CHANNEL),yes)
790# Cannot use Netbeans without CHANNEL
791NETBEANS=no
792else
Bram Moolenaar44d57182016-02-14 23:11:23 +0100793ifneq (yes, $(GUI))
794# Cannot use Netbeans without GUI.
795NETBEANS=no
796else
Bram Moolenaar4f7e8212014-11-05 13:53:32 +0100797OBJ += $(OUTDIR)/netbeans.o
Bram Moolenaar4f7e8212014-11-05 13:53:32 +0100798endif
799endif
Bram Moolenaare0874f82016-01-24 20:36:41 +0100800endif
801
802ifeq ($(CHANNEL),yes)
803OBJ += $(OUTDIR)/channel.o
Bram Moolenaare0874f82016-01-24 20:36:41 +0100804LIB += -lwsock32
805endif
Bram Moolenaare0874f82016-01-24 20:36:41 +0100806
Bram Moolenaar4f7e8212014-11-05 13:53:32 +0100807ifeq ($(DIRECTX),yes)
808# Only allow DIRECTX for a GUI build.
809ifeq (yes, $(GUI))
810OBJ += $(OUTDIR)/gui_dwrite.o
811LIB += -ld2d1 -ldwrite
812USE_STDCPLUS = yes
813endif
814endif
815ifneq ($(XPM),no)
816# Only allow XPM for a GUI build.
817ifeq (yes, $(GUI))
818OBJ += $(OUTDIR)/xpm_w32.o
819# You'll need libXpm.a from http://gnuwin32.sf.net
820LIB += -L$(XPM)/lib -lXpm
821endif
822endif
823
Bram Moolenaar4fc63502017-07-19 11:28:17 +0200824ifeq ($(TERMINAL),yes)
Bram Moolenaarf80451e2017-07-25 21:49:35 +0200825OBJ += $(OUTDIR)/terminal.o \
Bram Moolenaar78dcd4f2018-09-13 17:23:28 +0200826 $(OUTDIR)/encoding.o \
827 $(OUTDIR)/keyboard.o \
828 $(OUTDIR)/mouse.o \
829 $(OUTDIR)/parser.o \
830 $(OUTDIR)/pen.o \
831 $(OUTDIR)/termscreen.o \
832 $(OUTDIR)/state.o \
833 $(OUTDIR)/unicode.o \
834 $(OUTDIR)/vterm.o
Bram Moolenaar4fc63502017-07-19 11:28:17 +0200835endif
836
Bram Moolenaare828b762018-09-10 17:51:58 +0200837# Include xdiff
838OBJ += $(OUTDIR)/xdiffi.o \
839 $(OUTDIR)/xemit.o \
840 $(OUTDIR)/xprepare.o \
841 $(OUTDIR)/xutils.o \
842 $(OUTDIR)/xhistogram.o \
843 $(OUTDIR)/xpatience.o
844
845XDIFF_DEPS = \
846 xdiff/xdiff.h \
847 xdiff/xdiffi.h \
848 xdiff/xemit.h \
849 xdiff/xinclude.h \
850 xdiff/xmacros.h \
851 xdiff/xprepare.h \
852 xdiff/xtypes.h \
853 xdiff/xutils.h
Bram Moolenaar4f7e8212014-11-05 13:53:32 +0100854
855ifdef MZSCHEME
856MZSCHEME_SUFFIX = Z
857endif
858
859ifeq ($(GUI),yes)
860TARGET := gvim$(DEBUG_SUFFIX).exe
861DEFINES += $(DEF_GUI)
862OBJ += $(GUIOBJ)
863LFLAGS += -mwindows
864OUTDIR = gobj$(DEBUG_SUFFIX)$(MZSCHEME_SUFFIX)$(ARCH)
865else
Bram Moolenaar97ff9b92016-06-26 20:37:46 +0200866OBJ += $(CUIOBJ)
Bram Moolenaar4f7e8212014-11-05 13:53:32 +0100867TARGET := vim$(DEBUG_SUFFIX).exe
868OUTDIR = obj$(DEBUG_SUFFIX)$(MZSCHEME_SUFFIX)$(ARCH)
869endif
870
871ifdef GETTEXT
872ifneq (yes, $(GETTEXT))
873CFLAGS += -I$(GETTEXTINCLUDE)
874ifndef STATIC_GETTEXT
875LIB += -L$(GETTEXTLIB) -l$(INTLLIB)
876ifeq (USE_SAFE_GETTEXT_DLL, $(DYNAMIC_GETTEXT))
877OBJ+=$(SAFE_GETTEXT_DLL_OBJ)
878endif
879else
880LIB += -L$(GETTEXTLIB) -lintl
881endif
882endif
883endif
884
885ifdef PERL
886ifeq (no, $(DYNAMIC_PERL))
887LIB += -L$(PERLLIBS) -lperl$(PERL_VER)
888endif
889endif
890
891ifdef TCL
892LIB += -L$(TCL)/lib
893ifeq (yes, $(DYNAMIC_TCL))
894LIB += -ltclstub$(TCL_VER)
895else
896LIB += -ltcl$(TCL_VER)
897endif
898endif
899
900ifeq (yes, $(OLE))
901LIB += -loleaut32
902OBJ += $(OUTDIR)/if_ole.o
903USE_STDCPLUS = yes
904endif
905
906ifeq (yes, $(MBYTE))
907DEFINES += -DFEAT_MBYTE
908endif
909
910ifeq (yes, $(IME))
911DEFINES += -DFEAT_MBYTE_IME
912ifeq (yes, $(DYNAMIC_IME))
913DEFINES += -DDYNAMIC_IME
914else
915LIB += -limm32
916endif
917endif
918
919ifdef ICONV
920ifneq (yes, $(ICONV))
921LIB += -L$(ICONV)
922CFLAGS += -I$(ICONV)
923endif
924DEFINES+=-DDYNAMIC_ICONV
925endif
926
927ifeq (yes, $(USE_STDCPLUS))
928ifeq (yes, $(STATIC_STDCPLUS))
929LIB += -Wl,-Bstatic -lstdc++ -Wl,-Bdynamic
930else
931LIB += -lstdc++
932endif
933endif
934
Bram Moolenaare3af7632016-12-01 20:37:47 +0100935ifeq (yes, $(STATIC_WINPTHREAD))
936LIB += -Wl,-Bstatic -lwinpthread -Wl,-Bdynamic
937endif
938
Bram Moolenaar4f7e8212014-11-05 13:53:32 +0100939all: $(TARGET) vimrun.exe xxd/xxd.exe install.exe uninstal.exe GvimExt/gvimext.dll
940
941vimrun.exe: vimrun.c
942 $(CC) $(CFLAGS) -o vimrun.exe vimrun.c $(LIB)
943
944install.exe: dosinst.c
945 $(CC) $(CFLAGS) -o install.exe dosinst.c $(LIB) -lole32 -luuid
946
947uninstal.exe: uninstal.c
948 $(CC) $(CFLAGS) -o uninstal.exe uninstal.c $(LIB)
949
950$(TARGET): $(OUTDIR) $(OBJ)
Bram Moolenaarf80451e2017-07-25 21:49:35 +0200951 $(CC) $(CFLAGS) $(LFLAGS) -o $@ $(OBJ) $(LIB) -lole32 -luuid $(LUA_LIB) $(MZSCHEME_LIBDIR) $(MZSCHEME_LIB) $(PYTHONLIB) $(PYTHON3LIB) $(RUBYLIB)
Bram Moolenaar4f7e8212014-11-05 13:53:32 +0100952
953upx: exes
954 upx gvim.exe
955 upx vim.exe
956
957mpress: exes
958 mpress gvim.exe
959 mpress vim.exe
960
961xxd/xxd.exe: xxd/xxd.c
962 $(MAKE) -C xxd -f Make_ming.mak CC='$(CC)'
963
964GvimExt/gvimext.dll: GvimExt/gvimext.cpp GvimExt/gvimext.rc GvimExt/gvimext.h
965 $(MAKE) -C GvimExt -f Make_ming.mak CROSS=$(CROSS) CROSS_COMPILE=$(CROSS_COMPILE) CXX='$(CXX)' STATIC_STDCPLUS=$(STATIC_STDCPLUS)
966
Bram Moolenaar9ac9dfa2017-09-01 18:41:26 +0200967tags: notags
968 $(CTAGS) *.c *.cpp *.h if_perl.xs
969
970notags:
971 -$(DEL) tags
972
Bram Moolenaar4f7e8212014-11-05 13:53:32 +0100973clean:
974 -$(DEL) $(OUTDIR)$(DIRSLASH)*.o
975 -$(DEL) $(OUTDIR)$(DIRSLASH)*.res
976 -rmdir $(OUTDIR)
977 -$(DEL) *.exe
978 -$(DEL) pathdef.c
979ifdef PERL
980 -$(DEL) if_perl.c
981endif
982ifdef MZSCHEME
983 -$(DEL) mzscheme_base.c
984endif
985 $(MAKE) -C GvimExt -f Make_ming.mak clean
986 $(MAKE) -C xxd -f Make_ming.mak clean
987
988###########################################################################
Bram Moolenaar96e7a6e2017-09-23 19:48:29 +0200989INCL = vim.h alloc.h arabic.h ascii.h ex_cmds.h farsi.h feature.h globals.h \
990 keymap.h macros.h option.h os_dos.h os_win32.h proto.h regexp.h \
Bram Moolenaarc3719bd2017-11-18 22:13:31 +0100991 spell.h structs.h term.h beval.h $(NBDEBUG_INCL)
992GUI_INCL = gui.h
Bram Moolenaar97ff9b92016-06-26 20:37:46 +0200993CUI_INCL = iscygpty.h
Bram Moolenaar4f7e8212014-11-05 13:53:32 +0100994
Bram Moolenaar96e7a6e2017-09-23 19:48:29 +0200995$(OUTDIR)/if_python.o: if_python.c if_py_both.h $(INCL)
Bram Moolenaar449538c2016-01-09 17:49:15 +0100996 $(CC) -c $(CFLAGS) $(PYTHONINC) $(PYTHON_HOME_DEF) $< -o $@
Bram Moolenaar4f7e8212014-11-05 13:53:32 +0100997
Bram Moolenaar96e7a6e2017-09-23 19:48:29 +0200998$(OUTDIR)/if_python3.o: if_python3.c if_py_both.h $(INCL)
Bram Moolenaara7c37952016-01-20 22:23:15 +0100999 $(CC) -c $(CFLAGS) $(PYTHON3INC) $(PYTHON3_HOME_DEF) $< -o $@
Bram Moolenaar4f7e8212014-11-05 13:53:32 +01001000
1001$(OUTDIR)/%.o : %.c $(INCL)
1002 $(CC) -c $(CFLAGS) $< -o $@
1003
Bram Moolenaar96e7a6e2017-09-23 19:48:29 +02001004$(OUTDIR)/vimrc.o: vim.rc version.h gui_w32_rc.h
Bram Moolenaar4f7e8212014-11-05 13:53:32 +01001005 $(WINDRES) $(WINDRES_FLAGS) $(DEFINES) \
1006 --input-format=rc --output-format=coff -i vim.rc -o $@
1007
1008$(OUTDIR):
1009 $(MKDIR) $(OUTDIR)
1010
Bram Moolenaar4f7e8212014-11-05 13:53:32 +01001011$(OUTDIR)/gui_dwrite.o: gui_dwrite.cpp $(INCL) gui_dwrite.h
Bram Moolenaarcc6cf9b2016-03-19 20:51:35 +01001012 $(CC) -c $(CFLAGS) $(CXXFLAGS) gui_dwrite.cpp -o $(OUTDIR)/gui_dwrite.o
Bram Moolenaar4f7e8212014-11-05 13:53:32 +01001013
Bram Moolenaar96e7a6e2017-09-23 19:48:29 +02001014$(OUTDIR)/gui.o: gui.c $(INCL) $(GUI_INCL)
1015 $(CC) -c $(CFLAGS) gui.c -o $(OUTDIR)/gui.o
1016
Bram Moolenaarc3719bd2017-11-18 22:13:31 +01001017$(OUTDIR)/beval.o: beval.c $(INCL) $(GUI_INCL)
1018 $(CC) -c $(CFLAGS) beval.c -o $(OUTDIR)/beval.o
1019
Bram Moolenaar96e7a6e2017-09-23 19:48:29 +02001020$(OUTDIR)/gui_beval.o: gui_beval.c $(INCL) $(GUI_INCL)
1021 $(CC) -c $(CFLAGS) gui_beval.c -o $(OUTDIR)/gui_beval.o
1022
1023$(OUTDIR)/gui_w32.o: gui_w32.c $(INCL) $(GUI_INCL)
Bram Moolenaarf80451e2017-07-25 21:49:35 +02001024 $(CC) -c $(CFLAGS) gui_w32.c -o $(OUTDIR)/gui_w32.o
1025
Bram Moolenaar4f7e8212014-11-05 13:53:32 +01001026$(OUTDIR)/if_cscope.o: if_cscope.c $(INCL) if_cscope.h
1027 $(CC) -c $(CFLAGS) if_cscope.c -o $(OUTDIR)/if_cscope.o
1028
Bram Moolenaar96e7a6e2017-09-23 19:48:29 +02001029$(OUTDIR)/if_mzsch.o: if_mzsch.c $(INCL) $(MZSCHEME_INCL) $(MZ_EXTRA_DEP)
Bram Moolenaarf80451e2017-07-25 21:49:35 +02001030 $(CC) -c $(CFLAGS) if_mzsch.c -o $(OUTDIR)/if_mzsch.o
1031
1032mzscheme_base.c:
1033 $(MZSCHEME)/mzc --c-mods mzscheme_base.c ++lib scheme/base
1034
Bram Moolenaar4f7e8212014-11-05 13:53:32 +01001035# Remove -D__IID_DEFINED__ for newer versions of the w32api
Bram Moolenaar96e7a6e2017-09-23 19:48:29 +02001036$(OUTDIR)/if_ole.o: if_ole.cpp $(INCL) if_ole.h
Bram Moolenaarcc6cf9b2016-03-19 20:51:35 +01001037 $(CC) $(CFLAGS) $(CXXFLAGS) -c -o $(OUTDIR)/if_ole.o if_ole.cpp
Bram Moolenaar4f7e8212014-11-05 13:53:32 +01001038
Bram Moolenaar96e7a6e2017-09-23 19:48:29 +02001039if_perl.c: if_perl.xs typemap
Bram Moolenaarf80451e2017-07-25 21:49:35 +02001040 $(XSUBPP) -prototypes -typemap \
1041 $(PERLTYPEMAP) if_perl.xs -output $@
1042
Bram Moolenaar96e7a6e2017-09-23 19:48:29 +02001043$(OUTDIR)/if_ruby.o: if_ruby.c $(INCL)
Bram Moolenaar4f7e8212014-11-05 13:53:32 +01001044ifeq (16, $(RUBY))
1045 $(CC) $(CFLAGS) -U_WIN32 -c -o $(OUTDIR)/if_ruby.o if_ruby.c
1046endif
1047
Bram Moolenaar97ff9b92016-06-26 20:37:46 +02001048$(OUTDIR)/iscygpty.o: iscygpty.c $(CUI_INCL)
Bram Moolenaar2bc127f2016-07-10 13:57:40 +02001049 $(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 +02001050
Bram Moolenaar96e7a6e2017-09-23 19:48:29 +02001051$(OUTDIR)/main.o: main.c $(INCL) $(CUI_INCL)
Bram Moolenaar97ff9b92016-06-26 20:37:46 +02001052 $(CC) -c $(CFLAGS) main.c -o $(OUTDIR)/main.o
1053
Bram Moolenaar4f7e8212014-11-05 13:53:32 +01001054$(OUTDIR)/netbeans.o: netbeans.c $(INCL) $(NBDEBUG_INCL) $(NBDEBUG_SRC)
1055 $(CC) -c $(CFLAGS) netbeans.c -o $(OUTDIR)/netbeans.o
1056
Bram Moolenaar96e7a6e2017-09-23 19:48:29 +02001057$(OUTDIR)/os_win32.o: os_win32.c $(INCL) $(MZSCHEME_INCL)
1058 $(CC) -c $(CFLAGS) os_win32.c -o $(OUTDIR)/os_win32.o
1059
1060$(OUTDIR)/regexp.o: regexp.c regexp_nfa.c $(INCL)
Bram Moolenaar4f7e8212014-11-05 13:53:32 +01001061 $(CC) -c $(CFLAGS) regexp.c -o $(OUTDIR)/regexp.o
1062
Bram Moolenaarf80451e2017-07-25 21:49:35 +02001063$(OUTDIR)/terminal.o: terminal.c $(INCL) $(TERM_DEPS)
1064 $(CC) -c $(CFLAGS) terminal.c -o $(OUTDIR)/terminal.o
Bram Moolenaar4f7e8212014-11-05 13:53:32 +01001065
Bram Moolenaarf80451e2017-07-25 21:49:35 +02001066
Bram Moolenaar6d0826d2017-08-22 22:12:17 +02001067CCCTERM = $(CC) -c $(CFLAGS) -Ilibvterm/include -DINLINE="" \
1068 -DVSNPRINTF=vim_vsnprintf \
1069 -DIS_COMBINING_FUNCTION=utf_iscomposing_uint \
1070 -DWCWIDTH_FUNCTION=utf_uint2cells
1071
Bram Moolenaar78dcd4f2018-09-13 17:23:28 +02001072$(OUTDIR)/encoding.o: libvterm/src/encoding.c $(TERM_DEPS)
Bram Moolenaarf80451e2017-07-25 21:49:35 +02001073 $(CCCTERM) libvterm/src/encoding.c -o $@
1074
Bram Moolenaar78dcd4f2018-09-13 17:23:28 +02001075$(OUTDIR)/keyboard.o: libvterm/src/keyboard.c $(TERM_DEPS)
Bram Moolenaarf80451e2017-07-25 21:49:35 +02001076 $(CCCTERM) libvterm/src/keyboard.c -o $@
1077
Bram Moolenaar78dcd4f2018-09-13 17:23:28 +02001078$(OUTDIR)/mouse.o: libvterm/src/mouse.c $(TERM_DEPS)
Bram Moolenaarf80451e2017-07-25 21:49:35 +02001079 $(CCCTERM) libvterm/src/mouse.c -o $@
1080
Bram Moolenaar78dcd4f2018-09-13 17:23:28 +02001081$(OUTDIR)/parser.o: libvterm/src/parser.c $(TERM_DEPS)
Bram Moolenaarf80451e2017-07-25 21:49:35 +02001082 $(CCCTERM) libvterm/src/parser.c -o $@
1083
Bram Moolenaar78dcd4f2018-09-13 17:23:28 +02001084$(OUTDIR)/pen.o: libvterm/src/pen.c $(TERM_DEPS)
Bram Moolenaarf80451e2017-07-25 21:49:35 +02001085 $(CCCTERM) libvterm/src/pen.c -o $@
1086
Bram Moolenaar78dcd4f2018-09-13 17:23:28 +02001087$(OUTDIR)/termscreen.o: libvterm/src/termscreen.c $(TERM_DEPS)
1088 $(CCCTERM) libvterm/src/termscreen.c -o $@
Bram Moolenaarf80451e2017-07-25 21:49:35 +02001089
Bram Moolenaar78dcd4f2018-09-13 17:23:28 +02001090$(OUTDIR)/state.o: libvterm/src/state.c $(TERM_DEPS)
Bram Moolenaarf80451e2017-07-25 21:49:35 +02001091 $(CCCTERM) libvterm/src/state.c -o $@
1092
Bram Moolenaar78dcd4f2018-09-13 17:23:28 +02001093$(OUTDIR)/unicode.o: libvterm/src/unicode.c $(TERM_DEPS)
Bram Moolenaarf80451e2017-07-25 21:49:35 +02001094 $(CCCTERM) libvterm/src/unicode.c -o $@
1095
Bram Moolenaar78dcd4f2018-09-13 17:23:28 +02001096$(OUTDIR)/vterm.o: libvterm/src/vterm.c $(TERM_DEPS)
Bram Moolenaarf80451e2017-07-25 21:49:35 +02001097 $(CCCTERM) libvterm/src/vterm.c -o $@
1098
Bram Moolenaare828b762018-09-10 17:51:58 +02001099$(OUTDIR)/xdiffi.o: xdiff/xdiffi.c $(XDIFF_DEPS)
1100 $(CC) -c $(CFLAGS) xdiff/xdiffi.c -o $(OUTDIR)/xdiffi.o
1101
1102$(OUTDIR)/xemit.o: xdiff/xemit.c $(XDIFF_DEPS)
1103 $(CC) -c $(CFLAGS) xdiff/xemit.c -o $(OUTDIR)/xemit.o
1104
1105$(OUTDIR)/xprepare.o: xdiff/xprepare.c $(XDIFF_DEPS)
1106 $(CC) -c $(CFLAGS) xdiff/xprepare.c -o $(OUTDIR)/xprepare.o
1107
1108$(OUTDIR)/xutils.o: xdiff/xutils.c $(XDIFF_DEPS)
1109 $(CC) -c $(CFLAGS) xdiff/xutils.c -o $(OUTDIR)/xutils.o
1110
1111$(OUTDIR)/xhistogram.o: xdiff/xhistogram.c $(XDIFF_DEPS)
1112 $(CC) -c $(CFLAGS) xdiff/xhistogram.c -o $(OUTDIR)/xhistogram.o
1113
1114$(OUTDIR)/xpatience.o: xdiff/xpatience.c $(XDIFF_DEPS)
1115 $(CC) -c $(CFLAGS) xdiff/xpatience.c -o $(OUTDIR)/xpatience.o
Bram Moolenaar4f7e8212014-11-05 13:53:32 +01001116
1117pathdef.c: $(INCL)
1118ifneq (sh.exe, $(SHELL))
1119 @echo creating pathdef.c
1120 @echo '/* pathdef.c */' > pathdef.c
1121 @echo '#include "vim.h"' >> pathdef.c
1122 @echo 'char_u *default_vim_dir = (char_u *)"$(VIMRCLOC)";' >> pathdef.c
1123 @echo 'char_u *default_vimruntime_dir = (char_u *)"$(VIMRUNTIMEDIR)";' >> pathdef.c
1124 @echo 'char_u *all_cflags = (char_u *)"$(CC) $(CFLAGS)";' >> pathdef.c
1125 @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
1126 @echo 'char_u *compiled_user = (char_u *)"$(USERNAME)";' >> pathdef.c
1127 @echo 'char_u *compiled_sys = (char_u *)"$(USERDOMAIN)";' >> pathdef.c
1128else
1129 @echo creating pathdef.c
1130 @echo /* pathdef.c */ > pathdef.c
1131 @echo #include "vim.h" >> pathdef.c
1132 @echo char_u *default_vim_dir = (char_u *)"$(VIMRCLOC)"; >> pathdef.c
1133 @echo char_u *default_vimruntime_dir = (char_u *)"$(VIMRUNTIMEDIR)"; >> pathdef.c
1134 @echo char_u *all_cflags = (char_u *)"$(CC) $(CFLAGS)"; >> pathdef.c
1135 @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
1136 @echo char_u *compiled_user = (char_u *)"$(USERNAME)"; >> pathdef.c
1137 @echo char_u *compiled_sys = (char_u *)"$(USERDOMAIN)"; >> pathdef.c
1138endif
Bram Moolenaar96e7a6e2017-09-23 19:48:29 +02001139
1140# vim: set noet sw=8 ts=8 sts=0 wm=0 tw=0: