blob: 19896e23a4e15cf9e25f4dce72a06b4be4fd85d2 [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 Moolenaar8c79caf2010-03-17 17:25:09 +0100218else
219ifneq ($(wildcard $(RUBY)/lib/ruby/$(RUBY_VER_LONG)/i386-mingw32),)
Bram Moolenaar66ca3202010-03-10 13:20:40 +0100220RUBY_PLATFORM = i386-mingw32
Bram Moolenaar071d4272004-06-13 20:20:40 +0000221else
Bram Moolenaar071d4272004-06-13 20:20:40 +0000222RUBY_PLATFORM = i386-mswin32
223endif
Bram Moolenaar66ca3202010-03-10 13:20:40 +0100224endif
Bram Moolenaar8c79caf2010-03-17 17:25:09 +0100225endif
Bram Moolenaar66ca3202010-03-10 13:20:40 +0100226
Bram Moolenaar071d4272004-06-13 20:20:40 +0000227ifndef RUBY_INSTALL_NAME
Bram Moolenaar66ca3202010-03-10 13:20:40 +0100228ifeq ($(RUBY_VER), 16)
229RUBY_INSTALL_NAME = mswin32-ruby$(RUBY_VER)
230else
Bram Moolenaar071d4272004-06-13 20:20:40 +0000231RUBY_INSTALL_NAME = msvcrt-ruby$(RUBY_VER)
232endif
233endif
234
Bram Moolenaar66ca3202010-03-10 13:20:40 +0100235RUBYINC =-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 +0000236ifeq (no, $(DYNAMIC_RUBY))
237RUBYLIB = -L$(RUBY)/lib -l$(RUBY_INSTALL_NAME)
238endif
239
240endif # RUBY
241
242# See feature.h for a list of options.
243# Any other defines can be included here.
244DEF_GUI=-DFEAT_GUI_W32 -DFEAT_CLIPBOARD
245DEFINES=-DWIN32 -DWINVER=$(WINVER) -D_WIN32_WINNT=$(WINVER) \
246 -DHAVE_PATHDEF -DFEAT_$(FEATURES)
247ifeq ($(CROSS),yes)
Bram Moolenaar48f80c22010-02-24 15:08:27 +0100248# cross-compiler prefix:
249CROSS_COMPILE = i586-pc-mingw32msvc-
Bram Moolenaar071d4272004-06-13 20:20:40 +0000250DEL = rm
Bram Moolenaar0cf6f542005-01-16 21:59:36 +0000251MKDIR = mkdir -p
Bram Moolenaar48f80c22010-02-24 15:08:27 +0100252DIRSLASH = /
Bram Moolenaar071d4272004-06-13 20:20:40 +0000253else
254# normal (Windows) compilation:
Bram Moolenaar48f80c22010-02-24 15:08:27 +0100255CROSS_COMPILE =
Bram Moolenaar86ce1cc2010-02-26 22:05:22 +0100256ifneq (sh.exe, $(SHELL))
Bram Moolenaar071d4272004-06-13 20:20:40 +0000257DEL = rm
Bram Moolenaar0cf6f542005-01-16 21:59:36 +0000258MKDIR = mkdir -p
Bram Moolenaar071d4272004-06-13 20:20:40 +0000259DIRSLASH = /
260else
261DEL = del
Bram Moolenaar0cf6f542005-01-16 21:59:36 +0000262MKDIR = mkdir
Bram Moolenaar071d4272004-06-13 20:20:40 +0000263DIRSLASH = \\
264endif
Bram Moolenaar071d4272004-06-13 20:20:40 +0000265endif
Bram Moolenaar48f80c22010-02-24 15:08:27 +0100266CC := $(CROSS_COMPILE)gcc
267WINDRES := $(CROSS_COMPILE)windres
Bram Moolenaar071d4272004-06-13 20:20:40 +0000268
269#>>>>> end of choices
270###########################################################################
271
Bram Moolenaar1cd871b2004-12-19 22:46:22 +0000272CFLAGS = -Iproto $(DEFINES) -pipe -w -march=$(ARCH) -Wall
Bram Moolenaar071d4272004-06-13 20:20:40 +0000273
274ifdef GETTEXT
Bram Moolenaar8cd06ca2005-02-28 22:44:58 +0000275DEFINES += -DHAVE_GETTEXT -DHAVE_LOCALE_H
Bram Moolenaar071d4272004-06-13 20:20:40 +0000276GETTEXTINCLUDE = $(GETTEXT)/include
277GETTEXTLIB = $(INTLPATH)
278ifeq (yes, $(GETTEXT))
Bram Moolenaar8cd06ca2005-02-28 22:44:58 +0000279DEFINES += -DDYNAMIC_GETTEXT
Bram Moolenaar071d4272004-06-13 20:20:40 +0000280else
281ifdef DYNAMIC_GETTEXT
Bram Moolenaar8cd06ca2005-02-28 22:44:58 +0000282DEFINES += -D$(DYNAMIC_GETTEXT)
Bram Moolenaar071d4272004-06-13 20:20:40 +0000283ifdef GETTEXT_DYNAMIC
284DEFINES += -DGETTEXT_DYNAMIC -DGETTEXT_DLL=\"$(GETTEXT_DYNAMIC)\"
285endif
286endif
287endif
288endif
289
290ifdef PERL
291CFLAGS += -I$(PERLLIBS) -DFEAT_PERL -L$(PERLLIBS)
292ifeq (yes, $(DYNAMIC_PERL))
293CFLAGS += -DDYNAMIC_PERL -DDYNAMIC_PERL_DLL=\"perl$(PERL_VER).dll\"
294endif
295endif
296
Bram Moolenaar325b7a22004-07-05 15:58:32 +0000297ifdef MZSCHEME
298CFLAGS += -I$(MZSCHEME)/include -DFEAT_MZSCHEME -DMZSCHEME_COLLECTS=\"$(MZSCHEME)/collects\"
Bram Moolenaar281bdce2005-01-25 21:53:18 +0000299ifeq (yes, $(DYNAMIC_MZSCHEME))
300CFLAGS += -DDYNAMIC_MZSCHEME -DDYNAMIC_MZSCH_DLL=\"libmzsch$(MZSCHEME_VER).dll\" -DDYNAMIC_MZGC_DLL=\"libmzgc$(MZSCHEME_VER).dll\"
301endif
Bram Moolenaar325b7a22004-07-05 15:58:32 +0000302endif
303
Bram Moolenaar071d4272004-06-13 20:20:40 +0000304ifdef RUBY
305CFLAGS += -DFEAT_RUBY $(RUBYINC)
306ifeq (yes, $(DYNAMIC_RUBY))
307CFLAGS += -DDYNAMIC_RUBY -DDYNAMIC_RUBY_DLL=\"$(RUBY_INSTALL_NAME).dll\"
308CFLAGS += -DDYNAMIC_RUBY_VER=$(RUBY_VER)
309endif
310endif
311
312ifdef PYTHON
313CFLAGS += -DFEAT_PYTHON $(PYTHONINC)
314ifeq (yes, $(DYNAMIC_PYTHON))
315CFLAGS += -DDYNAMIC_PYTHON -DDYNAMIC_PYTHON_DLL=\"python$(PYTHON_VER).dll\"
316endif
317endif
318
319ifdef TCL
320CFLAGS += -DFEAT_TCL $(TCLINC)
321ifeq (yes, $(DYNAMIC_TCL))
322CFLAGS += -DDYNAMIC_TCL -DDYNAMIC_TCL_DLL=\"tcl$(TCL_VER).dll\"
323endif
324endif
325
326ifeq ($(POSTSCRIPT),yes)
327DEFINES += -DMSWINPS
328endif
329
330ifeq (yes, $(OLE))
331DEFINES += -DFEAT_OLE
332endif
333
334ifeq ($(CSCOPE),yes)
335DEFINES += -DFEAT_CSCOPE
336endif
337
338ifeq ($(NETBEANS),yes)
Bram Moolenaarcfbc5ee2004-07-02 15:38:35 +0000339# Only allow NETBEANS for a GUI build.
340ifeq (yes, $(GUI))
Bram Moolenaar071d4272004-06-13 20:20:40 +0000341DEFINES += -DFEAT_NETBEANS_INTG
Bram Moolenaarcfbc5ee2004-07-02 15:38:35 +0000342
343ifeq ($(NBDEBUG), yes)
Bram Moolenaar071d4272004-06-13 20:20:40 +0000344DEFINES += -DNBDEBUG
345NBDEBUG_INCL = nbdebug.h
346NBDEBUG_SRC = nbdebug.c
347endif
348endif
Bram Moolenaarcfbc5ee2004-07-02 15:38:35 +0000349endif
Bram Moolenaar071d4272004-06-13 20:20:40 +0000350
351ifdef XPM
Bram Moolenaarcfbc5ee2004-07-02 15:38:35 +0000352# Only allow XPM for a GUI build.
353ifeq (yes, $(GUI))
Bram Moolenaar071d4272004-06-13 20:20:40 +0000354CFLAGS += -DFEAT_XPM_W32 -I $(XPM)/include
355endif
Bram Moolenaarcfbc5ee2004-07-02 15:38:35 +0000356endif
Bram Moolenaar071d4272004-06-13 20:20:40 +0000357
358ifeq ($(DEBUG),yes)
359CFLAGS += -g -fstack-check
360DEBUG_SUFFIX=d
361else
362ifeq ($(OPTIMIZE), SIZE)
363CFLAGS += -Os
364else
365ifeq ($(OPTIMIZE), MAXSPEED)
366CFLAGS += -O3
Bram Moolenaar1cd871b2004-12-19 22:46:22 +0000367CFLAGS += -fomit-frame-pointer -freg-struct-return
Bram Moolenaar071d4272004-06-13 20:20:40 +0000368else # SPEED
369CFLAGS += -O2
370endif
371endif
372CFLAGS += -s
373endif
374
Bram Moolenaara3ffd9c2005-07-21 21:03:15 +0000375LIB = -lkernel32 -luser32 -lgdi32 -ladvapi32 -lcomdlg32 -lcomctl32 -lversion
Bram Moolenaar44ecf652005-03-07 23:09:59 +0000376GUIOBJ = $(OUTDIR)/gui.o $(OUTDIR)/gui_w32.o $(OUTDIR)/gui_beval.o $(OUTDIR)/os_w32exe.o
Bram Moolenaar071d4272004-06-13 20:20:40 +0000377OBJ = \
378 $(OUTDIR)/buffer.o \
379 $(OUTDIR)/charset.o \
380 $(OUTDIR)/diff.o \
381 $(OUTDIR)/digraph.o \
382 $(OUTDIR)/edit.o \
383 $(OUTDIR)/eval.o \
384 $(OUTDIR)/ex_cmds.o \
385 $(OUTDIR)/ex_cmds2.o \
386 $(OUTDIR)/ex_docmd.o \
387 $(OUTDIR)/ex_eval.o \
388 $(OUTDIR)/ex_getln.o \
389 $(OUTDIR)/fileio.o \
390 $(OUTDIR)/fold.o \
391 $(OUTDIR)/getchar.o \
Bram Moolenaar58d98232005-07-23 22:25:46 +0000392 $(OUTDIR)/hardcopy.o \
Bram Moolenaarc01140a2006-03-24 22:21:52 +0000393 $(OUTDIR)/hashtab.o \
Bram Moolenaar071d4272004-06-13 20:20:40 +0000394 $(OUTDIR)/main.o \
395 $(OUTDIR)/mark.o \
396 $(OUTDIR)/memfile.o \
397 $(OUTDIR)/memline.o \
398 $(OUTDIR)/menu.o \
399 $(OUTDIR)/message.o \
400 $(OUTDIR)/misc1.o \
401 $(OUTDIR)/misc2.o \
402 $(OUTDIR)/move.o \
403 $(OUTDIR)/mbyte.o \
404 $(OUTDIR)/normal.o \
405 $(OUTDIR)/ops.o \
406 $(OUTDIR)/option.o \
407 $(OUTDIR)/os_win32.o \
408 $(OUTDIR)/os_mswin.o \
409 $(OUTDIR)/pathdef.o \
Bram Moolenaarc01140a2006-03-24 22:21:52 +0000410 $(OUTDIR)/popupmnu.o \
Bram Moolenaar071d4272004-06-13 20:20:40 +0000411 $(OUTDIR)/quickfix.o \
412 $(OUTDIR)/regexp.o \
413 $(OUTDIR)/screen.o \
414 $(OUTDIR)/search.o \
Bram Moolenaar6bb68362005-03-22 23:03:44 +0000415 $(OUTDIR)/spell.o \
Bram Moolenaar071d4272004-06-13 20:20:40 +0000416 $(OUTDIR)/syntax.o \
417 $(OUTDIR)/tag.o \
418 $(OUTDIR)/term.o \
419 $(OUTDIR)/ui.o \
420 $(OUTDIR)/undo.o \
421 $(OUTDIR)/version.o \
422 $(OUTDIR)/vimrc.o \
423 $(OUTDIR)/window.o
424
425ifdef PERL
426OBJ += $(OUTDIR)/if_perl.o
427endif
Bram Moolenaar325b7a22004-07-05 15:58:32 +0000428ifdef MZSCHEME
429OBJ += $(OUTDIR)/if_mzsch.o
430MZSCHEME_INCL = if_mzsch.h
Bram Moolenaar9e70cf12009-05-26 20:59:55 +0000431ifeq (yes,$(MZSCHEME_GENERATE_BASE))
432CFLAGS += -DINCLUDE_MZSCHEME_BASE
433MZ_EXTRA_DEP += mzscheme_base.c
434endif
435ifeq (yes,$(MZSCHEME_PRECISE_GC))
436CFLAGS += -DMZ_PRECISE_GC
437endif
Bram Moolenaar325b7a22004-07-05 15:58:32 +0000438endif
Bram Moolenaar071d4272004-06-13 20:20:40 +0000439ifdef PYTHON
440OBJ += $(OUTDIR)/if_python.o
441endif
442ifdef RUBY
443OBJ += $(OUTDIR)/if_ruby.o
444endif
445ifdef TCL
446OBJ += $(OUTDIR)/if_tcl.o
447endif
448ifeq ($(CSCOPE),yes)
449OBJ += $(OUTDIR)/if_cscope.o
450endif
451ifeq ($(NETBEANS),yes)
Bram Moolenaarcfbc5ee2004-07-02 15:38:35 +0000452# Only allow NETBEANS for a GUI build.
453ifeq (yes, $(GUI))
Bram Moolenaar44ecf652005-03-07 23:09:59 +0000454OBJ += $(OUTDIR)/netbeans.o
Bram Moolenaar071d4272004-06-13 20:20:40 +0000455LIB += -lwsock32
456endif
Bram Moolenaarcfbc5ee2004-07-02 15:38:35 +0000457endif
Bram Moolenaar071d4272004-06-13 20:20:40 +0000458ifdef XPM
Bram Moolenaarcfbc5ee2004-07-02 15:38:35 +0000459# Only allow XPM for a GUI build.
460ifeq (yes, $(GUI))
Bram Moolenaar071d4272004-06-13 20:20:40 +0000461OBJ += $(OUTDIR)/xpm_w32.o
462# You'll need libXpm.a from http://gnuwin32.sf.net
463LIB += -L $(XPM)/lib -lXpm
464endif
Bram Moolenaarcfbc5ee2004-07-02 15:38:35 +0000465endif
Bram Moolenaar071d4272004-06-13 20:20:40 +0000466
467
Bram Moolenaar325b7a22004-07-05 15:58:32 +0000468ifdef MZSCHEME
469MZSCHEME_SUFFIX = Z
470endif
471
Bram Moolenaar071d4272004-06-13 20:20:40 +0000472ifeq ($(GUI),yes)
473TARGET := gvim$(DEBUG_SUFFIX).exe
474DEFINES += $(DEF_GUI)
475OBJ += $(GUIOBJ)
476LFLAGS += -mwindows
Bram Moolenaar325b7a22004-07-05 15:58:32 +0000477OUTDIR = gobj$(DEBUG_SUFFIX)$(MZSCHEME_SUFFIX)
Bram Moolenaar071d4272004-06-13 20:20:40 +0000478else
479TARGET := vim$(DEBUG_SUFFIX).exe
Bram Moolenaar325b7a22004-07-05 15:58:32 +0000480OUTDIR = obj$(DEBUG_SUFFIX)$(MZSCHEME_SUFFIX)
Bram Moolenaar071d4272004-06-13 20:20:40 +0000481endif
482
483ifdef GETTEXT
484ifneq (yes, $(GETTEXT))
485CFLAGS += -I$(GETTEXTINCLUDE)
486ifndef STATIC_GETTEXT
487LIB += -L$(GETTEXTLIB) -l$(INTLLIB)
488ifeq (USE_SAFE_GETTEXT_DLL, $(DYNAMIC_GETTEXT))
489OBJ+=$(SAFE_GETTEXT_DLL_OBJ)
490endif
491else
492LIB += -L$(GETTEXTLIB) -lintl
493endif
494endif
495endif
496
497ifdef PERL
498ifeq (no, $(DYNAMIC_PERL))
499LIB += -lperl$(PERL_VER)
500endif
501endif
502
503ifdef TCL
504LIB += -L$(TCL)/lib
505ifeq (yes, $(DYNAMIC_TCL))
506LIB += -ltclstub$(TCL_VER)
507else
508LIB += -ltcl$(TCL_VER)
509endif
510endif
511
512ifeq (yes, $(OLE))
513LIB += -loleaut32 -lstdc++
514OBJ += $(OUTDIR)/if_ole.o
515endif
516
517ifeq (yes, $(MBYTE))
518DEFINES += -DFEAT_MBYTE
519endif
520
521ifeq (yes, $(IME))
522DEFINES += -DFEAT_MBYTE_IME
523ifeq (yes, $(DYNAMIC_IME))
524DEFINES += -DDYNAMIC_IME
525else
526LIB += -limm32
527endif
528endif
529
530ifdef ICONV
531ifneq (yes, $(ICONV))
532LIB += -L$(ICONV)
533CFLAGS += -I$(ICONV)
534endif
535DEFINES+=-DDYNAMIC_ICONV
536endif
537
538all: $(TARGET) vimrun.exe xxd/xxd.exe install.exe uninstal.exe GvimExt/gvimext.dll
539
540vimrun.exe: vimrun.c
541 $(CC) $(CFLAGS) -o vimrun.exe vimrun.c $(LIB)
542
543install.exe: dosinst.c
544 $(CC) $(CFLAGS) -o install.exe dosinst.c $(LIB) -lole32 -luuid
545
546uninstal.exe: uninstal.c
547 $(CC) $(CFLAGS) -o uninstal.exe uninstal.c $(LIB)
548
549$(TARGET): $(OUTDIR) $(OBJ)
Bram Moolenaarc0197e22004-09-13 20:26:32 +0000550 $(CC) $(CFLAGS) $(LFLAGS) -o $@ $(OBJ) $(LIB) -lole32 -luuid $(MZSCHEME_LIBDIR) $(MZSCHEME_LIB) $(PYTHONLIB) $(RUBYLIB)
Bram Moolenaar071d4272004-06-13 20:20:40 +0000551
552upx: exes
553 upx gvim.exe
554 upx vim.exe
555
556xxd/xxd.exe: xxd/xxd.c
Bram Moolenaar48f80c22010-02-24 15:08:27 +0100557 $(MAKE) -C xxd -f Make_cyg.mak CC=$(CC)
Bram Moolenaar071d4272004-06-13 20:20:40 +0000558
559GvimExt/gvimext.dll: GvimExt/gvimext.cpp GvimExt/gvimext.rc GvimExt/gvimext.h
Bram Moolenaar48f80c22010-02-24 15:08:27 +0100560 $(MAKE) -C GvimExt -f Make_ming.mak CROSS=$(CROSS) CROSS_COMPILE=$(CROSS_COMPILE)
Bram Moolenaar071d4272004-06-13 20:20:40 +0000561
562clean:
563 -$(DEL) $(OUTDIR)$(DIRSLASH)*.o
564 -$(DEL) $(OUTDIR)$(DIRSLASH)*.res
565 -rmdir $(OUTDIR)
566 -$(DEL) *.exe
567 -$(DEL) pathdef.c
568ifdef PERL
569 -$(DEL) if_perl.c
570endif
Bram Moolenaar2d6db762009-09-11 10:49:58 +0000571ifdef MZSCHEME
572 -$(DEL) mzscheme_base.c
573endif
Bram Moolenaar071d4272004-06-13 20:20:40 +0000574 $(MAKE) -C GvimExt -f Make_ming.mak clean
575 $(MAKE) -C xxd -f Make_cyg.mak clean
576
577###########################################################################
578INCL = vim.h feature.h os_win32.h os_dos.h ascii.h keymap.h term.h macros.h \
579 structs.h regexp.h option.h ex_cmds.h proto.h globals.h farsi.h \
580 gui.h
581
582$(OUTDIR)/%.o : %.c $(INCL)
583 $(CC) -c $(CFLAGS) $< -o $@
584
585$(OUTDIR)/vimres.res: vim.rc version.h gui_w32_rc.h
586 $(WINDRES) $(DEFINES) vim.rc $(OUTDIR)/vimres.res
587
588$(OUTDIR)/vimrc.o: $(OUTDIR)/vimres.res
589 $(WINDRES) $(OUTDIR)/vimres.res $(OUTDIR)/vimrc.o
590
591$(OUTDIR):
Bram Moolenaar0cf6f542005-01-16 21:59:36 +0000592 $(MKDIR) $(OUTDIR)
Bram Moolenaar071d4272004-06-13 20:20:40 +0000593
594$(OUTDIR)/ex_docmd.o: ex_docmd.c $(INCL) ex_cmds.h
595 $(CC) -c $(CFLAGS) ex_docmd.c -o $(OUTDIR)/ex_docmd.o
596
597$(OUTDIR)/ex_eval.o: ex_eval.c $(INCL) ex_cmds.h
598 $(CC) -c $(CFLAGS) ex_eval.c -o $(OUTDIR)/ex_eval.o
599
600$(OUTDIR)/if_cscope.o: if_cscope.c $(INCL) if_cscope.h
601 $(CC) -c $(CFLAGS) if_cscope.c -o $(OUTDIR)/if_cscope.o
602
Bram Moolenaar8c69d532007-08-12 13:25:01 +0000603# Remove -D__IID_DEFINED__ for newer versions of the w32api
Bram Moolenaar071d4272004-06-13 20:20:40 +0000604$(OUTDIR)/if_ole.o: if_ole.cpp $(INCL)
Bram Moolenaar8c69d532007-08-12 13:25:01 +0000605 $(CC) $(CFLAGS) -c -o $(OUTDIR)/if_ole.o if_ole.cpp
Bram Moolenaar071d4272004-06-13 20:20:40 +0000606
607$(OUTDIR)/if_ruby.o: if_ruby.c $(INCL)
608ifeq (16, $(RUBY))
609 $(CC) $(CFLAGS) -U_WIN32 -c -o $(OUTDIR)/if_ruby.o if_ruby.c
610endif
611
612if_perl.c: if_perl.xs typemap
613 perl $(PERLLIB)/ExtUtils/xsubpp -prototypes -typemap \
614 $(PERLLIB)/ExtUtils/typemap if_perl.xs > $@
615
616$(OUTDIR)/netbeans.o: netbeans.c $(INCL) $(NBDEBUG_INCL) $(NBDEBUG_SRC)
617 $(CC) -c $(CFLAGS) netbeans.c -o $(OUTDIR)/netbeans.o
618
Bram Moolenaar9e70cf12009-05-26 20:59:55 +0000619$(OUTDIR)/if_mzsch.o: if_mzsch.c $(INCL) if_mzsch.h $(MZ_EXTRA_DEP)
620 $(CC) -c $(CFLAGS) if_mzsch.c -o $(OUTDIR)/if_mzsch.o
621
622mzscheme_base.c:
623 $(MZSCHEME)/mzc --c-mods mzscheme_base.c ++lib scheme/base
624
Bram Moolenaar071d4272004-06-13 20:20:40 +0000625pathdef.c: $(INCL)
626ifneq (sh.exe, $(SHELL))
627 @echo creating pathdef.c
628 @echo '/* pathdef.c */' > pathdef.c
629 @echo '#include "vim.h"' >> pathdef.c
630 @echo 'char_u *default_vim_dir = (char_u *)"$(VIMRCLOC)";' >> pathdef.c
631 @echo 'char_u *default_vimruntime_dir = (char_u *)"$(VIMRUNTIMEDIR)";' >> pathdef.c
632 @echo 'char_u *all_cflags = (char_u *)"$(CC) $(CFLAGS)";' >> pathdef.c
Bram Moolenaara40c5002005-01-09 21:16:21 +0000633 @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 +0000634 @echo 'char_u *compiled_user = (char_u *)"$(USERNAME)";' >> pathdef.c
635 @echo 'char_u *compiled_sys = (char_u *)"$(USERDOMAIN)";' >> pathdef.c
636else
637 @echo creating pathdef.c
638 @echo /* pathdef.c */ > pathdef.c
639 @echo #include "vim.h" >> pathdef.c
640 @echo char_u *default_vim_dir = (char_u *)"$(VIMRCLOC)"; >> pathdef.c
641 @echo char_u *default_vimruntime_dir = (char_u *)"$(VIMRUNTIMEDIR)"; >> pathdef.c
642 @echo char_u *all_cflags = (char_u *)"$(CC) $(CFLAGS)"; >> pathdef.c
Bram Moolenaara40c5002005-01-09 21:16:21 +0000643 @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 +0000644 @echo char_u *compiled_user = (char_u *)"$(USERNAME)"; >> pathdef.c
645 @echo char_u *compiled_sys = (char_u *)"$(USERDOMAIN)"; >> pathdef.c
646endif