blob: 971915cbc113f5ff0048db4d911c4a7542f9d29b [file] [log] [blame]
Bram Moolenaar071d4272004-06-13 20:20:40 +00001# Makefile for VIM on Win32, using 'EGCS/mingw32 1.1.2'.
2# Info at http://www.mingw.org
3# Also requires 'GNU make 3.77', which you can get through a link
4# to 'JanJaap's page from the above page.
5# Get missing libraries from http://gnuwin32.sf.net.
6#
7# Tested on Win32 NT 4 and Win95.
8#
9# To make everything, just 'make -f Make_ming.mak'
10# To make just e.g. gvim.exe, 'make -f Make_ming.mak gvim.exe'
11# After a run, you can 'make -f Make_ming.mak clean' to clean up
12#
13# NOTE: Sometimes 'GNU Make' will stop after building vimrun.exe -- I think
14# it's just run out of memory or something. Run again, and it will continue
15# with 'xxd'.
16#
17# "make upx" makes *compressed* versions of the GUI and console EXEs, using the
18# excellent UPX compressor:
19# http://upx.sourceforge.net/
20#
21# Maintained by Ron Aaron <ronaharon@yahoo.com>
22# updated 2003 Jan 20
23
24#>>>>> choose options:
25# set to yes for a debug build
26DEBUG=no
Bram Moolenaar7263a772007-05-10 17:35:54 +000027# set to SIZE for size, SPEED for speed, MAXSPEED for maximum optimization
Bram Moolenaar071d4272004-06-13 20:20:40 +000028OPTIMIZE=MAXSPEED
29# set to yes to make gvim, no for vim
30GUI=yes
31# FEATURES=[TINY | SMALL | NORMAL | BIG | HUGE]
32# set to TINY to make minimal version (few features)
33FEATURES=BIG
Bram Moolenaar1cd871b2004-12-19 22:46:22 +000034# set to one of i386, i486, i586, i686 as the minimum target processor
Bram Moolenaar071d4272004-06-13 20:20:40 +000035ARCH=i386
36# set to yes to cross-compile from unix; no=native Windows
37CROSS=no
38# set to path to iconv.h and libiconv.a to enable using 'iconv.dll'
39#ICONV="."
40ICONV=yes
41GETTEXT=yes
42# set to yes to include multibyte support
43MBYTE=yes
44# set to yes to include IME support
45IME=yes
46DYNAMIC_IME=yes
47# set to yes to enable writing a postscript file with :hardcopy
48POSTSCRIPT=no
49# set to yes to enable OLE support
50OLE=no
51# Set the default $(WINVER) to make it work with pre-Win2k
52WINVER = 0x0400
53# Set to yes to enable Cscope support
54CSCOPE=yes
55# Set to yes to enable Netbeans support
56NETBEANS=$(GUI)
57
58
59# If the user doesn't want gettext, undefine it.
60ifeq (no, $(GETTEXT))
61GETTEXT=
62endif
63# Added by E.F. Amatria <eferna1@platea.ptic.mec.es> 2001 Feb 23
64# Uncomment the first line and one of the following three if you want Native Language
65# Support. You'll need gnu_gettext.win32, a MINGW32 Windows PORT of gettext by
66# Franco Bez <franco.bez@gmx.de>. It may be found at
67# http://home.a-city.de/franco.bez/gettext/gettext_win32_en.html
68# Tested with mingw32 with GCC-2.95.2 on Win98
69# Updated 2001 Jun 9
70#GETTEXT=c:/gettext.win32.msvcrt
71#STATIC_GETTEXT=USE_STATIC_GETTEXT
72#DYNAMIC_GETTEXT=USE_GETTEXT_DLL
73#DYNAMIC_GETTEXT=USE_SAFE_GETTEXT_DLL
74SAFE_GETTEXT_DLL_OBJ = $(GETTEXT)/src/safe_gettext_dll/safe_gettext_dll.o
75# Alternatively, if you uncomment the two following lines, you get a "safe" version
76# without linking the safe_gettext_dll.o object file.
77#DYNAMIC_GETTEXT=DYNAMIC_GETTEXT
78#GETTEXT_DYNAMIC=gnu_gettext.dll
79INTLPATH=$(GETTEXT)/lib/mingw32
80INTLLIB=gnu_gettext
81
82# If you are using gettext-0.10.35 from http://sourceforge.net/projects/gettext
83# or gettext-0.10.37 from http://sourceforge.net/projects/mingwrep/
84# uncomment the following, but I can't build a static versión with them, ?-(|
85#GETTEXT=c:/gettext-0.10.37-20010430
86#STATIC_GETTEXT=USE_STATIC_GETTEXT
87#DYNAMIC_GETTEXT=DYNAMIC_GETTEXT
88#INTLPATH=$(GETTEXT)/lib
89#INTLLIB=intl
90
91# uncomment 'PERL' if you want a perl-enabled version
92#PERL=C:/perl
93ifdef PERL
94ifndef PERL_VER
95PERL_VER=56
96endif
97ifndef DYNAMIC_PERL
98DYNAMIC_PERL=yes
99endif
100# on Linux, for cross-compile, it's here:
101#PERLLIB=/home/ron/ActivePerl/lib
102# on NT, it's here:
103PERLLIB=$(PERL)/lib
104PERLLIBS=$(PERLLIB)/Core
105endif
106
Bram Moolenaar0ba04292010-07-14 23:23:17 +0200107# uncomment 'LUA' if you want a Lua-enabled version
108#LUA=/usr/local
109ifdef LUA
110ifndef DYNAMIC_LUA
111DYNAMIC_LUA=yes
112endif
113
114ifndef LUA_VER
115LUA_VER=51
116endif
117
118ifeq (no,$(DYNAMIC_LUA))
119LUA_LIB = -L$(LUA)/lib -llua
120endif
121
122endif
123
Bram Moolenaar325b7a22004-07-05 15:58:32 +0000124# uncomment 'MZSCHEME' if you want a MzScheme-enabled version
125#MZSCHEME=d:/plt
126ifdef MZSCHEME
Bram Moolenaar281bdce2005-01-25 21:53:18 +0000127ifndef DYNAMIC_MZSCHEME
128DYNAMIC_MZSCHEME=yes
129endif
130
Bram Moolenaar325b7a22004-07-05 15:58:32 +0000131ifndef MZSCHEME_VER
132MZSCHEME_VER=205_000
133endif
Bram Moolenaar281bdce2005-01-25 21:53:18 +0000134
Bram Moolenaar9e70cf12009-05-26 20:59:55 +0000135ifndef MZSCHEME_PRECISE_GC
136MZSCHEME_PRECISE_GC=no
137endif
138
139# for version 4.x we need to generate byte-code for Scheme base
140ifndef MZSCHEME_GENERATE_BASE
141MZSCHEME_GENERATE_BASE=no
142endif
143
Bram Moolenaar281bdce2005-01-25 21:53:18 +0000144ifeq (no,$(DYNAMIC_MZSCHEME))
Bram Moolenaar9e70cf12009-05-26 20:59:55 +0000145ifeq (yes,$(MZSCHEME_PRECISE_GC))
146MZSCHEME_LIB=-lmzsch$(MZSCHEME_VER)
147else
Bram Moolenaar281bdce2005-01-25 21:53:18 +0000148MZSCHEME_LIB = -lmzsch$(MZSCHEME_VER) -lmzgc$(MZSCHEME_VER)
Bram Moolenaar9e70cf12009-05-26 20:59:55 +0000149endif
Bram Moolenaar281bdce2005-01-25 21:53:18 +0000150# the modern MinGW can dynamically link to dlls directly.
151# point MZSCHEME_DLLS to where you put libmzschXXXXXXX.dll and libgcXXXXXXX.dll
Bram Moolenaar281bdce2005-01-25 21:53:18 +0000152ifndef MZSCHEME_DLLS
153MZSCHEME_DLLS=$(MZSCHEME)
Bram Moolenaar325b7a22004-07-05 15:58:32 +0000154endif
Bram Moolenaar2d6db762009-09-11 10:49:58 +0000155MZSCHEME_LIBDIR=-L$(MZSCHEME_DLLS) -L$(MZSCHEME_DLLS)\lib
Bram Moolenaar281bdce2005-01-25 21:53:18 +0000156endif
157
Bram Moolenaar325b7a22004-07-05 15:58:32 +0000158endif
159
Bram Moolenaar071d4272004-06-13 20:20:40 +0000160# Python support -- works with the ActiveState python 2.0 release (and others
161# too, probably)
162#
163# uncomment 'PYTHON' to make python-enabled version
164# Put the path to the python distro here. If cross compiling from Linux, you
165# will also need to convert the header files to unix instead of dos format:
166# for fil in *.h ; do vim -e -c 'set ff=unix|w|q' $fil
167# and also, you will need to make a mingw32 'libpython20.a' to link with:
168# cd $PYTHON/libs
169# pexports python20.dll > python20.def
170# dlltool -d python20.def -l libpython20.a
171# on my Linux box, I put the Python stuff here:
172#PYTHON=/home/ron/ActivePython-2.0.0-202/src/Core
173# on my NT box, it's here:
174#PYTHON=c:/python20
175
176ifdef PYTHON
177ifndef DYNAMIC_PYTHON
178DYNAMIC_PYTHON=yes
179endif
180
181ifndef PYTHON_VER
182PYTHON_VER=22
183endif
184
185ifeq (no,$(DYNAMIC_PYTHON))
186PYTHONLIB=-L$(PYTHON)/libs -lpython$(PYTHON_VER)
187endif
188# my include files are in 'win32inc' on Linux, and 'include' in the standard
189# NT distro (ActiveState)
190ifeq ($(CROSS),no)
191PYTHONINC=-I $(PYTHON)/include
192else
193PYTHONINC=-I $(PYTHON)/win32inc
194endif
195endif
196
Bram Moolenaarbd5e15f2010-07-17 21:19:38 +0200197#PYTHON3: See comment for Python 2 above
198
199ifdef PYTHON3
200ifndef DYNAMIC_PYTHON3
201DYNAMIC_PYTHON3=yes
202endif
203
204ifndef PYTHON3_VER
205PYTHON3_VER=31
206endif
207
208ifeq (no,$(DYNAMIC_PYTHON3))
209PYTHON3LIB=-L$(PYTHON3)/libs -lPYTHON$(PYTHON3_VER)
210endif
211
212ifeq ($(CROSS),no)
213PYTHON3INC=-I $(PYTHON3)/include
214else
215PYTHON3INC=-I $(PYTHON3)/win32inc
216endif
217endif
218
Bram Moolenaar071d4272004-06-13 20:20:40 +0000219# TCL interface:
220# TCL=[Path to TCL directory]
221# DYNAMIC_TCL=yes (to load the TCL DLL dynamically)
222# TCL_VER=[TCL version, eg 83, 84] (default is 83)
223#TCL=c:/tcl
224ifdef TCL
225ifndef DYNAMIC_TCL
226DYNAMIC_TCL=yes
227endif
228ifndef TCL_VER
229TCL_VER = 83
230endif
231TCLINC += -I$(TCL)/include
232endif
233
234
235# Ruby interface:
236# RUBY=[Path to Ruby directory]
237# DYNAMIC_RUBY=yes (to load the Ruby DLL dynamically)
238# RUBY_VER=[Ruby version, eg 16, 17] (default is 16)
239# RUBY_VER_LONG=[Ruby version, eg 1.6, 1.7] (default is 1.6)
240# You must set RUBY_VER_LONG when change RUBY_VER.
241#RUBY=c:/ruby
242ifdef RUBY
243ifndef DYNAMIC_RUBY
244DYNAMIC_RUBY=yes
245endif
246# Set default value
247ifndef RUBY_VER
248RUBY_VER = 16
249endif
250ifndef RUBY_VER_LONG
251RUBY_VER_LONG = 1.6
252endif
253
Bram Moolenaar66ca3202010-03-10 13:20:40 +0100254ifndef RUBY_PLATFORM
Bram Moolenaar071d4272004-06-13 20:20:40 +0000255ifeq ($(RUBY_VER), 16)
Bram Moolenaar071d4272004-06-13 20:20:40 +0000256RUBY_PLATFORM = i586-mswin32
Bram Moolenaar8c79caf2010-03-17 17:25:09 +0100257else
258ifneq ($(wildcard $(RUBY)/lib/ruby/$(RUBY_VER_LONG)/i386-mingw32),)
Bram Moolenaar66ca3202010-03-10 13:20:40 +0100259RUBY_PLATFORM = i386-mingw32
Bram Moolenaar071d4272004-06-13 20:20:40 +0000260else
Bram Moolenaar071d4272004-06-13 20:20:40 +0000261RUBY_PLATFORM = i386-mswin32
262endif
Bram Moolenaar66ca3202010-03-10 13:20:40 +0100263endif
Bram Moolenaar8c79caf2010-03-17 17:25:09 +0100264endif
Bram Moolenaar66ca3202010-03-10 13:20:40 +0100265
Bram Moolenaar071d4272004-06-13 20:20:40 +0000266ifndef RUBY_INSTALL_NAME
Bram Moolenaar66ca3202010-03-10 13:20:40 +0100267ifeq ($(RUBY_VER), 16)
268RUBY_INSTALL_NAME = mswin32-ruby$(RUBY_VER)
269else
Bram Moolenaar071d4272004-06-13 20:20:40 +0000270RUBY_INSTALL_NAME = msvcrt-ruby$(RUBY_VER)
271endif
272endif
273
Bram Moolenaar66ca3202010-03-10 13:20:40 +0100274RUBYINC =-I $(RUBY)/lib/ruby/$(RUBY_VER_LONG)/$(RUBY_PLATFORM) -I $(RUBY)/include/ruby-$(RUBY_VER_LONG) -I $(RUBY)/include/ruby-$(RUBY_VER_LONG)/$(RUBY_PLATFORM)
Bram Moolenaar071d4272004-06-13 20:20:40 +0000275ifeq (no, $(DYNAMIC_RUBY))
276RUBYLIB = -L$(RUBY)/lib -l$(RUBY_INSTALL_NAME)
277endif
278
279endif # RUBY
280
281# See feature.h for a list of options.
282# Any other defines can be included here.
283DEF_GUI=-DFEAT_GUI_W32 -DFEAT_CLIPBOARD
284DEFINES=-DWIN32 -DWINVER=$(WINVER) -D_WIN32_WINNT=$(WINVER) \
285 -DHAVE_PATHDEF -DFEAT_$(FEATURES)
286ifeq ($(CROSS),yes)
Bram Moolenaar48f80c22010-02-24 15:08:27 +0100287# cross-compiler prefix:
288CROSS_COMPILE = i586-pc-mingw32msvc-
Bram Moolenaar071d4272004-06-13 20:20:40 +0000289DEL = rm
Bram Moolenaar0cf6f542005-01-16 21:59:36 +0000290MKDIR = mkdir -p
Bram Moolenaar48f80c22010-02-24 15:08:27 +0100291DIRSLASH = /
Bram Moolenaar071d4272004-06-13 20:20:40 +0000292else
293# normal (Windows) compilation:
Bram Moolenaar48f80c22010-02-24 15:08:27 +0100294CROSS_COMPILE =
Bram Moolenaar86ce1cc2010-02-26 22:05:22 +0100295ifneq (sh.exe, $(SHELL))
Bram Moolenaar071d4272004-06-13 20:20:40 +0000296DEL = rm
Bram Moolenaar0cf6f542005-01-16 21:59:36 +0000297MKDIR = mkdir -p
Bram Moolenaar071d4272004-06-13 20:20:40 +0000298DIRSLASH = /
299else
300DEL = del
Bram Moolenaar0cf6f542005-01-16 21:59:36 +0000301MKDIR = mkdir
Bram Moolenaar071d4272004-06-13 20:20:40 +0000302DIRSLASH = \\
303endif
Bram Moolenaar071d4272004-06-13 20:20:40 +0000304endif
Bram Moolenaar48f80c22010-02-24 15:08:27 +0100305CC := $(CROSS_COMPILE)gcc
Bram Moolenaar3c9ab1c2010-09-29 12:38:00 +0200306WINDRES := $(CROSS_COMPILE)windres --preprocessor="$(CC) -E -xc" -
Bram Moolenaar071d4272004-06-13 20:20:40 +0000307
308#>>>>> end of choices
309###########################################################################
310
Bram Moolenaar1cd871b2004-12-19 22:46:22 +0000311CFLAGS = -Iproto $(DEFINES) -pipe -w -march=$(ARCH) -Wall
Bram Moolenaar071d4272004-06-13 20:20:40 +0000312
313ifdef GETTEXT
Bram Moolenaar8cd06ca2005-02-28 22:44:58 +0000314DEFINES += -DHAVE_GETTEXT -DHAVE_LOCALE_H
Bram Moolenaar071d4272004-06-13 20:20:40 +0000315GETTEXTINCLUDE = $(GETTEXT)/include
316GETTEXTLIB = $(INTLPATH)
317ifeq (yes, $(GETTEXT))
Bram Moolenaar8cd06ca2005-02-28 22:44:58 +0000318DEFINES += -DDYNAMIC_GETTEXT
Bram Moolenaar071d4272004-06-13 20:20:40 +0000319else
320ifdef DYNAMIC_GETTEXT
Bram Moolenaar8cd06ca2005-02-28 22:44:58 +0000321DEFINES += -D$(DYNAMIC_GETTEXT)
Bram Moolenaar071d4272004-06-13 20:20:40 +0000322ifdef GETTEXT_DYNAMIC
323DEFINES += -DGETTEXT_DYNAMIC -DGETTEXT_DLL=\"$(GETTEXT_DYNAMIC)\"
324endif
325endif
326endif
327endif
328
329ifdef PERL
330CFLAGS += -I$(PERLLIBS) -DFEAT_PERL -L$(PERLLIBS)
331ifeq (yes, $(DYNAMIC_PERL))
332CFLAGS += -DDYNAMIC_PERL -DDYNAMIC_PERL_DLL=\"perl$(PERL_VER).dll\"
333endif
334endif
335
Bram Moolenaar0ba04292010-07-14 23:23:17 +0200336ifdef LUA
337CFLAGS += -I$(LUA)/include -DFEAT_LUA
338ifeq (yes, $(DYNAMIC_LUA))
339CFLAGS += -DDYNAMIC_LUA -DDYNAMIC_LUA_DLL=\"lua$(LUA_VER).dll\"
340endif
341endif
342
Bram Moolenaar325b7a22004-07-05 15:58:32 +0000343ifdef MZSCHEME
344CFLAGS += -I$(MZSCHEME)/include -DFEAT_MZSCHEME -DMZSCHEME_COLLECTS=\"$(MZSCHEME)/collects\"
Bram Moolenaar281bdce2005-01-25 21:53:18 +0000345ifeq (yes, $(DYNAMIC_MZSCHEME))
346CFLAGS += -DDYNAMIC_MZSCHEME -DDYNAMIC_MZSCH_DLL=\"libmzsch$(MZSCHEME_VER).dll\" -DDYNAMIC_MZGC_DLL=\"libmzgc$(MZSCHEME_VER).dll\"
347endif
Bram Moolenaar325b7a22004-07-05 15:58:32 +0000348endif
349
Bram Moolenaar071d4272004-06-13 20:20:40 +0000350ifdef RUBY
351CFLAGS += -DFEAT_RUBY $(RUBYINC)
352ifeq (yes, $(DYNAMIC_RUBY))
353CFLAGS += -DDYNAMIC_RUBY -DDYNAMIC_RUBY_DLL=\"$(RUBY_INSTALL_NAME).dll\"
354CFLAGS += -DDYNAMIC_RUBY_VER=$(RUBY_VER)
355endif
356endif
357
358ifdef PYTHON
Bram Moolenaarbd5e15f2010-07-17 21:19:38 +0200359CFLAGS += -DFEAT_PYTHON
Bram Moolenaar071d4272004-06-13 20:20:40 +0000360ifeq (yes, $(DYNAMIC_PYTHON))
Bram Moolenaarbd5e15f2010-07-17 21:19:38 +0200361CFLAGS += -DDYNAMIC_PYTHON
362endif
363endif
364
365ifdef PYTHON3
366CFLAGS += -DFEAT_PYTHON3
367ifeq (yes, $(DYNAMIC_PYTHON3))
368CFLAGS += -DDYNAMIC_PYTHON3
Bram Moolenaar071d4272004-06-13 20:20:40 +0000369endif
370endif
371
372ifdef TCL
373CFLAGS += -DFEAT_TCL $(TCLINC)
374ifeq (yes, $(DYNAMIC_TCL))
375CFLAGS += -DDYNAMIC_TCL -DDYNAMIC_TCL_DLL=\"tcl$(TCL_VER).dll\"
376endif
377endif
378
379ifeq ($(POSTSCRIPT),yes)
380DEFINES += -DMSWINPS
381endif
382
383ifeq (yes, $(OLE))
384DEFINES += -DFEAT_OLE
385endif
386
387ifeq ($(CSCOPE),yes)
388DEFINES += -DFEAT_CSCOPE
389endif
390
391ifeq ($(NETBEANS),yes)
Bram Moolenaarcfbc5ee2004-07-02 15:38:35 +0000392# Only allow NETBEANS for a GUI build.
393ifeq (yes, $(GUI))
Bram Moolenaar071d4272004-06-13 20:20:40 +0000394DEFINES += -DFEAT_NETBEANS_INTG
Bram Moolenaarcfbc5ee2004-07-02 15:38:35 +0000395
396ifeq ($(NBDEBUG), yes)
Bram Moolenaar071d4272004-06-13 20:20:40 +0000397DEFINES += -DNBDEBUG
398NBDEBUG_INCL = nbdebug.h
399NBDEBUG_SRC = nbdebug.c
400endif
401endif
Bram Moolenaarcfbc5ee2004-07-02 15:38:35 +0000402endif
Bram Moolenaar071d4272004-06-13 20:20:40 +0000403
404ifdef XPM
Bram Moolenaarcfbc5ee2004-07-02 15:38:35 +0000405# Only allow XPM for a GUI build.
406ifeq (yes, $(GUI))
Bram Moolenaar071d4272004-06-13 20:20:40 +0000407CFLAGS += -DFEAT_XPM_W32 -I $(XPM)/include
408endif
Bram Moolenaarcfbc5ee2004-07-02 15:38:35 +0000409endif
Bram Moolenaar071d4272004-06-13 20:20:40 +0000410
411ifeq ($(DEBUG),yes)
412CFLAGS += -g -fstack-check
413DEBUG_SUFFIX=d
414else
415ifeq ($(OPTIMIZE), SIZE)
416CFLAGS += -Os
417else
418ifeq ($(OPTIMIZE), MAXSPEED)
419CFLAGS += -O3
Bram Moolenaar1cd871b2004-12-19 22:46:22 +0000420CFLAGS += -fomit-frame-pointer -freg-struct-return
Bram Moolenaar071d4272004-06-13 20:20:40 +0000421else # SPEED
422CFLAGS += -O2
423endif
424endif
425CFLAGS += -s
426endif
427
Bram Moolenaara3ffd9c2005-07-21 21:03:15 +0000428LIB = -lkernel32 -luser32 -lgdi32 -ladvapi32 -lcomdlg32 -lcomctl32 -lversion
Bram Moolenaar44ecf652005-03-07 23:09:59 +0000429GUIOBJ = $(OUTDIR)/gui.o $(OUTDIR)/gui_w32.o $(OUTDIR)/gui_beval.o $(OUTDIR)/os_w32exe.o
Bram Moolenaar071d4272004-06-13 20:20:40 +0000430OBJ = \
Bram Moolenaaredac1852010-05-18 20:34:20 +0200431 $(OUTDIR)/blowfish.o \
Bram Moolenaar071d4272004-06-13 20:20:40 +0000432 $(OUTDIR)/buffer.o \
433 $(OUTDIR)/charset.o \
434 $(OUTDIR)/diff.o \
435 $(OUTDIR)/digraph.o \
436 $(OUTDIR)/edit.o \
437 $(OUTDIR)/eval.o \
438 $(OUTDIR)/ex_cmds.o \
439 $(OUTDIR)/ex_cmds2.o \
440 $(OUTDIR)/ex_docmd.o \
441 $(OUTDIR)/ex_eval.o \
442 $(OUTDIR)/ex_getln.o \
443 $(OUTDIR)/fileio.o \
444 $(OUTDIR)/fold.o \
445 $(OUTDIR)/getchar.o \
Bram Moolenaar58d98232005-07-23 22:25:46 +0000446 $(OUTDIR)/hardcopy.o \
Bram Moolenaarc01140a2006-03-24 22:21:52 +0000447 $(OUTDIR)/hashtab.o \
Bram Moolenaar071d4272004-06-13 20:20:40 +0000448 $(OUTDIR)/main.o \
449 $(OUTDIR)/mark.o \
450 $(OUTDIR)/memfile.o \
451 $(OUTDIR)/memline.o \
452 $(OUTDIR)/menu.o \
453 $(OUTDIR)/message.o \
454 $(OUTDIR)/misc1.o \
455 $(OUTDIR)/misc2.o \
456 $(OUTDIR)/move.o \
457 $(OUTDIR)/mbyte.o \
458 $(OUTDIR)/normal.o \
459 $(OUTDIR)/ops.o \
460 $(OUTDIR)/option.o \
461 $(OUTDIR)/os_win32.o \
462 $(OUTDIR)/os_mswin.o \
463 $(OUTDIR)/pathdef.o \
Bram Moolenaarc01140a2006-03-24 22:21:52 +0000464 $(OUTDIR)/popupmnu.o \
Bram Moolenaar071d4272004-06-13 20:20:40 +0000465 $(OUTDIR)/quickfix.o \
466 $(OUTDIR)/regexp.o \
467 $(OUTDIR)/screen.o \
468 $(OUTDIR)/search.o \
Bram Moolenaaredac1852010-05-18 20:34:20 +0200469 $(OUTDIR)/sha256.o \
Bram Moolenaar6bb68362005-03-22 23:03:44 +0000470 $(OUTDIR)/spell.o \
Bram Moolenaar071d4272004-06-13 20:20:40 +0000471 $(OUTDIR)/syntax.o \
472 $(OUTDIR)/tag.o \
473 $(OUTDIR)/term.o \
474 $(OUTDIR)/ui.o \
475 $(OUTDIR)/undo.o \
476 $(OUTDIR)/version.o \
477 $(OUTDIR)/vimrc.o \
478 $(OUTDIR)/window.o
479
480ifdef PERL
481OBJ += $(OUTDIR)/if_perl.o
482endif
Bram Moolenaar0ba04292010-07-14 23:23:17 +0200483ifdef LUA
484OBJ += $(OUTDIR)/if_lua.o
485endif
Bram Moolenaar325b7a22004-07-05 15:58:32 +0000486ifdef MZSCHEME
487OBJ += $(OUTDIR)/if_mzsch.o
488MZSCHEME_INCL = if_mzsch.h
Bram Moolenaar9e70cf12009-05-26 20:59:55 +0000489ifeq (yes,$(MZSCHEME_GENERATE_BASE))
490CFLAGS += -DINCLUDE_MZSCHEME_BASE
491MZ_EXTRA_DEP += mzscheme_base.c
492endif
493ifeq (yes,$(MZSCHEME_PRECISE_GC))
494CFLAGS += -DMZ_PRECISE_GC
495endif
Bram Moolenaar325b7a22004-07-05 15:58:32 +0000496endif
Bram Moolenaar071d4272004-06-13 20:20:40 +0000497ifdef PYTHON
498OBJ += $(OUTDIR)/if_python.o
499endif
Bram Moolenaarbd5e15f2010-07-17 21:19:38 +0200500ifdef PYTHON3
501OBJ += $(OUTDIR)/if_python3.o
502endif
Bram Moolenaar071d4272004-06-13 20:20:40 +0000503ifdef RUBY
504OBJ += $(OUTDIR)/if_ruby.o
505endif
506ifdef TCL
507OBJ += $(OUTDIR)/if_tcl.o
508endif
509ifeq ($(CSCOPE),yes)
510OBJ += $(OUTDIR)/if_cscope.o
511endif
512ifeq ($(NETBEANS),yes)
Bram Moolenaarcfbc5ee2004-07-02 15:38:35 +0000513# Only allow NETBEANS for a GUI build.
514ifeq (yes, $(GUI))
Bram Moolenaar44ecf652005-03-07 23:09:59 +0000515OBJ += $(OUTDIR)/netbeans.o
Bram Moolenaar071d4272004-06-13 20:20:40 +0000516LIB += -lwsock32
517endif
Bram Moolenaarcfbc5ee2004-07-02 15:38:35 +0000518endif
Bram Moolenaar071d4272004-06-13 20:20:40 +0000519ifdef XPM
Bram Moolenaarcfbc5ee2004-07-02 15:38:35 +0000520# Only allow XPM for a GUI build.
521ifeq (yes, $(GUI))
Bram Moolenaar071d4272004-06-13 20:20:40 +0000522OBJ += $(OUTDIR)/xpm_w32.o
523# You'll need libXpm.a from http://gnuwin32.sf.net
524LIB += -L $(XPM)/lib -lXpm
525endif
Bram Moolenaarcfbc5ee2004-07-02 15:38:35 +0000526endif
Bram Moolenaar071d4272004-06-13 20:20:40 +0000527
528
Bram Moolenaar325b7a22004-07-05 15:58:32 +0000529ifdef MZSCHEME
530MZSCHEME_SUFFIX = Z
531endif
532
Bram Moolenaar071d4272004-06-13 20:20:40 +0000533ifeq ($(GUI),yes)
534TARGET := gvim$(DEBUG_SUFFIX).exe
535DEFINES += $(DEF_GUI)
536OBJ += $(GUIOBJ)
537LFLAGS += -mwindows
Bram Moolenaar325b7a22004-07-05 15:58:32 +0000538OUTDIR = gobj$(DEBUG_SUFFIX)$(MZSCHEME_SUFFIX)
Bram Moolenaar071d4272004-06-13 20:20:40 +0000539else
540TARGET := vim$(DEBUG_SUFFIX).exe
Bram Moolenaar325b7a22004-07-05 15:58:32 +0000541OUTDIR = obj$(DEBUG_SUFFIX)$(MZSCHEME_SUFFIX)
Bram Moolenaar071d4272004-06-13 20:20:40 +0000542endif
543
544ifdef GETTEXT
545ifneq (yes, $(GETTEXT))
546CFLAGS += -I$(GETTEXTINCLUDE)
547ifndef STATIC_GETTEXT
548LIB += -L$(GETTEXTLIB) -l$(INTLLIB)
549ifeq (USE_SAFE_GETTEXT_DLL, $(DYNAMIC_GETTEXT))
550OBJ+=$(SAFE_GETTEXT_DLL_OBJ)
551endif
552else
553LIB += -L$(GETTEXTLIB) -lintl
554endif
555endif
556endif
557
558ifdef PERL
559ifeq (no, $(DYNAMIC_PERL))
560LIB += -lperl$(PERL_VER)
561endif
562endif
563
564ifdef TCL
565LIB += -L$(TCL)/lib
566ifeq (yes, $(DYNAMIC_TCL))
567LIB += -ltclstub$(TCL_VER)
568else
569LIB += -ltcl$(TCL_VER)
570endif
571endif
572
573ifeq (yes, $(OLE))
574LIB += -loleaut32 -lstdc++
575OBJ += $(OUTDIR)/if_ole.o
576endif
577
578ifeq (yes, $(MBYTE))
579DEFINES += -DFEAT_MBYTE
580endif
581
582ifeq (yes, $(IME))
583DEFINES += -DFEAT_MBYTE_IME
584ifeq (yes, $(DYNAMIC_IME))
585DEFINES += -DDYNAMIC_IME
586else
587LIB += -limm32
588endif
589endif
590
591ifdef ICONV
592ifneq (yes, $(ICONV))
593LIB += -L$(ICONV)
594CFLAGS += -I$(ICONV)
595endif
596DEFINES+=-DDYNAMIC_ICONV
597endif
598
599all: $(TARGET) vimrun.exe xxd/xxd.exe install.exe uninstal.exe GvimExt/gvimext.dll
600
601vimrun.exe: vimrun.c
602 $(CC) $(CFLAGS) -o vimrun.exe vimrun.c $(LIB)
603
604install.exe: dosinst.c
605 $(CC) $(CFLAGS) -o install.exe dosinst.c $(LIB) -lole32 -luuid
606
607uninstal.exe: uninstal.c
608 $(CC) $(CFLAGS) -o uninstal.exe uninstal.c $(LIB)
609
610$(TARGET): $(OUTDIR) $(OBJ)
Bram Moolenaarbd5e15f2010-07-17 21:19:38 +0200611 $(CC) $(CFLAGS) $(LFLAGS) -o $@ $(OBJ) $(LIB) -lole32 -luuid $(LUA_LIB) $(MZSCHEME_LIBDIR) $(MZSCHEME_LIB) $(PYTHONLIB) $(PYTHON3LIB) $(RUBYLIB)
Bram Moolenaar071d4272004-06-13 20:20:40 +0000612
613upx: exes
614 upx gvim.exe
615 upx vim.exe
616
617xxd/xxd.exe: xxd/xxd.c
Bram Moolenaar48f80c22010-02-24 15:08:27 +0100618 $(MAKE) -C xxd -f Make_cyg.mak CC=$(CC)
Bram Moolenaar071d4272004-06-13 20:20:40 +0000619
620GvimExt/gvimext.dll: GvimExt/gvimext.cpp GvimExt/gvimext.rc GvimExt/gvimext.h
Bram Moolenaar48f80c22010-02-24 15:08:27 +0100621 $(MAKE) -C GvimExt -f Make_ming.mak CROSS=$(CROSS) CROSS_COMPILE=$(CROSS_COMPILE)
Bram Moolenaar071d4272004-06-13 20:20:40 +0000622
623clean:
624 -$(DEL) $(OUTDIR)$(DIRSLASH)*.o
625 -$(DEL) $(OUTDIR)$(DIRSLASH)*.res
626 -rmdir $(OUTDIR)
627 -$(DEL) *.exe
628 -$(DEL) pathdef.c
629ifdef PERL
630 -$(DEL) if_perl.c
631endif
Bram Moolenaar2d6db762009-09-11 10:49:58 +0000632ifdef MZSCHEME
633 -$(DEL) mzscheme_base.c
634endif
Bram Moolenaar071d4272004-06-13 20:20:40 +0000635 $(MAKE) -C GvimExt -f Make_ming.mak clean
636 $(MAKE) -C xxd -f Make_cyg.mak clean
637
638###########################################################################
639INCL = vim.h feature.h os_win32.h os_dos.h ascii.h keymap.h term.h macros.h \
640 structs.h regexp.h option.h ex_cmds.h proto.h globals.h farsi.h \
641 gui.h
642
Bram Moolenaarbd5e15f2010-07-17 21:19:38 +0200643$(OUTDIR)/if_python.o : if_python.c $(INCL)
644 $(CC) -c $(CFLAGS) $(PYTHONINC) -DDYNAMIC_PYTHON_DLL=\"python$(PYTHON_VER).dll\" $< -o $@
645
646$(OUTDIR)/if_python3.o : if_python3.c $(INCL)
647 $(CC) -c $(CFLAGS) $(PYTHON3INC) -DDYNAMIC_PYTHON3_DLL=\"PYTHON$(PYTHON3_VER).dll\" $< -o $@
648
Bram Moolenaar071d4272004-06-13 20:20:40 +0000649$(OUTDIR)/%.o : %.c $(INCL)
650 $(CC) -c $(CFLAGS) $< -o $@
651
652$(OUTDIR)/vimres.res: vim.rc version.h gui_w32_rc.h
653 $(WINDRES) $(DEFINES) vim.rc $(OUTDIR)/vimres.res
654
655$(OUTDIR)/vimrc.o: $(OUTDIR)/vimres.res
656 $(WINDRES) $(OUTDIR)/vimres.res $(OUTDIR)/vimrc.o
657
658$(OUTDIR):
Bram Moolenaar0cf6f542005-01-16 21:59:36 +0000659 $(MKDIR) $(OUTDIR)
Bram Moolenaar071d4272004-06-13 20:20:40 +0000660
661$(OUTDIR)/ex_docmd.o: ex_docmd.c $(INCL) ex_cmds.h
662 $(CC) -c $(CFLAGS) ex_docmd.c -o $(OUTDIR)/ex_docmd.o
663
664$(OUTDIR)/ex_eval.o: ex_eval.c $(INCL) ex_cmds.h
665 $(CC) -c $(CFLAGS) ex_eval.c -o $(OUTDIR)/ex_eval.o
666
667$(OUTDIR)/if_cscope.o: if_cscope.c $(INCL) if_cscope.h
668 $(CC) -c $(CFLAGS) if_cscope.c -o $(OUTDIR)/if_cscope.o
669
Bram Moolenaar8c69d532007-08-12 13:25:01 +0000670# Remove -D__IID_DEFINED__ for newer versions of the w32api
Bram Moolenaar071d4272004-06-13 20:20:40 +0000671$(OUTDIR)/if_ole.o: if_ole.cpp $(INCL)
Bram Moolenaar8c69d532007-08-12 13:25:01 +0000672 $(CC) $(CFLAGS) -c -o $(OUTDIR)/if_ole.o if_ole.cpp
Bram Moolenaar071d4272004-06-13 20:20:40 +0000673
674$(OUTDIR)/if_ruby.o: if_ruby.c $(INCL)
675ifeq (16, $(RUBY))
676 $(CC) $(CFLAGS) -U_WIN32 -c -o $(OUTDIR)/if_ruby.o if_ruby.c
677endif
678
679if_perl.c: if_perl.xs typemap
680 perl $(PERLLIB)/ExtUtils/xsubpp -prototypes -typemap \
681 $(PERLLIB)/ExtUtils/typemap if_perl.xs > $@
682
683$(OUTDIR)/netbeans.o: netbeans.c $(INCL) $(NBDEBUG_INCL) $(NBDEBUG_SRC)
684 $(CC) -c $(CFLAGS) netbeans.c -o $(OUTDIR)/netbeans.o
685
Bram Moolenaar9e70cf12009-05-26 20:59:55 +0000686$(OUTDIR)/if_mzsch.o: if_mzsch.c $(INCL) if_mzsch.h $(MZ_EXTRA_DEP)
687 $(CC) -c $(CFLAGS) if_mzsch.c -o $(OUTDIR)/if_mzsch.o
688
689mzscheme_base.c:
690 $(MZSCHEME)/mzc --c-mods mzscheme_base.c ++lib scheme/base
691
Bram Moolenaar071d4272004-06-13 20:20:40 +0000692pathdef.c: $(INCL)
693ifneq (sh.exe, $(SHELL))
694 @echo creating pathdef.c
695 @echo '/* pathdef.c */' > pathdef.c
696 @echo '#include "vim.h"' >> pathdef.c
697 @echo 'char_u *default_vim_dir = (char_u *)"$(VIMRCLOC)";' >> pathdef.c
698 @echo 'char_u *default_vimruntime_dir = (char_u *)"$(VIMRUNTIMEDIR)";' >> pathdef.c
699 @echo 'char_u *all_cflags = (char_u *)"$(CC) $(CFLAGS)";' >> pathdef.c
Bram Moolenaarbd5e15f2010-07-17 21:19:38 +0200700 @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
Bram Moolenaar071d4272004-06-13 20:20:40 +0000701 @echo 'char_u *compiled_user = (char_u *)"$(USERNAME)";' >> pathdef.c
702 @echo 'char_u *compiled_sys = (char_u *)"$(USERDOMAIN)";' >> pathdef.c
703else
704 @echo creating pathdef.c
705 @echo /* pathdef.c */ > pathdef.c
706 @echo #include "vim.h" >> pathdef.c
707 @echo char_u *default_vim_dir = (char_u *)"$(VIMRCLOC)"; >> pathdef.c
708 @echo char_u *default_vimruntime_dir = (char_u *)"$(VIMRUNTIMEDIR)"; >> pathdef.c
709 @echo char_u *all_cflags = (char_u *)"$(CC) $(CFLAGS)"; >> pathdef.c
Bram Moolenaarbd5e15f2010-07-17 21:19:38 +0200710 @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
Bram Moolenaar071d4272004-06-13 20:20:40 +0000711 @echo char_u *compiled_user = (char_u *)"$(USERNAME)"; >> pathdef.c
712 @echo char_u *compiled_sys = (char_u *)"$(USERDOMAIN)"; >> pathdef.c
713endif