blob: c98fc42d5a0b13d0b7b0b524d49fab8648969789 [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 Moolenaar2d0860d2010-11-03 21:59:30 +0100144ifndef MZSCHEME_USE_RACKET
145MZSCHEME_MAIN_LIB=mzsch
146else
147MZSCHEME_MAIN_LIB=racket
148endif
149
Bram Moolenaar281bdce2005-01-25 21:53:18 +0000150ifeq (no,$(DYNAMIC_MZSCHEME))
Bram Moolenaar9e70cf12009-05-26 20:59:55 +0000151ifeq (yes,$(MZSCHEME_PRECISE_GC))
Bram Moolenaar2d0860d2010-11-03 21:59:30 +0100152MZSCHEME_LIB=-l$(MZSCHEME_MAIN_LIB)$(MZSCHEME_VER)
Bram Moolenaar9e70cf12009-05-26 20:59:55 +0000153else
Bram Moolenaar2d0860d2010-11-03 21:59:30 +0100154MZSCHEME_LIB = -l$(MZSCHEME_MAIN_LIB)$(MZSCHEME_VER) -lmzgc$(MZSCHEME_VER)
Bram Moolenaar9e70cf12009-05-26 20:59:55 +0000155endif
Bram Moolenaar281bdce2005-01-25 21:53:18 +0000156# the modern MinGW can dynamically link to dlls directly.
157# point MZSCHEME_DLLS to where you put libmzschXXXXXXX.dll and libgcXXXXXXX.dll
Bram Moolenaar281bdce2005-01-25 21:53:18 +0000158ifndef MZSCHEME_DLLS
159MZSCHEME_DLLS=$(MZSCHEME)
Bram Moolenaar325b7a22004-07-05 15:58:32 +0000160endif
Bram Moolenaar2d6db762009-09-11 10:49:58 +0000161MZSCHEME_LIBDIR=-L$(MZSCHEME_DLLS) -L$(MZSCHEME_DLLS)\lib
Bram Moolenaar281bdce2005-01-25 21:53:18 +0000162endif
163
Bram Moolenaar325b7a22004-07-05 15:58:32 +0000164endif
165
Bram Moolenaar071d4272004-06-13 20:20:40 +0000166# Python support -- works with the ActiveState python 2.0 release (and others
167# too, probably)
168#
169# uncomment 'PYTHON' to make python-enabled version
170# Put the path to the python distro here. If cross compiling from Linux, you
171# will also need to convert the header files to unix instead of dos format:
172# for fil in *.h ; do vim -e -c 'set ff=unix|w|q' $fil
173# and also, you will need to make a mingw32 'libpython20.a' to link with:
174# cd $PYTHON/libs
175# pexports python20.dll > python20.def
176# dlltool -d python20.def -l libpython20.a
177# on my Linux box, I put the Python stuff here:
178#PYTHON=/home/ron/ActivePython-2.0.0-202/src/Core
179# on my NT box, it's here:
180#PYTHON=c:/python20
181
182ifdef PYTHON
183ifndef DYNAMIC_PYTHON
184DYNAMIC_PYTHON=yes
185endif
186
187ifndef PYTHON_VER
188PYTHON_VER=22
189endif
190
191ifeq (no,$(DYNAMIC_PYTHON))
192PYTHONLIB=-L$(PYTHON)/libs -lpython$(PYTHON_VER)
193endif
194# my include files are in 'win32inc' on Linux, and 'include' in the standard
195# NT distro (ActiveState)
196ifeq ($(CROSS),no)
197PYTHONINC=-I $(PYTHON)/include
198else
199PYTHONINC=-I $(PYTHON)/win32inc
200endif
201endif
202
Bram Moolenaarbd5e15f2010-07-17 21:19:38 +0200203#PYTHON3: See comment for Python 2 above
204
205ifdef PYTHON3
206ifndef DYNAMIC_PYTHON3
207DYNAMIC_PYTHON3=yes
208endif
209
210ifndef PYTHON3_VER
211PYTHON3_VER=31
212endif
213
214ifeq (no,$(DYNAMIC_PYTHON3))
215PYTHON3LIB=-L$(PYTHON3)/libs -lPYTHON$(PYTHON3_VER)
216endif
217
218ifeq ($(CROSS),no)
219PYTHON3INC=-I $(PYTHON3)/include
220else
221PYTHON3INC=-I $(PYTHON3)/win32inc
222endif
223endif
224
Bram Moolenaar071d4272004-06-13 20:20:40 +0000225# TCL interface:
226# TCL=[Path to TCL directory]
227# DYNAMIC_TCL=yes (to load the TCL DLL dynamically)
228# TCL_VER=[TCL version, eg 83, 84] (default is 83)
229#TCL=c:/tcl
230ifdef TCL
231ifndef DYNAMIC_TCL
232DYNAMIC_TCL=yes
233endif
234ifndef TCL_VER
235TCL_VER = 83
236endif
237TCLINC += -I$(TCL)/include
238endif
239
240
241# Ruby interface:
242# RUBY=[Path to Ruby directory]
243# DYNAMIC_RUBY=yes (to load the Ruby DLL dynamically)
244# RUBY_VER=[Ruby version, eg 16, 17] (default is 16)
245# RUBY_VER_LONG=[Ruby version, eg 1.6, 1.7] (default is 1.6)
246# You must set RUBY_VER_LONG when change RUBY_VER.
247#RUBY=c:/ruby
248ifdef RUBY
249ifndef DYNAMIC_RUBY
250DYNAMIC_RUBY=yes
251endif
252# Set default value
253ifndef RUBY_VER
254RUBY_VER = 16
255endif
256ifndef RUBY_VER_LONG
257RUBY_VER_LONG = 1.6
258endif
259
Bram Moolenaar66ca3202010-03-10 13:20:40 +0100260ifndef RUBY_PLATFORM
Bram Moolenaar071d4272004-06-13 20:20:40 +0000261ifeq ($(RUBY_VER), 16)
Bram Moolenaar071d4272004-06-13 20:20:40 +0000262RUBY_PLATFORM = i586-mswin32
Bram Moolenaar8c79caf2010-03-17 17:25:09 +0100263else
264ifneq ($(wildcard $(RUBY)/lib/ruby/$(RUBY_VER_LONG)/i386-mingw32),)
Bram Moolenaar66ca3202010-03-10 13:20:40 +0100265RUBY_PLATFORM = i386-mingw32
Bram Moolenaar071d4272004-06-13 20:20:40 +0000266else
Bram Moolenaar071d4272004-06-13 20:20:40 +0000267RUBY_PLATFORM = i386-mswin32
268endif
Bram Moolenaar66ca3202010-03-10 13:20:40 +0100269endif
Bram Moolenaar8c79caf2010-03-17 17:25:09 +0100270endif
Bram Moolenaar66ca3202010-03-10 13:20:40 +0100271
Bram Moolenaar071d4272004-06-13 20:20:40 +0000272ifndef RUBY_INSTALL_NAME
Bram Moolenaar66ca3202010-03-10 13:20:40 +0100273ifeq ($(RUBY_VER), 16)
274RUBY_INSTALL_NAME = mswin32-ruby$(RUBY_VER)
275else
Bram Moolenaar071d4272004-06-13 20:20:40 +0000276RUBY_INSTALL_NAME = msvcrt-ruby$(RUBY_VER)
277endif
278endif
279
Bram Moolenaar66ca3202010-03-10 13:20:40 +0100280RUBYINC =-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 +0000281ifeq (no, $(DYNAMIC_RUBY))
282RUBYLIB = -L$(RUBY)/lib -l$(RUBY_INSTALL_NAME)
283endif
284
285endif # RUBY
286
287# See feature.h for a list of options.
288# Any other defines can be included here.
289DEF_GUI=-DFEAT_GUI_W32 -DFEAT_CLIPBOARD
290DEFINES=-DWIN32 -DWINVER=$(WINVER) -D_WIN32_WINNT=$(WINVER) \
291 -DHAVE_PATHDEF -DFEAT_$(FEATURES)
292ifeq ($(CROSS),yes)
Bram Moolenaar48f80c22010-02-24 15:08:27 +0100293# cross-compiler prefix:
294CROSS_COMPILE = i586-pc-mingw32msvc-
Bram Moolenaar071d4272004-06-13 20:20:40 +0000295DEL = rm
Bram Moolenaar0cf6f542005-01-16 21:59:36 +0000296MKDIR = mkdir -p
Bram Moolenaar48f80c22010-02-24 15:08:27 +0100297DIRSLASH = /
Bram Moolenaar071d4272004-06-13 20:20:40 +0000298else
299# normal (Windows) compilation:
Bram Moolenaar48f80c22010-02-24 15:08:27 +0100300CROSS_COMPILE =
Bram Moolenaar86ce1cc2010-02-26 22:05:22 +0100301ifneq (sh.exe, $(SHELL))
Bram Moolenaar071d4272004-06-13 20:20:40 +0000302DEL = rm
Bram Moolenaar0cf6f542005-01-16 21:59:36 +0000303MKDIR = mkdir -p
Bram Moolenaar071d4272004-06-13 20:20:40 +0000304DIRSLASH = /
305else
306DEL = del
Bram Moolenaar0cf6f542005-01-16 21:59:36 +0000307MKDIR = mkdir
Bram Moolenaar071d4272004-06-13 20:20:40 +0000308DIRSLASH = \\
309endif
Bram Moolenaar071d4272004-06-13 20:20:40 +0000310endif
Bram Moolenaar48f80c22010-02-24 15:08:27 +0100311CC := $(CROSS_COMPILE)gcc
Bram Moolenaard622beb2010-09-29 18:42:28 +0200312WINDRES := $(CROSS_COMPILE)windres --preprocessor="$(CC) -E -xc" -DRC_INVOKED
Bram Moolenaar071d4272004-06-13 20:20:40 +0000313
314#>>>>> end of choices
315###########################################################################
316
Bram Moolenaar1cd871b2004-12-19 22:46:22 +0000317CFLAGS = -Iproto $(DEFINES) -pipe -w -march=$(ARCH) -Wall
Bram Moolenaar071d4272004-06-13 20:20:40 +0000318
319ifdef GETTEXT
Bram Moolenaar8cd06ca2005-02-28 22:44:58 +0000320DEFINES += -DHAVE_GETTEXT -DHAVE_LOCALE_H
Bram Moolenaar071d4272004-06-13 20:20:40 +0000321GETTEXTINCLUDE = $(GETTEXT)/include
322GETTEXTLIB = $(INTLPATH)
323ifeq (yes, $(GETTEXT))
Bram Moolenaar8cd06ca2005-02-28 22:44:58 +0000324DEFINES += -DDYNAMIC_GETTEXT
Bram Moolenaar071d4272004-06-13 20:20:40 +0000325else
326ifdef DYNAMIC_GETTEXT
Bram Moolenaar8cd06ca2005-02-28 22:44:58 +0000327DEFINES += -D$(DYNAMIC_GETTEXT)
Bram Moolenaar071d4272004-06-13 20:20:40 +0000328ifdef GETTEXT_DYNAMIC
329DEFINES += -DGETTEXT_DYNAMIC -DGETTEXT_DLL=\"$(GETTEXT_DYNAMIC)\"
330endif
331endif
332endif
333endif
334
335ifdef PERL
336CFLAGS += -I$(PERLLIBS) -DFEAT_PERL -L$(PERLLIBS)
337ifeq (yes, $(DYNAMIC_PERL))
338CFLAGS += -DDYNAMIC_PERL -DDYNAMIC_PERL_DLL=\"perl$(PERL_VER).dll\"
339endif
340endif
341
Bram Moolenaar0ba04292010-07-14 23:23:17 +0200342ifdef LUA
343CFLAGS += -I$(LUA)/include -DFEAT_LUA
344ifeq (yes, $(DYNAMIC_LUA))
345CFLAGS += -DDYNAMIC_LUA -DDYNAMIC_LUA_DLL=\"lua$(LUA_VER).dll\"
346endif
347endif
348
Bram Moolenaar325b7a22004-07-05 15:58:32 +0000349ifdef MZSCHEME
350CFLAGS += -I$(MZSCHEME)/include -DFEAT_MZSCHEME -DMZSCHEME_COLLECTS=\"$(MZSCHEME)/collects\"
Bram Moolenaar281bdce2005-01-25 21:53:18 +0000351ifeq (yes, $(DYNAMIC_MZSCHEME))
Bram Moolenaar2d0860d2010-11-03 21:59:30 +0100352CFLAGS += -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 +0000353endif
Bram Moolenaar325b7a22004-07-05 15:58:32 +0000354endif
355
Bram Moolenaar071d4272004-06-13 20:20:40 +0000356ifdef RUBY
357CFLAGS += -DFEAT_RUBY $(RUBYINC)
358ifeq (yes, $(DYNAMIC_RUBY))
359CFLAGS += -DDYNAMIC_RUBY -DDYNAMIC_RUBY_DLL=\"$(RUBY_INSTALL_NAME).dll\"
360CFLAGS += -DDYNAMIC_RUBY_VER=$(RUBY_VER)
361endif
362endif
363
364ifdef PYTHON
Bram Moolenaarbd5e15f2010-07-17 21:19:38 +0200365CFLAGS += -DFEAT_PYTHON
Bram Moolenaar071d4272004-06-13 20:20:40 +0000366ifeq (yes, $(DYNAMIC_PYTHON))
Bram Moolenaarbd5e15f2010-07-17 21:19:38 +0200367CFLAGS += -DDYNAMIC_PYTHON
368endif
369endif
370
371ifdef PYTHON3
372CFLAGS += -DFEAT_PYTHON3
373ifeq (yes, $(DYNAMIC_PYTHON3))
374CFLAGS += -DDYNAMIC_PYTHON3
Bram Moolenaar071d4272004-06-13 20:20:40 +0000375endif
376endif
377
378ifdef TCL
379CFLAGS += -DFEAT_TCL $(TCLINC)
380ifeq (yes, $(DYNAMIC_TCL))
381CFLAGS += -DDYNAMIC_TCL -DDYNAMIC_TCL_DLL=\"tcl$(TCL_VER).dll\"
382endif
383endif
384
385ifeq ($(POSTSCRIPT),yes)
386DEFINES += -DMSWINPS
387endif
388
389ifeq (yes, $(OLE))
390DEFINES += -DFEAT_OLE
391endif
392
393ifeq ($(CSCOPE),yes)
394DEFINES += -DFEAT_CSCOPE
395endif
396
397ifeq ($(NETBEANS),yes)
Bram Moolenaarcfbc5ee2004-07-02 15:38:35 +0000398# Only allow NETBEANS for a GUI build.
399ifeq (yes, $(GUI))
Bram Moolenaar071d4272004-06-13 20:20:40 +0000400DEFINES += -DFEAT_NETBEANS_INTG
Bram Moolenaarcfbc5ee2004-07-02 15:38:35 +0000401
402ifeq ($(NBDEBUG), yes)
Bram Moolenaar071d4272004-06-13 20:20:40 +0000403DEFINES += -DNBDEBUG
404NBDEBUG_INCL = nbdebug.h
405NBDEBUG_SRC = nbdebug.c
406endif
407endif
Bram Moolenaarcfbc5ee2004-07-02 15:38:35 +0000408endif
Bram Moolenaar071d4272004-06-13 20:20:40 +0000409
410ifdef XPM
Bram Moolenaarcfbc5ee2004-07-02 15:38:35 +0000411# Only allow XPM for a GUI build.
412ifeq (yes, $(GUI))
Bram Moolenaar071d4272004-06-13 20:20:40 +0000413CFLAGS += -DFEAT_XPM_W32 -I $(XPM)/include
414endif
Bram Moolenaarcfbc5ee2004-07-02 15:38:35 +0000415endif
Bram Moolenaar071d4272004-06-13 20:20:40 +0000416
417ifeq ($(DEBUG),yes)
418CFLAGS += -g -fstack-check
419DEBUG_SUFFIX=d
420else
421ifeq ($(OPTIMIZE), SIZE)
422CFLAGS += -Os
423else
424ifeq ($(OPTIMIZE), MAXSPEED)
425CFLAGS += -O3
Bram Moolenaar1cd871b2004-12-19 22:46:22 +0000426CFLAGS += -fomit-frame-pointer -freg-struct-return
Bram Moolenaar071d4272004-06-13 20:20:40 +0000427else # SPEED
428CFLAGS += -O2
429endif
430endif
431CFLAGS += -s
432endif
433
Bram Moolenaara3ffd9c2005-07-21 21:03:15 +0000434LIB = -lkernel32 -luser32 -lgdi32 -ladvapi32 -lcomdlg32 -lcomctl32 -lversion
Bram Moolenaar44ecf652005-03-07 23:09:59 +0000435GUIOBJ = $(OUTDIR)/gui.o $(OUTDIR)/gui_w32.o $(OUTDIR)/gui_beval.o $(OUTDIR)/os_w32exe.o
Bram Moolenaar071d4272004-06-13 20:20:40 +0000436OBJ = \
Bram Moolenaaredac1852010-05-18 20:34:20 +0200437 $(OUTDIR)/blowfish.o \
Bram Moolenaar071d4272004-06-13 20:20:40 +0000438 $(OUTDIR)/buffer.o \
439 $(OUTDIR)/charset.o \
440 $(OUTDIR)/diff.o \
441 $(OUTDIR)/digraph.o \
442 $(OUTDIR)/edit.o \
443 $(OUTDIR)/eval.o \
444 $(OUTDIR)/ex_cmds.o \
445 $(OUTDIR)/ex_cmds2.o \
446 $(OUTDIR)/ex_docmd.o \
447 $(OUTDIR)/ex_eval.o \
448 $(OUTDIR)/ex_getln.o \
449 $(OUTDIR)/fileio.o \
450 $(OUTDIR)/fold.o \
451 $(OUTDIR)/getchar.o \
Bram Moolenaar58d98232005-07-23 22:25:46 +0000452 $(OUTDIR)/hardcopy.o \
Bram Moolenaarc01140a2006-03-24 22:21:52 +0000453 $(OUTDIR)/hashtab.o \
Bram Moolenaar071d4272004-06-13 20:20:40 +0000454 $(OUTDIR)/main.o \
455 $(OUTDIR)/mark.o \
456 $(OUTDIR)/memfile.o \
457 $(OUTDIR)/memline.o \
458 $(OUTDIR)/menu.o \
459 $(OUTDIR)/message.o \
460 $(OUTDIR)/misc1.o \
461 $(OUTDIR)/misc2.o \
462 $(OUTDIR)/move.o \
463 $(OUTDIR)/mbyte.o \
464 $(OUTDIR)/normal.o \
465 $(OUTDIR)/ops.o \
466 $(OUTDIR)/option.o \
467 $(OUTDIR)/os_win32.o \
468 $(OUTDIR)/os_mswin.o \
469 $(OUTDIR)/pathdef.o \
Bram Moolenaarc01140a2006-03-24 22:21:52 +0000470 $(OUTDIR)/popupmnu.o \
Bram Moolenaar071d4272004-06-13 20:20:40 +0000471 $(OUTDIR)/quickfix.o \
472 $(OUTDIR)/regexp.o \
473 $(OUTDIR)/screen.o \
474 $(OUTDIR)/search.o \
Bram Moolenaaredac1852010-05-18 20:34:20 +0200475 $(OUTDIR)/sha256.o \
Bram Moolenaar6bb68362005-03-22 23:03:44 +0000476 $(OUTDIR)/spell.o \
Bram Moolenaar071d4272004-06-13 20:20:40 +0000477 $(OUTDIR)/syntax.o \
478 $(OUTDIR)/tag.o \
479 $(OUTDIR)/term.o \
480 $(OUTDIR)/ui.o \
481 $(OUTDIR)/undo.o \
482 $(OUTDIR)/version.o \
483 $(OUTDIR)/vimrc.o \
484 $(OUTDIR)/window.o
485
486ifdef PERL
487OBJ += $(OUTDIR)/if_perl.o
488endif
Bram Moolenaar0ba04292010-07-14 23:23:17 +0200489ifdef LUA
490OBJ += $(OUTDIR)/if_lua.o
491endif
Bram Moolenaar325b7a22004-07-05 15:58:32 +0000492ifdef MZSCHEME
493OBJ += $(OUTDIR)/if_mzsch.o
494MZSCHEME_INCL = if_mzsch.h
Bram Moolenaar9e70cf12009-05-26 20:59:55 +0000495ifeq (yes,$(MZSCHEME_GENERATE_BASE))
496CFLAGS += -DINCLUDE_MZSCHEME_BASE
497MZ_EXTRA_DEP += mzscheme_base.c
498endif
499ifeq (yes,$(MZSCHEME_PRECISE_GC))
500CFLAGS += -DMZ_PRECISE_GC
501endif
Bram Moolenaar325b7a22004-07-05 15:58:32 +0000502endif
Bram Moolenaar071d4272004-06-13 20:20:40 +0000503ifdef PYTHON
504OBJ += $(OUTDIR)/if_python.o
505endif
Bram Moolenaarbd5e15f2010-07-17 21:19:38 +0200506ifdef PYTHON3
507OBJ += $(OUTDIR)/if_python3.o
508endif
Bram Moolenaar071d4272004-06-13 20:20:40 +0000509ifdef RUBY
510OBJ += $(OUTDIR)/if_ruby.o
511endif
512ifdef TCL
513OBJ += $(OUTDIR)/if_tcl.o
514endif
515ifeq ($(CSCOPE),yes)
516OBJ += $(OUTDIR)/if_cscope.o
517endif
518ifeq ($(NETBEANS),yes)
Bram Moolenaarcfbc5ee2004-07-02 15:38:35 +0000519# Only allow NETBEANS for a GUI build.
520ifeq (yes, $(GUI))
Bram Moolenaar44ecf652005-03-07 23:09:59 +0000521OBJ += $(OUTDIR)/netbeans.o
Bram Moolenaar071d4272004-06-13 20:20:40 +0000522LIB += -lwsock32
523endif
Bram Moolenaarcfbc5ee2004-07-02 15:38:35 +0000524endif
Bram Moolenaar071d4272004-06-13 20:20:40 +0000525ifdef XPM
Bram Moolenaarcfbc5ee2004-07-02 15:38:35 +0000526# Only allow XPM for a GUI build.
527ifeq (yes, $(GUI))
Bram Moolenaar071d4272004-06-13 20:20:40 +0000528OBJ += $(OUTDIR)/xpm_w32.o
529# You'll need libXpm.a from http://gnuwin32.sf.net
530LIB += -L $(XPM)/lib -lXpm
531endif
Bram Moolenaarcfbc5ee2004-07-02 15:38:35 +0000532endif
Bram Moolenaar071d4272004-06-13 20:20:40 +0000533
534
Bram Moolenaar325b7a22004-07-05 15:58:32 +0000535ifdef MZSCHEME
536MZSCHEME_SUFFIX = Z
537endif
538
Bram Moolenaar071d4272004-06-13 20:20:40 +0000539ifeq ($(GUI),yes)
540TARGET := gvim$(DEBUG_SUFFIX).exe
541DEFINES += $(DEF_GUI)
542OBJ += $(GUIOBJ)
543LFLAGS += -mwindows
Bram Moolenaar325b7a22004-07-05 15:58:32 +0000544OUTDIR = gobj$(DEBUG_SUFFIX)$(MZSCHEME_SUFFIX)
Bram Moolenaar071d4272004-06-13 20:20:40 +0000545else
546TARGET := vim$(DEBUG_SUFFIX).exe
Bram Moolenaar325b7a22004-07-05 15:58:32 +0000547OUTDIR = obj$(DEBUG_SUFFIX)$(MZSCHEME_SUFFIX)
Bram Moolenaar071d4272004-06-13 20:20:40 +0000548endif
549
550ifdef GETTEXT
551ifneq (yes, $(GETTEXT))
552CFLAGS += -I$(GETTEXTINCLUDE)
553ifndef STATIC_GETTEXT
554LIB += -L$(GETTEXTLIB) -l$(INTLLIB)
555ifeq (USE_SAFE_GETTEXT_DLL, $(DYNAMIC_GETTEXT))
556OBJ+=$(SAFE_GETTEXT_DLL_OBJ)
557endif
558else
559LIB += -L$(GETTEXTLIB) -lintl
560endif
561endif
562endif
563
564ifdef PERL
565ifeq (no, $(DYNAMIC_PERL))
566LIB += -lperl$(PERL_VER)
567endif
568endif
569
570ifdef TCL
571LIB += -L$(TCL)/lib
572ifeq (yes, $(DYNAMIC_TCL))
573LIB += -ltclstub$(TCL_VER)
574else
575LIB += -ltcl$(TCL_VER)
576endif
577endif
578
579ifeq (yes, $(OLE))
580LIB += -loleaut32 -lstdc++
581OBJ += $(OUTDIR)/if_ole.o
582endif
583
584ifeq (yes, $(MBYTE))
585DEFINES += -DFEAT_MBYTE
586endif
587
588ifeq (yes, $(IME))
589DEFINES += -DFEAT_MBYTE_IME
590ifeq (yes, $(DYNAMIC_IME))
591DEFINES += -DDYNAMIC_IME
592else
593LIB += -limm32
594endif
595endif
596
597ifdef ICONV
598ifneq (yes, $(ICONV))
599LIB += -L$(ICONV)
600CFLAGS += -I$(ICONV)
601endif
602DEFINES+=-DDYNAMIC_ICONV
603endif
604
605all: $(TARGET) vimrun.exe xxd/xxd.exe install.exe uninstal.exe GvimExt/gvimext.dll
606
607vimrun.exe: vimrun.c
608 $(CC) $(CFLAGS) -o vimrun.exe vimrun.c $(LIB)
609
610install.exe: dosinst.c
611 $(CC) $(CFLAGS) -o install.exe dosinst.c $(LIB) -lole32 -luuid
612
613uninstal.exe: uninstal.c
614 $(CC) $(CFLAGS) -o uninstal.exe uninstal.c $(LIB)
615
616$(TARGET): $(OUTDIR) $(OBJ)
Bram Moolenaarbd5e15f2010-07-17 21:19:38 +0200617 $(CC) $(CFLAGS) $(LFLAGS) -o $@ $(OBJ) $(LIB) -lole32 -luuid $(LUA_LIB) $(MZSCHEME_LIBDIR) $(MZSCHEME_LIB) $(PYTHONLIB) $(PYTHON3LIB) $(RUBYLIB)
Bram Moolenaar071d4272004-06-13 20:20:40 +0000618
619upx: exes
620 upx gvim.exe
621 upx vim.exe
622
623xxd/xxd.exe: xxd/xxd.c
Bram Moolenaar48f80c22010-02-24 15:08:27 +0100624 $(MAKE) -C xxd -f Make_cyg.mak CC=$(CC)
Bram Moolenaar071d4272004-06-13 20:20:40 +0000625
626GvimExt/gvimext.dll: GvimExt/gvimext.cpp GvimExt/gvimext.rc GvimExt/gvimext.h
Bram Moolenaar48f80c22010-02-24 15:08:27 +0100627 $(MAKE) -C GvimExt -f Make_ming.mak CROSS=$(CROSS) CROSS_COMPILE=$(CROSS_COMPILE)
Bram Moolenaar071d4272004-06-13 20:20:40 +0000628
629clean:
630 -$(DEL) $(OUTDIR)$(DIRSLASH)*.o
631 -$(DEL) $(OUTDIR)$(DIRSLASH)*.res
632 -rmdir $(OUTDIR)
633 -$(DEL) *.exe
634 -$(DEL) pathdef.c
635ifdef PERL
636 -$(DEL) if_perl.c
637endif
Bram Moolenaar2d6db762009-09-11 10:49:58 +0000638ifdef MZSCHEME
639 -$(DEL) mzscheme_base.c
640endif
Bram Moolenaar071d4272004-06-13 20:20:40 +0000641 $(MAKE) -C GvimExt -f Make_ming.mak clean
642 $(MAKE) -C xxd -f Make_cyg.mak clean
643
644###########################################################################
645INCL = vim.h feature.h os_win32.h os_dos.h ascii.h keymap.h term.h macros.h \
646 structs.h regexp.h option.h ex_cmds.h proto.h globals.h farsi.h \
647 gui.h
648
Bram Moolenaarbd5e15f2010-07-17 21:19:38 +0200649$(OUTDIR)/if_python.o : if_python.c $(INCL)
650 $(CC) -c $(CFLAGS) $(PYTHONINC) -DDYNAMIC_PYTHON_DLL=\"python$(PYTHON_VER).dll\" $< -o $@
651
652$(OUTDIR)/if_python3.o : if_python3.c $(INCL)
653 $(CC) -c $(CFLAGS) $(PYTHON3INC) -DDYNAMIC_PYTHON3_DLL=\"PYTHON$(PYTHON3_VER).dll\" $< -o $@
654
Bram Moolenaar071d4272004-06-13 20:20:40 +0000655$(OUTDIR)/%.o : %.c $(INCL)
656 $(CC) -c $(CFLAGS) $< -o $@
657
658$(OUTDIR)/vimres.res: vim.rc version.h gui_w32_rc.h
659 $(WINDRES) $(DEFINES) vim.rc $(OUTDIR)/vimres.res
660
661$(OUTDIR)/vimrc.o: $(OUTDIR)/vimres.res
662 $(WINDRES) $(OUTDIR)/vimres.res $(OUTDIR)/vimrc.o
663
664$(OUTDIR):
Bram Moolenaar0cf6f542005-01-16 21:59:36 +0000665 $(MKDIR) $(OUTDIR)
Bram Moolenaar071d4272004-06-13 20:20:40 +0000666
667$(OUTDIR)/ex_docmd.o: ex_docmd.c $(INCL) ex_cmds.h
668 $(CC) -c $(CFLAGS) ex_docmd.c -o $(OUTDIR)/ex_docmd.o
669
670$(OUTDIR)/ex_eval.o: ex_eval.c $(INCL) ex_cmds.h
671 $(CC) -c $(CFLAGS) ex_eval.c -o $(OUTDIR)/ex_eval.o
672
673$(OUTDIR)/if_cscope.o: if_cscope.c $(INCL) if_cscope.h
674 $(CC) -c $(CFLAGS) if_cscope.c -o $(OUTDIR)/if_cscope.o
675
Bram Moolenaar8c69d532007-08-12 13:25:01 +0000676# Remove -D__IID_DEFINED__ for newer versions of the w32api
Bram Moolenaar071d4272004-06-13 20:20:40 +0000677$(OUTDIR)/if_ole.o: if_ole.cpp $(INCL)
Bram Moolenaar8c69d532007-08-12 13:25:01 +0000678 $(CC) $(CFLAGS) -c -o $(OUTDIR)/if_ole.o if_ole.cpp
Bram Moolenaar071d4272004-06-13 20:20:40 +0000679
680$(OUTDIR)/if_ruby.o: if_ruby.c $(INCL)
681ifeq (16, $(RUBY))
682 $(CC) $(CFLAGS) -U_WIN32 -c -o $(OUTDIR)/if_ruby.o if_ruby.c
683endif
684
685if_perl.c: if_perl.xs typemap
686 perl $(PERLLIB)/ExtUtils/xsubpp -prototypes -typemap \
687 $(PERLLIB)/ExtUtils/typemap if_perl.xs > $@
688
689$(OUTDIR)/netbeans.o: netbeans.c $(INCL) $(NBDEBUG_INCL) $(NBDEBUG_SRC)
690 $(CC) -c $(CFLAGS) netbeans.c -o $(OUTDIR)/netbeans.o
691
Bram Moolenaar9e70cf12009-05-26 20:59:55 +0000692$(OUTDIR)/if_mzsch.o: if_mzsch.c $(INCL) if_mzsch.h $(MZ_EXTRA_DEP)
693 $(CC) -c $(CFLAGS) if_mzsch.c -o $(OUTDIR)/if_mzsch.o
694
695mzscheme_base.c:
696 $(MZSCHEME)/mzc --c-mods mzscheme_base.c ++lib scheme/base
697
Bram Moolenaar071d4272004-06-13 20:20:40 +0000698pathdef.c: $(INCL)
699ifneq (sh.exe, $(SHELL))
700 @echo creating pathdef.c
701 @echo '/* pathdef.c */' > pathdef.c
702 @echo '#include "vim.h"' >> pathdef.c
703 @echo 'char_u *default_vim_dir = (char_u *)"$(VIMRCLOC)";' >> pathdef.c
704 @echo 'char_u *default_vimruntime_dir = (char_u *)"$(VIMRUNTIMEDIR)";' >> pathdef.c
705 @echo 'char_u *all_cflags = (char_u *)"$(CC) $(CFLAGS)";' >> pathdef.c
Bram Moolenaarbd5e15f2010-07-17 21:19:38 +0200706 @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 +0000707 @echo 'char_u *compiled_user = (char_u *)"$(USERNAME)";' >> pathdef.c
708 @echo 'char_u *compiled_sys = (char_u *)"$(USERDOMAIN)";' >> pathdef.c
709else
710 @echo creating pathdef.c
711 @echo /* pathdef.c */ > pathdef.c
712 @echo #include "vim.h" >> pathdef.c
713 @echo char_u *default_vim_dir = (char_u *)"$(VIMRCLOC)"; >> pathdef.c
714 @echo char_u *default_vimruntime_dir = (char_u *)"$(VIMRUNTIMEDIR)"; >> pathdef.c
715 @echo char_u *all_cflags = (char_u *)"$(CC) $(CFLAGS)"; >> pathdef.c
Bram Moolenaarbd5e15f2010-07-17 21:19:38 +0200716 @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 +0000717 @echo char_u *compiled_user = (char_u *)"$(USERNAME)"; >> pathdef.c
718 @echo char_u *compiled_sys = (char_u *)"$(USERDOMAIN)"; >> pathdef.c
719endif