blob: 0a9178903448b8ae907e75d3338869a5037077de [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 Moolenaar325b7a22004-07-05 15:58:32 +0000107# uncomment 'MZSCHEME' if you want a MzScheme-enabled version
108#MZSCHEME=d:/plt
109ifdef MZSCHEME
Bram Moolenaar281bdce2005-01-25 21:53:18 +0000110ifndef DYNAMIC_MZSCHEME
111DYNAMIC_MZSCHEME=yes
112endif
113
Bram Moolenaar325b7a22004-07-05 15:58:32 +0000114ifndef MZSCHEME_VER
115MZSCHEME_VER=205_000
116endif
Bram Moolenaar281bdce2005-01-25 21:53:18 +0000117
Bram Moolenaar9e70cf12009-05-26 20:59:55 +0000118ifndef MZSCHEME_PRECISE_GC
119MZSCHEME_PRECISE_GC=no
120endif
121
122# for version 4.x we need to generate byte-code for Scheme base
123ifndef MZSCHEME_GENERATE_BASE
124MZSCHEME_GENERATE_BASE=no
125endif
126
Bram Moolenaar281bdce2005-01-25 21:53:18 +0000127ifeq (no,$(DYNAMIC_MZSCHEME))
Bram Moolenaar9e70cf12009-05-26 20:59:55 +0000128ifeq (yes,$(MZSCHEME_PRECISE_GC))
129MZSCHEME_LIB=-lmzsch$(MZSCHEME_VER)
130else
Bram Moolenaar281bdce2005-01-25 21:53:18 +0000131MZSCHEME_LIB = -lmzsch$(MZSCHEME_VER) -lmzgc$(MZSCHEME_VER)
Bram Moolenaar9e70cf12009-05-26 20:59:55 +0000132endif
Bram Moolenaar281bdce2005-01-25 21:53:18 +0000133# the modern MinGW can dynamically link to dlls directly.
134# point MZSCHEME_DLLS to where you put libmzschXXXXXXX.dll and libgcXXXXXXX.dll
Bram Moolenaar281bdce2005-01-25 21:53:18 +0000135ifndef MZSCHEME_DLLS
136MZSCHEME_DLLS=$(MZSCHEME)
Bram Moolenaar325b7a22004-07-05 15:58:32 +0000137endif
Bram Moolenaar2d6db762009-09-11 10:49:58 +0000138MZSCHEME_LIBDIR=-L$(MZSCHEME_DLLS) -L$(MZSCHEME_DLLS)\lib
Bram Moolenaar281bdce2005-01-25 21:53:18 +0000139endif
140
Bram Moolenaar325b7a22004-07-05 15:58:32 +0000141endif
142
Bram Moolenaar071d4272004-06-13 20:20:40 +0000143# Python support -- works with the ActiveState python 2.0 release (and others
144# too, probably)
145#
146# uncomment 'PYTHON' to make python-enabled version
147# Put the path to the python distro here. If cross compiling from Linux, you
148# will also need to convert the header files to unix instead of dos format:
149# for fil in *.h ; do vim -e -c 'set ff=unix|w|q' $fil
150# and also, you will need to make a mingw32 'libpython20.a' to link with:
151# cd $PYTHON/libs
152# pexports python20.dll > python20.def
153# dlltool -d python20.def -l libpython20.a
154# on my Linux box, I put the Python stuff here:
155#PYTHON=/home/ron/ActivePython-2.0.0-202/src/Core
156# on my NT box, it's here:
157#PYTHON=c:/python20
158
159ifdef PYTHON
160ifndef DYNAMIC_PYTHON
161DYNAMIC_PYTHON=yes
162endif
163
164ifndef PYTHON_VER
165PYTHON_VER=22
166endif
167
168ifeq (no,$(DYNAMIC_PYTHON))
169PYTHONLIB=-L$(PYTHON)/libs -lpython$(PYTHON_VER)
170endif
171# my include files are in 'win32inc' on Linux, and 'include' in the standard
172# NT distro (ActiveState)
173ifeq ($(CROSS),no)
174PYTHONINC=-I $(PYTHON)/include
175else
176PYTHONINC=-I $(PYTHON)/win32inc
177endif
178endif
179
180# TCL interface:
181# TCL=[Path to TCL directory]
182# DYNAMIC_TCL=yes (to load the TCL DLL dynamically)
183# TCL_VER=[TCL version, eg 83, 84] (default is 83)
184#TCL=c:/tcl
185ifdef TCL
186ifndef DYNAMIC_TCL
187DYNAMIC_TCL=yes
188endif
189ifndef TCL_VER
190TCL_VER = 83
191endif
192TCLINC += -I$(TCL)/include
193endif
194
195
196# Ruby interface:
197# RUBY=[Path to Ruby directory]
198# DYNAMIC_RUBY=yes (to load the Ruby DLL dynamically)
199# RUBY_VER=[Ruby version, eg 16, 17] (default is 16)
200# RUBY_VER_LONG=[Ruby version, eg 1.6, 1.7] (default is 1.6)
201# You must set RUBY_VER_LONG when change RUBY_VER.
202#RUBY=c:/ruby
203ifdef RUBY
204ifndef DYNAMIC_RUBY
205DYNAMIC_RUBY=yes
206endif
207# Set default value
208ifndef RUBY_VER
209RUBY_VER = 16
210endif
211ifndef RUBY_VER_LONG
212RUBY_VER_LONG = 1.6
213endif
214
Bram Moolenaar66ca3202010-03-10 13:20:40 +0100215ifndef RUBY_PLATFORM
Bram Moolenaar071d4272004-06-13 20:20:40 +0000216ifeq ($(RUBY_VER), 16)
Bram Moolenaar071d4272004-06-13 20:20:40 +0000217RUBY_PLATFORM = i586-mswin32
Bram Moolenaar66ca3202010-03-10 13:20:40 +0100218else ifneq ("X$(wildcard, $(RUBY)/lib/ruby/$(RUBY_VER_LONG)/i386-mingw32)", X)
219RUBY_PLATFORM = i386-mingw32
Bram Moolenaar071d4272004-06-13 20:20:40 +0000220else
Bram Moolenaar071d4272004-06-13 20:20:40 +0000221RUBY_PLATFORM = i386-mswin32
222endif
Bram Moolenaar66ca3202010-03-10 13:20:40 +0100223endif
224
Bram Moolenaar071d4272004-06-13 20:20:40 +0000225ifndef RUBY_INSTALL_NAME
Bram Moolenaar66ca3202010-03-10 13:20:40 +0100226ifeq ($(RUBY_VER), 16)
227RUBY_INSTALL_NAME = mswin32-ruby$(RUBY_VER)
228else
Bram Moolenaar071d4272004-06-13 20:20:40 +0000229RUBY_INSTALL_NAME = msvcrt-ruby$(RUBY_VER)
230endif
231endif
232
Bram Moolenaar66ca3202010-03-10 13:20:40 +0100233RUBYINC =-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 +0000234ifeq (no, $(DYNAMIC_RUBY))
235RUBYLIB = -L$(RUBY)/lib -l$(RUBY_INSTALL_NAME)
236endif
237
238endif # RUBY
239
240# See feature.h for a list of options.
241# Any other defines can be included here.
242DEF_GUI=-DFEAT_GUI_W32 -DFEAT_CLIPBOARD
243DEFINES=-DWIN32 -DWINVER=$(WINVER) -D_WIN32_WINNT=$(WINVER) \
244 -DHAVE_PATHDEF -DFEAT_$(FEATURES)
245ifeq ($(CROSS),yes)
Bram Moolenaar48f80c22010-02-24 15:08:27 +0100246# cross-compiler prefix:
247CROSS_COMPILE = i586-pc-mingw32msvc-
Bram Moolenaar071d4272004-06-13 20:20:40 +0000248DEL = rm
Bram Moolenaar0cf6f542005-01-16 21:59:36 +0000249MKDIR = mkdir -p
Bram Moolenaar48f80c22010-02-24 15:08:27 +0100250DIRSLASH = /
Bram Moolenaar071d4272004-06-13 20:20:40 +0000251else
252# normal (Windows) compilation:
Bram Moolenaar48f80c22010-02-24 15:08:27 +0100253CROSS_COMPILE =
Bram Moolenaar86ce1cc2010-02-26 22:05:22 +0100254ifneq (sh.exe, $(SHELL))
Bram Moolenaar071d4272004-06-13 20:20:40 +0000255DEL = rm
Bram Moolenaar0cf6f542005-01-16 21:59:36 +0000256MKDIR = mkdir -p
Bram Moolenaar071d4272004-06-13 20:20:40 +0000257DIRSLASH = /
258else
259DEL = del
Bram Moolenaar0cf6f542005-01-16 21:59:36 +0000260MKDIR = mkdir
Bram Moolenaar071d4272004-06-13 20:20:40 +0000261DIRSLASH = \\
262endif
Bram Moolenaar071d4272004-06-13 20:20:40 +0000263endif
Bram Moolenaar48f80c22010-02-24 15:08:27 +0100264CC := $(CROSS_COMPILE)gcc
265WINDRES := $(CROSS_COMPILE)windres
Bram Moolenaar071d4272004-06-13 20:20:40 +0000266
267#>>>>> end of choices
268###########################################################################
269
Bram Moolenaar1cd871b2004-12-19 22:46:22 +0000270CFLAGS = -Iproto $(DEFINES) -pipe -w -march=$(ARCH) -Wall
Bram Moolenaar071d4272004-06-13 20:20:40 +0000271
272ifdef GETTEXT
Bram Moolenaar8cd06ca2005-02-28 22:44:58 +0000273DEFINES += -DHAVE_GETTEXT -DHAVE_LOCALE_H
Bram Moolenaar071d4272004-06-13 20:20:40 +0000274GETTEXTINCLUDE = $(GETTEXT)/include
275GETTEXTLIB = $(INTLPATH)
276ifeq (yes, $(GETTEXT))
Bram Moolenaar8cd06ca2005-02-28 22:44:58 +0000277DEFINES += -DDYNAMIC_GETTEXT
Bram Moolenaar071d4272004-06-13 20:20:40 +0000278else
279ifdef DYNAMIC_GETTEXT
Bram Moolenaar8cd06ca2005-02-28 22:44:58 +0000280DEFINES += -D$(DYNAMIC_GETTEXT)
Bram Moolenaar071d4272004-06-13 20:20:40 +0000281ifdef GETTEXT_DYNAMIC
282DEFINES += -DGETTEXT_DYNAMIC -DGETTEXT_DLL=\"$(GETTEXT_DYNAMIC)\"
283endif
284endif
285endif
286endif
287
288ifdef PERL
289CFLAGS += -I$(PERLLIBS) -DFEAT_PERL -L$(PERLLIBS)
290ifeq (yes, $(DYNAMIC_PERL))
291CFLAGS += -DDYNAMIC_PERL -DDYNAMIC_PERL_DLL=\"perl$(PERL_VER).dll\"
292endif
293endif
294
Bram Moolenaar325b7a22004-07-05 15:58:32 +0000295ifdef MZSCHEME
296CFLAGS += -I$(MZSCHEME)/include -DFEAT_MZSCHEME -DMZSCHEME_COLLECTS=\"$(MZSCHEME)/collects\"
Bram Moolenaar281bdce2005-01-25 21:53:18 +0000297ifeq (yes, $(DYNAMIC_MZSCHEME))
298CFLAGS += -DDYNAMIC_MZSCHEME -DDYNAMIC_MZSCH_DLL=\"libmzsch$(MZSCHEME_VER).dll\" -DDYNAMIC_MZGC_DLL=\"libmzgc$(MZSCHEME_VER).dll\"
299endif
Bram Moolenaar325b7a22004-07-05 15:58:32 +0000300endif
301
Bram Moolenaar071d4272004-06-13 20:20:40 +0000302ifdef RUBY
303CFLAGS += -DFEAT_RUBY $(RUBYINC)
304ifeq (yes, $(DYNAMIC_RUBY))
305CFLAGS += -DDYNAMIC_RUBY -DDYNAMIC_RUBY_DLL=\"$(RUBY_INSTALL_NAME).dll\"
306CFLAGS += -DDYNAMIC_RUBY_VER=$(RUBY_VER)
307endif
308endif
309
310ifdef PYTHON
311CFLAGS += -DFEAT_PYTHON $(PYTHONINC)
312ifeq (yes, $(DYNAMIC_PYTHON))
313CFLAGS += -DDYNAMIC_PYTHON -DDYNAMIC_PYTHON_DLL=\"python$(PYTHON_VER).dll\"
314endif
315endif
316
317ifdef TCL
318CFLAGS += -DFEAT_TCL $(TCLINC)
319ifeq (yes, $(DYNAMIC_TCL))
320CFLAGS += -DDYNAMIC_TCL -DDYNAMIC_TCL_DLL=\"tcl$(TCL_VER).dll\"
321endif
322endif
323
324ifeq ($(POSTSCRIPT),yes)
325DEFINES += -DMSWINPS
326endif
327
328ifeq (yes, $(OLE))
329DEFINES += -DFEAT_OLE
330endif
331
332ifeq ($(CSCOPE),yes)
333DEFINES += -DFEAT_CSCOPE
334endif
335
336ifeq ($(NETBEANS),yes)
Bram Moolenaarcfbc5ee2004-07-02 15:38:35 +0000337# Only allow NETBEANS for a GUI build.
338ifeq (yes, $(GUI))
Bram Moolenaar071d4272004-06-13 20:20:40 +0000339DEFINES += -DFEAT_NETBEANS_INTG
Bram Moolenaarcfbc5ee2004-07-02 15:38:35 +0000340
341ifeq ($(NBDEBUG), yes)
Bram Moolenaar071d4272004-06-13 20:20:40 +0000342DEFINES += -DNBDEBUG
343NBDEBUG_INCL = nbdebug.h
344NBDEBUG_SRC = nbdebug.c
345endif
346endif
Bram Moolenaarcfbc5ee2004-07-02 15:38:35 +0000347endif
Bram Moolenaar071d4272004-06-13 20:20:40 +0000348
349ifdef XPM
Bram Moolenaarcfbc5ee2004-07-02 15:38:35 +0000350# Only allow XPM for a GUI build.
351ifeq (yes, $(GUI))
Bram Moolenaar071d4272004-06-13 20:20:40 +0000352CFLAGS += -DFEAT_XPM_W32 -I $(XPM)/include
353endif
Bram Moolenaarcfbc5ee2004-07-02 15:38:35 +0000354endif
Bram Moolenaar071d4272004-06-13 20:20:40 +0000355
356ifeq ($(DEBUG),yes)
357CFLAGS += -g -fstack-check
358DEBUG_SUFFIX=d
359else
360ifeq ($(OPTIMIZE), SIZE)
361CFLAGS += -Os
362else
363ifeq ($(OPTIMIZE), MAXSPEED)
364CFLAGS += -O3
Bram Moolenaar1cd871b2004-12-19 22:46:22 +0000365CFLAGS += -fomit-frame-pointer -freg-struct-return
Bram Moolenaar071d4272004-06-13 20:20:40 +0000366else # SPEED
367CFLAGS += -O2
368endif
369endif
370CFLAGS += -s
371endif
372
Bram Moolenaara3ffd9c2005-07-21 21:03:15 +0000373LIB = -lkernel32 -luser32 -lgdi32 -ladvapi32 -lcomdlg32 -lcomctl32 -lversion
Bram Moolenaar44ecf652005-03-07 23:09:59 +0000374GUIOBJ = $(OUTDIR)/gui.o $(OUTDIR)/gui_w32.o $(OUTDIR)/gui_beval.o $(OUTDIR)/os_w32exe.o
Bram Moolenaar071d4272004-06-13 20:20:40 +0000375OBJ = \
376 $(OUTDIR)/buffer.o \
377 $(OUTDIR)/charset.o \
378 $(OUTDIR)/diff.o \
379 $(OUTDIR)/digraph.o \
380 $(OUTDIR)/edit.o \
381 $(OUTDIR)/eval.o \
382 $(OUTDIR)/ex_cmds.o \
383 $(OUTDIR)/ex_cmds2.o \
384 $(OUTDIR)/ex_docmd.o \
385 $(OUTDIR)/ex_eval.o \
386 $(OUTDIR)/ex_getln.o \
387 $(OUTDIR)/fileio.o \
388 $(OUTDIR)/fold.o \
389 $(OUTDIR)/getchar.o \
Bram Moolenaar58d98232005-07-23 22:25:46 +0000390 $(OUTDIR)/hardcopy.o \
Bram Moolenaarc01140a2006-03-24 22:21:52 +0000391 $(OUTDIR)/hashtab.o \
Bram Moolenaar071d4272004-06-13 20:20:40 +0000392 $(OUTDIR)/main.o \
393 $(OUTDIR)/mark.o \
394 $(OUTDIR)/memfile.o \
395 $(OUTDIR)/memline.o \
396 $(OUTDIR)/menu.o \
397 $(OUTDIR)/message.o \
398 $(OUTDIR)/misc1.o \
399 $(OUTDIR)/misc2.o \
400 $(OUTDIR)/move.o \
401 $(OUTDIR)/mbyte.o \
402 $(OUTDIR)/normal.o \
403 $(OUTDIR)/ops.o \
404 $(OUTDIR)/option.o \
405 $(OUTDIR)/os_win32.o \
406 $(OUTDIR)/os_mswin.o \
407 $(OUTDIR)/pathdef.o \
Bram Moolenaarc01140a2006-03-24 22:21:52 +0000408 $(OUTDIR)/popupmnu.o \
Bram Moolenaar071d4272004-06-13 20:20:40 +0000409 $(OUTDIR)/quickfix.o \
410 $(OUTDIR)/regexp.o \
411 $(OUTDIR)/screen.o \
412 $(OUTDIR)/search.o \
Bram Moolenaar6bb68362005-03-22 23:03:44 +0000413 $(OUTDIR)/spell.o \
Bram Moolenaar071d4272004-06-13 20:20:40 +0000414 $(OUTDIR)/syntax.o \
415 $(OUTDIR)/tag.o \
416 $(OUTDIR)/term.o \
417 $(OUTDIR)/ui.o \
418 $(OUTDIR)/undo.o \
419 $(OUTDIR)/version.o \
420 $(OUTDIR)/vimrc.o \
421 $(OUTDIR)/window.o
422
423ifdef PERL
424OBJ += $(OUTDIR)/if_perl.o
425endif
Bram Moolenaar325b7a22004-07-05 15:58:32 +0000426ifdef MZSCHEME
427OBJ += $(OUTDIR)/if_mzsch.o
428MZSCHEME_INCL = if_mzsch.h
Bram Moolenaar9e70cf12009-05-26 20:59:55 +0000429ifeq (yes,$(MZSCHEME_GENERATE_BASE))
430CFLAGS += -DINCLUDE_MZSCHEME_BASE
431MZ_EXTRA_DEP += mzscheme_base.c
432endif
433ifeq (yes,$(MZSCHEME_PRECISE_GC))
434CFLAGS += -DMZ_PRECISE_GC
435endif
Bram Moolenaar325b7a22004-07-05 15:58:32 +0000436endif
Bram Moolenaar071d4272004-06-13 20:20:40 +0000437ifdef PYTHON
438OBJ += $(OUTDIR)/if_python.o
439endif
440ifdef RUBY
441OBJ += $(OUTDIR)/if_ruby.o
442endif
443ifdef TCL
444OBJ += $(OUTDIR)/if_tcl.o
445endif
446ifeq ($(CSCOPE),yes)
447OBJ += $(OUTDIR)/if_cscope.o
448endif
449ifeq ($(NETBEANS),yes)
Bram Moolenaarcfbc5ee2004-07-02 15:38:35 +0000450# Only allow NETBEANS for a GUI build.
451ifeq (yes, $(GUI))
Bram Moolenaar44ecf652005-03-07 23:09:59 +0000452OBJ += $(OUTDIR)/netbeans.o
Bram Moolenaar071d4272004-06-13 20:20:40 +0000453LIB += -lwsock32
454endif
Bram Moolenaarcfbc5ee2004-07-02 15:38:35 +0000455endif
Bram Moolenaar071d4272004-06-13 20:20:40 +0000456ifdef XPM
Bram Moolenaarcfbc5ee2004-07-02 15:38:35 +0000457# Only allow XPM for a GUI build.
458ifeq (yes, $(GUI))
Bram Moolenaar071d4272004-06-13 20:20:40 +0000459OBJ += $(OUTDIR)/xpm_w32.o
460# You'll need libXpm.a from http://gnuwin32.sf.net
461LIB += -L $(XPM)/lib -lXpm
462endif
Bram Moolenaarcfbc5ee2004-07-02 15:38:35 +0000463endif
Bram Moolenaar071d4272004-06-13 20:20:40 +0000464
465
Bram Moolenaar325b7a22004-07-05 15:58:32 +0000466ifdef MZSCHEME
467MZSCHEME_SUFFIX = Z
468endif
469
Bram Moolenaar071d4272004-06-13 20:20:40 +0000470ifeq ($(GUI),yes)
471TARGET := gvim$(DEBUG_SUFFIX).exe
472DEFINES += $(DEF_GUI)
473OBJ += $(GUIOBJ)
474LFLAGS += -mwindows
Bram Moolenaar325b7a22004-07-05 15:58:32 +0000475OUTDIR = gobj$(DEBUG_SUFFIX)$(MZSCHEME_SUFFIX)
Bram Moolenaar071d4272004-06-13 20:20:40 +0000476else
477TARGET := vim$(DEBUG_SUFFIX).exe
Bram Moolenaar325b7a22004-07-05 15:58:32 +0000478OUTDIR = obj$(DEBUG_SUFFIX)$(MZSCHEME_SUFFIX)
Bram Moolenaar071d4272004-06-13 20:20:40 +0000479endif
480
481ifdef GETTEXT
482ifneq (yes, $(GETTEXT))
483CFLAGS += -I$(GETTEXTINCLUDE)
484ifndef STATIC_GETTEXT
485LIB += -L$(GETTEXTLIB) -l$(INTLLIB)
486ifeq (USE_SAFE_GETTEXT_DLL, $(DYNAMIC_GETTEXT))
487OBJ+=$(SAFE_GETTEXT_DLL_OBJ)
488endif
489else
490LIB += -L$(GETTEXTLIB) -lintl
491endif
492endif
493endif
494
495ifdef PERL
496ifeq (no, $(DYNAMIC_PERL))
497LIB += -lperl$(PERL_VER)
498endif
499endif
500
501ifdef TCL
502LIB += -L$(TCL)/lib
503ifeq (yes, $(DYNAMIC_TCL))
504LIB += -ltclstub$(TCL_VER)
505else
506LIB += -ltcl$(TCL_VER)
507endif
508endif
509
510ifeq (yes, $(OLE))
511LIB += -loleaut32 -lstdc++
512OBJ += $(OUTDIR)/if_ole.o
513endif
514
515ifeq (yes, $(MBYTE))
516DEFINES += -DFEAT_MBYTE
517endif
518
519ifeq (yes, $(IME))
520DEFINES += -DFEAT_MBYTE_IME
521ifeq (yes, $(DYNAMIC_IME))
522DEFINES += -DDYNAMIC_IME
523else
524LIB += -limm32
525endif
526endif
527
528ifdef ICONV
529ifneq (yes, $(ICONV))
530LIB += -L$(ICONV)
531CFLAGS += -I$(ICONV)
532endif
533DEFINES+=-DDYNAMIC_ICONV
534endif
535
536all: $(TARGET) vimrun.exe xxd/xxd.exe install.exe uninstal.exe GvimExt/gvimext.dll
537
538vimrun.exe: vimrun.c
539 $(CC) $(CFLAGS) -o vimrun.exe vimrun.c $(LIB)
540
541install.exe: dosinst.c
542 $(CC) $(CFLAGS) -o install.exe dosinst.c $(LIB) -lole32 -luuid
543
544uninstal.exe: uninstal.c
545 $(CC) $(CFLAGS) -o uninstal.exe uninstal.c $(LIB)
546
547$(TARGET): $(OUTDIR) $(OBJ)
Bram Moolenaarc0197e22004-09-13 20:26:32 +0000548 $(CC) $(CFLAGS) $(LFLAGS) -o $@ $(OBJ) $(LIB) -lole32 -luuid $(MZSCHEME_LIBDIR) $(MZSCHEME_LIB) $(PYTHONLIB) $(RUBYLIB)
Bram Moolenaar071d4272004-06-13 20:20:40 +0000549
550upx: exes
551 upx gvim.exe
552 upx vim.exe
553
554xxd/xxd.exe: xxd/xxd.c
Bram Moolenaar48f80c22010-02-24 15:08:27 +0100555 $(MAKE) -C xxd -f Make_cyg.mak CC=$(CC)
Bram Moolenaar071d4272004-06-13 20:20:40 +0000556
557GvimExt/gvimext.dll: GvimExt/gvimext.cpp GvimExt/gvimext.rc GvimExt/gvimext.h
Bram Moolenaar48f80c22010-02-24 15:08:27 +0100558 $(MAKE) -C GvimExt -f Make_ming.mak CROSS=$(CROSS) CROSS_COMPILE=$(CROSS_COMPILE)
Bram Moolenaar071d4272004-06-13 20:20:40 +0000559
560clean:
561 -$(DEL) $(OUTDIR)$(DIRSLASH)*.o
562 -$(DEL) $(OUTDIR)$(DIRSLASH)*.res
563 -rmdir $(OUTDIR)
564 -$(DEL) *.exe
565 -$(DEL) pathdef.c
566ifdef PERL
567 -$(DEL) if_perl.c
568endif
Bram Moolenaar2d6db762009-09-11 10:49:58 +0000569ifdef MZSCHEME
570 -$(DEL) mzscheme_base.c
571endif
Bram Moolenaar071d4272004-06-13 20:20:40 +0000572 $(MAKE) -C GvimExt -f Make_ming.mak clean
573 $(MAKE) -C xxd -f Make_cyg.mak clean
574
575###########################################################################
576INCL = vim.h feature.h os_win32.h os_dos.h ascii.h keymap.h term.h macros.h \
577 structs.h regexp.h option.h ex_cmds.h proto.h globals.h farsi.h \
578 gui.h
579
580$(OUTDIR)/%.o : %.c $(INCL)
581 $(CC) -c $(CFLAGS) $< -o $@
582
583$(OUTDIR)/vimres.res: vim.rc version.h gui_w32_rc.h
584 $(WINDRES) $(DEFINES) vim.rc $(OUTDIR)/vimres.res
585
586$(OUTDIR)/vimrc.o: $(OUTDIR)/vimres.res
587 $(WINDRES) $(OUTDIR)/vimres.res $(OUTDIR)/vimrc.o
588
589$(OUTDIR):
Bram Moolenaar0cf6f542005-01-16 21:59:36 +0000590 $(MKDIR) $(OUTDIR)
Bram Moolenaar071d4272004-06-13 20:20:40 +0000591
592$(OUTDIR)/ex_docmd.o: ex_docmd.c $(INCL) ex_cmds.h
593 $(CC) -c $(CFLAGS) ex_docmd.c -o $(OUTDIR)/ex_docmd.o
594
595$(OUTDIR)/ex_eval.o: ex_eval.c $(INCL) ex_cmds.h
596 $(CC) -c $(CFLAGS) ex_eval.c -o $(OUTDIR)/ex_eval.o
597
598$(OUTDIR)/if_cscope.o: if_cscope.c $(INCL) if_cscope.h
599 $(CC) -c $(CFLAGS) if_cscope.c -o $(OUTDIR)/if_cscope.o
600
Bram Moolenaar8c69d532007-08-12 13:25:01 +0000601# Remove -D__IID_DEFINED__ for newer versions of the w32api
Bram Moolenaar071d4272004-06-13 20:20:40 +0000602$(OUTDIR)/if_ole.o: if_ole.cpp $(INCL)
Bram Moolenaar8c69d532007-08-12 13:25:01 +0000603 $(CC) $(CFLAGS) -c -o $(OUTDIR)/if_ole.o if_ole.cpp
Bram Moolenaar071d4272004-06-13 20:20:40 +0000604
605$(OUTDIR)/if_ruby.o: if_ruby.c $(INCL)
606ifeq (16, $(RUBY))
607 $(CC) $(CFLAGS) -U_WIN32 -c -o $(OUTDIR)/if_ruby.o if_ruby.c
608endif
609
610if_perl.c: if_perl.xs typemap
611 perl $(PERLLIB)/ExtUtils/xsubpp -prototypes -typemap \
612 $(PERLLIB)/ExtUtils/typemap if_perl.xs > $@
613
614$(OUTDIR)/netbeans.o: netbeans.c $(INCL) $(NBDEBUG_INCL) $(NBDEBUG_SRC)
615 $(CC) -c $(CFLAGS) netbeans.c -o $(OUTDIR)/netbeans.o
616
Bram Moolenaar9e70cf12009-05-26 20:59:55 +0000617$(OUTDIR)/if_mzsch.o: if_mzsch.c $(INCL) if_mzsch.h $(MZ_EXTRA_DEP)
618 $(CC) -c $(CFLAGS) if_mzsch.c -o $(OUTDIR)/if_mzsch.o
619
620mzscheme_base.c:
621 $(MZSCHEME)/mzc --c-mods mzscheme_base.c ++lib scheme/base
622
Bram Moolenaar071d4272004-06-13 20:20:40 +0000623pathdef.c: $(INCL)
624ifneq (sh.exe, $(SHELL))
625 @echo creating pathdef.c
626 @echo '/* pathdef.c */' > pathdef.c
627 @echo '#include "vim.h"' >> pathdef.c
628 @echo 'char_u *default_vim_dir = (char_u *)"$(VIMRCLOC)";' >> pathdef.c
629 @echo 'char_u *default_vimruntime_dir = (char_u *)"$(VIMRUNTIMEDIR)";' >> pathdef.c
630 @echo 'char_u *all_cflags = (char_u *)"$(CC) $(CFLAGS)";' >> pathdef.c
Bram Moolenaara40c5002005-01-09 21:16:21 +0000631 @echo 'char_u *all_lflags = (char_u *)"$(CC) $(CFLAGS) $(LFLAGS) -o $(TARGET) $(LIB) -lole32 -luuid $(MZSCHEME_LIBDIR) $(MZSCHEME_LIB) $(PYTHONLIB) $(RUBYLIB)";' >> pathdef.c
Bram Moolenaar071d4272004-06-13 20:20:40 +0000632 @echo 'char_u *compiled_user = (char_u *)"$(USERNAME)";' >> pathdef.c
633 @echo 'char_u *compiled_sys = (char_u *)"$(USERDOMAIN)";' >> pathdef.c
634else
635 @echo creating pathdef.c
636 @echo /* pathdef.c */ > pathdef.c
637 @echo #include "vim.h" >> pathdef.c
638 @echo char_u *default_vim_dir = (char_u *)"$(VIMRCLOC)"; >> pathdef.c
639 @echo char_u *default_vimruntime_dir = (char_u *)"$(VIMRUNTIMEDIR)"; >> pathdef.c
640 @echo char_u *all_cflags = (char_u *)"$(CC) $(CFLAGS)"; >> pathdef.c
Bram Moolenaara40c5002005-01-09 21:16:21 +0000641 @echo char_u *all_lflags = (char_u *)"$(CC) $(CFLAGS) $(LFLAGS) -o $(TARGET) $(LIB) -lole32 -luuid $(MZSCHEME_LIBDIR) $(MZSCHEME_LIB) $(PYTHONLIB) $(RUBYLIB)"; >> pathdef.c
Bram Moolenaar071d4272004-06-13 20:20:40 +0000642 @echo char_u *compiled_user = (char_u *)"$(USERNAME)"; >> pathdef.c
643 @echo char_u *compiled_sys = (char_u *)"$(USERDOMAIN)"; >> pathdef.c
644endif