blob: d72282aa8695df2e64bc55b4e0b8aec60fd70204 [file] [log] [blame]
Bram Moolenaar071d4272004-06-13 20:20:40 +00001#
2# Makefile for VIM on Win32, using Cygnus gcc
Bram Moolenaar84a05ac2013-05-06 04:24:17 +02003# Last updated by Dan Sharp. Last Change: 2013 Apr 22
Bram Moolenaar65c1b012005-01-31 19:02:28 +00004#
5# Also read INSTALLpc.txt!
Bram Moolenaar071d4272004-06-13 20:20:40 +00006#
7# This compiles Vim as a Windows application. If you want Vim to run as a
8# Cygwin application use the Makefile (just like on Unix).
9#
10# GUI no or yes: set to yes if you want the GUI version (yes)
11# PERL define to path to Perl dir to get Perl support (not defined)
12# PERL_VER define to version of Perl being used (56)
13# DYNAMIC_PERL no or yes: set to yes to load the Perl DLL dynamically (yes)
14# PYTHON define to path to Python dir to get PYTHON support (not defined)
15# PYTHON_VER define to version of Python being used (22)
16# DYNAMIC_PYTHON no or yes: use yes to load the Python DLL dynamically (yes)
Bram Moolenaarbd5e15f2010-07-17 21:19:38 +020017# PYTHON3 define to path to Python3 dir to get PYTHON3 support (not defined)
18# PYTHON3_VER define to version of Python3 being used (22)
19# DYNAMIC_PYTHON3 no or yes: use yes to load the Python3 DLL dynamically (yes)
Bram Moolenaar071d4272004-06-13 20:20:40 +000020# TCL define to path to TCL dir to get TCL support (not defined)
21# TCL_VER define to version of TCL being used (83)
22# DYNAMIC_TCL no or yes: use yes to load the TCL DLL dynamically (yes)
23# RUBY define to path to Ruby dir to get Ruby support (not defined)
Bram Moolenaardd53a412012-11-28 16:18:29 +010024# RUBY_VER define to version of Ruby being used (16)
25# RUBY_VER_LONG same, but in format with dot. (1.6)
26# You must set RUBY_VER_LONG when changing RUBY_VER.
27# You must set RUBY_API_VER version to RUBY_VER_LONG.
28# Don't set ruby API version to RUBY_VER like 191.
Bram Moolenaar071d4272004-06-13 20:20:40 +000029# DYNAMIC_RUBY no or yes: use yes to load the Ruby DLL dynamically (yes)
Bram Moolenaar281bdce2005-01-25 21:53:18 +000030# MZSCHEME define to path to MzScheme dir to get MZSCHEME support (not defined)
31# MZSCHEME_VER define to version of MzScheme being used (209_000)
32# DYNAMIC_MZSCHEME no or yes: use yes to load the MzScheme DLLs dynamically (yes)
Bram Moolenaar65c1b012005-01-31 19:02:28 +000033# MZSCHEME_DLLS path to MzScheme DLLs (libmzgc and libmzsch), for "static" build.
Bram Moolenaar2d0860d2010-11-03 21:59:30 +010034# MZSCHEME_USE_RACKET define to use "racket" instead of "mzsch".
Bram Moolenaar0ba04292010-07-14 23:23:17 +020035# LUA define to path to Lua dir to get Lua support (not defined)
36# LUA_VER define to version of Lua being used (51)
37# DYNAMIC_LUA no or yes: use yes to load the Lua DLL dynamically (yes)
Bram Moolenaar071d4272004-06-13 20:20:40 +000038# GETTEXT no or yes: set to yes for dynamic gettext support (yes)
39# ICONV no or yes: set to yes for dynamic iconv support (yes)
40# MBYTE no or yes: set to yes to include multibyte support (yes)
41# IME no or yes: set to yes to include IME support (yes)
42# DYNAMIC_IME no or yes: set to yes to load imm32.dll dynamically (yes)
43# OLE no or yes: set to yes to make OLE gvim (no)
44# DEBUG no or yes: set to yes if you wish a DEBUGging build (no)
Bram Moolenaar1cd871b2004-12-19 22:46:22 +000045# CPUNR No longer supported, use ARCH.
Bram Moolenaar48f80c22010-02-24 15:08:27 +010046# ARCH i386 through pentium4: select -march argument to compile with
47# (i386)
Bram Moolenaar071d4272004-06-13 20:20:40 +000048# USEDLL no or yes: set to yes to use the Runtime library DLL (no)
49# For USEDLL=yes the cygwin1.dll is required to run Vim.
Bram Moolenaarc2149ea2013-02-13 17:06:11 +010050# For "no" the mingw-gcc-g++ package or the mingw64-i686-gcc-g++
Bram Moolenaar84a05ac2013-05-06 04:24:17 +020051# package is required to compile Vim. Or set CC to gcc-3 and add
Bram Moolenaar164fca32010-07-14 13:58:07 +020052# -L/lib/w32api to EXTRA_LIBS.
Bram Moolenaar071d4272004-06-13 20:20:40 +000053# POSTSCRIPT no or yes: set to yes for PostScript printing (no)
54# FEATURES TINY, SMALL, NORMAL, BIG or HUGE (BIG)
Bram Moolenaar95b557b2012-07-06 13:40:50 +020055# WINVER Lowest Win32 version to support. (0x0500)
Bram Moolenaar071d4272004-06-13 20:20:40 +000056# CSCOPE no or yes: to include cscope interface support (yes)
57# OPTIMIZE SPACE, SPEED, or MAXSPEED: set optimization level (MAXSPEED)
58# NETBEANS no or yes: to include netbeans interface support (yes when GUI
59# is yes)
Bram Moolenaarc9b4b052006-04-30 18:54:39 +000060# NBDEBUG no or yes: to include netbeans interface debugging support (no)
Bram Moolenaar071d4272004-06-13 20:20:40 +000061# XPM define to path to XPM dir to get XPM image support (not defined)
62#>>>>> choose options:
63ifndef GUI
64GUI=yes
65endif
66
67ifndef FEATURES
68FEATURES = BIG
69endif
70
71ifndef GETTEXT
72GETTEXT = yes
73endif
74
75ifndef ICONV
76ICONV = yes
77endif
78
79ifndef MBYTE
80MBYTE = yes
81endif
82
83ifndef IME
84IME = yes
85endif
86
Bram Moolenaar071d4272004-06-13 20:20:40 +000087ifndef ARCH
88ARCH = i386
89endif
90
91ifndef WINVER
Bram Moolenaar95b557b2012-07-06 13:40:50 +020092WINVER = 0x0500
Bram Moolenaar071d4272004-06-13 20:20:40 +000093endif
94
95ifndef CSCOPE
96CSCOPE = yes
97endif
98
99ifndef NETBEANS
100ifeq ($(GUI),yes)
101NETBEANS = yes
102endif
103endif
104
105ifndef OPTIMIZE
106OPTIMIZE = MAXSPEED
107endif
108
Bram Moolenaar5004e882013-02-16 18:16:15 +0100109
110# Link against the shared version of libstdc++ by default. Set
111# STATIC_STDCPLUS to "yes" to link against static version instead.
112ifndef STATIC_STDCPLUS
113STATIC_STDCPLUS=no
114endif
115
Bram Moolenaar071d4272004-06-13 20:20:40 +0000116### See feature.h for a list of optionals.
117### Any other defines can be included here.
118
119DEFINES = -DWIN32 -DHAVE_PATHDEF -DFEAT_$(FEATURES) \
120 -DWINVER=$(WINVER) -D_WIN32_WINNT=$(WINVER)
Bram Moolenaar1cd871b2004-12-19 22:46:22 +0000121INCLUDES = -march=$(ARCH) -Iproto
Bram Moolenaar071d4272004-06-13 20:20:40 +0000122
123#>>>>> name of the compiler and linker, name of lib directory
Bram Moolenaarc2149ea2013-02-13 17:06:11 +0100124ifeq (yes, $(USEDLL))
125# CROSS_COMPILE is used for the gvimext DLL.
126CROSS_COMPILE = i686-pc-mingw32-
Bram Moolenaar071d4272004-06-13 20:20:40 +0000127CC = gcc
128RC = windres
Bram Moolenaarc2149ea2013-02-13 17:06:11 +0100129else
130# i686-pc-mingw32-gcc, i686-w64-mingw32-gcc or gcc-3 can be used.
131CROSS_COMPILE = i686-pc-mingw32-
132CC = $(CROSS_COMPILE)gcc
133RC = $(CROSS_COMPILE)windres
134endif
Bram Moolenaar071d4272004-06-13 20:20:40 +0000135
136##############################
137# DYNAMIC_PERL=yes and no both work
138##############################
139ifdef PERL
140DEFINES += -DFEAT_PERL
141INCLUDES += -I$(PERL)/lib/CORE
142EXTRA_OBJS += $(OUTDIR)/if_perl.o
143
144ifndef DYNAMIC_PERL
145DYNAMIC_PERL = yes
146endif
147
148ifndef PERL_VER
149PERL_VER = 56
150endif
151
152ifeq (yes, $(DYNAMIC_PERL))
153DEFINES += -DDYNAMIC_PERL -DDYNAMIC_PERL_DLL=\"perl$(PERL_VER).dll\"
154else
155EXTRA_LIBS += $(PERL)/lib/CORE/perl$(PERL_VER).lib
156endif
157endif
158
159##############################
160# DYNAMIC_PYTHON=yes works.
161# DYNAMIC_PYTHON=no does not (unresolved externals on link).
162##############################
163ifdef PYTHON
164DEFINES += -DFEAT_PYTHON
Bram Moolenaar071d4272004-06-13 20:20:40 +0000165EXTRA_OBJS += $(OUTDIR)/if_python.o
166
167ifndef DYNAMIC_PYTHON
168DYNAMIC_PYTHON = yes
169endif
170
171ifndef PYTHON_VER
172PYTHON_VER = 22
173endif
174
175ifeq (yes, $(DYNAMIC_PYTHON))
176DEFINES += -DDYNAMIC_PYTHON -DDYNAMIC_PYTHON_DLL=\"python$(PYTHON_VER).dll\"
177else
178EXTRA_LIBS += $(PYTHON)/libs/python$(PYTHON_VER).lib
179endif
180endif
181
182##############################
Bram Moolenaarbd5e15f2010-07-17 21:19:38 +0200183# DYNAMIC_PYTHON3=yes works.
184# DYNAMIC_PYTHON3=no does not (unresolved externals on link).
185##############################
186ifdef PYTHON3
187DEFINES += -DFEAT_PYTHON3
188EXTRA_OBJS += $(OUTDIR)/if_python3.o
189
190ifndef DYNAMIC_PYTHON3
191DYNAMIC_PYTHON3 = yes
192endif
193
194ifndef PYTHON3_VER
195PYTHON3_VER = 31
196endif
197
198ifeq (yes, $(DYNAMIC_PYTHON3))
199DEFINES += -DDYNAMIC_PYTHON3 -DDYNAMIC_PYTHON3_DLL=\"python$(PYTHON3_VER).dll\"
200else
201EXTRA_LIBS += $(PYTHON3)/libs/python$(PYTHON3_VER).lib
202endif
203endif
204
205##############################
Bram Moolenaar071d4272004-06-13 20:20:40 +0000206# DYNAMIC_RUBY=yes works.
207# DYNAMIC_RUBY=no does not (process exits).
208##############################
209ifdef RUBY
210
Bram Moolenaar071d4272004-06-13 20:20:40 +0000211ifndef DYNAMIC_RUBY
Bram Moolenaarc2149ea2013-02-13 17:06:11 +0100212DYNAMIC_RUBY=yes
213endif
214# Set default value
215ifndef RUBY_VER
216RUBY_VER = 16
217endif
218ifndef RUBY_VER_LONG
219RUBY_VER_LONG = 1.6
220endif
221ifndef RUBY_API_VER
222RUBY_API_VER = $(subst .,,$(RUBY_VER_LONG))
Bram Moolenaar071d4272004-06-13 20:20:40 +0000223endif
224
Bram Moolenaarc2149ea2013-02-13 17:06:11 +0100225ifndef RUBY_PLATFORM
Bram Moolenaar071d4272004-06-13 20:20:40 +0000226ifeq ($(RUBY_VER), 16)
Bram Moolenaar071d4272004-06-13 20:20:40 +0000227RUBY_PLATFORM = i586-mswin32
Bram Moolenaar071d4272004-06-13 20:20:40 +0000228else
Bram Moolenaarc2149ea2013-02-13 17:06:11 +0100229ifneq ($(wildcard $(RUBY)/lib/ruby/$(RUBY_VER_LONG)/i386-mingw32),)
230RUBY_PLATFORM = i386-mingw32
231else
Bram Moolenaardb3fbe52013-03-07 15:16:21 +0100232ifneq ($(wildcard $(RUBY)/lib/ruby/$(RUBY_VER_LONG)/x64-mingw32),)
233RUBY_PLATFORM = x64-mingw32
234else
Bram Moolenaar071d4272004-06-13 20:20:40 +0000235RUBY_PLATFORM = i386-mswin32
236endif
Bram Moolenaarc2149ea2013-02-13 17:06:11 +0100237endif
238endif
Bram Moolenaardb3fbe52013-03-07 15:16:21 +0100239endif
Bram Moolenaarc2149ea2013-02-13 17:06:11 +0100240
Bram Moolenaar071d4272004-06-13 20:20:40 +0000241ifndef RUBY_INSTALL_NAME
Bram Moolenaarc2149ea2013-02-13 17:06:11 +0100242ifeq ($(RUBY_VER), 16)
243RUBY_INSTALL_NAME = mswin32-ruby$(RUBY_API_VER)
244else
Bram Moolenaardb3fbe52013-03-07 15:16:21 +0100245ifeq ($(ARCH),x86-64)
246RUBY_INSTALL_NAME = x64-msvcrt-ruby$(RUBY_API_VER)
247else
Bram Moolenaarc2149ea2013-02-13 17:06:11 +0100248RUBY_INSTALL_NAME = msvcrt-ruby$(RUBY_API_VER)
Bram Moolenaar071d4272004-06-13 20:20:40 +0000249endif
250endif
Bram Moolenaardb3fbe52013-03-07 15:16:21 +0100251endif
Bram Moolenaar071d4272004-06-13 20:20:40 +0000252
Bram Moolenaardd53a412012-11-28 16:18:29 +0100253ifeq (19, $(word 1,$(sort 19 $(RUBY_VER))))
254RUBY_19_OR_LATER = 1
255endif
256
Bram Moolenaar071d4272004-06-13 20:20:40 +0000257DEFINES += -DFEAT_RUBY
Bram Moolenaarc2149ea2013-02-13 17:06:11 +0100258ifneq ($(findstring w64-mingw32,$(CC)),)
259# A workaround for mingw-w64
260DEFINES += -DHAVE_STRUCT_TIMESPEC -DHAVE_STRUCT_TIMEZONE
261endif
Bram Moolenaar071d4272004-06-13 20:20:40 +0000262INCLUDES += -I$(RUBY)/lib/ruby/$(RUBY_VER_LONG)/$(RUBY_PLATFORM)
Bram Moolenaardd53a412012-11-28 16:18:29 +0100263ifdef RUBY_19_OR_LATER
264INCLUDES += -I$(RUBY)/include/ruby-$(RUBY_VER_LONG) -I$(RUBY)/include/ruby-$(RUBY_VER_LONG)/$(RUBY_PLATFORM)
265endif
Bram Moolenaar071d4272004-06-13 20:20:40 +0000266EXTRA_OBJS += $(OUTDIR)/if_ruby.o
267
268ifeq (yes, $(DYNAMIC_RUBY))
269DEFINES += -DDYNAMIC_RUBY -DDYNAMIC_RUBY_DLL=\"$(RUBY_INSTALL_NAME).dll\"
270DEFINES += -DDYNAMIC_RUBY_VER=$(RUBY_VER)
271else
272EXTRA_LIBS += $(RUBY)/lib/$(RUBY_INSTALL_NAME).lib
273endif
274endif
275
276##############################
Bram Moolenaar281bdce2005-01-25 21:53:18 +0000277# DYNAMIC_MZSCHEME=yes works
278# DYNAMIC_MZSCHEME=no works too
279##############################
280ifdef MZSCHEME
281DEFINES += -DFEAT_MZSCHEME
282INCLUDES += -I$(MZSCHEME)/include
283EXTRA_OBJS += $(OUTDIR)/if_mzsch.o
284
285ifndef DYNAMIC_MZSCHEME
286DYNAMIC_MZSCHEME = yes
287endif
288
289ifndef MZSCHEME_VER
290MZSCHEME_VER = 209_000
291endif
292
Bram Moolenaar2d6db762009-09-11 10:49:58 +0000293ifndef MZSCHEME_PRECISE_GC
294MZSCHEME_PRECISE_GC=no
295endif
296
297# for version 4.x we need to generate byte-code for Scheme base
298ifndef MZSCHEME_GENERATE_BASE
299MZSCHEME_GENERATE_BASE=no
300endif
301
Bram Moolenaar2d0860d2010-11-03 21:59:30 +0100302ifndef MZSCHEME_USE_RACKET
303MZSCHEME_MAIN_LIB=mzsch
304else
305MZSCHEME_MAIN_LIB=racket
306endif
307
Bram Moolenaar281bdce2005-01-25 21:53:18 +0000308ifeq (yes, $(DYNAMIC_MZSCHEME))
Bram Moolenaar2d0860d2010-11-03 21:59:30 +0100309DEFINES += -DDYNAMIC_MZSCHEME -DDYNAMIC_MZSCH_DLL=\"lib$(MZSCHEME_MAIN_LIB)$(MZSCHEME_VER).dll\" -DDYNAMIC_MZGC_DLL=\"libmzgc$(MZSCHEME_VER).dll\"
Bram Moolenaar281bdce2005-01-25 21:53:18 +0000310else
311ifndef MZSCHEME_DLLS
312MZSCHEME_DLLS = $(MZSCHEME)
313endif
Bram Moolenaar2d6db762009-09-11 10:49:58 +0000314ifeq (yes,$(MZSCHEME_PRECISE_GC))
Bram Moolenaar2d0860d2010-11-03 21:59:30 +0100315MZSCHEME_LIB=-l$(MZSCHEME_MAIN_LIB)$(MZSCHEME_VER)
Bram Moolenaar2d6db762009-09-11 10:49:58 +0000316else
Bram Moolenaar2d0860d2010-11-03 21:59:30 +0100317MZSCHEME_LIB = -l$(MZSCHEME_MAIN_LIB)$(MZSCHEME_VER) -lmzgc$(MZSCHEME_VER)
Bram Moolenaar2d6db762009-09-11 10:49:58 +0000318endif
319EXTRA_LIBS += -L$(MZSCHEME_DLLS) -L$(MZSCHEME_DLLS)/lib $(MZSCHEME_LIB)
320endif
321ifeq (yes,$(MZSCHEME_GENERATE_BASE))
322DEFINES += -DINCLUDE_MZSCHEME_BASE
323MZ_EXTRA_DEP += mzscheme_base.c
324endif
325ifeq (yes,$(MZSCHEME_PRECISE_GC))
326DEFINES += -DMZ_PRECISE_GC
Bram Moolenaar281bdce2005-01-25 21:53:18 +0000327endif
328endif
329
330##############################
Bram Moolenaar071d4272004-06-13 20:20:40 +0000331# DYNAMIC_TCL=yes and no both work.
332##############################
333ifdef TCL
334DEFINES += -DFEAT_TCL
335INCLUDES += -I$(TCL)/include
336EXTRA_OBJS += $(OUTDIR)/if_tcl.o
337
338ifndef DYNAMIC_TCL
339DYNAMIC_TCL = yes
340endif
341
342ifndef TCL_VER
343TCL_VER = 83
344endif
345
346ifeq (yes, $(DYNAMIC_TCL))
347DEFINES += -DDYNAMIC_TCL -DDYNAMIC_TCL_DLL=\"tcl$(TCL_VER).dll\"
348EXTRA_LIBS += $(TCL)/lib/tclstub$(TCL_VER).lib
349else
350EXTRA_LIBS += $(TCL)/lib/tcl$(TCL_VER).lib
351endif
352endif
353
354##############################
Bram Moolenaar0ba04292010-07-14 23:23:17 +0200355# DYNAMIC_LUA=yes works.
356# DYNAMIC_LUA=no does not (unresolved externals on link).
357##############################
358ifdef LUA
359DEFINES += -DFEAT_LUA
360INCLUDES += -I$(LUA)/include
361EXTRA_OBJS += $(OUTDIR)/if_lua.o
362
363ifndef DYNAMIC_LUA
364DYNAMIC_LUA = yes
365endif
366
367ifndef LUA_VER
368LUA_VER = 51
369endif
370
371ifeq (yes, $(DYNAMIC_LUA))
372DEFINES += -DDYNAMIC_LUA -DDYNAMIC_LUA_DLL=\"lua$(LUA_VER).dll\"
373else
374EXTRA_LIBS += $(LUA)/lib/lua$(LUA_VER).lib
375endif
376endif
377
378##############################
Bram Moolenaar071d4272004-06-13 20:20:40 +0000379ifeq (yes, $(GETTEXT))
380DEFINES += -DDYNAMIC_GETTEXT
381endif
382
383##############################
384ifeq (yes, $(ICONV))
385DEFINES += -DDYNAMIC_ICONV
386endif
387
388##############################
389ifeq (yes, $(MBYTE))
390DEFINES += -DFEAT_MBYTE
391endif
392
393##############################
394ifeq (yes, $(IME))
395DEFINES += -DFEAT_MBYTE_IME
396
397ifndef DYNAMIC_IME
398DYNAMIC_IME = yes
399endif
400
401ifeq (yes, $(DYNAMIC_IME))
402DEFINES += -DDYNAMIC_IME
403else
404EXTRA_LIBS += -limm32
405endif
406endif
407
408##############################
409ifeq (yes, $(DEBUG))
410DEFINES += -DDEBUG
411INCLUDES += -g -fstack-check
412DEBUG_SUFFIX = d
413else
414
415ifeq ($(OPTIMIZE), SIZE)
416OPTFLAG = -Os
417else
418ifeq ($(OPTIMIZE), MAXSPEED)
Bram Moolenaar1cd871b2004-12-19 22:46:22 +0000419OPTFLAG = -O3 -fomit-frame-pointer -freg-struct-return
Bram Moolenaar071d4272004-06-13 20:20:40 +0000420else
421OPTFLAG = -O2
422endif
423endif
424
425# A bug in the GCC <= 3.2 optimizer can cause a crash. The
426# following option removes the problem optimization.
427OPTFLAG += -fno-strength-reduce
428
429INCLUDES += -s
430
431endif
432
433##############################
434# USEDLL=yes will build a Cygwin32 executable that relies on cygwin1.dll.
435# USEDLL=no will build a Mingw32 executable with no extra dll dependencies.
436##############################
437ifeq (yes, $(USEDLL))
438DEFINES += -D_MAX_PATH=256 -D__CYGWIN__
439else
440INCLUDES += -mno-cygwin
441endif
442
443##############################
444ifeq (yes, $(POSTSCRIPT))
445DEFINES += -DMSWINPS
446endif
447
448##############################
449ifeq (yes, $(CSCOPE))
450DEFINES += -DFEAT_CSCOPE
451EXTRA_OBJS += $(OUTDIR)/if_cscope.o
452endif
453
454##############################
Bram Moolenaarcfbc5ee2004-07-02 15:38:35 +0000455ifeq ($(GUI),yes)
456
457##############################
Bram Moolenaar071d4272004-06-13 20:20:40 +0000458ifeq (yes, $(NETBEANS))
Bram Moolenaarcfbc5ee2004-07-02 15:38:35 +0000459# Only allow NETBEANS for a GUI build.
Bram Moolenaar071d4272004-06-13 20:20:40 +0000460DEFINES += -DFEAT_NETBEANS_INTG
Bram Moolenaar408fb622005-03-07 23:03:19 +0000461EXTRA_OBJS += $(OUTDIR)/netbeans.o
Bram Moolenaar071d4272004-06-13 20:20:40 +0000462EXTRA_LIBS += -lwsock32
463
Bram Moolenaarcfbc5ee2004-07-02 15:38:35 +0000464ifeq (yes, $(NBDEBUG))
Bram Moolenaar071d4272004-06-13 20:20:40 +0000465DEFINES += -DNBDEBUG
466NBDEBUG_DEP = nbdebug.h nbdebug.c
467endif
468
469endif
470
471##############################
472ifdef XPM
Bram Moolenaarcfbc5ee2004-07-02 15:38:35 +0000473# Only allow XPM for a GUI build.
Bram Moolenaar071d4272004-06-13 20:20:40 +0000474DEFINES += -DFEAT_XPM_W32
475INCLUDES += -I$(XPM)/include
476EXTRA_OBJS += $(OUTDIR)/xpm_w32.o
477EXTRA_LIBS += -L$(XPM)/lib -lXpm
478endif
479
480##############################
Bram Moolenaar071d4272004-06-13 20:20:40 +0000481EXE = gvim$(DEBUG_SUFFIX).exe
482OUTDIR = gobj$(DEBUG_SUFFIX)
483DEFINES += -DFEAT_GUI_W32 -DFEAT_CLIPBOARD
Bram Moolenaar408fb622005-03-07 23:03:19 +0000484EXTRA_OBJS += $(OUTDIR)/gui.o $(OUTDIR)/gui_w32.o $(OUTDIR)/gui_beval.o $(OUTDIR)/os_w32exe.o
Bram Moolenaar45360022005-07-21 21:08:21 +0000485EXTRA_LIBS += -mwindows -lcomctl32 -lversion
Bram Moolenaar071d4272004-06-13 20:20:40 +0000486else
487EXE = vim$(DEBUG_SUFFIX).exe
488OUTDIR = obj$(DEBUG_SUFFIX)
489LIBS += -luser32 -lgdi32 -lcomdlg32
490endif
491
492##############################
Bram Moolenaarcfbc5ee2004-07-02 15:38:35 +0000493ifeq (yes, $(OLE))
494DEFINES += -DFEAT_OLE
495EXTRA_OBJS += $(OUTDIR)/if_ole.o
Bram Moolenaar5004e882013-02-16 18:16:15 +0100496EXTRA_LIBS += -loleaut32
497ifeq (yes, $(STATIC_STDCPLUS))
Bram Moolenaar452ff5b2013-02-20 13:34:19 +0100498EXTRA_LIBS += -Wl,-Bstatic -lstdc++ -Wl,-Bdynamic
Bram Moolenaar5004e882013-02-16 18:16:15 +0100499else
500EXTRA_LIBS += -lstdc++
501endif
Bram Moolenaarcfbc5ee2004-07-02 15:38:35 +0000502endif
503
504##############################
Bram Moolenaar071d4272004-06-13 20:20:40 +0000505ifneq (sh.exe, $(SHELL))
506DEL = rm
Bram Moolenaar32e4e1f2005-01-16 21:57:33 +0000507MKDIR = mkdir -p
Bram Moolenaar071d4272004-06-13 20:20:40 +0000508DIRSLASH = /
509else
510DEL = del
Bram Moolenaar32e4e1f2005-01-16 21:57:33 +0000511MKDIR = mkdir
Bram Moolenaar071d4272004-06-13 20:20:40 +0000512DIRSLASH = \\
513endif
514
515#>>>>> end of choices
516###########################################################################
517
518INCL = vim.h globals.h option.h keymap.h macros.h ascii.h term.h os_win32.h \
519 structs.h version.h
520
521CFLAGS = $(OPTFLAG) $(DEFINES) $(INCLUDES)
522
523RCFLAGS = -O coff $(DEFINES)
524
525OBJ = \
Bram Moolenaaredac1852010-05-18 20:34:20 +0200526 $(OUTDIR)/blowfish.o \
Bram Moolenaar071d4272004-06-13 20:20:40 +0000527 $(OUTDIR)/buffer.o \
528 $(OUTDIR)/charset.o \
529 $(OUTDIR)/diff.o \
530 $(OUTDIR)/digraph.o \
531 $(OUTDIR)/edit.o \
532 $(OUTDIR)/eval.o \
533 $(OUTDIR)/ex_cmds.o \
534 $(OUTDIR)/ex_cmds2.o \
535 $(OUTDIR)/ex_docmd.o \
536 $(OUTDIR)/ex_eval.o \
537 $(OUTDIR)/ex_getln.o \
538 $(OUTDIR)/fileio.o \
539 $(OUTDIR)/fold.o \
540 $(OUTDIR)/getchar.o \
Bram Moolenaar58d98232005-07-23 22:25:46 +0000541 $(OUTDIR)/hardcopy.o \
Bram Moolenaar76b92b22006-03-24 22:46:53 +0000542 $(OUTDIR)/hashtab.o \
Bram Moolenaar071d4272004-06-13 20:20:40 +0000543 $(OUTDIR)/main.o \
544 $(OUTDIR)/mark.o \
545 $(OUTDIR)/memfile.o \
546 $(OUTDIR)/memline.o \
547 $(OUTDIR)/menu.o \
548 $(OUTDIR)/message.o \
549 $(OUTDIR)/misc1.o \
550 $(OUTDIR)/misc2.o \
551 $(OUTDIR)/move.o \
552 $(OUTDIR)/mbyte.o \
553 $(OUTDIR)/normal.o \
554 $(OUTDIR)/ops.o \
555 $(OUTDIR)/option.o \
556 $(OUTDIR)/os_win32.o \
557 $(OUTDIR)/os_mswin.o \
Bram Moolenaar693e40c2013-02-26 14:56:42 +0100558 $(OUTDIR)/winclip.o \
Bram Moolenaar071d4272004-06-13 20:20:40 +0000559 $(OUTDIR)/pathdef.o \
Bram Moolenaar76b92b22006-03-24 22:46:53 +0000560 $(OUTDIR)/popupmnu.o \
Bram Moolenaar071d4272004-06-13 20:20:40 +0000561 $(OUTDIR)/quickfix.o \
562 $(OUTDIR)/regexp.o \
563 $(OUTDIR)/screen.o \
564 $(OUTDIR)/search.o \
Bram Moolenaaredac1852010-05-18 20:34:20 +0200565 $(OUTDIR)/sha256.o \
Bram Moolenaarfc735152005-03-22 22:54:12 +0000566 $(OUTDIR)/spell.o \
Bram Moolenaar071d4272004-06-13 20:20:40 +0000567 $(OUTDIR)/syntax.o \
568 $(OUTDIR)/tag.o \
569 $(OUTDIR)/term.o \
570 $(OUTDIR)/ui.o \
571 $(OUTDIR)/undo.o \
572 $(OUTDIR)/version.o \
573 $(OUTDIR)/vimrc.o \
574 $(OUTDIR)/window.o \
575 $(EXTRA_OBJS)
576
577all: $(EXE) xxd/xxd.exe vimrun.exe install.exe uninstal.exe GvimExt/gvimext.dll
578
579# According to the Cygwin doc 1.2 FAQ, kernel32 should not be specified for
580# linking unless calling ld directly.
581# See /usr/doc/cygwin-doc-1.2/html/faq_toc.html#TOC93 for more information.
582$(EXE): $(OUTDIR) $(OBJ)
583 $(CC) $(CFLAGS) -o $(EXE) $(OBJ) $(LIBS) -luuid -lole32 $(EXTRA_LIBS)
584
585xxd/xxd.exe: xxd/xxd.c
Bram Moolenaar48f80c22010-02-24 15:08:27 +0100586 $(MAKE) -C xxd -f Make_cyg.mak CC=$(CC) USEDLL=$(USEDLL)
Bram Moolenaar071d4272004-06-13 20:20:40 +0000587
588GvimExt/gvimext.dll: GvimExt/gvimext.cpp GvimExt/gvimext.rc GvimExt/gvimext.h
Bram Moolenaar2369e352011-09-30 16:56:02 +0200589 $(MAKE) -C GvimExt -f Make_cyg.mak CROSS_COMPILE=$(CROSS_COMPILE)
Bram Moolenaar071d4272004-06-13 20:20:40 +0000590
591vimrun.exe: vimrun.c
592 $(CC) $(CFLAGS) -o vimrun.exe vimrun.c $(LIBS)
593
594install.exe: dosinst.c
595 $(CC) $(CFLAGS) -o install.exe dosinst.c $(LIBS) -luuid -lole32
596
597uninstal.exe: uninstal.c
598 $(CC) $(CFLAGS) -o uninstal.exe uninstal.c $(LIBS)
599
600$(OUTDIR):
Bram Moolenaar32e4e1f2005-01-16 21:57:33 +0000601 $(MKDIR) $(OUTDIR)
Bram Moolenaar071d4272004-06-13 20:20:40 +0000602
603tags:
604 command /c ctags *.c $(INCL)
605
606clean:
607 -$(DEL) $(OUTDIR)$(DIRSLASH)*.o
608 -rmdir $(OUTDIR)
Bram Moolenaarcf3630f2005-01-08 16:04:29 +0000609 -$(DEL) $(EXE) vimrun.exe install.exe uninstal.exe
Bram Moolenaar071d4272004-06-13 20:20:40 +0000610ifdef PERL
611 -$(DEL) if_perl.c
612endif
Bram Moolenaar2d6db762009-09-11 10:49:58 +0000613ifdef MZSCHEME
614 -$(DEL) mzscheme_base.c
615endif
Bram Moolenaar071d4272004-06-13 20:20:40 +0000616 -$(DEL) pathdef.c
617 $(MAKE) -C xxd -f Make_cyg.mak clean
Bram Moolenaar2369e352011-09-30 16:56:02 +0200618 $(MAKE) -C GvimExt -f Make_cyg.mak clean
Bram Moolenaar071d4272004-06-13 20:20:40 +0000619
Bram Moolenaarcf3630f2005-01-08 16:04:29 +0000620distclean: clean
621 -$(DEL) obj$(DIRSLASH)*.o
622 -rmdir obj
623 -$(DEL) gobj$(DIRSLASH)*.o
624 -rmdir gobj
625 -$(DEL) objd$(DIRSLASH)*.o
626 -rmdir objd
627 -$(DEL) gobjd$(DIRSLASH)*.o
628 -rmdir gobjd
629 -$(DEL) *.exe
630
Bram Moolenaar071d4272004-06-13 20:20:40 +0000631###########################################################################
632
633$(OUTDIR)/%.o : %.c $(INCL)
634 $(CC) -c $(CFLAGS) $< -o $@
635
636$(OUTDIR)/ex_docmd.o: ex_docmd.c $(INCL) ex_cmds.h
637 $(CC) -c $(CFLAGS) ex_docmd.c -o $(OUTDIR)/ex_docmd.o
638
639$(OUTDIR)/ex_eval.o: ex_eval.c $(INCL) ex_cmds.h
640 $(CC) -c $(CFLAGS) ex_eval.c -o $(OUTDIR)/ex_eval.o
641
Bram Moolenaar4da70db2013-01-23 13:55:20 +0100642$(OUTDIR)/gui_w32.o: gui_w32.c gui_w48.c $(INCL)
643 $(CC) -c $(CFLAGS) gui_w32.c -o $(OUTDIR)/gui_w32.o
644
Bram Moolenaar071d4272004-06-13 20:20:40 +0000645$(OUTDIR)/if_cscope.o: if_cscope.c $(INCL) if_cscope.h
646 $(CC) -c $(CFLAGS) if_cscope.c -o $(OUTDIR)/if_cscope.o
647
648$(OUTDIR)/if_ole.o: if_ole.cpp $(INCL)
Bram Moolenaar61bfb9f2007-09-30 20:28:48 +0000649 $(CC) -c $(CFLAGS) if_ole.cpp -o $(OUTDIR)/if_ole.o
Bram Moolenaar071d4272004-06-13 20:20:40 +0000650
Bram Moolenaarbd5e15f2010-07-17 21:19:38 +0200651$(OUTDIR)/if_python.o : if_python.c $(INCL)
652 $(CC) -c $(CFLAGS) -I$(PYTHON)/include $< -o $@
653
654$(OUTDIR)/if_python3.o : if_python3.c $(INCL)
655 $(CC) -c $(CFLAGS) -I$(PYTHON3)/include $< -o $@
656
Bram Moolenaar071d4272004-06-13 20:20:40 +0000657if_perl.c: if_perl.xs typemap
Bram Moolenaarcf3630f2005-01-08 16:04:29 +0000658 $(PERL)/bin/perl `cygpath -d $(PERL)/lib/ExtUtils/xsubpp` \
659 -prototypes -typemap \
660 `cygpath -d $(PERL)/lib/ExtUtils/typemap` if_perl.xs > $@
Bram Moolenaar071d4272004-06-13 20:20:40 +0000661
662$(OUTDIR)/if_perl.o: if_perl.c $(INCL)
663ifeq (yes, $(USEDLL))
664 $(CC) -c $(CFLAGS) -I/usr/include/mingw -D__MINGW32__ if_perl.c -o $(OUTDIR)/if_perl.o
665endif
666
667$(OUTDIR)/if_ruby.o: if_ruby.c $(INCL)
668ifeq (16, $(RUBY_VER))
669 $(CC) -c $(CFLAGS) -U_WIN32 if_ruby.c -o $(OUTDIR)/if_ruby.o
670endif
671
672$(OUTDIR)/netbeans.o: netbeans.c $(INCL) $(NBDEBUG_DEP)
673 $(CC) -c $(CFLAGS) netbeans.c -o $(OUTDIR)/netbeans.o
674
Bram Moolenaarfbc0d2e2013-05-19 19:40:29 +0200675$(OUTDIR)/regexp.o: regexp.c regexp_nfa.c $(INCL)
676 $(CC) -c $(CFLAGS) regexp.c -o $(OUTDIR)/regexp.o
677
Bram Moolenaar2d6db762009-09-11 10:49:58 +0000678$(OUTDIR)/if_mzsch.o: if_mzsch.c $(INCL) if_mzsch.h $(MZ_EXTRA_DEP)
679 $(CC) -c $(CFLAGS) if_mzsch.c -o $(OUTDIR)/if_mzsch.o
680
Bram Moolenaar071d4272004-06-13 20:20:40 +0000681$(OUTDIR)/vimrc.o: vim.rc version.h gui_w32_rc.h
682 $(RC) $(RCFLAGS) vim.rc -o $(OUTDIR)/vimrc.o
683
Bram Moolenaar2d6db762009-09-11 10:49:58 +0000684mzscheme_base.c:
685 $(MZSCHEME)/mzc --c-mods mzscheme_base.c ++lib scheme/base
686
Bram Moolenaar071d4272004-06-13 20:20:40 +0000687pathdef.c: $(INCL)
688ifneq (sh.exe, $(SHELL))
689 @echo creating pathdef.c
690 @echo '/* pathdef.c */' > pathdef.c
691 @echo '#include "vim.h"' >> pathdef.c
692 @echo 'char_u *default_vim_dir = (char_u *)"$(VIMRCLOC)";' >> pathdef.c
693 @echo 'char_u *default_vimruntime_dir = (char_u *)"$(VIMRUNTIMEDIR)";' >> pathdef.c
694 @echo 'char_u *all_cflags = (char_u *)"$(CC) $(CFLAGS)";' >> pathdef.c
695 @echo 'char_u *all_lflags = (char_u *)"$(CC) -s -o $(EXE) $(LIBS) -luuid -lole32 $(EXTRA_LIBS)";' >> pathdef.c
696 @echo 'char_u *compiled_user = (char_u *)"$(USERNAME)";' >> pathdef.c
697 @echo 'char_u *compiled_sys = (char_u *)"$(USERDOMAIN)";' >> pathdef.c
698else
699 @echo creating pathdef.c
700 @echo /* pathdef.c */ > pathdef.c
701 @echo #include "vim.h" >> pathdef.c
702 @echo char_u *default_vim_dir = (char_u *)"$(VIMRCLOC)"; >> pathdef.c
703 @echo char_u *default_vimruntime_dir = (char_u *)"$(VIMRUNTIMEDIR)"; >> pathdef.c
704 @echo char_u *all_cflags = (char_u *)"$(CC) $(CFLAGS)"; >> pathdef.c
705 @echo char_u *all_lflags = (char_u *)"$(CC) -s -o $(EXE) $(LIBS) -luuid -lole32 $(EXTRA_LIBS)"; >> pathdef.c
706 @echo char_u *compiled_user = (char_u *)"$(USERNAME)"; >> pathdef.c
707 @echo char_u *compiled_sys = (char_u *)"$(USERDOMAIN)"; >> pathdef.c
708endif
Bram Moolenaarbd5e15f2010-07-17 21:19:38 +0200709