blob: 160fcd9c07118ff9fb8d7bdf95bf03bbe877ea40 [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:
23# http://upx.sourceforge.net/
24# "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:
31# set to yes for a debug build
32DEBUG=no
33# set to SIZE for size, SPEED for speed, MAXSPEED for maximum optimization
34OPTIMIZE=MAXSPEED
35# set to yes to make gvim, no for vim
36GUI=yes
37# set to yes if you want to use DirectWrite (DirectX)
38# MinGW-w64 is needed, and ARCH should be set to i686 or x86-64.
39DIRECTX=no
40# FEATURES=[TINY | SMALL | NORMAL | BIG | HUGE]
41# Set to TINY to make minimal version (few features).
Bram Moolenaare5f2be62016-01-21 20:24:34 +010042FEATURES=HUGE
Bram Moolenaar4f7e8212014-11-05 13:53:32 +010043# Set to one of i386, i486, i586, i686 as the minimum target processor.
44# For amd64/x64 architecture set ARCH=x86-64 .
45ARCH=i386
46# Set to yes to cross-compile from unix; no=native Windows (and Cygwin).
47CROSS=no
48# Set to path to iconv.h and libiconv.a to enable using 'iconv.dll'.
49#ICONV="."
50ICONV=yes
51GETTEXT=yes
52# Set to yes to include multibyte support.
53MBYTE=yes
54# Set to yes to include IME support.
55IME=yes
56DYNAMIC_IME=yes
57# Set to yes to enable writing a postscript file with :hardcopy.
58POSTSCRIPT=no
59# Set to yes to enable OLE support.
60OLE=no
61# Set the default $(WINVER) to make it work with pre-Win2k.
62ifndef WINVER
63WINVER = 0x0500
64endif
65# Set to yes to enable Cscope support.
66CSCOPE=yes
Bram Moolenaare0874f82016-01-24 20:36:41 +010067# Set to yes to enable Netbeans support (requires CHANNEL).
Bram Moolenaar4f7e8212014-11-05 13:53:32 +010068NETBEANS=$(GUI)
Bram Moolenaare0874f82016-01-24 20:36:41 +010069# Set to yes to enable inter process communication.
70CHANNEL=$(GUI)
Bram Moolenaar4f7e8212014-11-05 13:53:32 +010071
72
73# Link against the shared version of libstdc++ by default. Set
74# STATIC_STDCPLUS to "yes" to link against static version instead.
75ifndef STATIC_STDCPLUS
76STATIC_STDCPLUS=no
77endif
78
79# If the user doesn't want gettext, undefine it.
80ifeq (no, $(GETTEXT))
81GETTEXT=
82endif
83# Added by E.F. Amatria <eferna1@platea.ptic.mec.es> 2001 Feb 23
84# Uncomment the first line and one of the following three if you want Native Language
85# Support. You'll need gnu_gettext.win32, a MINGW32 Windows PORT of gettext by
86# Franco Bez <franco.bez@gmx.de>. It may be found at
87# http://home.a-city.de/franco.bez/gettext/gettext_win32_en.html
88# Tested with mingw32 with GCC-2.95.2 on Win98
89# Updated 2001 Jun 9
90#GETTEXT=c:/gettext.win32.msvcrt
91#STATIC_GETTEXT=USE_STATIC_GETTEXT
92#DYNAMIC_GETTEXT=USE_GETTEXT_DLL
93#DYNAMIC_GETTEXT=USE_SAFE_GETTEXT_DLL
94SAFE_GETTEXT_DLL_OBJ = $(GETTEXT)/src/safe_gettext_dll/safe_gettext_dll.o
95# Alternatively, if you uncomment the two following lines, you get a "safe" version
96# without linking the safe_gettext_dll.o object file.
97#DYNAMIC_GETTEXT=DYNAMIC_GETTEXT
98#GETTEXT_DYNAMIC=gnu_gettext.dll
99INTLPATH=$(GETTEXT)/lib/mingw32
100INTLLIB=gnu_gettext
101
102# If you are using gettext-0.10.35 from http://sourceforge.net/projects/gettext
103# or gettext-0.10.37 from http://sourceforge.net/projects/mingwrep/
104# uncomment the following, but I can't build a static version with them, ?-(|
105#GETTEXT=c:/gettext-0.10.37-20010430
106#STATIC_GETTEXT=USE_STATIC_GETTEXT
107#DYNAMIC_GETTEXT=DYNAMIC_GETTEXT
108#INTLPATH=$(GETTEXT)/lib
109#INTLLIB=intl
110
111# Perl interface:
112# PERL=[Path to Perl directory] (Set inside Make_cyg.mak or Make_ming.mak)
113# DYNAMIC_PERL=yes (to load the Perl DLL dynamically)
114# PERL_VER=[Perl version, eg 56, 58, 510] (default is 56)
115ifdef PERL
116ifndef PERL_VER
117PERL_VER=56
118endif
119ifndef DYNAMIC_PERL
120DYNAMIC_PERL=yes
121endif
122# on Linux, for cross-compile, it's here:
123#PERLLIB=/home/ron/ActivePerl/lib
124# on NT, it's here:
125PERLEXE=$(PERL)/bin/perl
126PERLLIB=$(PERL)/lib
127PERLLIBS=$(PERLLIB)/Core
128ifeq ($(UNDER_CYGWIN),yes)
129PERLTYPEMAP:=$(shell cygpath -m $(PERLLIB)/ExtUtils/typemap)
130XSUBPPTRY:=$(shell cygpath -m $(PERLLIB)/ExtUtils/xsubpp)
131else
132PERLTYPEMAP=$(PERLLIB)/ExtUtils/typemap
133XSUBPPTRY=$(PERLLIB)/ExtUtils/xsubpp
134endif
135XSUBPP_EXISTS=$(shell $(PERLEXE) -e "print 1 unless -e '$(XSUBPPTRY)'")
136ifeq "$(XSUBPP_EXISTS)" ""
Bram Moolenaar345326a2014-11-06 10:03:01 +0100137XSUBPP=$(PERLEXE) $(XSUBPPTRY)
Bram Moolenaar4f7e8212014-11-05 13:53:32 +0100138else
139XSUBPP=xsubpp
140endif
141endif
142
143# Lua interface:
144# LUA=[Path to Lua directory] (Set inside Make_cyg.mak or Make_ming.mak)
145# DYNAMIC_LUA=yes (to load the Lua DLL dynamically)
146# LUA_VER=[Lua version, eg 51, 52] (default is 51)
147ifdef LUA
148ifndef DYNAMIC_LUA
149DYNAMIC_LUA=yes
150endif
151
152ifndef LUA_VER
153LUA_VER=51
154endif
155
156ifeq (no,$(DYNAMIC_LUA))
157LUA_LIB = -L$(LUA)/lib -llua
158endif
159
160endif
161
162# MzScheme interface:
163# MZSCHEME=[Path to MzScheme directory] (Set inside Make_cyg.mak or Make_ming.mak)
164# DYNAMIC_MZSCHEME=yes (to load the MzScheme DLL dynamically)
165# MZSCHEME_VER=[MzScheme version] (default is 205_000)
166# MZSCHEME_DEBUG=no
167ifdef MZSCHEME
168ifndef DYNAMIC_MZSCHEME
169DYNAMIC_MZSCHEME=yes
170endif
171
172ifndef MZSCHEME_VER
173MZSCHEME_VER=205_000
174endif
175
Bram Moolenaar4f7e8212014-11-05 13:53:32 +0100176# for version 4.x we need to generate byte-code for Scheme base
177ifndef MZSCHEME_GENERATE_BASE
178MZSCHEME_GENERATE_BASE=no
179endif
180
Bram Moolenaar4e640bd2016-01-16 16:20:38 +0100181ifneq ($(wildcard $(MZSCHEME)/lib/msvc/libmzsch$(MZSCHEME_VER).lib),)
Bram Moolenaar4f7e8212014-11-05 13:53:32 +0100182MZSCHEME_MAIN_LIB=mzsch
183else
184MZSCHEME_MAIN_LIB=racket
185endif
186
Bram Moolenaar4e640bd2016-01-16 16:20:38 +0100187ifndef MZSCHEME_PRECISE_GC
188MZSCHEME_PRECISE_GC=no
189ifneq ($(wildcard $(MZSCHEME)\lib\lib$(MZSCHEME_MAIN_LIB)$(MZSCHEME_VER).dll),)
190ifeq ($(wildcard $(MZSCHEME)\lib\libmzgc$(MZSCHEME_VER).dll),)
191MZSCHEME_PRECISE_GC=yes
192endif
193else
194ifneq ($(wildcard $(MZSCHEME)\lib\msvc\lib$(MZSCHEME_MAIN_LIB)$(MZSCHEME_VER).lib),)
195ifeq ($(wildcard $(MZSCHEME)\lib\msvc\libmzgc$(MZSCHEME_VER).lib),)
196MZSCHEME_PRECISE_GC=yes
197endif
198endif
199endif
200endif
201
Bram Moolenaar4f7e8212014-11-05 13:53:32 +0100202ifeq (no,$(DYNAMIC_MZSCHEME))
203ifeq (yes,$(MZSCHEME_PRECISE_GC))
204MZSCHEME_LIB=-l$(MZSCHEME_MAIN_LIB)$(MZSCHEME_VER)
205else
Bram Moolenaar4e640bd2016-01-16 16:20:38 +0100206MZSCHEME_LIB=-l$(MZSCHEME_MAIN_LIB)$(MZSCHEME_VER) -lmzgc$(MZSCHEME_VER)
Bram Moolenaar4f7e8212014-11-05 13:53:32 +0100207endif
208# the modern MinGW can dynamically link to dlls directly.
209# point MZSCHEME_DLLS to where you put libmzschXXXXXXX.dll and libgcXXXXXXX.dll
210ifndef MZSCHEME_DLLS
211MZSCHEME_DLLS=$(MZSCHEME)
212endif
213MZSCHEME_LIBDIR=-L$(MZSCHEME_DLLS) -L$(MZSCHEME_DLLS)\lib
214endif
215
216endif
217
218# Python interface:
219# PYTHON=[Path to Python directory] (Set inside Make_cyg.mak or Make_ming.mak)
220# DYNAMIC_PYTHON=yes (to load the Python DLL dynamically)
221# PYTHON_VER=[Python version, eg 22, 23, ..., 27] (default is 22)
222ifdef PYTHON
223ifndef DYNAMIC_PYTHON
224DYNAMIC_PYTHON=yes
225endif
226
227ifndef PYTHON_VER
Bram Moolenaar3c6f92e2016-01-02 20:26:36 +0100228PYTHON_VER=27
229endif
230ifndef DYNAMIC_PYTHON_DLL
231DYNAMIC_PYTHON_DLL=python$(PYTHON_VER).dll
232endif
233ifdef PYTHON_HOME
234PYTHON_HOME_DEF=-DPYTHON_HOME=\"$(PYTHON_HOME)\"
Bram Moolenaar4f7e8212014-11-05 13:53:32 +0100235endif
236
237ifeq (no,$(DYNAMIC_PYTHON))
238PYTHONLIB=-L$(PYTHON)/libs -lpython$(PYTHON_VER)
239endif
240# my include files are in 'win32inc' on Linux, and 'include' in the standard
241# NT distro (ActiveState)
Bram Moolenaar3c6f92e2016-01-02 20:26:36 +0100242ifndef PYTHONINC
Bram Moolenaar4f7e8212014-11-05 13:53:32 +0100243ifeq ($(CROSS),no)
244PYTHONINC=-I $(PYTHON)/include
245else
246PYTHONINC=-I $(PYTHON)/win32inc
247endif
248endif
Bram Moolenaar3c6f92e2016-01-02 20:26:36 +0100249endif
Bram Moolenaar4f7e8212014-11-05 13:53:32 +0100250
251# Python3 interface:
252# PYTHON3=[Path to Python3 directory] (Set inside Make_cyg.mak or Make_ming.mak)
253# DYNAMIC_PYTHON3=yes (to load the Python3 DLL dynamically)
254# PYTHON3_VER=[Python3 version, eg 31, 32] (default is 31)
255ifdef PYTHON3
256ifndef DYNAMIC_PYTHON3
257DYNAMIC_PYTHON3=yes
258endif
259
260ifndef PYTHON3_VER
261PYTHON3_VER=31
262endif
Bram Moolenaara7c37952016-01-20 22:23:15 +0100263ifndef DYNAMIC_PYTHON3_DLL
264DYNAMIC_PYTHON3_DLL=python$(PYTHON3_VER).dll
265endif
266ifdef PYTHON3_HOME
267PYTHON3_HOME_DEF=-DPYTHON3_HOME=\"$(PYTHON3_HOME)\"
Bram Moolenaar4f7e8212014-11-05 13:53:32 +0100268endif
269
Bram Moolenaara7c37952016-01-20 22:23:15 +0100270ifeq (no,$(DYNAMIC_PYTHON3))
271PYTHON3LIB=-L$(PYTHON3)/libs -lpython$(PYTHON3_VER)
272endif
273
274ifndef PYTHON3INC
Bram Moolenaar4f7e8212014-11-05 13:53:32 +0100275ifeq ($(CROSS),no)
276PYTHON3INC=-I $(PYTHON3)/include
277else
278PYTHON3INC=-I $(PYTHON3)/win32inc
279endif
280endif
Bram Moolenaara7c37952016-01-20 22:23:15 +0100281endif
Bram Moolenaar4f7e8212014-11-05 13:53:32 +0100282
283# TCL interface:
284# TCL=[Path to TCL directory] (Set inside Make_cyg.mak or Make_ming.mak)
285# DYNAMIC_TCL=yes (to load the TCL DLL dynamically)
286# TCL_VER=[TCL version, eg 83, 84] (default is 83)
Bram Moolenaareca99bd2016-01-07 22:50:05 +0100287# TCL_VER_LONG=[Tcl version, eg 8.3] (default is 8.3)
288# You must set TCL_VER_LONG when you set TCL_VER.
Bram Moolenaar4f7e8212014-11-05 13:53:32 +0100289ifdef TCL
290ifndef DYNAMIC_TCL
291DYNAMIC_TCL=yes
292endif
293ifndef TCL_VER
294TCL_VER = 83
295endif
Bram Moolenaareca99bd2016-01-07 22:50:05 +0100296ifndef TCL_VER_LONG
297TCL_VER_LONG = 8.3
298endif
Bram Moolenaar4f7e8212014-11-05 13:53:32 +0100299TCLINC += -I$(TCL)/include
300endif
301
302
303# Ruby interface:
304# RUBY=[Path to Ruby directory] (Set inside Make_cyg.mak or Make_ming.mak)
305# DYNAMIC_RUBY=yes (to load the Ruby DLL dynamically)
306# RUBY_VER=[Ruby version, eg 18, 19, 20] (default is 18)
307# RUBY_VER_LONG=[Ruby version, eg 1.8, 1.9.1, 2.0.0] (default is 1.8)
308# You must set RUBY_VER_LONG when changing RUBY_VER.
309# RUBY_API_VER is derived from RUBY_VER_LONG.
310# Note: If you use Ruby 1.9.3, set as follows:
311# RUBY_VER=19
312# RUBY_VER_LONG=1.9.1 (not 1.9.3, because the API version is 1.9.1.)
313ifdef RUBY
314ifndef DYNAMIC_RUBY
315DYNAMIC_RUBY=yes
316endif
317# Set default value
318ifndef RUBY_VER
319RUBY_VER = 18
320endif
321ifndef RUBY_VER_LONG
322RUBY_VER_LONG = 1.8
323endif
324ifndef RUBY_API_VER
325RUBY_API_VER = $(subst .,,$(RUBY_VER_LONG))
326endif
327
328ifndef RUBY_PLATFORM
329ifeq ($(RUBY_VER), 16)
330RUBY_PLATFORM = i586-mswin32
331else
332ifneq ($(wildcard $(RUBY)/lib/ruby/$(RUBY_VER_LONG)/i386-mingw32),)
333RUBY_PLATFORM = i386-mingw32
334else
335ifneq ($(wildcard $(RUBY)/lib/ruby/$(RUBY_VER_LONG)/x64-mingw32),)
336RUBY_PLATFORM = x64-mingw32
337else
338RUBY_PLATFORM = i386-mswin32
339endif
340endif
341endif
342endif
343
344ifndef RUBY_INSTALL_NAME
345ifeq ($(RUBY_VER), 16)
346RUBY_INSTALL_NAME = mswin32-ruby$(RUBY_API_VER)
347else
Bram Moolenaar0bee2fe2016-01-07 22:45:09 +0100348ifndef RUBY_MSVCRT_NAME
349# Base name of msvcrXX.dll which is used by ruby's dll.
350RUBY_MSVCRT_NAME = msvcrt
351endif
Bram Moolenaar4f7e8212014-11-05 13:53:32 +0100352ifeq ($(ARCH),x86-64)
Bram Moolenaar0bee2fe2016-01-07 22:45:09 +0100353RUBY_INSTALL_NAME = x64-$(RUBY_MSVCRT_NAME)-ruby$(RUBY_API_VER)
Bram Moolenaar4f7e8212014-11-05 13:53:32 +0100354else
Bram Moolenaar0bee2fe2016-01-07 22:45:09 +0100355RUBY_INSTALL_NAME = $(RUBY_MSVCRT_NAME)-ruby$(RUBY_API_VER)
Bram Moolenaar4f7e8212014-11-05 13:53:32 +0100356endif
357endif
358endif
359
360ifeq (19, $(word 1,$(sort 19 $(RUBY_VER))))
361RUBY_19_OR_LATER = 1
362endif
363
364RUBYINC = -I $(RUBY)/lib/ruby/$(RUBY_VER_LONG)/$(RUBY_PLATFORM)
365ifdef RUBY_19_OR_LATER
366RUBYINC += -I $(RUBY)/include/ruby-$(RUBY_VER_LONG) -I $(RUBY)/include/ruby-$(RUBY_VER_LONG)/$(RUBY_PLATFORM)
367endif
368ifeq (no, $(DYNAMIC_RUBY))
369RUBYLIB = -L$(RUBY)/lib -l$(RUBY_INSTALL_NAME)
370endif
371
372endif # RUBY
373
374# See feature.h for a list of options.
375# Any other defines can be included here.
376DEF_GUI=-DFEAT_GUI_W32 -DFEAT_CLIPBOARD
377DEFINES=-DWIN32 -DWINVER=$(WINVER) -D_WIN32_WINNT=$(WINVER) \
378 -DHAVE_PATHDEF -DFEAT_$(FEATURES)
379ifeq ($(ARCH),x86-64)
380DEFINES+=-DMS_WIN64
381endif
382ifeq ($(CROSS),yes)
383# cross-compiler prefix:
384ifndef CROSS_COMPILE
385CROSS_COMPILE = i586-pc-mingw32msvc-
386endif
387DEL = rm
388MKDIR = mkdir -p
389DIRSLASH = /
390else
391# normal (Windows) compilation:
392ifndef CROSS_COMPILE
393CROSS_COMPILE =
394endif
395ifneq (sh.exe, $(SHELL))
396DEL = rm
397MKDIR = mkdir -p
398DIRSLASH = /
399else
400DEL = del
401MKDIR = mkdir
402DIRSLASH = \\
403endif
404endif
405CC := $(CROSS_COMPILE)gcc
406CXX := $(CROSS_COMPILE)g++
Bram Moolenaar2d78cd72014-12-13 20:50:09 +0100407ifeq ($(UNDER_CYGWIN),yes)
Bram Moolenaar4f7e8212014-11-05 13:53:32 +0100408WINDRES := $(CROSS_COMPILE)windres
Bram Moolenaar2d78cd72014-12-13 20:50:09 +0100409else
410WINDRES := windres
411endif
Bram Moolenaar4f7e8212014-11-05 13:53:32 +0100412WINDRES_CC = $(CC)
413
414#>>>>> end of choices
415###########################################################################
416
Bram Moolenaara971df82016-02-15 21:22:10 +0100417CFLAGS = -Iproto $(DEFINES) -pipe -march=$(ARCH) -Wall
Bram Moolenaar4f7e8212014-11-05 13:53:32 +0100418WINDRES_FLAGS = --preprocessor="$(WINDRES_CC) -E -xc" -DRC_INVOKED
419EXTRA_LIBS =
420
421ifdef GETTEXT
422DEFINES += -DHAVE_GETTEXT -DHAVE_LOCALE_H
423GETTEXTINCLUDE = $(GETTEXT)/include
424GETTEXTLIB = $(INTLPATH)
425ifeq (yes, $(GETTEXT))
426DEFINES += -DDYNAMIC_GETTEXT
427else
428ifdef DYNAMIC_GETTEXT
429DEFINES += -D$(DYNAMIC_GETTEXT)
430ifdef GETTEXT_DYNAMIC
431DEFINES += -DGETTEXT_DYNAMIC -DGETTEXT_DLL=\"$(GETTEXT_DYNAMIC)\"
432endif
433endif
434endif
435endif
436
437ifdef PERL
Bram Moolenaar367fbf12015-06-25 16:13:46 +0200438CFLAGS += -I$(PERLLIBS) -DFEAT_PERL -DPERL_IMPLICIT_CONTEXT -DPERL_IMPLICIT_SYS
Bram Moolenaar4f7e8212014-11-05 13:53:32 +0100439ifeq (yes, $(DYNAMIC_PERL))
440CFLAGS += -DDYNAMIC_PERL -DDYNAMIC_PERL_DLL=\"perl$(PERL_VER).dll\"
441EXTRA_LIBS += -L$(PERLLIBS) -lperl$(PERL_VER)
442endif
443endif
444
445ifdef LUA
446CFLAGS += -I$(LUA)/include -I$(LUA) -DFEAT_LUA
447ifeq (yes, $(DYNAMIC_LUA))
448CFLAGS += -DDYNAMIC_LUA -DDYNAMIC_LUA_DLL=\"lua$(LUA_VER).dll\"
449endif
450endif
451
452ifdef MZSCHEME
Bram Moolenaar4e640bd2016-01-16 16:20:38 +0100453ifndef MZSCHEME_COLLECTS
454MZSCHEME_COLLECTS=$(MZSCHEME)/collects
455ifeq (yes, $(UNDER_CYGWIN))
456MZSCHEME_COLLECTS:=$(shell cygpath -m $(MZSCHEME_COLLECTS) | sed -e 's/ /\\ /g')
457endif
458endif
459CFLAGS += -I$(MZSCHEME)/include -DFEAT_MZSCHEME -DMZSCHEME_COLLECTS=\"$(MZSCHEME_COLLECTS)\"
Bram Moolenaar4f7e8212014-11-05 13:53:32 +0100460ifeq (yes, $(DYNAMIC_MZSCHEME))
Bram Moolenaar4e640bd2016-01-16 16:20:38 +0100461ifeq (yes, $(MZSCHEME_PRECISE_GC))
462# Precise GC does not use separate dll
463CFLAGS += -DDYNAMIC_MZSCHEME -DDYNAMIC_MZSCH_DLL=\"lib$(MZSCHEME_MAIN_LIB)$(MZSCHEME_VER).dll\" -DDYNAMIC_MZGC_DLL=\"lib$(MZSCHEME_MAIN_LIB)$(MZSCHEME_VER).dll\"
464else
Bram Moolenaar4f7e8212014-11-05 13:53:32 +0100465CFLAGS += -DDYNAMIC_MZSCHEME -DDYNAMIC_MZSCH_DLL=\"lib$(MZSCHEME_MAIN_LIB)$(MZSCHEME_VER).dll\" -DDYNAMIC_MZGC_DLL=\"libmzgc$(MZSCHEME_VER).dll\"
466endif
Bram Moolenaar4e640bd2016-01-16 16:20:38 +0100467endif
Bram Moolenaar4f7e8212014-11-05 13:53:32 +0100468ifeq (yes, "$(MZSCHEME_DEBUG)")
469CFLAGS += -DMZSCHEME_FORCE_GC
470endif
471endif
472
473ifdef RUBY
474CFLAGS += -DFEAT_RUBY $(RUBYINC)
475ifeq (yes, $(DYNAMIC_RUBY))
476CFLAGS += -DDYNAMIC_RUBY -DDYNAMIC_RUBY_DLL=\"$(RUBY_INSTALL_NAME).dll\"
477CFLAGS += -DDYNAMIC_RUBY_VER=$(RUBY_VER)
478endif
479ifneq ($(findstring w64-mingw32,$(CC)),)
480# A workaround for MinGW-w64
481CFLAGS += -DHAVE_STRUCT_TIMESPEC -DHAVE_STRUCT_TIMEZONE
482endif
483endif
484
485ifdef PYTHON
486CFLAGS += -DFEAT_PYTHON
487ifeq (yes, $(DYNAMIC_PYTHON))
Bram Moolenaar449538c2016-01-09 17:49:15 +0100488CFLAGS += -DDYNAMIC_PYTHON -DDYNAMIC_PYTHON_DLL=\"$(DYNAMIC_PYTHON_DLL)\"
Bram Moolenaar4f7e8212014-11-05 13:53:32 +0100489endif
490endif
491
492ifdef PYTHON3
493CFLAGS += -DFEAT_PYTHON3
494ifeq (yes, $(DYNAMIC_PYTHON3))
Bram Moolenaara7c37952016-01-20 22:23:15 +0100495CFLAGS += -DDYNAMIC_PYTHON3 -DDYNAMIC_PYTHON3_DLL=\"$(DYNAMIC_PYTHON3_DLL)\"
Bram Moolenaar4f7e8212014-11-05 13:53:32 +0100496endif
497endif
498
499ifdef TCL
500CFLAGS += -DFEAT_TCL $(TCLINC)
501ifeq (yes, $(DYNAMIC_TCL))
Bram Moolenaareca99bd2016-01-07 22:50:05 +0100502CFLAGS += -DDYNAMIC_TCL -DDYNAMIC_TCL_DLL=\"tcl$(TCL_VER).dll\" -DDYNAMIC_TCL_VER=\"$(TCL_VER_LONG)\"
Bram Moolenaar4f7e8212014-11-05 13:53:32 +0100503endif
504endif
505
506ifeq ($(POSTSCRIPT),yes)
507DEFINES += -DMSWINPS
508endif
509
510ifeq (yes, $(OLE))
511DEFINES += -DFEAT_OLE
512endif
513
514ifeq ($(CSCOPE),yes)
515DEFINES += -DFEAT_CSCOPE
516endif
517
518ifeq ($(NETBEANS),yes)
519# Only allow NETBEANS for a GUI build.
520ifeq (yes, $(GUI))
521DEFINES += -DFEAT_NETBEANS_INTG
522
523ifeq ($(NBDEBUG), yes)
524DEFINES += -DNBDEBUG
525NBDEBUG_INCL = nbdebug.h
526NBDEBUG_SRC = nbdebug.c
527endif
528endif
529endif
530
Bram Moolenaare0874f82016-01-24 20:36:41 +0100531ifeq ($(CHANNEL),yes)
532DEFINES += -DFEAT_CHANNEL
533endif
534
Bram Moolenaar4f7e8212014-11-05 13:53:32 +0100535# DirectWrite (DirectX)
536ifeq ($(DIRECTX),yes)
537# Only allow DirectWrite for a GUI build.
538ifeq (yes, $(GUI))
539DEFINES += -DFEAT_DIRECTX -DDYNAMIC_DIRECTX
540endif
541endif
542
543# Only allow XPM for a GUI build.
544ifeq (yes, $(GUI))
545
546ifndef XPM
547ifeq ($(ARCH),i386)
548XPM = xpm/x86
549endif
550ifeq ($(ARCH),i486)
551XPM = xpm/x86
552endif
553ifeq ($(ARCH),i586)
554XPM = xpm/x86
555endif
556ifeq ($(ARCH),i686)
557XPM = xpm/x86
558endif
559ifeq ($(ARCH),x86-64)
560XPM = xpm/x64
561endif
562endif
563ifdef XPM
564ifneq ($(XPM),no)
565CFLAGS += -DFEAT_XPM_W32 -I $(XPM)/include -I $(XPM)/../include
566endif
567endif
568
569endif
570
571ifeq ($(DEBUG),yes)
572CFLAGS += -g -fstack-check
573DEBUG_SUFFIX=d
574else
575ifeq ($(OPTIMIZE), SIZE)
576CFLAGS += -Os
577else
578ifeq ($(OPTIMIZE), MAXSPEED)
579CFLAGS += -O3
580CFLAGS += -fomit-frame-pointer -freg-struct-return
581else # SPEED
582CFLAGS += -O2
583endif
584endif
585CFLAGS += -s
586endif
587
588LIB = -lkernel32 -luser32 -lgdi32 -ladvapi32 -lcomdlg32 -lcomctl32 -lversion
589GUIOBJ = $(OUTDIR)/gui.o $(OUTDIR)/gui_w32.o $(OUTDIR)/gui_beval.o $(OUTDIR)/os_w32exe.o
590OBJ = \
591 $(OUTDIR)/blowfish.o \
592 $(OUTDIR)/buffer.o \
593 $(OUTDIR)/charset.o \
594 $(OUTDIR)/crypt.o \
595 $(OUTDIR)/crypt_zip.o \
596 $(OUTDIR)/diff.o \
597 $(OUTDIR)/digraph.o \
598 $(OUTDIR)/edit.o \
599 $(OUTDIR)/eval.o \
600 $(OUTDIR)/ex_cmds.o \
601 $(OUTDIR)/ex_cmds2.o \
602 $(OUTDIR)/ex_docmd.o \
603 $(OUTDIR)/ex_eval.o \
604 $(OUTDIR)/ex_getln.o \
605 $(OUTDIR)/fileio.o \
606 $(OUTDIR)/fold.o \
607 $(OUTDIR)/getchar.o \
608 $(OUTDIR)/hardcopy.o \
609 $(OUTDIR)/hashtab.o \
Bram Moolenaar520e1e42016-01-23 19:46:28 +0100610 $(OUTDIR)/json.o \
Bram Moolenaar4f7e8212014-11-05 13:53:32 +0100611 $(OUTDIR)/main.o \
612 $(OUTDIR)/mark.o \
613 $(OUTDIR)/memfile.o \
614 $(OUTDIR)/memline.o \
615 $(OUTDIR)/menu.o \
616 $(OUTDIR)/message.o \
617 $(OUTDIR)/misc1.o \
618 $(OUTDIR)/misc2.o \
619 $(OUTDIR)/move.o \
620 $(OUTDIR)/mbyte.o \
621 $(OUTDIR)/normal.o \
622 $(OUTDIR)/ops.o \
623 $(OUTDIR)/option.o \
624 $(OUTDIR)/os_win32.o \
625 $(OUTDIR)/os_mswin.o \
626 $(OUTDIR)/winclip.o \
627 $(OUTDIR)/pathdef.o \
628 $(OUTDIR)/popupmnu.o \
629 $(OUTDIR)/quickfix.o \
630 $(OUTDIR)/regexp.o \
631 $(OUTDIR)/screen.o \
632 $(OUTDIR)/search.o \
633 $(OUTDIR)/sha256.o \
634 $(OUTDIR)/spell.o \
635 $(OUTDIR)/syntax.o \
636 $(OUTDIR)/tag.o \
637 $(OUTDIR)/term.o \
638 $(OUTDIR)/ui.o \
639 $(OUTDIR)/undo.o \
640 $(OUTDIR)/version.o \
641 $(OUTDIR)/vimrc.o \
642 $(OUTDIR)/window.o
643
644ifdef PERL
645OBJ += $(OUTDIR)/if_perl.o
646endif
647ifdef LUA
648OBJ += $(OUTDIR)/if_lua.o
649endif
650ifdef MZSCHEME
651OBJ += $(OUTDIR)/if_mzsch.o
652MZSCHEME_INCL = if_mzsch.h
653ifeq (yes,$(MZSCHEME_GENERATE_BASE))
654CFLAGS += -DINCLUDE_MZSCHEME_BASE
655MZ_EXTRA_DEP += mzscheme_base.c
656endif
657ifeq (yes,$(MZSCHEME_PRECISE_GC))
658CFLAGS += -DMZ_PRECISE_GC
659endif
660endif
661ifdef PYTHON
662OBJ += $(OUTDIR)/if_python.o
663endif
664ifdef PYTHON3
665OBJ += $(OUTDIR)/if_python3.o
666endif
667ifdef RUBY
668OBJ += $(OUTDIR)/if_ruby.o
669endif
670ifdef TCL
671OBJ += $(OUTDIR)/if_tcl.o
672endif
673ifeq ($(CSCOPE),yes)
674OBJ += $(OUTDIR)/if_cscope.o
675endif
Bram Moolenaare0874f82016-01-24 20:36:41 +0100676
Bram Moolenaar4f7e8212014-11-05 13:53:32 +0100677ifeq ($(NETBEANS),yes)
Bram Moolenaare0874f82016-01-24 20:36:41 +0100678ifneq ($(CHANNEL),yes)
679# Cannot use Netbeans without CHANNEL
680NETBEANS=no
681else
Bram Moolenaar44d57182016-02-14 23:11:23 +0100682ifneq (yes, $(GUI))
683# Cannot use Netbeans without GUI.
684NETBEANS=no
685else
Bram Moolenaar4f7e8212014-11-05 13:53:32 +0100686OBJ += $(OUTDIR)/netbeans.o
687LIB += -lwsock32
688endif
689endif
Bram Moolenaare0874f82016-01-24 20:36:41 +0100690endif
691
692ifeq ($(CHANNEL),yes)
693OBJ += $(OUTDIR)/channel.o
694ifneq ($(NETBEANS),yes)
695LIB += -lwsock32
696endif
697endif
Bram Moolenaare0874f82016-01-24 20:36:41 +0100698
Bram Moolenaar4f7e8212014-11-05 13:53:32 +0100699ifeq ($(DIRECTX),yes)
700# Only allow DIRECTX for a GUI build.
701ifeq (yes, $(GUI))
702OBJ += $(OUTDIR)/gui_dwrite.o
703LIB += -ld2d1 -ldwrite
704USE_STDCPLUS = yes
705endif
706endif
707ifneq ($(XPM),no)
708# Only allow XPM for a GUI build.
709ifeq (yes, $(GUI))
710OBJ += $(OUTDIR)/xpm_w32.o
711# You'll need libXpm.a from http://gnuwin32.sf.net
712LIB += -L$(XPM)/lib -lXpm
713endif
714endif
715
716
717ifdef MZSCHEME
718MZSCHEME_SUFFIX = Z
719endif
720
721ifeq ($(GUI),yes)
722TARGET := gvim$(DEBUG_SUFFIX).exe
723DEFINES += $(DEF_GUI)
724OBJ += $(GUIOBJ)
725LFLAGS += -mwindows
726OUTDIR = gobj$(DEBUG_SUFFIX)$(MZSCHEME_SUFFIX)$(ARCH)
727else
728TARGET := vim$(DEBUG_SUFFIX).exe
729OUTDIR = obj$(DEBUG_SUFFIX)$(MZSCHEME_SUFFIX)$(ARCH)
730endif
731
732ifdef GETTEXT
733ifneq (yes, $(GETTEXT))
734CFLAGS += -I$(GETTEXTINCLUDE)
735ifndef STATIC_GETTEXT
736LIB += -L$(GETTEXTLIB) -l$(INTLLIB)
737ifeq (USE_SAFE_GETTEXT_DLL, $(DYNAMIC_GETTEXT))
738OBJ+=$(SAFE_GETTEXT_DLL_OBJ)
739endif
740else
741LIB += -L$(GETTEXTLIB) -lintl
742endif
743endif
744endif
745
746ifdef PERL
747ifeq (no, $(DYNAMIC_PERL))
748LIB += -L$(PERLLIBS) -lperl$(PERL_VER)
749endif
750endif
751
752ifdef TCL
753LIB += -L$(TCL)/lib
754ifeq (yes, $(DYNAMIC_TCL))
755LIB += -ltclstub$(TCL_VER)
756else
757LIB += -ltcl$(TCL_VER)
758endif
759endif
760
761ifeq (yes, $(OLE))
762LIB += -loleaut32
763OBJ += $(OUTDIR)/if_ole.o
764USE_STDCPLUS = yes
765endif
766
767ifeq (yes, $(MBYTE))
768DEFINES += -DFEAT_MBYTE
769endif
770
771ifeq (yes, $(IME))
772DEFINES += -DFEAT_MBYTE_IME
773ifeq (yes, $(DYNAMIC_IME))
774DEFINES += -DDYNAMIC_IME
775else
776LIB += -limm32
777endif
778endif
779
780ifdef ICONV
781ifneq (yes, $(ICONV))
782LIB += -L$(ICONV)
783CFLAGS += -I$(ICONV)
784endif
785DEFINES+=-DDYNAMIC_ICONV
786endif
787
788ifeq (yes, $(USE_STDCPLUS))
789ifeq (yes, $(STATIC_STDCPLUS))
790LIB += -Wl,-Bstatic -lstdc++ -Wl,-Bdynamic
791else
792LIB += -lstdc++
793endif
794endif
795
796all: $(TARGET) vimrun.exe xxd/xxd.exe install.exe uninstal.exe GvimExt/gvimext.dll
797
798vimrun.exe: vimrun.c
799 $(CC) $(CFLAGS) -o vimrun.exe vimrun.c $(LIB)
800
801install.exe: dosinst.c
802 $(CC) $(CFLAGS) -o install.exe dosinst.c $(LIB) -lole32 -luuid
803
804uninstal.exe: uninstal.c
805 $(CC) $(CFLAGS) -o uninstal.exe uninstal.c $(LIB)
806
807$(TARGET): $(OUTDIR) $(OBJ)
808 $(CC) $(CFLAGS) $(LFLAGS) -o $@ $(OBJ) $(LIB) -lole32 -luuid $(LUA_LIB) $(MZSCHEME_LIBDIR) $(MZSCHEME_LIB) $(PYTHONLIB) $(PYTHON3LIB) $(RUBYLIB)
809
810upx: exes
811 upx gvim.exe
812 upx vim.exe
813
814mpress: exes
815 mpress gvim.exe
816 mpress vim.exe
817
818xxd/xxd.exe: xxd/xxd.c
819 $(MAKE) -C xxd -f Make_ming.mak CC='$(CC)'
820
821GvimExt/gvimext.dll: GvimExt/gvimext.cpp GvimExt/gvimext.rc GvimExt/gvimext.h
822 $(MAKE) -C GvimExt -f Make_ming.mak CROSS=$(CROSS) CROSS_COMPILE=$(CROSS_COMPILE) CXX='$(CXX)' STATIC_STDCPLUS=$(STATIC_STDCPLUS)
823
824clean:
825 -$(DEL) $(OUTDIR)$(DIRSLASH)*.o
826 -$(DEL) $(OUTDIR)$(DIRSLASH)*.res
827 -rmdir $(OUTDIR)
828 -$(DEL) *.exe
829 -$(DEL) pathdef.c
830ifdef PERL
831 -$(DEL) if_perl.c
832endif
833ifdef MZSCHEME
834 -$(DEL) mzscheme_base.c
835endif
836 $(MAKE) -C GvimExt -f Make_ming.mak clean
837 $(MAKE) -C xxd -f Make_ming.mak clean
838
839###########################################################################
840INCL = vim.h feature.h os_win32.h os_dos.h ascii.h keymap.h term.h macros.h \
841 structs.h regexp.h option.h ex_cmds.h proto.h globals.h farsi.h \
842 gui.h
843
844$(OUTDIR)/if_python.o : if_python.c if_py_both.h $(INCL)
Bram Moolenaar449538c2016-01-09 17:49:15 +0100845 $(CC) -c $(CFLAGS) $(PYTHONINC) $(PYTHON_HOME_DEF) $< -o $@
Bram Moolenaar4f7e8212014-11-05 13:53:32 +0100846
847$(OUTDIR)/if_python3.o : if_python3.c if_py_both.h $(INCL)
Bram Moolenaara7c37952016-01-20 22:23:15 +0100848 $(CC) -c $(CFLAGS) $(PYTHON3INC) $(PYTHON3_HOME_DEF) $< -o $@
Bram Moolenaar4f7e8212014-11-05 13:53:32 +0100849
850$(OUTDIR)/%.o : %.c $(INCL)
851 $(CC) -c $(CFLAGS) $< -o $@
852
853$(OUTDIR)/vimrc.o: vim.rc version.h gui_w32_rc.h
854 $(WINDRES) $(WINDRES_FLAGS) $(DEFINES) \
855 --input-format=rc --output-format=coff -i vim.rc -o $@
856
857$(OUTDIR):
858 $(MKDIR) $(OUTDIR)
859
860$(OUTDIR)/ex_docmd.o: ex_docmd.c $(INCL) ex_cmds.h
861 $(CC) -c $(CFLAGS) ex_docmd.c -o $(OUTDIR)/ex_docmd.o
862
863$(OUTDIR)/ex_eval.o: ex_eval.c $(INCL) ex_cmds.h
864 $(CC) -c $(CFLAGS) ex_eval.c -o $(OUTDIR)/ex_eval.o
865
866$(OUTDIR)/gui_w32.o: gui_w32.c gui_w48.c $(INCL)
867 $(CC) -c $(CFLAGS) gui_w32.c -o $(OUTDIR)/gui_w32.o
868
869$(OUTDIR)/gui_dwrite.o: gui_dwrite.cpp $(INCL) gui_dwrite.h
870 $(CC) -c $(CFLAGS) gui_dwrite.cpp -o $(OUTDIR)/gui_dwrite.o
871
872$(OUTDIR)/if_cscope.o: if_cscope.c $(INCL) if_cscope.h
873 $(CC) -c $(CFLAGS) if_cscope.c -o $(OUTDIR)/if_cscope.o
874
875# Remove -D__IID_DEFINED__ for newer versions of the w32api
876$(OUTDIR)/if_ole.o: if_ole.cpp $(INCL)
877 $(CC) $(CFLAGS) -c -o $(OUTDIR)/if_ole.o if_ole.cpp
878
879$(OUTDIR)/if_ruby.o: if_ruby.c $(INCL)
880ifeq (16, $(RUBY))
881 $(CC) $(CFLAGS) -U_WIN32 -c -o $(OUTDIR)/if_ruby.o if_ruby.c
882endif
883
884if_perl.c: if_perl.xs typemap
885 $(XSUBPP) -prototypes -typemap \
Bram Moolenaar345326a2014-11-06 10:03:01 +0100886 $(PERLTYPEMAP) if_perl.xs > $@
Bram Moolenaar4f7e8212014-11-05 13:53:32 +0100887
888$(OUTDIR)/netbeans.o: netbeans.c $(INCL) $(NBDEBUG_INCL) $(NBDEBUG_SRC)
889 $(CC) -c $(CFLAGS) netbeans.c -o $(OUTDIR)/netbeans.o
890
Bram Moolenaare0874f82016-01-24 20:36:41 +0100891$(OUTDIR)/channel.o: channel.c $(INCL)
892 $(CC) -c $(CFLAGS) channel.c -o $(OUTDIR)/channel.o
893
Bram Moolenaar4f7e8212014-11-05 13:53:32 +0100894$(OUTDIR)/regexp.o: regexp.c regexp_nfa.c $(INCL)
895 $(CC) -c $(CFLAGS) regexp.c -o $(OUTDIR)/regexp.o
896
897$(OUTDIR)/if_mzsch.o: if_mzsch.c $(INCL) if_mzsch.h $(MZ_EXTRA_DEP)
898 $(CC) -c $(CFLAGS) if_mzsch.c -o $(OUTDIR)/if_mzsch.o
899
900mzscheme_base.c:
901 $(MZSCHEME)/mzc --c-mods mzscheme_base.c ++lib scheme/base
902
903pathdef.c: $(INCL)
904ifneq (sh.exe, $(SHELL))
905 @echo creating pathdef.c
906 @echo '/* pathdef.c */' > pathdef.c
907 @echo '#include "vim.h"' >> pathdef.c
908 @echo 'char_u *default_vim_dir = (char_u *)"$(VIMRCLOC)";' >> pathdef.c
909 @echo 'char_u *default_vimruntime_dir = (char_u *)"$(VIMRUNTIMEDIR)";' >> pathdef.c
910 @echo 'char_u *all_cflags = (char_u *)"$(CC) $(CFLAGS)";' >> pathdef.c
911 @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
912 @echo 'char_u *compiled_user = (char_u *)"$(USERNAME)";' >> pathdef.c
913 @echo 'char_u *compiled_sys = (char_u *)"$(USERDOMAIN)";' >> pathdef.c
914else
915 @echo creating pathdef.c
916 @echo /* pathdef.c */ > pathdef.c
917 @echo #include "vim.h" >> pathdef.c
918 @echo char_u *default_vim_dir = (char_u *)"$(VIMRCLOC)"; >> pathdef.c
919 @echo char_u *default_vimruntime_dir = (char_u *)"$(VIMRUNTIMEDIR)"; >> pathdef.c
920 @echo char_u *all_cflags = (char_u *)"$(CC) $(CFLAGS)"; >> pathdef.c
921 @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
922 @echo char_u *compiled_user = (char_u *)"$(USERNAME)"; >> pathdef.c
923 @echo char_u *compiled_sys = (char_u *)"$(USERDOMAIN)"; >> pathdef.c
924endif