blob: f57fb18d00bde3fd545f727fdc55239dd9836faf [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
215ifeq ($(RUBY_VER), 16)
216ifndef RUBY_PLATFORM
217RUBY_PLATFORM = i586-mswin32
218endif
219ifndef RUBY_INSTALL_NAME
220RUBY_INSTALL_NAME = mswin32-ruby$(RUBY_VER)
221endif
222else
223ifndef RUBY_PLATFORM
224RUBY_PLATFORM = i386-mswin32
225endif
226ifndef RUBY_INSTALL_NAME
227RUBY_INSTALL_NAME = msvcrt-ruby$(RUBY_VER)
228endif
229endif
230
231RUBYINC =-I $(RUBY)/lib/ruby/$(RUBY_VER_LONG)/$(RUBY_PLATFORM)
232ifeq (no, $(DYNAMIC_RUBY))
233RUBYLIB = -L$(RUBY)/lib -l$(RUBY_INSTALL_NAME)
234endif
235
236endif # RUBY
237
238# See feature.h for a list of options.
239# Any other defines can be included here.
240DEF_GUI=-DFEAT_GUI_W32 -DFEAT_CLIPBOARD
241DEFINES=-DWIN32 -DWINVER=$(WINVER) -D_WIN32_WINNT=$(WINVER) \
242 -DHAVE_PATHDEF -DFEAT_$(FEATURES)
243ifeq ($(CROSS),yes)
Bram Moolenaar48f80c22010-02-24 15:08:27 +0100244# cross-compiler prefix:
245CROSS_COMPILE = i586-pc-mingw32msvc-
Bram Moolenaar071d4272004-06-13 20:20:40 +0000246DEL = rm
Bram Moolenaar0cf6f542005-01-16 21:59:36 +0000247MKDIR = mkdir -p
Bram Moolenaar48f80c22010-02-24 15:08:27 +0100248DIRSLASH = /
Bram Moolenaar071d4272004-06-13 20:20:40 +0000249else
250# normal (Windows) compilation:
Bram Moolenaar48f80c22010-02-24 15:08:27 +0100251CROSS_COMPILE =
Bram Moolenaar86ce1cc2010-02-26 22:05:22 +0100252ifneq (sh.exe, $(SHELL))
Bram Moolenaar071d4272004-06-13 20:20:40 +0000253DEL = rm
Bram Moolenaar0cf6f542005-01-16 21:59:36 +0000254MKDIR = mkdir -p
Bram Moolenaar071d4272004-06-13 20:20:40 +0000255DIRSLASH = /
256else
257DEL = del
Bram Moolenaar0cf6f542005-01-16 21:59:36 +0000258MKDIR = mkdir
Bram Moolenaar071d4272004-06-13 20:20:40 +0000259DIRSLASH = \\
260endif
Bram Moolenaar071d4272004-06-13 20:20:40 +0000261endif
Bram Moolenaar48f80c22010-02-24 15:08:27 +0100262CC := $(CROSS_COMPILE)gcc
263WINDRES := $(CROSS_COMPILE)windres
Bram Moolenaar071d4272004-06-13 20:20:40 +0000264
265#>>>>> end of choices
266###########################################################################
267
Bram Moolenaar1cd871b2004-12-19 22:46:22 +0000268CFLAGS = -Iproto $(DEFINES) -pipe -w -march=$(ARCH) -Wall
Bram Moolenaar071d4272004-06-13 20:20:40 +0000269
270ifdef GETTEXT
Bram Moolenaar8cd06ca2005-02-28 22:44:58 +0000271DEFINES += -DHAVE_GETTEXT -DHAVE_LOCALE_H
Bram Moolenaar071d4272004-06-13 20:20:40 +0000272GETTEXTINCLUDE = $(GETTEXT)/include
273GETTEXTLIB = $(INTLPATH)
274ifeq (yes, $(GETTEXT))
Bram Moolenaar8cd06ca2005-02-28 22:44:58 +0000275DEFINES += -DDYNAMIC_GETTEXT
Bram Moolenaar071d4272004-06-13 20:20:40 +0000276else
277ifdef DYNAMIC_GETTEXT
Bram Moolenaar8cd06ca2005-02-28 22:44:58 +0000278DEFINES += -D$(DYNAMIC_GETTEXT)
Bram Moolenaar071d4272004-06-13 20:20:40 +0000279ifdef GETTEXT_DYNAMIC
280DEFINES += -DGETTEXT_DYNAMIC -DGETTEXT_DLL=\"$(GETTEXT_DYNAMIC)\"
281endif
282endif
283endif
284endif
285
286ifdef PERL
287CFLAGS += -I$(PERLLIBS) -DFEAT_PERL -L$(PERLLIBS)
288ifeq (yes, $(DYNAMIC_PERL))
289CFLAGS += -DDYNAMIC_PERL -DDYNAMIC_PERL_DLL=\"perl$(PERL_VER).dll\"
290endif
291endif
292
Bram Moolenaar325b7a22004-07-05 15:58:32 +0000293ifdef MZSCHEME
294CFLAGS += -I$(MZSCHEME)/include -DFEAT_MZSCHEME -DMZSCHEME_COLLECTS=\"$(MZSCHEME)/collects\"
Bram Moolenaar281bdce2005-01-25 21:53:18 +0000295ifeq (yes, $(DYNAMIC_MZSCHEME))
296CFLAGS += -DDYNAMIC_MZSCHEME -DDYNAMIC_MZSCH_DLL=\"libmzsch$(MZSCHEME_VER).dll\" -DDYNAMIC_MZGC_DLL=\"libmzgc$(MZSCHEME_VER).dll\"
297endif
Bram Moolenaar325b7a22004-07-05 15:58:32 +0000298endif
299
Bram Moolenaar071d4272004-06-13 20:20:40 +0000300ifdef RUBY
301CFLAGS += -DFEAT_RUBY $(RUBYINC)
302ifeq (yes, $(DYNAMIC_RUBY))
303CFLAGS += -DDYNAMIC_RUBY -DDYNAMIC_RUBY_DLL=\"$(RUBY_INSTALL_NAME).dll\"
304CFLAGS += -DDYNAMIC_RUBY_VER=$(RUBY_VER)
305endif
306endif
307
308ifdef PYTHON
309CFLAGS += -DFEAT_PYTHON $(PYTHONINC)
310ifeq (yes, $(DYNAMIC_PYTHON))
311CFLAGS += -DDYNAMIC_PYTHON -DDYNAMIC_PYTHON_DLL=\"python$(PYTHON_VER).dll\"
312endif
313endif
314
315ifdef TCL
316CFLAGS += -DFEAT_TCL $(TCLINC)
317ifeq (yes, $(DYNAMIC_TCL))
318CFLAGS += -DDYNAMIC_TCL -DDYNAMIC_TCL_DLL=\"tcl$(TCL_VER).dll\"
319endif
320endif
321
322ifeq ($(POSTSCRIPT),yes)
323DEFINES += -DMSWINPS
324endif
325
326ifeq (yes, $(OLE))
327DEFINES += -DFEAT_OLE
328endif
329
330ifeq ($(CSCOPE),yes)
331DEFINES += -DFEAT_CSCOPE
332endif
333
334ifeq ($(NETBEANS),yes)
Bram Moolenaarcfbc5ee2004-07-02 15:38:35 +0000335# Only allow NETBEANS for a GUI build.
336ifeq (yes, $(GUI))
Bram Moolenaar071d4272004-06-13 20:20:40 +0000337DEFINES += -DFEAT_NETBEANS_INTG
Bram Moolenaarcfbc5ee2004-07-02 15:38:35 +0000338
339ifeq ($(NBDEBUG), yes)
Bram Moolenaar071d4272004-06-13 20:20:40 +0000340DEFINES += -DNBDEBUG
341NBDEBUG_INCL = nbdebug.h
342NBDEBUG_SRC = nbdebug.c
343endif
344endif
Bram Moolenaarcfbc5ee2004-07-02 15:38:35 +0000345endif
Bram Moolenaar071d4272004-06-13 20:20:40 +0000346
347ifdef XPM
Bram Moolenaarcfbc5ee2004-07-02 15:38:35 +0000348# Only allow XPM for a GUI build.
349ifeq (yes, $(GUI))
Bram Moolenaar071d4272004-06-13 20:20:40 +0000350CFLAGS += -DFEAT_XPM_W32 -I $(XPM)/include
351endif
Bram Moolenaarcfbc5ee2004-07-02 15:38:35 +0000352endif
Bram Moolenaar071d4272004-06-13 20:20:40 +0000353
354ifeq ($(DEBUG),yes)
355CFLAGS += -g -fstack-check
356DEBUG_SUFFIX=d
357else
358ifeq ($(OPTIMIZE), SIZE)
359CFLAGS += -Os
360else
361ifeq ($(OPTIMIZE), MAXSPEED)
362CFLAGS += -O3
Bram Moolenaar1cd871b2004-12-19 22:46:22 +0000363CFLAGS += -fomit-frame-pointer -freg-struct-return
Bram Moolenaar071d4272004-06-13 20:20:40 +0000364else # SPEED
365CFLAGS += -O2
366endif
367endif
368CFLAGS += -s
369endif
370
Bram Moolenaara3ffd9c2005-07-21 21:03:15 +0000371LIB = -lkernel32 -luser32 -lgdi32 -ladvapi32 -lcomdlg32 -lcomctl32 -lversion
Bram Moolenaar44ecf652005-03-07 23:09:59 +0000372GUIOBJ = $(OUTDIR)/gui.o $(OUTDIR)/gui_w32.o $(OUTDIR)/gui_beval.o $(OUTDIR)/os_w32exe.o
Bram Moolenaar071d4272004-06-13 20:20:40 +0000373OBJ = \
374 $(OUTDIR)/buffer.o \
375 $(OUTDIR)/charset.o \
376 $(OUTDIR)/diff.o \
377 $(OUTDIR)/digraph.o \
378 $(OUTDIR)/edit.o \
379 $(OUTDIR)/eval.o \
380 $(OUTDIR)/ex_cmds.o \
381 $(OUTDIR)/ex_cmds2.o \
382 $(OUTDIR)/ex_docmd.o \
383 $(OUTDIR)/ex_eval.o \
384 $(OUTDIR)/ex_getln.o \
385 $(OUTDIR)/fileio.o \
386 $(OUTDIR)/fold.o \
387 $(OUTDIR)/getchar.o \
Bram Moolenaar58d98232005-07-23 22:25:46 +0000388 $(OUTDIR)/hardcopy.o \
Bram Moolenaarc01140a2006-03-24 22:21:52 +0000389 $(OUTDIR)/hashtab.o \
Bram Moolenaar071d4272004-06-13 20:20:40 +0000390 $(OUTDIR)/main.o \
391 $(OUTDIR)/mark.o \
392 $(OUTDIR)/memfile.o \
393 $(OUTDIR)/memline.o \
394 $(OUTDIR)/menu.o \
395 $(OUTDIR)/message.o \
396 $(OUTDIR)/misc1.o \
397 $(OUTDIR)/misc2.o \
398 $(OUTDIR)/move.o \
399 $(OUTDIR)/mbyte.o \
400 $(OUTDIR)/normal.o \
401 $(OUTDIR)/ops.o \
402 $(OUTDIR)/option.o \
403 $(OUTDIR)/os_win32.o \
404 $(OUTDIR)/os_mswin.o \
405 $(OUTDIR)/pathdef.o \
Bram Moolenaarc01140a2006-03-24 22:21:52 +0000406 $(OUTDIR)/popupmnu.o \
Bram Moolenaar071d4272004-06-13 20:20:40 +0000407 $(OUTDIR)/quickfix.o \
408 $(OUTDIR)/regexp.o \
409 $(OUTDIR)/screen.o \
410 $(OUTDIR)/search.o \
Bram Moolenaar6bb68362005-03-22 23:03:44 +0000411 $(OUTDIR)/spell.o \
Bram Moolenaar071d4272004-06-13 20:20:40 +0000412 $(OUTDIR)/syntax.o \
413 $(OUTDIR)/tag.o \
414 $(OUTDIR)/term.o \
415 $(OUTDIR)/ui.o \
416 $(OUTDIR)/undo.o \
417 $(OUTDIR)/version.o \
418 $(OUTDIR)/vimrc.o \
419 $(OUTDIR)/window.o
420
421ifdef PERL
422OBJ += $(OUTDIR)/if_perl.o
423endif
Bram Moolenaar325b7a22004-07-05 15:58:32 +0000424ifdef MZSCHEME
425OBJ += $(OUTDIR)/if_mzsch.o
426MZSCHEME_INCL = if_mzsch.h
Bram Moolenaar9e70cf12009-05-26 20:59:55 +0000427ifeq (yes,$(MZSCHEME_GENERATE_BASE))
428CFLAGS += -DINCLUDE_MZSCHEME_BASE
429MZ_EXTRA_DEP += mzscheme_base.c
430endif
431ifeq (yes,$(MZSCHEME_PRECISE_GC))
432CFLAGS += -DMZ_PRECISE_GC
433endif
Bram Moolenaar325b7a22004-07-05 15:58:32 +0000434endif
Bram Moolenaar071d4272004-06-13 20:20:40 +0000435ifdef PYTHON
436OBJ += $(OUTDIR)/if_python.o
437endif
438ifdef RUBY
439OBJ += $(OUTDIR)/if_ruby.o
440endif
441ifdef TCL
442OBJ += $(OUTDIR)/if_tcl.o
443endif
444ifeq ($(CSCOPE),yes)
445OBJ += $(OUTDIR)/if_cscope.o
446endif
447ifeq ($(NETBEANS),yes)
Bram Moolenaarcfbc5ee2004-07-02 15:38:35 +0000448# Only allow NETBEANS for a GUI build.
449ifeq (yes, $(GUI))
Bram Moolenaar44ecf652005-03-07 23:09:59 +0000450OBJ += $(OUTDIR)/netbeans.o
Bram Moolenaar071d4272004-06-13 20:20:40 +0000451LIB += -lwsock32
452endif
Bram Moolenaarcfbc5ee2004-07-02 15:38:35 +0000453endif
Bram Moolenaar071d4272004-06-13 20:20:40 +0000454ifdef XPM
Bram Moolenaarcfbc5ee2004-07-02 15:38:35 +0000455# Only allow XPM for a GUI build.
456ifeq (yes, $(GUI))
Bram Moolenaar071d4272004-06-13 20:20:40 +0000457OBJ += $(OUTDIR)/xpm_w32.o
458# You'll need libXpm.a from http://gnuwin32.sf.net
459LIB += -L $(XPM)/lib -lXpm
460endif
Bram Moolenaarcfbc5ee2004-07-02 15:38:35 +0000461endif
Bram Moolenaar071d4272004-06-13 20:20:40 +0000462
463
Bram Moolenaar325b7a22004-07-05 15:58:32 +0000464ifdef MZSCHEME
465MZSCHEME_SUFFIX = Z
466endif
467
Bram Moolenaar071d4272004-06-13 20:20:40 +0000468ifeq ($(GUI),yes)
469TARGET := gvim$(DEBUG_SUFFIX).exe
470DEFINES += $(DEF_GUI)
471OBJ += $(GUIOBJ)
472LFLAGS += -mwindows
Bram Moolenaar325b7a22004-07-05 15:58:32 +0000473OUTDIR = gobj$(DEBUG_SUFFIX)$(MZSCHEME_SUFFIX)
Bram Moolenaar071d4272004-06-13 20:20:40 +0000474else
475TARGET := vim$(DEBUG_SUFFIX).exe
Bram Moolenaar325b7a22004-07-05 15:58:32 +0000476OUTDIR = obj$(DEBUG_SUFFIX)$(MZSCHEME_SUFFIX)
Bram Moolenaar071d4272004-06-13 20:20:40 +0000477endif
478
479ifdef GETTEXT
480ifneq (yes, $(GETTEXT))
481CFLAGS += -I$(GETTEXTINCLUDE)
482ifndef STATIC_GETTEXT
483LIB += -L$(GETTEXTLIB) -l$(INTLLIB)
484ifeq (USE_SAFE_GETTEXT_DLL, $(DYNAMIC_GETTEXT))
485OBJ+=$(SAFE_GETTEXT_DLL_OBJ)
486endif
487else
488LIB += -L$(GETTEXTLIB) -lintl
489endif
490endif
491endif
492
493ifdef PERL
494ifeq (no, $(DYNAMIC_PERL))
495LIB += -lperl$(PERL_VER)
496endif
497endif
498
499ifdef TCL
500LIB += -L$(TCL)/lib
501ifeq (yes, $(DYNAMIC_TCL))
502LIB += -ltclstub$(TCL_VER)
503else
504LIB += -ltcl$(TCL_VER)
505endif
506endif
507
508ifeq (yes, $(OLE))
509LIB += -loleaut32 -lstdc++
510OBJ += $(OUTDIR)/if_ole.o
511endif
512
513ifeq (yes, $(MBYTE))
514DEFINES += -DFEAT_MBYTE
515endif
516
517ifeq (yes, $(IME))
518DEFINES += -DFEAT_MBYTE_IME
519ifeq (yes, $(DYNAMIC_IME))
520DEFINES += -DDYNAMIC_IME
521else
522LIB += -limm32
523endif
524endif
525
526ifdef ICONV
527ifneq (yes, $(ICONV))
528LIB += -L$(ICONV)
529CFLAGS += -I$(ICONV)
530endif
531DEFINES+=-DDYNAMIC_ICONV
532endif
533
534all: $(TARGET) vimrun.exe xxd/xxd.exe install.exe uninstal.exe GvimExt/gvimext.dll
535
536vimrun.exe: vimrun.c
537 $(CC) $(CFLAGS) -o vimrun.exe vimrun.c $(LIB)
538
539install.exe: dosinst.c
540 $(CC) $(CFLAGS) -o install.exe dosinst.c $(LIB) -lole32 -luuid
541
542uninstal.exe: uninstal.c
543 $(CC) $(CFLAGS) -o uninstal.exe uninstal.c $(LIB)
544
545$(TARGET): $(OUTDIR) $(OBJ)
Bram Moolenaarc0197e22004-09-13 20:26:32 +0000546 $(CC) $(CFLAGS) $(LFLAGS) -o $@ $(OBJ) $(LIB) -lole32 -luuid $(MZSCHEME_LIBDIR) $(MZSCHEME_LIB) $(PYTHONLIB) $(RUBYLIB)
Bram Moolenaar071d4272004-06-13 20:20:40 +0000547
548upx: exes
549 upx gvim.exe
550 upx vim.exe
551
552xxd/xxd.exe: xxd/xxd.c
Bram Moolenaar48f80c22010-02-24 15:08:27 +0100553 $(MAKE) -C xxd -f Make_cyg.mak CC=$(CC)
Bram Moolenaar071d4272004-06-13 20:20:40 +0000554
555GvimExt/gvimext.dll: GvimExt/gvimext.cpp GvimExt/gvimext.rc GvimExt/gvimext.h
Bram Moolenaar48f80c22010-02-24 15:08:27 +0100556 $(MAKE) -C GvimExt -f Make_ming.mak CROSS=$(CROSS) CROSS_COMPILE=$(CROSS_COMPILE)
Bram Moolenaar071d4272004-06-13 20:20:40 +0000557
558clean:
559 -$(DEL) $(OUTDIR)$(DIRSLASH)*.o
560 -$(DEL) $(OUTDIR)$(DIRSLASH)*.res
561 -rmdir $(OUTDIR)
562 -$(DEL) *.exe
563 -$(DEL) pathdef.c
564ifdef PERL
565 -$(DEL) if_perl.c
566endif
Bram Moolenaar2d6db762009-09-11 10:49:58 +0000567ifdef MZSCHEME
568 -$(DEL) mzscheme_base.c
569endif
Bram Moolenaar071d4272004-06-13 20:20:40 +0000570 $(MAKE) -C GvimExt -f Make_ming.mak clean
571 $(MAKE) -C xxd -f Make_cyg.mak clean
572
573###########################################################################
574INCL = vim.h feature.h os_win32.h os_dos.h ascii.h keymap.h term.h macros.h \
575 structs.h regexp.h option.h ex_cmds.h proto.h globals.h farsi.h \
576 gui.h
577
578$(OUTDIR)/%.o : %.c $(INCL)
579 $(CC) -c $(CFLAGS) $< -o $@
580
581$(OUTDIR)/vimres.res: vim.rc version.h gui_w32_rc.h
582 $(WINDRES) $(DEFINES) vim.rc $(OUTDIR)/vimres.res
583
584$(OUTDIR)/vimrc.o: $(OUTDIR)/vimres.res
585 $(WINDRES) $(OUTDIR)/vimres.res $(OUTDIR)/vimrc.o
586
587$(OUTDIR):
Bram Moolenaar0cf6f542005-01-16 21:59:36 +0000588 $(MKDIR) $(OUTDIR)
Bram Moolenaar071d4272004-06-13 20:20:40 +0000589
590$(OUTDIR)/ex_docmd.o: ex_docmd.c $(INCL) ex_cmds.h
591 $(CC) -c $(CFLAGS) ex_docmd.c -o $(OUTDIR)/ex_docmd.o
592
593$(OUTDIR)/ex_eval.o: ex_eval.c $(INCL) ex_cmds.h
594 $(CC) -c $(CFLAGS) ex_eval.c -o $(OUTDIR)/ex_eval.o
595
596$(OUTDIR)/if_cscope.o: if_cscope.c $(INCL) if_cscope.h
597 $(CC) -c $(CFLAGS) if_cscope.c -o $(OUTDIR)/if_cscope.o
598
Bram Moolenaar8c69d532007-08-12 13:25:01 +0000599# Remove -D__IID_DEFINED__ for newer versions of the w32api
Bram Moolenaar071d4272004-06-13 20:20:40 +0000600$(OUTDIR)/if_ole.o: if_ole.cpp $(INCL)
Bram Moolenaar8c69d532007-08-12 13:25:01 +0000601 $(CC) $(CFLAGS) -c -o $(OUTDIR)/if_ole.o if_ole.cpp
Bram Moolenaar071d4272004-06-13 20:20:40 +0000602
603$(OUTDIR)/if_ruby.o: if_ruby.c $(INCL)
604ifeq (16, $(RUBY))
605 $(CC) $(CFLAGS) -U_WIN32 -c -o $(OUTDIR)/if_ruby.o if_ruby.c
606endif
607
608if_perl.c: if_perl.xs typemap
609 perl $(PERLLIB)/ExtUtils/xsubpp -prototypes -typemap \
610 $(PERLLIB)/ExtUtils/typemap if_perl.xs > $@
611
612$(OUTDIR)/netbeans.o: netbeans.c $(INCL) $(NBDEBUG_INCL) $(NBDEBUG_SRC)
613 $(CC) -c $(CFLAGS) netbeans.c -o $(OUTDIR)/netbeans.o
614
Bram Moolenaar9e70cf12009-05-26 20:59:55 +0000615$(OUTDIR)/if_mzsch.o: if_mzsch.c $(INCL) if_mzsch.h $(MZ_EXTRA_DEP)
616 $(CC) -c $(CFLAGS) if_mzsch.c -o $(OUTDIR)/if_mzsch.o
617
618mzscheme_base.c:
619 $(MZSCHEME)/mzc --c-mods mzscheme_base.c ++lib scheme/base
620
Bram Moolenaar071d4272004-06-13 20:20:40 +0000621pathdef.c: $(INCL)
622ifneq (sh.exe, $(SHELL))
623 @echo creating pathdef.c
624 @echo '/* pathdef.c */' > pathdef.c
625 @echo '#include "vim.h"' >> pathdef.c
626 @echo 'char_u *default_vim_dir = (char_u *)"$(VIMRCLOC)";' >> pathdef.c
627 @echo 'char_u *default_vimruntime_dir = (char_u *)"$(VIMRUNTIMEDIR)";' >> pathdef.c
628 @echo 'char_u *all_cflags = (char_u *)"$(CC) $(CFLAGS)";' >> pathdef.c
Bram Moolenaara40c5002005-01-09 21:16:21 +0000629 @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 +0000630 @echo 'char_u *compiled_user = (char_u *)"$(USERNAME)";' >> pathdef.c
631 @echo 'char_u *compiled_sys = (char_u *)"$(USERDOMAIN)";' >> pathdef.c
632else
633 @echo creating pathdef.c
634 @echo /* pathdef.c */ > pathdef.c
635 @echo #include "vim.h" >> pathdef.c
636 @echo char_u *default_vim_dir = (char_u *)"$(VIMRCLOC)"; >> pathdef.c
637 @echo char_u *default_vimruntime_dir = (char_u *)"$(VIMRUNTIMEDIR)"; >> pathdef.c
638 @echo char_u *all_cflags = (char_u *)"$(CC) $(CFLAGS)"; >> pathdef.c
Bram Moolenaara40c5002005-01-09 21:16:21 +0000639 @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 +0000640 @echo char_u *compiled_user = (char_u *)"$(USERNAME)"; >> pathdef.c
641 @echo char_u *compiled_sys = (char_u *)"$(USERDOMAIN)"; >> pathdef.c
642endif