blob: b9ce390cf9185a8d8dbdc2979070c27529107c9a [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)
247# DYNAMIC_LUA=yes (to load the Lua DLL dynamically)
Bram Moolenaar0eaadec2016-09-08 20:28:45 +0200248# LUA_VER=[Lua version, eg 51, 52] (default is 53)
Bram Moolenaar4f7e8212014-11-05 13:53:32 +0100249ifdef LUA
250ifndef DYNAMIC_LUA
251DYNAMIC_LUA=yes
252endif
253
254ifndef LUA_VER
Bram Moolenaar0eaadec2016-09-08 20:28:45 +0200255LUA_VER=53
Bram Moolenaar4f7e8212014-11-05 13:53:32 +0100256endif
257
258ifeq (no,$(DYNAMIC_LUA))
259LUA_LIB = -L$(LUA)/lib -llua
260endif
261
262endif
263
264# MzScheme interface:
265# MZSCHEME=[Path to MzScheme directory] (Set inside Make_cyg.mak or Make_ming.mak)
266# DYNAMIC_MZSCHEME=yes (to load the MzScheme DLL dynamically)
Bram Moolenaar0eaadec2016-09-08 20:28:45 +0200267# MZSCHEME_VER=[MzScheme version] (default is 3m_a0solc (6.6))
Bram Moolenaarf16c71b2017-09-18 20:01:02 +0200268# Used for the DLL file name. E.g.:
269# C:\Program Files (x86)\Racket\lib\libracket3m_XXXXXX.dll
Bram Moolenaar4f7e8212014-11-05 13:53:32 +0100270# MZSCHEME_DEBUG=no
271ifdef MZSCHEME
272ifndef DYNAMIC_MZSCHEME
273DYNAMIC_MZSCHEME=yes
274endif
275
276ifndef MZSCHEME_VER
Bram Moolenaar0eaadec2016-09-08 20:28:45 +0200277MZSCHEME_VER=3m_a0solc
Bram Moolenaar4f7e8212014-11-05 13:53:32 +0100278endif
279
Bram Moolenaar4f7e8212014-11-05 13:53:32 +0100280# for version 4.x we need to generate byte-code for Scheme base
281ifndef MZSCHEME_GENERATE_BASE
282MZSCHEME_GENERATE_BASE=no
283endif
284
Bram Moolenaar4e640bd2016-01-16 16:20:38 +0100285ifneq ($(wildcard $(MZSCHEME)/lib/msvc/libmzsch$(MZSCHEME_VER).lib),)
Bram Moolenaar4f7e8212014-11-05 13:53:32 +0100286MZSCHEME_MAIN_LIB=mzsch
287else
288MZSCHEME_MAIN_LIB=racket
289endif
290
Bram Moolenaar4e640bd2016-01-16 16:20:38 +0100291ifndef MZSCHEME_PRECISE_GC
292MZSCHEME_PRECISE_GC=no
293ifneq ($(wildcard $(MZSCHEME)\lib\lib$(MZSCHEME_MAIN_LIB)$(MZSCHEME_VER).dll),)
294ifeq ($(wildcard $(MZSCHEME)\lib\libmzgc$(MZSCHEME_VER).dll),)
295MZSCHEME_PRECISE_GC=yes
296endif
297else
298ifneq ($(wildcard $(MZSCHEME)\lib\msvc\lib$(MZSCHEME_MAIN_LIB)$(MZSCHEME_VER).lib),)
299ifeq ($(wildcard $(MZSCHEME)\lib\msvc\libmzgc$(MZSCHEME_VER).lib),)
300MZSCHEME_PRECISE_GC=yes
301endif
302endif
303endif
304endif
305
Bram Moolenaar4f7e8212014-11-05 13:53:32 +0100306ifeq (no,$(DYNAMIC_MZSCHEME))
307ifeq (yes,$(MZSCHEME_PRECISE_GC))
308MZSCHEME_LIB=-l$(MZSCHEME_MAIN_LIB)$(MZSCHEME_VER)
309else
Bram Moolenaar4e640bd2016-01-16 16:20:38 +0100310MZSCHEME_LIB=-l$(MZSCHEME_MAIN_LIB)$(MZSCHEME_VER) -lmzgc$(MZSCHEME_VER)
Bram Moolenaar4f7e8212014-11-05 13:53:32 +0100311endif
312# the modern MinGW can dynamically link to dlls directly.
313# point MZSCHEME_DLLS to where you put libmzschXXXXXXX.dll and libgcXXXXXXX.dll
314ifndef MZSCHEME_DLLS
315MZSCHEME_DLLS=$(MZSCHEME)
316endif
317MZSCHEME_LIBDIR=-L$(MZSCHEME_DLLS) -L$(MZSCHEME_DLLS)\lib
318endif
319
320endif
321
322# Python interface:
323# PYTHON=[Path to Python directory] (Set inside Make_cyg.mak or Make_ming.mak)
324# DYNAMIC_PYTHON=yes (to load the Python DLL dynamically)
Bram Moolenaar0eaadec2016-09-08 20:28:45 +0200325# PYTHON_VER=[Python version, eg 22, 23, ..., 27] (default is 27)
Bram Moolenaar4f7e8212014-11-05 13:53:32 +0100326ifdef PYTHON
327ifndef DYNAMIC_PYTHON
328DYNAMIC_PYTHON=yes
329endif
330
331ifndef PYTHON_VER
Bram Moolenaar3c6f92e2016-01-02 20:26:36 +0100332PYTHON_VER=27
333endif
334ifndef DYNAMIC_PYTHON_DLL
335DYNAMIC_PYTHON_DLL=python$(PYTHON_VER).dll
336endif
337ifdef PYTHON_HOME
338PYTHON_HOME_DEF=-DPYTHON_HOME=\"$(PYTHON_HOME)\"
Bram Moolenaar4f7e8212014-11-05 13:53:32 +0100339endif
340
341ifeq (no,$(DYNAMIC_PYTHON))
342PYTHONLIB=-L$(PYTHON)/libs -lpython$(PYTHON_VER)
343endif
344# my include files are in 'win32inc' on Linux, and 'include' in the standard
345# NT distro (ActiveState)
Bram Moolenaar3c6f92e2016-01-02 20:26:36 +0100346ifndef PYTHONINC
Bram Moolenaar4f7e8212014-11-05 13:53:32 +0100347ifeq ($(CROSS),no)
348PYTHONINC=-I $(PYTHON)/include
349else
350PYTHONINC=-I $(PYTHON)/win32inc
351endif
352endif
Bram Moolenaar3c6f92e2016-01-02 20:26:36 +0100353endif
Bram Moolenaar4f7e8212014-11-05 13:53:32 +0100354
355# Python3 interface:
356# PYTHON3=[Path to Python3 directory] (Set inside Make_cyg.mak or Make_ming.mak)
357# DYNAMIC_PYTHON3=yes (to load the Python3 DLL dynamically)
Bram Moolenaar59eb0162017-12-10 18:17:44 +0100358# PYTHON3_VER=[Python3 version, eg 31, 32] (default is 36)
Bram Moolenaar4f7e8212014-11-05 13:53:32 +0100359ifdef PYTHON3
360ifndef DYNAMIC_PYTHON3
361DYNAMIC_PYTHON3=yes
362endif
363
364ifndef PYTHON3_VER
Bram Moolenaar59eb0162017-12-10 18:17:44 +0100365PYTHON3_VER=36
Bram Moolenaar4f7e8212014-11-05 13:53:32 +0100366endif
Bram Moolenaara7c37952016-01-20 22:23:15 +0100367ifndef DYNAMIC_PYTHON3_DLL
368DYNAMIC_PYTHON3_DLL=python$(PYTHON3_VER).dll
369endif
370ifdef PYTHON3_HOME
Bram Moolenaaracd58ef2016-02-16 13:42:24 +0100371PYTHON3_HOME_DEF=-DPYTHON3_HOME=L\"$(PYTHON3_HOME)\"
Bram Moolenaar4f7e8212014-11-05 13:53:32 +0100372endif
373
Bram Moolenaara7c37952016-01-20 22:23:15 +0100374ifeq (no,$(DYNAMIC_PYTHON3))
375PYTHON3LIB=-L$(PYTHON3)/libs -lpython$(PYTHON3_VER)
376endif
377
378ifndef PYTHON3INC
Bram Moolenaar4f7e8212014-11-05 13:53:32 +0100379ifeq ($(CROSS),no)
380PYTHON3INC=-I $(PYTHON3)/include
381else
382PYTHON3INC=-I $(PYTHON3)/win32inc
383endif
384endif
Bram Moolenaara7c37952016-01-20 22:23:15 +0100385endif
Bram Moolenaar4f7e8212014-11-05 13:53:32 +0100386
387# TCL interface:
388# TCL=[Path to TCL directory] (Set inside Make_cyg.mak or Make_ming.mak)
389# DYNAMIC_TCL=yes (to load the TCL DLL dynamically)
Bram Moolenaar0eaadec2016-09-08 20:28:45 +0200390# TCL_VER=[TCL version, eg 83, 84] (default is 86)
391# TCL_VER_LONG=[Tcl version, eg 8.3] (default is 8.6)
Bram Moolenaareca99bd2016-01-07 22:50:05 +0100392# You must set TCL_VER_LONG when you set TCL_VER.
Bram Moolenaar77f74742017-08-23 22:40:41 +0200393# TCL_DLL=[TCL dll name, eg tcl86.dll] (default is tcl86.dll)
Bram Moolenaar4f7e8212014-11-05 13:53:32 +0100394ifdef TCL
395ifndef DYNAMIC_TCL
396DYNAMIC_TCL=yes
397endif
398ifndef TCL_VER
Bram Moolenaar0eaadec2016-09-08 20:28:45 +0200399TCL_VER = 86
Bram Moolenaar4f7e8212014-11-05 13:53:32 +0100400endif
Bram Moolenaareca99bd2016-01-07 22:50:05 +0100401ifndef TCL_VER_LONG
Bram Moolenaar0eaadec2016-09-08 20:28:45 +0200402TCL_VER_LONG = 8.6
Bram Moolenaareca99bd2016-01-07 22:50:05 +0100403endif
Bram Moolenaar77f74742017-08-23 22:40:41 +0200404ifndef TCL_DLL
405TCL_DLL = tcl$(TCL_VER).dll
406endif
Bram Moolenaar4f7e8212014-11-05 13:53:32 +0100407TCLINC += -I$(TCL)/include
408endif
409
410
411# Ruby interface:
412# RUBY=[Path to Ruby directory] (Set inside Make_cyg.mak or Make_ming.mak)
Bram Moolenaar61766972018-04-20 22:31:41 +0200413# DYNAMIC_RUBY=yes (to load the Ruby DLL dynamically, "no" for static)
Bram Moolenaar6384c5d2016-09-06 22:06:35 +0200414# RUBY_VER=[Ruby version, eg 19, 22] (default is 22)
415# RUBY_API_VER_LONG=[Ruby API version, eg 1.8, 1.9.1, 2.2.0]
416# (default is 2.2.0)
417# You must set RUBY_API_VER_LONG when changing RUBY_VER.
Bram Moolenaar4f7e8212014-11-05 13:53:32 +0100418# Note: If you use Ruby 1.9.3, set as follows:
419# RUBY_VER=19
Bram Moolenaar6384c5d2016-09-06 22:06:35 +0200420# 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 +0100421ifdef RUBY
422ifndef DYNAMIC_RUBY
423DYNAMIC_RUBY=yes
424endif
425# Set default value
426ifndef RUBY_VER
Bram Moolenaar6384c5d2016-09-06 22:06:35 +0200427RUBY_VER = 22
Bram Moolenaar4f7e8212014-11-05 13:53:32 +0100428endif
429ifndef RUBY_VER_LONG
Bram Moolenaar6384c5d2016-09-06 22:06:35 +0200430RUBY_VER_LONG = 2.2.0
431endif
432ifndef RUBY_API_VER_LONG
Bram Moolenaar0eaadec2016-09-08 20:28:45 +0200433RUBY_API_VER_LONG = $(RUBY_VER_LONG)
Bram Moolenaar4f7e8212014-11-05 13:53:32 +0100434endif
435ifndef RUBY_API_VER
Bram Moolenaar6384c5d2016-09-06 22:06:35 +0200436RUBY_API_VER = $(subst .,,$(RUBY_API_VER_LONG))
Bram Moolenaar4f7e8212014-11-05 13:53:32 +0100437endif
438
439ifndef RUBY_PLATFORM
440ifeq ($(RUBY_VER), 16)
441RUBY_PLATFORM = i586-mswin32
442else
Bram Moolenaar6384c5d2016-09-06 22:06:35 +0200443ifneq ($(wildcard $(RUBY)/lib/ruby/$(RUBY_API_VER_LONG)/i386-mingw32),)
Bram Moolenaar4f7e8212014-11-05 13:53:32 +0100444RUBY_PLATFORM = i386-mingw32
445else
Bram Moolenaar6384c5d2016-09-06 22:06:35 +0200446ifneq ($(wildcard $(RUBY)/lib/ruby/$(RUBY_API_VER_LONG)/x64-mingw32),)
Bram Moolenaar4f7e8212014-11-05 13:53:32 +0100447RUBY_PLATFORM = x64-mingw32
448else
449RUBY_PLATFORM = i386-mswin32
450endif
451endif
452endif
453endif
454
455ifndef RUBY_INSTALL_NAME
456ifeq ($(RUBY_VER), 16)
457RUBY_INSTALL_NAME = mswin32-ruby$(RUBY_API_VER)
458else
Bram Moolenaar0bee2fe2016-01-07 22:45:09 +0100459ifndef RUBY_MSVCRT_NAME
460# Base name of msvcrXX.dll which is used by ruby's dll.
461RUBY_MSVCRT_NAME = msvcrt
462endif
Bram Moolenaar4f7e8212014-11-05 13:53:32 +0100463ifeq ($(ARCH),x86-64)
Bram Moolenaar0bee2fe2016-01-07 22:45:09 +0100464RUBY_INSTALL_NAME = x64-$(RUBY_MSVCRT_NAME)-ruby$(RUBY_API_VER)
Bram Moolenaar4f7e8212014-11-05 13:53:32 +0100465else
Bram Moolenaar0bee2fe2016-01-07 22:45:09 +0100466RUBY_INSTALL_NAME = $(RUBY_MSVCRT_NAME)-ruby$(RUBY_API_VER)
Bram Moolenaar4f7e8212014-11-05 13:53:32 +0100467endif
468endif
469endif
470
471ifeq (19, $(word 1,$(sort 19 $(RUBY_VER))))
472RUBY_19_OR_LATER = 1
473endif
474
Bram Moolenaar6384c5d2016-09-06 22:06:35 +0200475RUBYINC = -I $(RUBY)/lib/ruby/$(RUBY_API_VER_LONG)/$(RUBY_PLATFORM)
Bram Moolenaar4f7e8212014-11-05 13:53:32 +0100476ifdef RUBY_19_OR_LATER
Bram Moolenaar6384c5d2016-09-06 22:06:35 +0200477RUBYINC += -I $(RUBY)/include/ruby-$(RUBY_API_VER_LONG) -I $(RUBY)/include/ruby-$(RUBY_API_VER_LONG)/$(RUBY_PLATFORM)
Bram Moolenaar4f7e8212014-11-05 13:53:32 +0100478endif
479ifeq (no, $(DYNAMIC_RUBY))
480RUBYLIB = -L$(RUBY)/lib -l$(RUBY_INSTALL_NAME)
481endif
482
483endif # RUBY
484
485# See feature.h for a list of options.
486# Any other defines can be included here.
487DEF_GUI=-DFEAT_GUI_W32 -DFEAT_CLIPBOARD
488DEFINES=-DWIN32 -DWINVER=$(WINVER) -D_WIN32_WINNT=$(WINVER) \
Bram Moolenaar22fcfad2016-07-01 18:17:26 +0200489 -DHAVE_PATHDEF -DFEAT_$(FEATURES) -DHAVE_STDINT_H
Bram Moolenaar4f7e8212014-11-05 13:53:32 +0100490ifeq ($(ARCH),x86-64)
491DEFINES+=-DMS_WIN64
492endif
Bram Moolenaar4f7e8212014-11-05 13:53:32 +0100493
494#>>>>> end of choices
495###########################################################################
496
Bram Moolenaara971df82016-02-15 21:22:10 +0100497CFLAGS = -Iproto $(DEFINES) -pipe -march=$(ARCH) -Wall
Bram Moolenaar6c0e9842016-03-22 20:42:31 +0100498CXXFLAGS = -std=gnu++11
Bram Moolenaar4f7e8212014-11-05 13:53:32 +0100499WINDRES_FLAGS = --preprocessor="$(WINDRES_CC) -E -xc" -DRC_INVOKED
500EXTRA_LIBS =
501
502ifdef GETTEXT
503DEFINES += -DHAVE_GETTEXT -DHAVE_LOCALE_H
504GETTEXTINCLUDE = $(GETTEXT)/include
505GETTEXTLIB = $(INTLPATH)
506ifeq (yes, $(GETTEXT))
507DEFINES += -DDYNAMIC_GETTEXT
508else
509ifdef DYNAMIC_GETTEXT
510DEFINES += -D$(DYNAMIC_GETTEXT)
511ifdef GETTEXT_DYNAMIC
512DEFINES += -DGETTEXT_DYNAMIC -DGETTEXT_DLL=\"$(GETTEXT_DYNAMIC)\"
513endif
514endif
515endif
516endif
517
518ifdef PERL
Bram Moolenaar367fbf12015-06-25 16:13:46 +0200519CFLAGS += -I$(PERLLIBS) -DFEAT_PERL -DPERL_IMPLICIT_CONTEXT -DPERL_IMPLICIT_SYS
Bram Moolenaar4f7e8212014-11-05 13:53:32 +0100520ifeq (yes, $(DYNAMIC_PERL))
521CFLAGS += -DDYNAMIC_PERL -DDYNAMIC_PERL_DLL=\"perl$(PERL_VER).dll\"
522EXTRA_LIBS += -L$(PERLLIBS) -lperl$(PERL_VER)
523endif
524endif
525
526ifdef LUA
527CFLAGS += -I$(LUA)/include -I$(LUA) -DFEAT_LUA
528ifeq (yes, $(DYNAMIC_LUA))
529CFLAGS += -DDYNAMIC_LUA -DDYNAMIC_LUA_DLL=\"lua$(LUA_VER).dll\"
530endif
531endif
532
533ifdef MZSCHEME
Bram Moolenaar4e640bd2016-01-16 16:20:38 +0100534ifndef MZSCHEME_COLLECTS
535MZSCHEME_COLLECTS=$(MZSCHEME)/collects
536ifeq (yes, $(UNDER_CYGWIN))
537MZSCHEME_COLLECTS:=$(shell cygpath -m $(MZSCHEME_COLLECTS) | sed -e 's/ /\\ /g')
538endif
539endif
540CFLAGS += -I$(MZSCHEME)/include -DFEAT_MZSCHEME -DMZSCHEME_COLLECTS=\"$(MZSCHEME_COLLECTS)\"
Bram Moolenaar4f7e8212014-11-05 13:53:32 +0100541ifeq (yes, $(DYNAMIC_MZSCHEME))
Bram Moolenaar4e640bd2016-01-16 16:20:38 +0100542ifeq (yes, $(MZSCHEME_PRECISE_GC))
543# Precise GC does not use separate dll
544CFLAGS += -DDYNAMIC_MZSCHEME -DDYNAMIC_MZSCH_DLL=\"lib$(MZSCHEME_MAIN_LIB)$(MZSCHEME_VER).dll\" -DDYNAMIC_MZGC_DLL=\"lib$(MZSCHEME_MAIN_LIB)$(MZSCHEME_VER).dll\"
545else
Bram Moolenaar4f7e8212014-11-05 13:53:32 +0100546CFLAGS += -DDYNAMIC_MZSCHEME -DDYNAMIC_MZSCH_DLL=\"lib$(MZSCHEME_MAIN_LIB)$(MZSCHEME_VER).dll\" -DDYNAMIC_MZGC_DLL=\"libmzgc$(MZSCHEME_VER).dll\"
547endif
Bram Moolenaar4e640bd2016-01-16 16:20:38 +0100548endif
Bram Moolenaar4f7e8212014-11-05 13:53:32 +0100549ifeq (yes, "$(MZSCHEME_DEBUG)")
550CFLAGS += -DMZSCHEME_FORCE_GC
551endif
552endif
553
554ifdef RUBY
555CFLAGS += -DFEAT_RUBY $(RUBYINC)
556ifeq (yes, $(DYNAMIC_RUBY))
557CFLAGS += -DDYNAMIC_RUBY -DDYNAMIC_RUBY_DLL=\"$(RUBY_INSTALL_NAME).dll\"
558CFLAGS += -DDYNAMIC_RUBY_VER=$(RUBY_VER)
559endif
Bram Moolenaar259a90f2018-04-21 19:08:55 +0200560ifeq (no, $(DYNAMIC_RUBY))
561CFLAGS += -DRUBY_VERSION=$(RUBY_VER)
562endif
Bram Moolenaar4f7e8212014-11-05 13:53:32 +0100563ifneq ($(findstring w64-mingw32,$(CC)),)
564# A workaround for MinGW-w64
565CFLAGS += -DHAVE_STRUCT_TIMESPEC -DHAVE_STRUCT_TIMEZONE
566endif
567endif
568
569ifdef PYTHON
Bram Moolenaar223b7232016-02-19 19:43:49 +0100570CFLAGS += -DFEAT_PYTHON
Bram Moolenaar4f7e8212014-11-05 13:53:32 +0100571ifeq (yes, $(DYNAMIC_PYTHON))
Bram Moolenaar449538c2016-01-09 17:49:15 +0100572CFLAGS += -DDYNAMIC_PYTHON -DDYNAMIC_PYTHON_DLL=\"$(DYNAMIC_PYTHON_DLL)\"
Bram Moolenaar4f7e8212014-11-05 13:53:32 +0100573endif
574endif
575
Bram Moolenaar223b7232016-02-19 19:43:49 +0100576ifdef PYTHON3
577CFLAGS += -DFEAT_PYTHON3
Bram Moolenaar4f7e8212014-11-05 13:53:32 +0100578ifeq (yes, $(DYNAMIC_PYTHON3))
Bram Moolenaara7c37952016-01-20 22:23:15 +0100579CFLAGS += -DDYNAMIC_PYTHON3 -DDYNAMIC_PYTHON3_DLL=\"$(DYNAMIC_PYTHON3_DLL)\"
Bram Moolenaar4f7e8212014-11-05 13:53:32 +0100580endif
581endif
582
583ifdef TCL
584CFLAGS += -DFEAT_TCL $(TCLINC)
585ifeq (yes, $(DYNAMIC_TCL))
Bram Moolenaar77f74742017-08-23 22:40:41 +0200586CFLAGS += -DDYNAMIC_TCL -DDYNAMIC_TCL_DLL=\"$(TCL_DLL)\" -DDYNAMIC_TCL_VER=\"$(TCL_VER_LONG)\"
Bram Moolenaar4f7e8212014-11-05 13:53:32 +0100587endif
588endif
589
590ifeq ($(POSTSCRIPT),yes)
591DEFINES += -DMSWINPS
592endif
593
594ifeq (yes, $(OLE))
595DEFINES += -DFEAT_OLE
596endif
597
598ifeq ($(CSCOPE),yes)
599DEFINES += -DFEAT_CSCOPE
600endif
601
602ifeq ($(NETBEANS),yes)
603# Only allow NETBEANS for a GUI build.
604ifeq (yes, $(GUI))
605DEFINES += -DFEAT_NETBEANS_INTG
606
607ifeq ($(NBDEBUG), yes)
608DEFINES += -DNBDEBUG
609NBDEBUG_INCL = nbdebug.h
610NBDEBUG_SRC = nbdebug.c
611endif
612endif
613endif
614
Bram Moolenaare0874f82016-01-24 20:36:41 +0100615ifeq ($(CHANNEL),yes)
Bram Moolenaar509ce2a2016-03-11 22:52:15 +0100616DEFINES += -DFEAT_JOB_CHANNEL
Bram Moolenaare0874f82016-01-24 20:36:41 +0100617endif
618
Bram Moolenaar4fc63502017-07-19 11:28:17 +0200619ifeq ($(TERMINAL),yes)
620DEFINES += -DFEAT_TERMINAL
Bram Moolenaarf80451e2017-07-25 21:49:35 +0200621TERM_DEPS = \
622 libvterm/include/vterm.h \
623 libvterm/include/vterm_keycodes.h \
624 libvterm/src/rect.h \
625 libvterm/src/utf8.h \
626 libvterm/src/vterm_internal.h
Bram Moolenaar4fc63502017-07-19 11:28:17 +0200627endif
628
Bram Moolenaar4f7e8212014-11-05 13:53:32 +0100629# DirectWrite (DirectX)
630ifeq ($(DIRECTX),yes)
631# Only allow DirectWrite for a GUI build.
632ifeq (yes, $(GUI))
Bram Moolenaarcccd62d2018-04-12 20:23:48 +0200633DEFINES += -DFEAT_DIRECTX -DDYNAMIC_DIRECTX
634ifneq ($(COLOR_EMOJI),no)
635DEFINES += -DFEAT_DIRECTX_COLOR_EMOJI
636endif
Bram Moolenaar4f7e8212014-11-05 13:53:32 +0100637endif
638endif
639
640# Only allow XPM for a GUI build.
641ifeq (yes, $(GUI))
642
643ifndef XPM
644ifeq ($(ARCH),i386)
645XPM = xpm/x86
646endif
647ifeq ($(ARCH),i486)
648XPM = xpm/x86
649endif
650ifeq ($(ARCH),i586)
651XPM = xpm/x86
652endif
653ifeq ($(ARCH),i686)
654XPM = xpm/x86
655endif
656ifeq ($(ARCH),x86-64)
657XPM = xpm/x64
658endif
659endif
660ifdef XPM
661ifneq ($(XPM),no)
662CFLAGS += -DFEAT_XPM_W32 -I $(XPM)/include -I $(XPM)/../include
663endif
664endif
665
666endif
667
668ifeq ($(DEBUG),yes)
669CFLAGS += -g -fstack-check
670DEBUG_SUFFIX=d
671else
672ifeq ($(OPTIMIZE), SIZE)
673CFLAGS += -Os
674else
675ifeq ($(OPTIMIZE), MAXSPEED)
676CFLAGS += -O3
677CFLAGS += -fomit-frame-pointer -freg-struct-return
678else # SPEED
679CFLAGS += -O2
680endif
681endif
682CFLAGS += -s
683endif
684
Bram Moolenaar828c3d72018-06-19 18:58:07 +0200685LIB = -lkernel32 -luser32 -lgdi32 -ladvapi32 -lcomdlg32 -lcomctl32 -lnetapi32 -lversion
Bram Moolenaar4f7e8212014-11-05 13:53:32 +0100686GUIOBJ = $(OUTDIR)/gui.o $(OUTDIR)/gui_w32.o $(OUTDIR)/gui_beval.o $(OUTDIR)/os_w32exe.o
Bram Moolenaar97ff9b92016-06-26 20:37:46 +0200687CUIOBJ = $(OUTDIR)/iscygpty.o
Bram Moolenaar4f7e8212014-11-05 13:53:32 +0100688OBJ = \
Bram Moolenaar75464dc2016-07-02 20:27:50 +0200689 $(OUTDIR)/arabic.o \
Bram Moolenaarc3719bd2017-11-18 22:13:31 +0100690 $(OUTDIR)/beval.o \
Bram Moolenaar4f7e8212014-11-05 13:53:32 +0100691 $(OUTDIR)/blowfish.o \
692 $(OUTDIR)/buffer.o \
693 $(OUTDIR)/charset.o \
694 $(OUTDIR)/crypt.o \
695 $(OUTDIR)/crypt_zip.o \
Bram Moolenaar6583c442016-07-17 18:41:47 +0200696 $(OUTDIR)/dict.o \
Bram Moolenaar4f7e8212014-11-05 13:53:32 +0100697 $(OUTDIR)/diff.o \
698 $(OUTDIR)/digraph.o \
699 $(OUTDIR)/edit.o \
700 $(OUTDIR)/eval.o \
Bram Moolenaar73dad1e2016-07-17 22:13:49 +0200701 $(OUTDIR)/evalfunc.o \
Bram Moolenaar4f7e8212014-11-05 13:53:32 +0100702 $(OUTDIR)/ex_cmds.o \
703 $(OUTDIR)/ex_cmds2.o \
704 $(OUTDIR)/ex_docmd.o \
705 $(OUTDIR)/ex_eval.o \
706 $(OUTDIR)/ex_getln.o \
Bram Moolenaar75464dc2016-07-02 20:27:50 +0200707 $(OUTDIR)/farsi.o \
Bram Moolenaar4f7e8212014-11-05 13:53:32 +0100708 $(OUTDIR)/fileio.o \
709 $(OUTDIR)/fold.o \
710 $(OUTDIR)/getchar.o \
711 $(OUTDIR)/hardcopy.o \
712 $(OUTDIR)/hashtab.o \
Bram Moolenaar520e1e42016-01-23 19:46:28 +0100713 $(OUTDIR)/json.o \
Bram Moolenaar6583c442016-07-17 18:41:47 +0200714 $(OUTDIR)/list.o \
Bram Moolenaar4f7e8212014-11-05 13:53:32 +0100715 $(OUTDIR)/main.o \
716 $(OUTDIR)/mark.o \
717 $(OUTDIR)/memfile.o \
718 $(OUTDIR)/memline.o \
719 $(OUTDIR)/menu.o \
720 $(OUTDIR)/message.o \
721 $(OUTDIR)/misc1.o \
722 $(OUTDIR)/misc2.o \
723 $(OUTDIR)/move.o \
724 $(OUTDIR)/mbyte.o \
725 $(OUTDIR)/normal.o \
726 $(OUTDIR)/ops.o \
727 $(OUTDIR)/option.o \
728 $(OUTDIR)/os_win32.o \
729 $(OUTDIR)/os_mswin.o \
730 $(OUTDIR)/winclip.o \
731 $(OUTDIR)/pathdef.o \
732 $(OUTDIR)/popupmnu.o \
733 $(OUTDIR)/quickfix.o \
734 $(OUTDIR)/regexp.o \
735 $(OUTDIR)/screen.o \
736 $(OUTDIR)/search.o \
737 $(OUTDIR)/sha256.o \
738 $(OUTDIR)/spell.o \
Bram Moolenaar9ccfebd2016-07-19 16:39:08 +0200739 $(OUTDIR)/spellfile.o \
Bram Moolenaar4f7e8212014-11-05 13:53:32 +0100740 $(OUTDIR)/syntax.o \
741 $(OUTDIR)/tag.o \
742 $(OUTDIR)/term.o \
743 $(OUTDIR)/ui.o \
744 $(OUTDIR)/undo.o \
Bram Moolenaar6583c442016-07-17 18:41:47 +0200745 $(OUTDIR)/userfunc.o \
Bram Moolenaar4f7e8212014-11-05 13:53:32 +0100746 $(OUTDIR)/version.o \
747 $(OUTDIR)/vimrc.o \
748 $(OUTDIR)/window.o
749
750ifdef PERL
751OBJ += $(OUTDIR)/if_perl.o
752endif
753ifdef LUA
754OBJ += $(OUTDIR)/if_lua.o
755endif
756ifdef MZSCHEME
757OBJ += $(OUTDIR)/if_mzsch.o
758MZSCHEME_INCL = if_mzsch.h
759ifeq (yes,$(MZSCHEME_GENERATE_BASE))
760CFLAGS += -DINCLUDE_MZSCHEME_BASE
761MZ_EXTRA_DEP += mzscheme_base.c
762endif
763ifeq (yes,$(MZSCHEME_PRECISE_GC))
764CFLAGS += -DMZ_PRECISE_GC
765endif
766endif
767ifdef PYTHON
768OBJ += $(OUTDIR)/if_python.o
769endif
770ifdef PYTHON3
771OBJ += $(OUTDIR)/if_python3.o
772endif
773ifdef RUBY
774OBJ += $(OUTDIR)/if_ruby.o
775endif
776ifdef TCL
777OBJ += $(OUTDIR)/if_tcl.o
778endif
779ifeq ($(CSCOPE),yes)
780OBJ += $(OUTDIR)/if_cscope.o
781endif
Bram Moolenaare0874f82016-01-24 20:36:41 +0100782
Bram Moolenaar4f7e8212014-11-05 13:53:32 +0100783ifeq ($(NETBEANS),yes)
Bram Moolenaare0874f82016-01-24 20:36:41 +0100784ifneq ($(CHANNEL),yes)
785# Cannot use Netbeans without CHANNEL
786NETBEANS=no
787else
Bram Moolenaar44d57182016-02-14 23:11:23 +0100788ifneq (yes, $(GUI))
789# Cannot use Netbeans without GUI.
790NETBEANS=no
791else
Bram Moolenaar4f7e8212014-11-05 13:53:32 +0100792OBJ += $(OUTDIR)/netbeans.o
Bram Moolenaar4f7e8212014-11-05 13:53:32 +0100793endif
794endif
Bram Moolenaare0874f82016-01-24 20:36:41 +0100795endif
796
797ifeq ($(CHANNEL),yes)
798OBJ += $(OUTDIR)/channel.o
Bram Moolenaare0874f82016-01-24 20:36:41 +0100799LIB += -lwsock32
800endif
Bram Moolenaare0874f82016-01-24 20:36:41 +0100801
Bram Moolenaar4f7e8212014-11-05 13:53:32 +0100802ifeq ($(DIRECTX),yes)
803# Only allow DIRECTX for a GUI build.
804ifeq (yes, $(GUI))
805OBJ += $(OUTDIR)/gui_dwrite.o
806LIB += -ld2d1 -ldwrite
807USE_STDCPLUS = yes
808endif
809endif
810ifneq ($(XPM),no)
811# Only allow XPM for a GUI build.
812ifeq (yes, $(GUI))
813OBJ += $(OUTDIR)/xpm_w32.o
814# You'll need libXpm.a from http://gnuwin32.sf.net
815LIB += -L$(XPM)/lib -lXpm
816endif
817endif
818
Bram Moolenaar4fc63502017-07-19 11:28:17 +0200819ifeq ($(TERMINAL),yes)
Bram Moolenaarf80451e2017-07-25 21:49:35 +0200820OBJ += $(OUTDIR)/terminal.o \
Bram Moolenaar78dcd4f2018-09-13 17:23:28 +0200821 $(OUTDIR)/encoding.o \
822 $(OUTDIR)/keyboard.o \
823 $(OUTDIR)/mouse.o \
824 $(OUTDIR)/parser.o \
825 $(OUTDIR)/pen.o \
826 $(OUTDIR)/termscreen.o \
827 $(OUTDIR)/state.o \
828 $(OUTDIR)/unicode.o \
829 $(OUTDIR)/vterm.o
Bram Moolenaar4fc63502017-07-19 11:28:17 +0200830endif
831
Bram Moolenaare828b762018-09-10 17:51:58 +0200832# Include xdiff
833OBJ += $(OUTDIR)/xdiffi.o \
834 $(OUTDIR)/xemit.o \
835 $(OUTDIR)/xprepare.o \
836 $(OUTDIR)/xutils.o \
837 $(OUTDIR)/xhistogram.o \
838 $(OUTDIR)/xpatience.o
839
840XDIFF_DEPS = \
841 xdiff/xdiff.h \
842 xdiff/xdiffi.h \
843 xdiff/xemit.h \
844 xdiff/xinclude.h \
845 xdiff/xmacros.h \
846 xdiff/xprepare.h \
847 xdiff/xtypes.h \
848 xdiff/xutils.h
Bram Moolenaar4f7e8212014-11-05 13:53:32 +0100849
850ifdef MZSCHEME
851MZSCHEME_SUFFIX = Z
852endif
853
854ifeq ($(GUI),yes)
855TARGET := gvim$(DEBUG_SUFFIX).exe
856DEFINES += $(DEF_GUI)
857OBJ += $(GUIOBJ)
858LFLAGS += -mwindows
859OUTDIR = gobj$(DEBUG_SUFFIX)$(MZSCHEME_SUFFIX)$(ARCH)
860else
Bram Moolenaar97ff9b92016-06-26 20:37:46 +0200861OBJ += $(CUIOBJ)
Bram Moolenaar4f7e8212014-11-05 13:53:32 +0100862TARGET := vim$(DEBUG_SUFFIX).exe
863OUTDIR = obj$(DEBUG_SUFFIX)$(MZSCHEME_SUFFIX)$(ARCH)
864endif
865
866ifdef GETTEXT
867ifneq (yes, $(GETTEXT))
868CFLAGS += -I$(GETTEXTINCLUDE)
869ifndef STATIC_GETTEXT
870LIB += -L$(GETTEXTLIB) -l$(INTLLIB)
871ifeq (USE_SAFE_GETTEXT_DLL, $(DYNAMIC_GETTEXT))
872OBJ+=$(SAFE_GETTEXT_DLL_OBJ)
873endif
874else
875LIB += -L$(GETTEXTLIB) -lintl
876endif
877endif
878endif
879
880ifdef PERL
881ifeq (no, $(DYNAMIC_PERL))
882LIB += -L$(PERLLIBS) -lperl$(PERL_VER)
883endif
884endif
885
886ifdef TCL
887LIB += -L$(TCL)/lib
888ifeq (yes, $(DYNAMIC_TCL))
889LIB += -ltclstub$(TCL_VER)
890else
891LIB += -ltcl$(TCL_VER)
892endif
893endif
894
895ifeq (yes, $(OLE))
896LIB += -loleaut32
897OBJ += $(OUTDIR)/if_ole.o
898USE_STDCPLUS = yes
899endif
900
901ifeq (yes, $(MBYTE))
902DEFINES += -DFEAT_MBYTE
903endif
904
905ifeq (yes, $(IME))
906DEFINES += -DFEAT_MBYTE_IME
907ifeq (yes, $(DYNAMIC_IME))
908DEFINES += -DDYNAMIC_IME
909else
910LIB += -limm32
911endif
912endif
913
914ifdef ICONV
915ifneq (yes, $(ICONV))
916LIB += -L$(ICONV)
917CFLAGS += -I$(ICONV)
918endif
919DEFINES+=-DDYNAMIC_ICONV
920endif
921
922ifeq (yes, $(USE_STDCPLUS))
923ifeq (yes, $(STATIC_STDCPLUS))
924LIB += -Wl,-Bstatic -lstdc++ -Wl,-Bdynamic
925else
926LIB += -lstdc++
927endif
928endif
929
Bram Moolenaare3af7632016-12-01 20:37:47 +0100930ifeq (yes, $(STATIC_WINPTHREAD))
931LIB += -Wl,-Bstatic -lwinpthread -Wl,-Bdynamic
932endif
933
Bram Moolenaar4f7e8212014-11-05 13:53:32 +0100934all: $(TARGET) vimrun.exe xxd/xxd.exe install.exe uninstal.exe GvimExt/gvimext.dll
935
936vimrun.exe: vimrun.c
937 $(CC) $(CFLAGS) -o vimrun.exe vimrun.c $(LIB)
938
939install.exe: dosinst.c
940 $(CC) $(CFLAGS) -o install.exe dosinst.c $(LIB) -lole32 -luuid
941
942uninstal.exe: uninstal.c
943 $(CC) $(CFLAGS) -o uninstal.exe uninstal.c $(LIB)
944
945$(TARGET): $(OUTDIR) $(OBJ)
Bram Moolenaarf80451e2017-07-25 21:49:35 +0200946 $(CC) $(CFLAGS) $(LFLAGS) -o $@ $(OBJ) $(LIB) -lole32 -luuid $(LUA_LIB) $(MZSCHEME_LIBDIR) $(MZSCHEME_LIB) $(PYTHONLIB) $(PYTHON3LIB) $(RUBYLIB)
Bram Moolenaar4f7e8212014-11-05 13:53:32 +0100947
948upx: exes
949 upx gvim.exe
950 upx vim.exe
951
952mpress: exes
953 mpress gvim.exe
954 mpress vim.exe
955
956xxd/xxd.exe: xxd/xxd.c
957 $(MAKE) -C xxd -f Make_ming.mak CC='$(CC)'
958
959GvimExt/gvimext.dll: GvimExt/gvimext.cpp GvimExt/gvimext.rc GvimExt/gvimext.h
960 $(MAKE) -C GvimExt -f Make_ming.mak CROSS=$(CROSS) CROSS_COMPILE=$(CROSS_COMPILE) CXX='$(CXX)' STATIC_STDCPLUS=$(STATIC_STDCPLUS)
961
Bram Moolenaar9ac9dfa2017-09-01 18:41:26 +0200962tags: notags
963 $(CTAGS) *.c *.cpp *.h if_perl.xs
964
965notags:
966 -$(DEL) tags
967
Bram Moolenaar4f7e8212014-11-05 13:53:32 +0100968clean:
969 -$(DEL) $(OUTDIR)$(DIRSLASH)*.o
970 -$(DEL) $(OUTDIR)$(DIRSLASH)*.res
971 -rmdir $(OUTDIR)
972 -$(DEL) *.exe
973 -$(DEL) pathdef.c
974ifdef PERL
975 -$(DEL) if_perl.c
976endif
977ifdef MZSCHEME
978 -$(DEL) mzscheme_base.c
979endif
980 $(MAKE) -C GvimExt -f Make_ming.mak clean
981 $(MAKE) -C xxd -f Make_ming.mak clean
982
983###########################################################################
Bram Moolenaar96e7a6e2017-09-23 19:48:29 +0200984INCL = vim.h alloc.h arabic.h ascii.h ex_cmds.h farsi.h feature.h globals.h \
985 keymap.h macros.h option.h os_dos.h os_win32.h proto.h regexp.h \
Bram Moolenaarc3719bd2017-11-18 22:13:31 +0100986 spell.h structs.h term.h beval.h $(NBDEBUG_INCL)
987GUI_INCL = gui.h
Bram Moolenaar97ff9b92016-06-26 20:37:46 +0200988CUI_INCL = iscygpty.h
Bram Moolenaar4f7e8212014-11-05 13:53:32 +0100989
Bram Moolenaar96e7a6e2017-09-23 19:48:29 +0200990$(OUTDIR)/if_python.o: if_python.c if_py_both.h $(INCL)
Bram Moolenaar449538c2016-01-09 17:49:15 +0100991 $(CC) -c $(CFLAGS) $(PYTHONINC) $(PYTHON_HOME_DEF) $< -o $@
Bram Moolenaar4f7e8212014-11-05 13:53:32 +0100992
Bram Moolenaar96e7a6e2017-09-23 19:48:29 +0200993$(OUTDIR)/if_python3.o: if_python3.c if_py_both.h $(INCL)
Bram Moolenaara7c37952016-01-20 22:23:15 +0100994 $(CC) -c $(CFLAGS) $(PYTHON3INC) $(PYTHON3_HOME_DEF) $< -o $@
Bram Moolenaar4f7e8212014-11-05 13:53:32 +0100995
996$(OUTDIR)/%.o : %.c $(INCL)
997 $(CC) -c $(CFLAGS) $< -o $@
998
Bram Moolenaar96e7a6e2017-09-23 19:48:29 +0200999$(OUTDIR)/vimrc.o: vim.rc version.h gui_w32_rc.h
Bram Moolenaar4f7e8212014-11-05 13:53:32 +01001000 $(WINDRES) $(WINDRES_FLAGS) $(DEFINES) \
1001 --input-format=rc --output-format=coff -i vim.rc -o $@
1002
1003$(OUTDIR):
1004 $(MKDIR) $(OUTDIR)
1005
Bram Moolenaar4f7e8212014-11-05 13:53:32 +01001006$(OUTDIR)/gui_dwrite.o: gui_dwrite.cpp $(INCL) gui_dwrite.h
Bram Moolenaarcc6cf9b2016-03-19 20:51:35 +01001007 $(CC) -c $(CFLAGS) $(CXXFLAGS) gui_dwrite.cpp -o $(OUTDIR)/gui_dwrite.o
Bram Moolenaar4f7e8212014-11-05 13:53:32 +01001008
Bram Moolenaar96e7a6e2017-09-23 19:48:29 +02001009$(OUTDIR)/gui.o: gui.c $(INCL) $(GUI_INCL)
1010 $(CC) -c $(CFLAGS) gui.c -o $(OUTDIR)/gui.o
1011
Bram Moolenaarc3719bd2017-11-18 22:13:31 +01001012$(OUTDIR)/beval.o: beval.c $(INCL) $(GUI_INCL)
1013 $(CC) -c $(CFLAGS) beval.c -o $(OUTDIR)/beval.o
1014
Bram Moolenaar96e7a6e2017-09-23 19:48:29 +02001015$(OUTDIR)/gui_beval.o: gui_beval.c $(INCL) $(GUI_INCL)
1016 $(CC) -c $(CFLAGS) gui_beval.c -o $(OUTDIR)/gui_beval.o
1017
1018$(OUTDIR)/gui_w32.o: gui_w32.c $(INCL) $(GUI_INCL)
Bram Moolenaarf80451e2017-07-25 21:49:35 +02001019 $(CC) -c $(CFLAGS) gui_w32.c -o $(OUTDIR)/gui_w32.o
1020
Bram Moolenaar4f7e8212014-11-05 13:53:32 +01001021$(OUTDIR)/if_cscope.o: if_cscope.c $(INCL) if_cscope.h
1022 $(CC) -c $(CFLAGS) if_cscope.c -o $(OUTDIR)/if_cscope.o
1023
Bram Moolenaar96e7a6e2017-09-23 19:48:29 +02001024$(OUTDIR)/if_mzsch.o: if_mzsch.c $(INCL) $(MZSCHEME_INCL) $(MZ_EXTRA_DEP)
Bram Moolenaarf80451e2017-07-25 21:49:35 +02001025 $(CC) -c $(CFLAGS) if_mzsch.c -o $(OUTDIR)/if_mzsch.o
1026
1027mzscheme_base.c:
1028 $(MZSCHEME)/mzc --c-mods mzscheme_base.c ++lib scheme/base
1029
Bram Moolenaar4f7e8212014-11-05 13:53:32 +01001030# Remove -D__IID_DEFINED__ for newer versions of the w32api
Bram Moolenaar96e7a6e2017-09-23 19:48:29 +02001031$(OUTDIR)/if_ole.o: if_ole.cpp $(INCL) if_ole.h
Bram Moolenaarcc6cf9b2016-03-19 20:51:35 +01001032 $(CC) $(CFLAGS) $(CXXFLAGS) -c -o $(OUTDIR)/if_ole.o if_ole.cpp
Bram Moolenaar4f7e8212014-11-05 13:53:32 +01001033
Bram Moolenaar96e7a6e2017-09-23 19:48:29 +02001034if_perl.c: if_perl.xs typemap
Bram Moolenaarf80451e2017-07-25 21:49:35 +02001035 $(XSUBPP) -prototypes -typemap \
1036 $(PERLTYPEMAP) if_perl.xs -output $@
1037
Bram Moolenaar96e7a6e2017-09-23 19:48:29 +02001038$(OUTDIR)/if_ruby.o: if_ruby.c $(INCL)
Bram Moolenaar4f7e8212014-11-05 13:53:32 +01001039ifeq (16, $(RUBY))
1040 $(CC) $(CFLAGS) -U_WIN32 -c -o $(OUTDIR)/if_ruby.o if_ruby.c
1041endif
1042
Bram Moolenaar97ff9b92016-06-26 20:37:46 +02001043$(OUTDIR)/iscygpty.o: iscygpty.c $(CUI_INCL)
Bram Moolenaar2bc127f2016-07-10 13:57:40 +02001044 $(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 +02001045
Bram Moolenaar96e7a6e2017-09-23 19:48:29 +02001046$(OUTDIR)/main.o: main.c $(INCL) $(CUI_INCL)
Bram Moolenaar97ff9b92016-06-26 20:37:46 +02001047 $(CC) -c $(CFLAGS) main.c -o $(OUTDIR)/main.o
1048
Bram Moolenaar4f7e8212014-11-05 13:53:32 +01001049$(OUTDIR)/netbeans.o: netbeans.c $(INCL) $(NBDEBUG_INCL) $(NBDEBUG_SRC)
1050 $(CC) -c $(CFLAGS) netbeans.c -o $(OUTDIR)/netbeans.o
1051
Bram Moolenaar96e7a6e2017-09-23 19:48:29 +02001052$(OUTDIR)/os_win32.o: os_win32.c $(INCL) $(MZSCHEME_INCL)
1053 $(CC) -c $(CFLAGS) os_win32.c -o $(OUTDIR)/os_win32.o
1054
1055$(OUTDIR)/regexp.o: regexp.c regexp_nfa.c $(INCL)
Bram Moolenaar4f7e8212014-11-05 13:53:32 +01001056 $(CC) -c $(CFLAGS) regexp.c -o $(OUTDIR)/regexp.o
1057
Bram Moolenaarf80451e2017-07-25 21:49:35 +02001058$(OUTDIR)/terminal.o: terminal.c $(INCL) $(TERM_DEPS)
1059 $(CC) -c $(CFLAGS) terminal.c -o $(OUTDIR)/terminal.o
Bram Moolenaar4f7e8212014-11-05 13:53:32 +01001060
Bram Moolenaarf80451e2017-07-25 21:49:35 +02001061
Bram Moolenaar6d0826d2017-08-22 22:12:17 +02001062CCCTERM = $(CC) -c $(CFLAGS) -Ilibvterm/include -DINLINE="" \
1063 -DVSNPRINTF=vim_vsnprintf \
1064 -DIS_COMBINING_FUNCTION=utf_iscomposing_uint \
1065 -DWCWIDTH_FUNCTION=utf_uint2cells
1066
Bram Moolenaar78dcd4f2018-09-13 17:23:28 +02001067$(OUTDIR)/encoding.o: libvterm/src/encoding.c $(TERM_DEPS)
Bram Moolenaarf80451e2017-07-25 21:49:35 +02001068 $(CCCTERM) libvterm/src/encoding.c -o $@
1069
Bram Moolenaar78dcd4f2018-09-13 17:23:28 +02001070$(OUTDIR)/keyboard.o: libvterm/src/keyboard.c $(TERM_DEPS)
Bram Moolenaarf80451e2017-07-25 21:49:35 +02001071 $(CCCTERM) libvterm/src/keyboard.c -o $@
1072
Bram Moolenaar78dcd4f2018-09-13 17:23:28 +02001073$(OUTDIR)/mouse.o: libvterm/src/mouse.c $(TERM_DEPS)
Bram Moolenaarf80451e2017-07-25 21:49:35 +02001074 $(CCCTERM) libvterm/src/mouse.c -o $@
1075
Bram Moolenaar78dcd4f2018-09-13 17:23:28 +02001076$(OUTDIR)/parser.o: libvterm/src/parser.c $(TERM_DEPS)
Bram Moolenaarf80451e2017-07-25 21:49:35 +02001077 $(CCCTERM) libvterm/src/parser.c -o $@
1078
Bram Moolenaar78dcd4f2018-09-13 17:23:28 +02001079$(OUTDIR)/pen.o: libvterm/src/pen.c $(TERM_DEPS)
Bram Moolenaarf80451e2017-07-25 21:49:35 +02001080 $(CCCTERM) libvterm/src/pen.c -o $@
1081
Bram Moolenaar78dcd4f2018-09-13 17:23:28 +02001082$(OUTDIR)/termscreen.o: libvterm/src/termscreen.c $(TERM_DEPS)
1083 $(CCCTERM) libvterm/src/termscreen.c -o $@
Bram Moolenaarf80451e2017-07-25 21:49:35 +02001084
Bram Moolenaar78dcd4f2018-09-13 17:23:28 +02001085$(OUTDIR)/state.o: libvterm/src/state.c $(TERM_DEPS)
Bram Moolenaarf80451e2017-07-25 21:49:35 +02001086 $(CCCTERM) libvterm/src/state.c -o $@
1087
Bram Moolenaar78dcd4f2018-09-13 17:23:28 +02001088$(OUTDIR)/unicode.o: libvterm/src/unicode.c $(TERM_DEPS)
Bram Moolenaarf80451e2017-07-25 21:49:35 +02001089 $(CCCTERM) libvterm/src/unicode.c -o $@
1090
Bram Moolenaar78dcd4f2018-09-13 17:23:28 +02001091$(OUTDIR)/vterm.o: libvterm/src/vterm.c $(TERM_DEPS)
Bram Moolenaarf80451e2017-07-25 21:49:35 +02001092 $(CCCTERM) libvterm/src/vterm.c -o $@
1093
Bram Moolenaare828b762018-09-10 17:51:58 +02001094$(OUTDIR)/xdiffi.o: xdiff/xdiffi.c $(XDIFF_DEPS)
1095 $(CC) -c $(CFLAGS) xdiff/xdiffi.c -o $(OUTDIR)/xdiffi.o
1096
1097$(OUTDIR)/xemit.o: xdiff/xemit.c $(XDIFF_DEPS)
1098 $(CC) -c $(CFLAGS) xdiff/xemit.c -o $(OUTDIR)/xemit.o
1099
1100$(OUTDIR)/xprepare.o: xdiff/xprepare.c $(XDIFF_DEPS)
1101 $(CC) -c $(CFLAGS) xdiff/xprepare.c -o $(OUTDIR)/xprepare.o
1102
1103$(OUTDIR)/xutils.o: xdiff/xutils.c $(XDIFF_DEPS)
1104 $(CC) -c $(CFLAGS) xdiff/xutils.c -o $(OUTDIR)/xutils.o
1105
1106$(OUTDIR)/xhistogram.o: xdiff/xhistogram.c $(XDIFF_DEPS)
1107 $(CC) -c $(CFLAGS) xdiff/xhistogram.c -o $(OUTDIR)/xhistogram.o
1108
1109$(OUTDIR)/xpatience.o: xdiff/xpatience.c $(XDIFF_DEPS)
1110 $(CC) -c $(CFLAGS) xdiff/xpatience.c -o $(OUTDIR)/xpatience.o
Bram Moolenaar4f7e8212014-11-05 13:53:32 +01001111
1112pathdef.c: $(INCL)
1113ifneq (sh.exe, $(SHELL))
1114 @echo creating pathdef.c
1115 @echo '/* pathdef.c */' > pathdef.c
1116 @echo '#include "vim.h"' >> pathdef.c
1117 @echo 'char_u *default_vim_dir = (char_u *)"$(VIMRCLOC)";' >> pathdef.c
1118 @echo 'char_u *default_vimruntime_dir = (char_u *)"$(VIMRUNTIMEDIR)";' >> pathdef.c
1119 @echo 'char_u *all_cflags = (char_u *)"$(CC) $(CFLAGS)";' >> pathdef.c
1120 @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
1121 @echo 'char_u *compiled_user = (char_u *)"$(USERNAME)";' >> pathdef.c
1122 @echo 'char_u *compiled_sys = (char_u *)"$(USERDOMAIN)";' >> pathdef.c
1123else
1124 @echo creating pathdef.c
1125 @echo /* pathdef.c */ > pathdef.c
1126 @echo #include "vim.h" >> pathdef.c
1127 @echo char_u *default_vim_dir = (char_u *)"$(VIMRCLOC)"; >> pathdef.c
1128 @echo char_u *default_vimruntime_dir = (char_u *)"$(VIMRUNTIMEDIR)"; >> pathdef.c
1129 @echo char_u *all_cflags = (char_u *)"$(CC) $(CFLAGS)"; >> pathdef.c
1130 @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
1131 @echo char_u *compiled_user = (char_u *)"$(USERNAME)"; >> pathdef.c
1132 @echo char_u *compiled_sys = (char_u *)"$(USERDOMAIN)"; >> pathdef.c
1133endif
Bram Moolenaar96e7a6e2017-09-23 19:48:29 +02001134
1135# vim: set noet sw=8 ts=8 sts=0 wm=0 tw=0: