xref: /vim-8.2.3635/src/Make_cyg_ming.mak (revision b3a29558)
1# 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#     https://upx.github.io/
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 <[email protected]> et al.
28# Updated 2014 Oct 13.
29
30#>>>>> choose options:
31# FEATURES=[TINY | SMALL | NORMAL | BIG | HUGE]
32# Set to TINY to make minimal version (few features).
33FEATURES=HUGE
34
35# set to yes for a debug build
36DEBUG=no
37
38# set to yes to create a mapfile
39#MAP=yes
40
41# set to yes to measure code coverage
42COVERAGE=no
43
44# better encryption support using libsodium
45#SODIUM=yes
46
47# set to SIZE for size, SPEED for speed, MAXSPEED for maximum optimization
48OPTIMIZE=MAXSPEED
49
50# set to yes to make gvim, no for vim
51GUI=yes
52
53# set to yes to enable the DLL support (EXPERIMENTAL).
54# Creates vim{32,64}.dll, and stub gvim.exe and vim.exe.
55# "GUI" should be also set to "yes".
56#VIMDLL=yes
57
58# set to no if you do not want to use DirectWrite (DirectX)
59# MinGW-w64 is needed, and ARCH should be set to i686 or x86-64.
60DIRECTX=yes
61
62# Disable Color emoji support
63# (default is yes if DIRECTX=yes, requires WinSDK 8.1 or later.)
64#COLOR_EMOJI=no
65
66# Set to one of i386, i486, i586, i686 as the minimum target processor.
67# For amd64/x64 architecture set ARCH=x86-64 .
68# If not set, it will be automatically detected. (Normally i686 or x86-64.)
69#ARCH=i686
70# Set to yes to cross-compile from unix; no=native Windows (and Cygwin).
71CROSS=no
72
73# Set to path to iconv.h and libiconv.a to enable using 'iconv.dll'.
74# Use "yes" when the path does not need to be define.
75#ICONV="."
76ICONV=yes
77GETTEXT=yes
78
79# Set to yes to include IME support.
80IME=yes
81DYNAMIC_IME=yes
82
83# Set to yes to enable writing a postscript file with :hardcopy.
84POSTSCRIPT=no
85
86# Set to yes to enable OLE support.
87OLE=no
88
89# Set the default $(WINVER).  Use 0x0501 to make it work with WinXP.
90ifndef WINVER
91# WINVER = 0x0501
92WINVER = 0x0600
93endif
94
95# Set to yes to enable Cscope support.
96CSCOPE=yes
97
98# Set to yes to enable Netbeans support (requires CHANNEL).
99NETBEANS=$(GUI)
100
101# Set to yes to enable inter process communication.
102ifeq (HUGE, $(FEATURES))
103CHANNEL=yes
104else
105CHANNEL=$(GUI)
106endif
107
108# Set to yes to enable terminal support.
109ifeq (HUGE, $(FEATURES))
110TERMINAL=yes
111else
112TERMINAL=no
113endif
114
115# Set to yes to enable sound support.
116ifneq ($(findstring $(FEATURES),BIG HUGE),)
117SOUND=yes
118else
119SOUND=no
120endif
121
122ifndef CTAGS
123# this assumes ctags is Exuberant ctags
124CTAGS = ctags -I INIT+,INIT2+,INIT3+,INIT4+,INIT5+ --fields=+S
125endif
126
127# Link against the shared version of libstdc++ by default.  Set
128# STATIC_STDCPLUS to "yes" to link against static version instead.
129ifndef STATIC_STDCPLUS
130STATIC_STDCPLUS=no
131endif
132
133
134# Link against the shared version of libwinpthread by default.  Set
135# STATIC_WINPTHREAD to "yes" to link against static version instead.
136ifndef STATIC_WINPTHREAD
137STATIC_WINPTHREAD=$(STATIC_STDCPLUS)
138endif
139# If you use TDM-GCC(-64), change HAS_GCC_EH to "no".
140# This is used when STATIC_STDCPLUS=yes.
141HAS_GCC_EH=yes
142
143# If the user doesn't want gettext, undefine it.
144ifeq (no, $(GETTEXT))
145GETTEXT=
146endif
147# Added by E.F. Amatria <[email protected]> 2001 Feb 23
148# Uncomment the first line and one of the following three if you want Native Language
149# Support.  You'll need gnu_gettext.win32, a MINGW32 Windows PORT of gettext by
150# Franco Bez <[email protected]>.  It may be found at
151# http://home.a-city.de/franco.bez/gettext/gettext_win32_en.html
152# Tested with mingw32 with GCC-2.95.2 on Win98
153# Updated 2001 Jun 9
154#GETTEXT=c:/gettext.win32.msvcrt
155#STATIC_GETTEXT=USE_STATIC_GETTEXT
156#DYNAMIC_GETTEXT=USE_GETTEXT_DLL
157#DYNAMIC_GETTEXT=USE_SAFE_GETTEXT_DLL
158SAFE_GETTEXT_DLL_OBJ = $(GETTEXT)/src/safe_gettext_dll/safe_gettext_dll.o
159# Alternatively, if you uncomment the two following lines, you get a "safe" version
160# without linking the safe_gettext_dll.o object file.
161#DYNAMIC_GETTEXT=DYNAMIC_GETTEXT
162#GETTEXT_DYNAMIC=gnu_gettext.dll
163INTLPATH=$(GETTEXT)/lib/mingw32
164INTLLIB=gnu_gettext
165
166# If you are using gettext-0.10.35 from http://sourceforge.net/projects/gettext
167# or gettext-0.10.37 from http://sourceforge.net/projects/mingwrep/
168# uncomment the following, but I can't build a static version with them, ?-(|
169#GETTEXT=c:/gettext-0.10.37-20010430
170#STATIC_GETTEXT=USE_STATIC_GETTEXT
171#DYNAMIC_GETTEXT=DYNAMIC_GETTEXT
172#INTLPATH=$(GETTEXT)/lib
173#INTLLIB=intl
174
175
176# Command definitions (depends on cross-compiling and shell)
177ifeq ($(CROSS),yes)
178# cross-compiler prefix:
179 ifndef CROSS_COMPILE
180CROSS_COMPILE = i586-pc-mingw32msvc-
181 endif
182DEL = rm
183MKDIR = mkdir -p
184DIRSLASH = /
185else
186# normal (Windows) compilation:
187 ifndef CROSS_COMPILE
188CROSS_COMPILE =
189 endif
190
191# About the "sh.exe" condition, as explained by Ken Takata:
192#
193# If the makefile is executed with mingw32-make and sh.exe is not found in
194# $PATH, then $SHELL is set to "sh.exe" (without any path). In this case,
195# unix-like commands might not work and a dos-style path is needed.
196#
197# If the makefile is executed with mingw32-make and sh.exe IS found in $PATH,
198# then $SHELL is set with the actual path of sh.exe (e.g.
199# "C:/msys64/usr/bin/sh.exe").  In this case, unix-like commands can be used.
200#
201# If it is executed by the "make" command from cmd.exe, $SHELL is set to
202# "/bin/sh". If the "make" command is in the $PATH, other unix-like commands
203# might also work.
204#
205# If it is executed by the "make" command from a unix-like shell,
206# $SHELL is set with the unix-style path (e.g. "/bin/bash").
207# In this case, unix-like commands can be used.
208#
209 ifneq (sh.exe, $(SHELL))
210DEL = rm
211MKDIR = mkdir -p
212DIRSLASH = /
213 else
214DEL = del
215MKDIR = mkdir
216DIRSLASH = \\
217 endif
218endif
219CC := $(CROSS_COMPILE)gcc
220CXX := $(CROSS_COMPILE)g++
221ifeq ($(UNDER_CYGWIN),yes)
222WINDRES := $(CROSS_COMPILE)windres
223else
224WINDRES := windres
225endif
226
227# Get the default ARCH.
228ifndef ARCH
229ARCH := $(shell $(CC) -dumpmachine | sed -e 's/-.*//' -e 's/_/-/' -e 's/^mingw32$$/i686/')
230endif
231
232
233#	Perl interface:
234#	  PERL=[Path to Perl directory] (Set inside Make_cyg.mak or Make_ming.mak)
235#	  DYNAMIC_PERL=yes (to load the Perl DLL dynamically)
236#	  PERL_VER=[Perl version, eg 56, 58, 510] (default is 524)
237ifdef PERL
238 ifndef PERL_VER
239PERL_VER=524
240 endif
241 ifndef DYNAMIC_PERL
242DYNAMIC_PERL=yes
243 endif
244# on Linux, for cross-compile, it's here:
245#PERLLIB=/home/ron/ActivePerl/lib
246# on NT, it's here:
247PERLEXE=$(PERL)/bin/perl
248PERLLIB=$(PERL)/lib
249PERLLIBS=$(PERLLIB)/Core
250 ifeq ($(UNDER_CYGWIN),yes)
251PERLTYPEMAP:=$(shell cygpath -m $(PERLLIB)/ExtUtils/typemap)
252XSUBPPTRY:=$(shell cygpath -m $(PERLLIB)/ExtUtils/xsubpp)
253 else
254PERLTYPEMAP=$(PERLLIB)/ExtUtils/typemap
255XSUBPPTRY=$(PERLLIB)/ExtUtils/xsubpp
256 endif
257XSUBPP_EXISTS=$(shell $(PERLEXE) -e "print 1 unless -e '$(XSUBPPTRY)'")
258 ifeq "$(XSUBPP_EXISTS)" ""
259XSUBPP=$(PERLEXE) $(XSUBPPTRY)
260 else
261XSUBPP=xsubpp
262 endif
263endif
264
265#	Lua interface:
266#	  LUA=[Path to Lua directory] (Set inside Make_cyg.mak or Make_ming.mak)
267#	  LUA_LIBDIR=[Path to Lua library directory] (default: $LUA/lib)
268#	  LUA_INCDIR=[Path to Lua include directory] (default: $LUA/include)
269#	  DYNAMIC_LUA=yes (to load the Lua DLL dynamically)
270#	  LUA_VER=[Lua version, eg 51, 52] (default is 53)
271ifdef LUA
272 ifndef DYNAMIC_LUA
273DYNAMIC_LUA=yes
274 endif
275
276 ifndef LUA_VER
277LUA_VER=53
278 endif
279
280 ifeq (no,$(DYNAMIC_LUA))
281LUA_LIBDIR = $(LUA)/lib
282LUA_LIB = -L$(LUA_LIBDIR) -llua
283 endif
284
285endif
286
287#	MzScheme interface:
288#	  MZSCHEME=[Path to MzScheme directory] (Set inside Make_cyg.mak or Make_ming.mak)
289#	  DYNAMIC_MZSCHEME=yes (to load the MzScheme DLL dynamically)
290#	  MZSCHEME_VER=[MzScheme version] (default is 3m_a0solc (6.6))
291#	  	Used for the DLL file name. E.g.:
292#	  	C:\Program Files (x86)\Racket\lib\libracket3m_XXXXXX.dll
293#	  MZSCHEME_DEBUG=no
294ifdef MZSCHEME
295 ifndef DYNAMIC_MZSCHEME
296DYNAMIC_MZSCHEME=yes
297 endif
298
299 ifndef MZSCHEME_VER
300MZSCHEME_VER=3m_a0solc
301 endif
302
303# for version 4.x we need to generate byte-code for Scheme base
304 ifndef MZSCHEME_GENERATE_BASE
305MZSCHEME_GENERATE_BASE=no
306 endif
307
308 ifneq ($(wildcard $(MZSCHEME)/lib/msvc/libmzsch$(MZSCHEME_VER).lib),)
309MZSCHEME_MAIN_LIB=mzsch
310 else
311MZSCHEME_MAIN_LIB=racket
312 endif
313
314 ifndef MZSCHEME_PRECISE_GC
315MZSCHEME_PRECISE_GC=no
316  ifneq ($(wildcard $(MZSCHEME)\lib\lib$(MZSCHEME_MAIN_LIB)$(MZSCHEME_VER).dll),)
317   ifeq ($(wildcard $(MZSCHEME)\lib\libmzgc$(MZSCHEME_VER).dll),)
318MZSCHEME_PRECISE_GC=yes
319   endif
320  else
321   ifneq ($(wildcard $(MZSCHEME)\lib\msvc\lib$(MZSCHEME_MAIN_LIB)$(MZSCHEME_VER).lib),)
322    ifeq ($(wildcard $(MZSCHEME)\lib\msvc\libmzgc$(MZSCHEME_VER).lib),)
323MZSCHEME_PRECISE_GC=yes
324    endif
325   endif
326  endif
327 endif
328
329 ifeq (no,$(DYNAMIC_MZSCHEME))
330  ifeq (yes,$(MZSCHEME_PRECISE_GC))
331MZSCHEME_LIB=-l$(MZSCHEME_MAIN_LIB)$(MZSCHEME_VER)
332  else
333MZSCHEME_LIB=-l$(MZSCHEME_MAIN_LIB)$(MZSCHEME_VER) -lmzgc$(MZSCHEME_VER)
334  endif
335# the modern MinGW can dynamically link to dlls directly.
336# point MZSCHEME_DLLS to where you put libmzschXXXXXXX.dll and libgcXXXXXXX.dll
337  ifndef MZSCHEME_DLLS
338MZSCHEME_DLLS=$(MZSCHEME)
339  endif
340MZSCHEME_LIBDIR=-L$(MZSCHEME_DLLS) -L$(MZSCHEME_DLLS)\lib
341 endif
342
343endif
344
345#	Python interface:
346#	  PYTHON=[Path to Python directory] (Set inside Make_cyg.mak or Make_ming.mak)
347#	  DYNAMIC_PYTHON=yes (to load the Python DLL dynamically)
348#	  PYTHON_VER=[Python version, eg 22, 23, ..., 27] (default is 27)
349ifdef PYTHON
350 ifndef DYNAMIC_PYTHON
351DYNAMIC_PYTHON=yes
352 endif
353
354 ifndef PYTHON_VER
355PYTHON_VER=27
356 endif
357 ifndef DYNAMIC_PYTHON_DLL
358DYNAMIC_PYTHON_DLL=python$(PYTHON_VER).dll
359 endif
360 ifdef PYTHON_HOME
361PYTHON_HOME_DEF=-DPYTHON_HOME=\"$(PYTHON_HOME)\"
362 endif
363
364 ifeq (no,$(DYNAMIC_PYTHON))
365PYTHONLIB=-L$(PYTHON)/libs -lpython$(PYTHON_VER)
366 endif
367# my include files are in 'win32inc' on Linux, and 'include' in the standard
368# NT distro (ActiveState)
369 ifndef PYTHONINC
370  ifeq ($(CROSS),no)
371PYTHONINC=-I $(PYTHON)/include
372  else
373PYTHONINC=-I $(PYTHON)/win32inc
374  endif
375 endif
376endif
377
378#	Python3 interface:
379#	  PYTHON3=[Path to Python3 directory] (Set inside Make_cyg.mak or Make_ming.mak)
380#	  DYNAMIC_PYTHON3=yes (to load the Python3 DLL dynamically)
381#	  PYTHON3_VER=[Python3 version, eg 31, 32] (default is 36)
382ifdef PYTHON3
383 ifndef DYNAMIC_PYTHON3
384DYNAMIC_PYTHON3=yes
385 endif
386
387 ifndef PYTHON3_VER
388PYTHON3_VER=36
389 endif
390 ifndef DYNAMIC_PYTHON3_DLL
391DYNAMIC_PYTHON3_DLL=python$(PYTHON3_VER).dll
392 endif
393 ifdef PYTHON3_HOME
394PYTHON3_HOME_DEF=-DPYTHON3_HOME=L\"$(PYTHON3_HOME)\"
395 endif
396
397 ifeq (no,$(DYNAMIC_PYTHON3))
398PYTHON3LIB=-L$(PYTHON3)/libs -lpython$(PYTHON3_VER)
399 endif
400
401 ifndef PYTHON3INC
402  ifeq ($(CROSS),no)
403PYTHON3INC=-I $(PYTHON3)/include
404  else
405PYTHON3INC=-I $(PYTHON3)/win32inc
406  endif
407 endif
408endif
409
410#	TCL interface:
411#	  TCL=[Path to TCL directory] (Set inside Make_cyg.mak or Make_ming.mak)
412#	  DYNAMIC_TCL=yes (to load the TCL DLL dynamically)
413#	  TCL_VER=[TCL version, eg 83, 84] (default is 86)
414#	  TCL_VER_LONG=[Tcl version, eg 8.3] (default is 8.6)
415#	    You must set TCL_VER_LONG when you set TCL_VER.
416#	  TCL_DLL=[TCL dll name, eg tcl86.dll] (default is tcl86.dll)
417ifdef TCL
418 ifndef DYNAMIC_TCL
419DYNAMIC_TCL=yes
420 endif
421 ifndef TCL_VER
422TCL_VER = 86
423 endif
424 ifndef TCL_VER_LONG
425TCL_VER_LONG = 8.6
426 endif
427 ifndef TCL_DLL
428TCL_DLL = tcl$(TCL_VER).dll
429 endif
430TCLINC += -I$(TCL)/include
431endif
432
433
434#	Ruby interface:
435#	  RUBY=[Path to Ruby directory] (Set inside Make_cyg.mak or Make_ming.mak)
436#	  DYNAMIC_RUBY=yes (to load the Ruby DLL dynamically, "no" for static)
437#	  RUBY_VER=[Ruby version, eg 19, 22] (default is 22)
438#	  RUBY_API_VER_LONG=[Ruby API version, eg 1.8, 1.9.1, 2.2.0]
439#			    (default is 2.2.0)
440#	    You must set RUBY_API_VER_LONG when changing RUBY_VER.
441#	    Note: If you use Ruby 1.9.3, set as follows:
442#	      RUBY_VER=19
443#	      RUBY_API_VER_LONG=1.9.1 (not 1.9.3, because the API version is 1.9.1.)
444ifdef RUBY
445 ifndef DYNAMIC_RUBY
446DYNAMIC_RUBY=yes
447 endif
448#  Set default value
449 ifndef RUBY_VER
450RUBY_VER = 22
451 endif
452 ifndef RUBY_VER_LONG
453RUBY_VER_LONG = 2.2.0
454 endif
455 ifndef RUBY_API_VER_LONG
456RUBY_API_VER_LONG = $(RUBY_VER_LONG)
457 endif
458 ifndef RUBY_API_VER
459RUBY_API_VER = $(subst .,,$(RUBY_API_VER_LONG))
460 endif
461
462 ifndef RUBY_PLATFORM
463  ifeq ($(RUBY_VER), 16)
464RUBY_PLATFORM = i586-mswin32
465  else ifneq ($(wildcard $(RUBY)/lib/ruby/$(RUBY_API_VER_LONG)/i386-mingw32),)
466RUBY_PLATFORM = i386-mingw32
467  else ifneq ($(wildcard $(RUBY)/lib/ruby/$(RUBY_API_VER_LONG)/x64-mingw32),)
468RUBY_PLATFORM = x64-mingw32
469  else
470RUBY_PLATFORM = i386-mswin32
471  endif
472 endif
473
474 ifndef RUBY_INSTALL_NAME
475  ifeq ($(RUBY_VER), 16)
476RUBY_INSTALL_NAME = mswin32-ruby$(RUBY_API_VER)
477  else
478   ifndef RUBY_MSVCRT_NAME
479# Base name of msvcrXX.dll which is used by ruby's dll.
480RUBY_MSVCRT_NAME = msvcrt
481   endif
482   ifeq ($(ARCH),x86-64)
483RUBY_INSTALL_NAME = x64-$(RUBY_MSVCRT_NAME)-ruby$(RUBY_API_VER)
484   else
485RUBY_INSTALL_NAME = $(RUBY_MSVCRT_NAME)-ruby$(RUBY_API_VER)
486   endif
487  endif
488 endif
489
490 ifeq (19, $(word 1,$(sort 19 $(RUBY_VER))))
491RUBY_19_OR_LATER = 1
492 endif
493
494 ifdef RUBY_19_OR_LATER
495RUBYINC = -I $(RUBY)/include/ruby-$(RUBY_API_VER_LONG) -I $(RUBY)/include/ruby-$(RUBY_API_VER_LONG)/$(RUBY_PLATFORM)
496 else
497RUBYINC = -I $(RUBY)/lib/ruby/$(RUBY_API_VER_LONG)/$(RUBY_PLATFORM)
498 endif
499 ifeq (no, $(DYNAMIC_RUBY))
500RUBYLIB = -L$(RUBY)/lib -l$(RUBY_INSTALL_NAME)
501 endif
502
503endif # RUBY
504
505# See feature.h for a list of options.
506# Any other defines can be included here.
507DEF_GUI=-DFEAT_GUI_MSWIN -DFEAT_CLIPBOARD
508DEFINES=-DWIN32 -DWINVER=$(WINVER) -D_WIN32_WINNT=$(WINVER) \
509	-DHAVE_PATHDEF -DFEAT_$(FEATURES) -DHAVE_STDINT_H
510ifeq ($(ARCH),x86-64)
511DEFINES+=-DMS_WIN64
512endif
513
514#>>>>> end of choices
515###########################################################################
516
517CFLAGS = -I. -Iproto $(DEFINES) -pipe -march=$(ARCH) -Wall
518CXXFLAGS = -std=gnu++11
519# This used to have --preprocessor, but it's no longer supported
520WINDRES_FLAGS =
521EXTRA_LIBS =
522
523ifdef SODIUM
524DEFINES += -DHAVE_SODIUM
525endif
526
527ifdef GETTEXT
528DEFINES += -DHAVE_GETTEXT -DHAVE_LOCALE_H
529GETTEXTINCLUDE = $(GETTEXT)/include
530GETTEXTLIB = $(INTLPATH)
531 ifeq (yes, $(GETTEXT))
532DEFINES += -DDYNAMIC_GETTEXT
533 else ifdef DYNAMIC_GETTEXT
534DEFINES += -D$(DYNAMIC_GETTEXT)
535  ifdef GETTEXT_DYNAMIC
536DEFINES += -DGETTEXT_DYNAMIC -DGETTEXT_DLL=\"$(GETTEXT_DYNAMIC)\"
537  endif
538 endif
539endif
540
541ifdef PERL
542CFLAGS += -I$(PERLLIBS) -DFEAT_PERL -DPERL_IMPLICIT_CONTEXT -DPERL_IMPLICIT_SYS
543 ifeq (yes, $(DYNAMIC_PERL))
544CFLAGS += -DDYNAMIC_PERL -DDYNAMIC_PERL_DLL=\"perl$(PERL_VER).dll\"
545EXTRA_LIBS += -L$(PERLLIBS) -lperl$(PERL_VER)
546 endif
547endif
548
549ifdef LUA
550LUA_INCDIR = $(LUA)/include
551CFLAGS += -I$(LUA_INCDIR) -I$(LUA) -DFEAT_LUA
552 ifeq (yes, $(DYNAMIC_LUA))
553CFLAGS += -DDYNAMIC_LUA -DDYNAMIC_LUA_DLL=\"lua$(LUA_VER).dll\"
554 endif
555endif
556
557ifdef MZSCHEME
558 ifndef MZSCHEME_COLLECTS
559MZSCHEME_COLLECTS=$(MZSCHEME)/collects
560  ifeq (yes, $(UNDER_CYGWIN))
561MZSCHEME_COLLECTS:=$(shell cygpath -m $(MZSCHEME_COLLECTS) | sed -e 's/ /\\ /g')
562  endif
563 endif
564CFLAGS += -I$(MZSCHEME)/include -DFEAT_MZSCHEME -DMZSCHEME_COLLECTS=\"$(MZSCHEME_COLLECTS)\"
565 ifeq (yes, $(DYNAMIC_MZSCHEME))
566  ifeq (yes, $(MZSCHEME_PRECISE_GC))
567# Precise GC does not use separate dll
568CFLAGS += -DDYNAMIC_MZSCHEME -DDYNAMIC_MZSCH_DLL=\"lib$(MZSCHEME_MAIN_LIB)$(MZSCHEME_VER).dll\" -DDYNAMIC_MZGC_DLL=\"lib$(MZSCHEME_MAIN_LIB)$(MZSCHEME_VER).dll\"
569  else
570CFLAGS += -DDYNAMIC_MZSCHEME -DDYNAMIC_MZSCH_DLL=\"lib$(MZSCHEME_MAIN_LIB)$(MZSCHEME_VER).dll\" -DDYNAMIC_MZGC_DLL=\"libmzgc$(MZSCHEME_VER).dll\"
571  endif
572 endif
573 ifeq (yes, "$(MZSCHEME_DEBUG)")
574CFLAGS += -DMZSCHEME_FORCE_GC
575 endif
576endif
577
578ifdef RUBY
579CFLAGS += -DFEAT_RUBY $(RUBYINC)
580 ifeq (yes, $(DYNAMIC_RUBY))
581CFLAGS += -DDYNAMIC_RUBY -DDYNAMIC_RUBY_DLL=\"$(RUBY_INSTALL_NAME).dll\"
582 endif
583CFLAGS += -DRUBY_VERSION=$(RUBY_VER)
584 ifneq ($(findstring w64-mingw32,$(CC)),)
585# A workaround for MinGW-w64
586CFLAGS += -DHAVE_STRUCT_TIMESPEC -DHAVE_STRUCT_TIMEZONE
587 endif
588endif
589
590ifdef PYTHON
591CFLAGS += -DFEAT_PYTHON
592 ifeq (yes, $(DYNAMIC_PYTHON))
593CFLAGS += -DDYNAMIC_PYTHON -DDYNAMIC_PYTHON_DLL=\"$(DYNAMIC_PYTHON_DLL)\"
594 endif
595endif
596
597ifdef PYTHON3
598CFLAGS += -DFEAT_PYTHON3
599 ifeq (yes, $(DYNAMIC_PYTHON3))
600CFLAGS += -DDYNAMIC_PYTHON3 -DDYNAMIC_PYTHON3_DLL=\"$(DYNAMIC_PYTHON3_DLL)\"
601 else
602CFLAGS += -DPYTHON3_DLL=\"$(DYNAMIC_PYTHON3_DLL)\"
603 endif
604endif
605
606ifdef TCL
607CFLAGS += -DFEAT_TCL $(TCLINC)
608 ifeq (yes, $(DYNAMIC_TCL))
609CFLAGS += -DDYNAMIC_TCL -DDYNAMIC_TCL_DLL=\"$(TCL_DLL)\" -DDYNAMIC_TCL_VER=\"$(TCL_VER_LONG)\"
610 endif
611endif
612
613ifeq ($(POSTSCRIPT),yes)
614DEFINES += -DMSWINPS
615endif
616
617ifeq (yes, $(OLE))
618DEFINES += -DFEAT_OLE
619endif
620
621ifeq ($(CSCOPE),yes)
622DEFINES += -DFEAT_CSCOPE
623endif
624
625ifeq ($(NETBEANS),yes)
626# Only allow NETBEANS for a GUI build.
627 ifeq (yes, $(GUI))
628DEFINES += -DFEAT_NETBEANS_INTG
629
630  ifeq ($(NBDEBUG), yes)
631DEFINES += -DNBDEBUG
632NBDEBUG_INCL = nbdebug.h
633NBDEBUG_SRC = nbdebug.c
634  endif
635 endif
636endif
637
638ifeq ($(CHANNEL),yes)
639DEFINES += -DFEAT_JOB_CHANNEL -DFEAT_IPV6
640 ifeq ($(shell expr "$$(($(WINVER)))" \>= "$$((0x600))"),1)
641DEFINES += -DHAVE_INET_NTOP
642 endif
643endif
644
645ifeq ($(TERMINAL),yes)
646DEFINES += -DFEAT_TERMINAL
647TERM_DEPS = \
648	libvterm/include/vterm.h \
649	libvterm/include/vterm_keycodes.h \
650	libvterm/src/rect.h \
651	libvterm/src/utf8.h \
652	libvterm/src/vterm_internal.h
653endif
654
655ifeq ($(SOUND),yes)
656DEFINES += -DFEAT_SOUND
657endif
658
659# DirectWrite (DirectX)
660ifeq ($(DIRECTX),yes)
661# Only allow DirectWrite for a GUI build.
662 ifeq (yes, $(GUI))
663DEFINES += -DFEAT_DIRECTX -DDYNAMIC_DIRECTX
664  ifneq ($(COLOR_EMOJI),no)
665DEFINES += -DFEAT_DIRECTX_COLOR_EMOJI
666  endif
667 endif
668endif
669
670ifeq ($(SODIUM),yes)
671SODIUMLIB = -lsodium
672endif
673
674# Only allow XPM for a GUI build.
675ifeq (yes, $(GUI))
676
677 ifndef XPM
678  ifeq ($(ARCH),i386)
679XPM = xpm/x86
680  endif
681  ifeq ($(ARCH),i486)
682XPM = xpm/x86
683  endif
684  ifeq ($(ARCH),i586)
685XPM = xpm/x86
686  endif
687  ifeq ($(ARCH),i686)
688XPM = xpm/x86
689  endif
690  ifeq ($(ARCH),x86-64)
691XPM = xpm/x64
692  endif
693 endif
694 ifdef XPM
695  ifneq ($(XPM),no)
696CFLAGS += -DFEAT_XPM_W32 -I $(XPM)/include -I $(XPM)/../include
697  endif
698 endif
699
700endif
701
702ifeq ($(DEBUG),yes)
703CFLAGS += -g -fstack-check
704DEBUG_SUFFIX=d
705else
706 ifeq ($(OPTIMIZE), SIZE)
707CFLAGS += -Os
708 else ifeq ($(OPTIMIZE), MAXSPEED)
709CFLAGS += -O3
710CFLAGS += -fomit-frame-pointer -freg-struct-return
711 else  # SPEED
712CFLAGS += -O2
713 endif
714LFLAGS += -s
715endif
716
717ifeq ($(COVERAGE),yes)
718CFLAGS += --coverage
719LFLAGS += --coverage
720endif
721
722LIB = -lkernel32 -luser32 -lgdi32 -ladvapi32 -lcomdlg32 -lcomctl32 -lnetapi32 -lversion
723GUIOBJ =  $(OUTDIR)/gui.o $(OUTDIR)/gui_w32.o $(OUTDIR)/gui_beval.o
724CUIOBJ = $(OUTDIR)/iscygpty.o
725OBJ = \
726	$(OUTDIR)/alloc.o \
727	$(OUTDIR)/arabic.o \
728	$(OUTDIR)/arglist.o \
729	$(OUTDIR)/autocmd.o \
730	$(OUTDIR)/beval.o \
731	$(OUTDIR)/blob.o \
732	$(OUTDIR)/blowfish.o \
733	$(OUTDIR)/buffer.o \
734	$(OUTDIR)/bufwrite.o \
735	$(OUTDIR)/change.o \
736	$(OUTDIR)/charset.o \
737	$(OUTDIR)/cindent.o \
738	$(OUTDIR)/clientserver.o \
739	$(OUTDIR)/clipboard.o \
740	$(OUTDIR)/cmdexpand.o \
741	$(OUTDIR)/cmdhist.o \
742	$(OUTDIR)/crypt.o \
743	$(OUTDIR)/crypt_zip.o \
744	$(OUTDIR)/debugger.o \
745	$(OUTDIR)/dict.o \
746	$(OUTDIR)/diff.o \
747	$(OUTDIR)/digraph.o \
748	$(OUTDIR)/drawline.o \
749	$(OUTDIR)/drawscreen.o \
750	$(OUTDIR)/edit.o \
751	$(OUTDIR)/eval.o \
752	$(OUTDIR)/evalbuffer.o \
753	$(OUTDIR)/evalfunc.o \
754	$(OUTDIR)/evalvars.o \
755	$(OUTDIR)/evalwindow.o \
756	$(OUTDIR)/ex_cmds.o \
757	$(OUTDIR)/ex_cmds2.o \
758	$(OUTDIR)/ex_docmd.o \
759	$(OUTDIR)/ex_eval.o \
760	$(OUTDIR)/ex_getln.o \
761	$(OUTDIR)/fileio.o \
762	$(OUTDIR)/filepath.o \
763	$(OUTDIR)/findfile.o \
764	$(OUTDIR)/float.o \
765	$(OUTDIR)/fold.o \
766	$(OUTDIR)/getchar.o \
767	$(OUTDIR)/gui_xim.o \
768	$(OUTDIR)/hardcopy.o \
769	$(OUTDIR)/hashtab.o \
770	$(OUTDIR)/help.o \
771	$(OUTDIR)/highlight.o \
772	$(OUTDIR)/if_cscope.o \
773	$(OUTDIR)/indent.o \
774	$(OUTDIR)/insexpand.o \
775	$(OUTDIR)/json.o \
776	$(OUTDIR)/list.o \
777	$(OUTDIR)/locale.o \
778	$(OUTDIR)/main.o \
779	$(OUTDIR)/map.o \
780	$(OUTDIR)/mark.o \
781	$(OUTDIR)/match.o \
782	$(OUTDIR)/memfile.o \
783	$(OUTDIR)/memline.o \
784	$(OUTDIR)/menu.o \
785	$(OUTDIR)/message.o \
786	$(OUTDIR)/misc1.o \
787	$(OUTDIR)/misc2.o \
788	$(OUTDIR)/mouse.o \
789	$(OUTDIR)/move.o \
790	$(OUTDIR)/mbyte.o \
791	$(OUTDIR)/normal.o \
792	$(OUTDIR)/ops.o \
793	$(OUTDIR)/option.o \
794	$(OUTDIR)/optionstr.o \
795	$(OUTDIR)/os_mswin.o \
796	$(OUTDIR)/os_win32.o \
797	$(OUTDIR)/pathdef.o \
798	$(OUTDIR)/popupmenu.o \
799	$(OUTDIR)/popupwin.o \
800	$(OUTDIR)/profiler.o \
801	$(OUTDIR)/quickfix.o \
802	$(OUTDIR)/regexp.o \
803	$(OUTDIR)/register.o \
804	$(OUTDIR)/scriptfile.o \
805	$(OUTDIR)/screen.o \
806	$(OUTDIR)/search.o \
807	$(OUTDIR)/session.o \
808	$(OUTDIR)/sha256.o \
809	$(OUTDIR)/sign.o \
810	$(OUTDIR)/spell.o \
811	$(OUTDIR)/spellfile.o \
812	$(OUTDIR)/spellsuggest.o \
813	$(OUTDIR)/strings.o \
814	$(OUTDIR)/syntax.o \
815	$(OUTDIR)/tag.o \
816	$(OUTDIR)/term.o \
817	$(OUTDIR)/testing.o \
818	$(OUTDIR)/textformat.o \
819	$(OUTDIR)/textobject.o \
820	$(OUTDIR)/textprop.o \
821	$(OUTDIR)/time.o \
822	$(OUTDIR)/typval.o \
823	$(OUTDIR)/ui.o \
824	$(OUTDIR)/undo.o \
825	$(OUTDIR)/usercmd.o \
826	$(OUTDIR)/userfunc.o \
827	$(OUTDIR)/version.o \
828	$(OUTDIR)/vim9compile.o \
829	$(OUTDIR)/vim9execute.o \
830	$(OUTDIR)/vim9script.o \
831	$(OUTDIR)/vim9type.o \
832	$(OUTDIR)/viminfo.o \
833	$(OUTDIR)/winclip.o \
834	$(OUTDIR)/window.o
835
836ifeq ($(VIMDLL),yes)
837OBJ += $(OUTDIR)/os_w32dll.o $(OUTDIR)/vimresd.o
838EXEOBJC = $(OUTDIR)/os_w32exec.o $(OUTDIR)/vimresc.o
839EXEOBJG = $(OUTDIR)/os_w32exeg.o $(OUTDIR)/vimresg.o
840else
841OBJ += $(OUTDIR)/os_w32exe.o $(OUTDIR)/vimres.o
842endif
843
844ifdef PERL
845OBJ += $(OUTDIR)/if_perl.o
846endif
847ifdef LUA
848OBJ += $(OUTDIR)/if_lua.o
849endif
850ifdef MZSCHEME
851OBJ += $(OUTDIR)/if_mzsch.o
852MZSCHEME_INCL = if_mzsch.h
853 ifeq (yes,$(MZSCHEME_GENERATE_BASE))
854CFLAGS += -DINCLUDE_MZSCHEME_BASE
855MZ_EXTRA_DEP += mzscheme_base.c
856 endif
857 ifeq (yes,$(MZSCHEME_PRECISE_GC))
858CFLAGS += -DMZ_PRECISE_GC
859 endif
860endif
861ifdef PYTHON
862OBJ += $(OUTDIR)/if_python.o
863endif
864ifdef PYTHON3
865OBJ += $(OUTDIR)/if_python3.o
866endif
867ifdef RUBY
868OBJ += $(OUTDIR)/if_ruby.o
869endif
870ifdef TCL
871OBJ += $(OUTDIR)/if_tcl.o
872endif
873
874ifeq ($(NETBEANS),yes)
875 ifneq ($(CHANNEL),yes)
876# Cannot use Netbeans without CHANNEL
877NETBEANS=no
878 else ifneq (yes, $(GUI))
879# Cannot use Netbeans without GUI.
880NETBEANS=no
881 else
882OBJ += $(OUTDIR)/netbeans.o
883 endif
884endif
885
886ifeq ($(CHANNEL),yes)
887OBJ += $(OUTDIR)/job.o $(OUTDIR)/channel.o
888LIB += -lwsock32 -lws2_32
889endif
890
891ifeq ($(DIRECTX),yes)
892# Only allow DIRECTX for a GUI build.
893 ifeq (yes, $(GUI))
894OBJ += $(OUTDIR)/gui_dwrite.o
895LIB += -ld2d1 -ldwrite
896USE_STDCPLUS = yes
897 endif
898endif
899ifneq ($(XPM),no)
900# Only allow XPM for a GUI build.
901 ifeq (yes, $(GUI))
902OBJ += $(OUTDIR)/xpm_w32.o
903# You'll need libXpm.a from http://gnuwin32.sf.net
904LIB += -L$(XPM)/lib -lXpm
905 endif
906endif
907
908ifeq ($(TERMINAL),yes)
909OBJ += $(OUTDIR)/terminal.o \
910	$(OUTDIR)/vterm_encoding.o \
911	$(OUTDIR)/vterm_keyboard.o \
912	$(OUTDIR)/vterm_mouse.o \
913	$(OUTDIR)/vterm_parser.o \
914	$(OUTDIR)/vterm_pen.o \
915	$(OUTDIR)/vterm_screen.o \
916	$(OUTDIR)/vterm_state.o \
917	$(OUTDIR)/vterm_unicode.o \
918	$(OUTDIR)/vterm_vterm.o
919endif
920
921ifeq ($(SOUND),yes)
922OBJ += $(OUTDIR)/sound.o
923endif
924
925# Include xdiff
926OBJ +=  $(OUTDIR)/xdiffi.o \
927	$(OUTDIR)/xemit.o \
928	$(OUTDIR)/xprepare.o \
929	$(OUTDIR)/xutils.o \
930	$(OUTDIR)/xhistogram.o \
931	$(OUTDIR)/xpatience.o
932
933XDIFF_DEPS = \
934	xdiff/xdiff.h \
935	xdiff/xdiffi.h \
936	xdiff/xemit.h \
937	xdiff/xinclude.h \
938	xdiff/xmacros.h \
939	xdiff/xprepare.h \
940	xdiff/xtypes.h \
941	xdiff/xutils.h
942
943ifdef MZSCHEME
944MZSCHEME_SUFFIX = Z
945endif
946
947LFLAGS += -municode
948
949ifeq ($(VIMDLL),yes)
950VIMEXE := vim$(DEBUG_SUFFIX).exe
951GVIMEXE := gvim$(DEBUG_SUFFIX).exe
952 ifeq ($(ARCH),x86-64)
953VIMDLLBASE := vim64$(DEBUG_SUFFIX)
954 else
955VIMDLLBASE := vim32$(DEBUG_SUFFIX)
956 endif
957TARGET = $(VIMDLLBASE).dll
958LFLAGS += -shared
959EXELFLAGS += -municode
960 ifneq ($(DEBUG),yes)
961EXELFLAGS += -s
962 endif
963 ifeq ($(COVERAGE),yes)
964EXELFLAGS += --coverage
965 endif
966DEFINES += $(DEF_GUI) -DVIMDLL
967OBJ += $(GUIOBJ) $(CUIOBJ)
968OUTDIR = dobj$(DEBUG_SUFFIX)$(MZSCHEME_SUFFIX)$(ARCH)
969MAIN_TARGET = $(GVIMEXE) $(VIMEXE) $(VIMDLLBASE).dll
970else ifeq ($(GUI),yes)
971TARGET := gvim$(DEBUG_SUFFIX).exe
972DEFINES += $(DEF_GUI)
973OBJ += $(GUIOBJ)
974LFLAGS += -mwindows
975OUTDIR = gobj$(DEBUG_SUFFIX)$(MZSCHEME_SUFFIX)$(ARCH)
976MAIN_TARGET = $(TARGET)
977else
978OBJ += $(CUIOBJ)
979TARGET := vim$(DEBUG_SUFFIX).exe
980OUTDIR = obj$(DEBUG_SUFFIX)$(MZSCHEME_SUFFIX)$(ARCH)
981MAIN_TARGET = $(TARGET)
982endif
983
984ifdef GETTEXT
985 ifneq (yes, $(GETTEXT))
986CFLAGS += -I$(GETTEXTINCLUDE)
987  ifndef STATIC_GETTEXT
988LIB += -L$(GETTEXTLIB) -l$(INTLLIB)
989   ifeq (USE_SAFE_GETTEXT_DLL, $(DYNAMIC_GETTEXT))
990OBJ+=$(SAFE_GETTEXT_DLL_OBJ)
991   endif
992  else
993LIB += -L$(GETTEXTLIB) -lintl
994  endif
995 endif
996endif
997
998ifdef PERL
999 ifeq (no, $(DYNAMIC_PERL))
1000LIB += -L$(PERLLIBS) -lperl$(PERL_VER)
1001 endif
1002endif
1003
1004ifdef TCL
1005LIB += -L$(TCL)/lib
1006 ifeq (yes, $(DYNAMIC_TCL))
1007LIB += -ltclstub$(TCL_VER)
1008 else
1009LIB += -ltcl$(TCL_VER)
1010 endif
1011endif
1012
1013ifeq (yes, $(OLE))
1014LIB += -loleaut32
1015OBJ += $(OUTDIR)/if_ole.o
1016USE_STDCPLUS = yes
1017endif
1018
1019ifeq (yes, $(IME))
1020DEFINES += -DFEAT_MBYTE_IME
1021 ifeq (yes, $(DYNAMIC_IME))
1022DEFINES += -DDYNAMIC_IME
1023 else
1024LIB += -limm32
1025 endif
1026endif
1027
1028ifdef ICONV
1029 ifneq (yes, $(ICONV))
1030LIB += -L$(ICONV)
1031CFLAGS += -I$(ICONV)
1032 endif
1033DEFINES+=-DDYNAMIC_ICONV
1034endif
1035
1036ifeq (yes, $(SOUND))
1037LIB += -lwinmm
1038endif
1039
1040ifeq (yes, $(USE_STDCPLUS))
1041LINK = $(CXX)
1042 ifeq (yes, $(STATIC_STDCPLUS))
1043#LIB += -static-libstdc++ -static-libgcc
1044LIB += -Wl,-Bstatic -lstdc++ -lgcc -Wl,-Bdynamic
1045 endif
1046else
1047LINK = $(CC)
1048endif
1049
1050ifeq (yes, $(STATIC_WINPTHREAD))
1051 ifeq (yes, $(HAS_GCC_EH))
1052LIB += -lgcc_eh
1053 endif
1054LIB += -Wl,-Bstatic -lwinpthread -Wl,-Bdynamic
1055endif
1056
1057ifeq (yes, $(MAP))
1058LFLAGS += -Wl,-Map=$(TARGET).map
1059endif
1060
1061all: $(MAIN_TARGET) vimrun.exe xxd/xxd.exe tee/tee.exe install.exe uninstall.exe GvimExt/gvimext.dll
1062
1063vimrun.exe: vimrun.c
1064	$(CC) $(CFLAGS) -o vimrun.exe vimrun.c $(LIB)
1065
1066install.exe: dosinst.c dosinst.h version.h
1067	$(CC) $(CFLAGS) -o install.exe dosinst.c $(LIB) -lole32 -luuid
1068
1069uninstall.exe: uninstall.c dosinst.h version.h
1070	$(CC) $(CFLAGS) -o uninstall.exe uninstall.c $(LIB) -lole32
1071
1072$(OBJ): | $(OUTDIR)
1073
1074$(EXEOBJG): | $(OUTDIR)
1075
1076$(EXEOBJC): | $(OUTDIR)
1077
1078ifeq ($(VIMDLL),yes)
1079$(TARGET): $(OBJ)
1080	$(LINK) $(CFLAGS) $(LFLAGS) -o $@ $(OBJ) $(LIB) -lole32 -luuid -lgdi32 $(LUA_LIB) $(MZSCHEME_LIBDIR) $(MZSCHEME_LIB) $(PYTHONLIB) $(PYTHON3LIB) $(RUBYLIB) $(SODIUMLIB)
1081
1082$(GVIMEXE): $(EXEOBJG) $(VIMDLLBASE).dll
1083	$(CC) -L. $(EXELFLAGS) -mwindows -o $@ $(EXEOBJG) -l$(VIMDLLBASE)
1084
1085$(VIMEXE): $(EXEOBJC) $(VIMDLLBASE).dll
1086	$(CC) -L. $(EXELFLAGS) -o $@ $(EXEOBJC) -l$(VIMDLLBASE)
1087else
1088$(TARGET): $(OBJ)
1089	$(LINK) $(CFLAGS) $(LFLAGS) -o $@ $(OBJ) $(LIB) -lole32 -luuid $(LUA_LIB) $(MZSCHEME_LIBDIR) $(MZSCHEME_LIB) $(PYTHONLIB) $(PYTHON3LIB) $(RUBYLIB) $(SODIUMLIB)
1090endif
1091
1092upx: exes
1093	upx gvim.exe
1094	upx vim.exe
1095
1096mpress: exes
1097	mpress gvim.exe
1098	mpress vim.exe
1099
1100xxd/xxd.exe: xxd/xxd.c
1101	$(MAKE) -C xxd -f Make_ming.mak CC='$(CC)'
1102
1103tee/tee.exe: tee/tee.c
1104	$(MAKE) -C tee CC='$(CC)'
1105
1106GvimExt/gvimext.dll: GvimExt/gvimext.cpp GvimExt/gvimext.rc GvimExt/gvimext.h
1107	$(MAKE) -C GvimExt -f Make_ming.mak CROSS=$(CROSS) CROSS_COMPILE=$(CROSS_COMPILE) CXX='$(CXX)' STATIC_STDCPLUS=$(STATIC_STDCPLUS)
1108
1109tags: notags
1110	$(CTAGS) $(TAGS_FILES)
1111
1112notags:
1113	-$(DEL) tags
1114
1115clean:
1116	-$(DEL) $(OUTDIR)$(DIRSLASH)*.o
1117	-$(DEL) $(OUTDIR)$(DIRSLASH)*.res
1118	-$(DEL) $(OUTDIR)$(DIRSLASH)pathdef.c
1119	-rmdir $(OUTDIR)
1120	-$(DEL) $(MAIN_TARGET) vimrun.exe install.exe uninstall.exe
1121	-$(DEL) *.map
1122ifdef PERL
1123	-$(DEL) if_perl.c
1124	-$(DEL) auto$(DIRSLASH)if_perl.c
1125endif
1126ifdef MZSCHEME
1127	-$(DEL) mzscheme_base.c
1128endif
1129	$(MAKE) -C GvimExt -f Make_ming.mak clean
1130	$(MAKE) -C xxd -f Make_ming.mak clean
1131	$(MAKE) -C tee clean
1132
1133# Run vim script to generate the Ex command lookup table.
1134# This only needs to be run when a command name has been added or changed.
1135# If this fails because you don't have Vim yet, first build and install Vim
1136# without changes.
1137cmdidxs: ex_cmds.h
1138	vim --clean -X --not-a-term -u create_cmdidxs.vim
1139
1140###########################################################################
1141INCL =	vim.h alloc.h ascii.h ex_cmds.h feature.h errors.h globals.h \
1142	keymap.h macros.h option.h os_dos.h os_win32.h proto.h regexp.h \
1143	spell.h structs.h termdefs.h beval.h $(NBDEBUG_INCL)
1144GUI_INCL = gui.h
1145ifeq ($(DIRECTX),yes)
1146GUI_INCL += gui_dwrite.h
1147endif
1148CUI_INCL = iscygpty.h
1149
1150PATHDEF_SRC = $(OUTDIR)/pathdef.c
1151
1152$(OUTDIR)/if_python.o:	if_python.c if_py_both.h $(INCL)
1153	$(CC) -c $(CFLAGS) $(PYTHONINC) $(PYTHON_HOME_DEF) $< -o $@
1154
1155$(OUTDIR)/if_python3.o:	if_python3.c if_py_both.h $(INCL)
1156	$(CC) -c $(CFLAGS) $(PYTHON3INC) $(PYTHON3_HOME_DEF) $< -o $@
1157
1158$(OUTDIR)/%.o : %.c $(INCL)
1159	$(CC) -c $(CFLAGS) $< -o $@
1160
1161ifeq ($(VIMDLL),yes)
1162$(OUTDIR)/vimresc.o:	vim.rc vim.manifest version.h gui_w32_rc.h vim.ico
1163	$(WINDRES) $(WINDRES_FLAGS) $(DEFINES) -UFEAT_GUI_MSWIN \
1164	    --input-format=rc --output-format=coff -i vim.rc -o $@
1165
1166$(OUTDIR)/vimresg.o:	vim.rc vim.manifest version.h gui_w32_rc.h vim.ico
1167	$(WINDRES) $(WINDRES_FLAGS) $(DEFINES) \
1168	    --input-format=rc --output-format=coff -i vim.rc -o $@
1169
1170$(OUTDIR)/vimresd.o:	vim.rc version.h gui_w32_rc.h \
1171			tools.bmp tearoff.bmp vim.ico vim_error.ico \
1172			vim_alert.ico vim_info.ico vim_quest.ico
1173	$(WINDRES) $(WINDRES_FLAGS) $(DEFINES) -DRCDLL -DVIMDLLBASE=\\\"$(VIMDLLBASE)\\\" \
1174	    --input-format=rc --output-format=coff -i vim.rc -o $@
1175else
1176$(OUTDIR)/vimres.o:	vim.rc vim.manifest version.h gui_w32_rc.h \
1177			tools.bmp tearoff.bmp vim.ico vim_error.ico \
1178			vim_alert.ico vim_info.ico vim_quest.ico
1179	$(WINDRES) $(WINDRES_FLAGS) $(DEFINES) \
1180	    --input-format=rc --output-format=coff -i vim.rc -o $@
1181endif
1182
1183$(OUTDIR):
1184	$(MKDIR) $(OUTDIR)
1185
1186$(OUTDIR)/buffer.o: buffer.c $(INCL) version.h
1187
1188$(OUTDIR)/evalfunc.o: evalfunc.c $(INCL) version.h
1189
1190$(OUTDIR)/evalvars.o: evalvars.c $(INCL) version.h
1191
1192$(OUTDIR)/ex_cmds.o: ex_cmds.c $(INCL) version.h
1193
1194$(OUTDIR)/ex_cmds2.o: ex_cmds2.c $(INCL) version.h
1195
1196$(OUTDIR)/ex_docmd.o: ex_docmd.c $(INCL) ex_cmdidxs.h
1197
1198$(OUTDIR)/hardcopy.o: hardcopy.c $(INCL) version.h
1199
1200$(OUTDIR)/misc1.o: misc1.c $(INCL) version.h
1201
1202$(OUTDIR)/netbeans.o: netbeans.c $(INCL) version.h
1203
1204$(OUTDIR)/version.o: version.c $(INCL) version.h
1205
1206$(OUTDIR)/vim9compile.o: vim9compile.c $(INCL) version.h
1207
1208$(OUTDIR)/vim9execute.o: vim9execute.c $(INCL) version.h
1209
1210$(OUTDIR)/vim9script.o: vim9script.c $(INCL) version.h
1211
1212$(OUTDIR)/vim9type.o: vim9type.c $(INCL) version.h
1213
1214$(OUTDIR)/viminfo.o: viminfo.c $(INCL) version.h
1215
1216$(OUTDIR)/gui_dwrite.o:	gui_dwrite.cpp gui_dwrite.h
1217	$(CC) -c $(CFLAGS) $(CXXFLAGS) gui_dwrite.cpp -o $@
1218
1219$(OUTDIR)/gui.o:	gui.c $(INCL) $(GUI_INCL)
1220	$(CC) -c $(CFLAGS) gui.c -o $@
1221
1222$(OUTDIR)/beval.o:	beval.c $(INCL) $(GUI_INCL)
1223	$(CC) -c $(CFLAGS) beval.c -o $@
1224
1225$(OUTDIR)/gui_beval.o:	gui_beval.c $(INCL) $(GUI_INCL)
1226	$(CC) -c $(CFLAGS) gui_beval.c -o $@
1227
1228$(OUTDIR)/gui_w32.o:	gui_w32.c $(INCL) $(GUI_INCL) version.h
1229	$(CC) -c $(CFLAGS) gui_w32.c -o $@
1230
1231$(OUTDIR)/if_cscope.o:	if_cscope.c $(INCL) if_cscope.h
1232	$(CC) -c $(CFLAGS) if_cscope.c -o $@
1233
1234$(OUTDIR)/if_mzsch.o:	if_mzsch.c $(INCL) $(MZSCHEME_INCL) $(MZ_EXTRA_DEP)
1235	$(CC) -c $(CFLAGS) if_mzsch.c -o $@
1236
1237mzscheme_base.c:
1238	$(MZSCHEME)/mzc --c-mods mzscheme_base.c ++lib scheme/base
1239
1240# Remove -D__IID_DEFINED__ for newer versions of the w32api
1241$(OUTDIR)/if_ole.o:	if_ole.cpp $(INCL) if_ole.h
1242	$(CC) -c $(CFLAGS) $(CXXFLAGS) if_ole.cpp -o $@
1243
1244auto/if_perl.c:		if_perl.xs typemap
1245	$(XSUBPP) -prototypes -typemap \
1246	     $(PERLTYPEMAP) if_perl.xs -output $@
1247
1248$(OUTDIR)/if_perl.o:	auto/if_perl.c $(INCL)
1249	$(CC) -c $(CFLAGS) auto/if_perl.c -o $@
1250
1251
1252$(OUTDIR)/if_ruby.o:	if_ruby.c $(INCL) version.h
1253ifeq (16, $(RUBY))
1254	$(CC) $(CFLAGS) -U_WIN32 -c -o $@ if_ruby.c
1255endif
1256
1257$(OUTDIR)/iscygpty.o:	iscygpty.c $(CUI_INCL)
1258	$(CC) -c $(CFLAGS) iscygpty.c -o $(OUTDIR)/iscygpty.o -U_WIN32_WINNT -D_WIN32_WINNT=0x0600 -DUSE_DYNFILEID -DENABLE_STUB_IMPL
1259
1260$(OUTDIR)/main.o:	main.c $(INCL) $(CUI_INCL)
1261	$(CC) -c $(CFLAGS) main.c -o $@
1262
1263$(OUTDIR)/netbeans.o:	netbeans.c $(INCL) $(NBDEBUG_INCL) $(NBDEBUG_SRC)
1264	$(CC) -c $(CFLAGS) netbeans.c -o $@
1265
1266$(OUTDIR)/os_w32exec.o:	os_w32exe.c $(INCL)
1267	$(CC) -c $(CFLAGS) -UFEAT_GUI_MSWIN os_w32exe.c -o $@
1268
1269$(OUTDIR)/os_w32exeg.o:	os_w32exe.c $(INCL)
1270	$(CC) -c $(CFLAGS) os_w32exe.c -o $@
1271
1272$(OUTDIR)/os_win32.o:	os_win32.c $(INCL) $(MZSCHEME_INCL)
1273	$(CC) -c $(CFLAGS) os_win32.c -o $@
1274
1275$(OUTDIR)/regexp.o:	regexp.c regexp_bt.c regexp_nfa.c $(INCL)
1276	$(CC) -c $(CFLAGS) regexp.c -o $@
1277
1278$(OUTDIR)/register.o:	register.c $(INCL)
1279	$(CC) -c $(CFLAGS) register.c -o $@
1280
1281$(OUTDIR)/terminal.o:	terminal.c $(INCL) $(TERM_DEPS)
1282	$(CC) -c $(CFLAGS) terminal.c -o $@
1283
1284$(OUTDIR)/pathdef.o:	$(PATHDEF_SRC) $(INCL)
1285	$(CC) -c $(CFLAGS) $(PATHDEF_SRC) -o $@
1286
1287
1288CCCTERM = $(CC) -c $(CFLAGS) -Ilibvterm/include -DINLINE="" \
1289	  -DVSNPRINTF=vim_vsnprintf \
1290	  -DSNPRINTF=vim_snprintf \
1291	  -DIS_COMBINING_FUNCTION=utf_iscomposing_uint \
1292	  -DWCWIDTH_FUNCTION=utf_uint2cells \
1293	  -DGET_SPECIAL_PTY_TYPE_FUNCTION=get_special_pty_type
1294
1295$(OUTDIR)/vterm_%.o : libvterm/src/%.c $(TERM_DEPS)
1296	$(CCCTERM) $< -o $@
1297
1298
1299$(OUTDIR)/%.o : xdiff/%.c $(XDIFF_DEPS)
1300	$(CC) -c $(CFLAGS) $< -o $@
1301
1302
1303$(PATHDEF_SRC): Make_cyg_ming.mak Make_cyg.mak Make_ming.mak | $(OUTDIR)
1304ifneq (sh.exe, $(SHELL))
1305	@echo creating $(PATHDEF_SRC)
1306	@echo '/* pathdef.c */' > $(PATHDEF_SRC)
1307	@echo '#include "vim.h"' >> $(PATHDEF_SRC)
1308	@echo 'char_u *default_vim_dir = (char_u *)"$(VIMRCLOC)";' >> $(PATHDEF_SRC)
1309	@echo 'char_u *default_vimruntime_dir = (char_u *)"$(VIMRUNTIMEDIR)";' >> $(PATHDEF_SRC)
1310	@echo 'char_u *all_cflags = (char_u *)"$(CC) $(CFLAGS)";' >> $(PATHDEF_SRC)
1311	@echo 'char_u *all_lflags = (char_u *)"$(LINK) $(CFLAGS) $(LFLAGS) -o $(TARGET) $(LIB) -lole32 -luuid $(LUA_LIB) $(MZSCHEME_LIBDIR) $(MZSCHEME_LIB) $(PYTHONLIB) $(PYTHON3LIB) $(RUBYLIB)";' >> $(PATHDEF_SRC)
1312	@echo 'char_u *compiled_user = (char_u *)"$(USERNAME)";' >> $(PATHDEF_SRC)
1313	@echo 'char_u *compiled_sys = (char_u *)"$(USERDOMAIN)";' >> $(PATHDEF_SRC)
1314else
1315	@echo creating $(PATHDEF_SRC)
1316	@echo /* pathdef.c */ > $(PATHDEF_SRC)
1317	@echo #include "vim.h" >> $(PATHDEF_SRC)
1318	@echo char_u *default_vim_dir = (char_u *)"$(VIMRCLOC)"; >> $(PATHDEF_SRC)
1319	@echo char_u *default_vimruntime_dir = (char_u *)"$(VIMRUNTIMEDIR)"; >> $(PATHDEF_SRC)
1320	@echo char_u *all_cflags = (char_u *)"$(CC) $(CFLAGS)"; >> $(PATHDEF_SRC)
1321	@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_SRC)
1322	@echo char_u *compiled_user = (char_u *)"$(USERNAME)"; >> $(PATHDEF_SRC)
1323	@echo char_u *compiled_sys = (char_u *)"$(USERDOMAIN)"; >> $(PATHDEF_SRC)
1324endif
1325
1326# vim: set noet sw=8 ts=8 sts=0 wm=0 tw=0:
1327