1 # 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.
7 # Tested on Win32 NT 4 and Win95.
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
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
17 # "make upx" makes *compressed* versions of the GUI and console EXEs, using the
18 # excellent UPX compressor:
19 # http://upx.sourceforge.net/
21 # Maintained by Ron Aaron <ronaharon@yahoo.com>
24 #>>>>> choose options:
25 # set to yes for a debug build
27 # set to SIZE for size, SPEED for speed, MAXSPEED for maximum optimization
29 # set to yes to make gvim, no for vim
31 # FEATURES=[TINY | SMALL | NORMAL | BIG | HUGE]
32 # set to TINY to make minimal version (few features)
34 # set to one of i386, i486, i586, i686 as the minimum target processor
36 # set to yes to cross-compile from unix; no=native Windows
38 # set to path to iconv.h and libiconv.a to enable using 'iconv.dll'
42 # set to yes to include multibyte support
44 # set to yes to include IME support
47 # set to yes to enable writing a postscript file with :hardcopy
49 # set to yes to enable OLE support
51 # Set the default $(WINVER) to make it work with pre-Win2k
53 # Set to yes to enable Cscope support
55 # Set to yes to enable Netbeans support
59 # If the user doesn't want gettext, undefine it.
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
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
74 SAFE_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
79 INTLPATH
=$(GETTEXT
)/lib
/mingw32
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
91 # uncomment 'PERL' if you want a perl-enabled version
100 # on Linux, for cross-compile, it's here:
101 #PERLLIB=/home/ron/ActivePerl/lib
104 PERLLIBS
=$(PERLLIB
)/Core
107 # uncomment 'LUA' if you want a Lua-enabled version
118 ifeq (no
,$(DYNAMIC_LUA
))
119 LUA_LIB
= -L
$(LUA
)/lib
-llua
124 # uncomment 'MZSCHEME' if you want a MzScheme-enabled version
127 ifndef DYNAMIC_MZSCHEME
135 ifndef MZSCHEME_PRECISE_GC
136 MZSCHEME_PRECISE_GC
=no
139 # for version 4.x we need to generate byte-code for Scheme base
140 ifndef MZSCHEME_GENERATE_BASE
141 MZSCHEME_GENERATE_BASE
=no
144 ifeq (no
,$(DYNAMIC_MZSCHEME
))
145 ifeq (yes
,$(MZSCHEME_PRECISE_GC
))
146 MZSCHEME_LIB
=-lmzsch
$(MZSCHEME_VER
)
148 MZSCHEME_LIB
= -lmzsch
$(MZSCHEME_VER
) -lmzgc
$(MZSCHEME_VER
)
150 # the modern MinGW can dynamically link to dlls directly.
151 # point MZSCHEME_DLLS to where you put libmzschXXXXXXX.dll and libgcXXXXXXX.dll
153 MZSCHEME_DLLS
=$(MZSCHEME
)
155 MZSCHEME_LIBDIR
=-L
$(MZSCHEME_DLLS
) -L
$(MZSCHEME_DLLS
)\lib
160 # Python support -- works with the ActiveState python 2.0 release (and others
163 # uncomment 'PYTHON' to make python-enabled version
164 # Put the path to the python distro here. If cross compiling from Linux, you
165 # will also need to convert the header files to unix instead of dos format:
166 # for fil in *.h ; do vim -e -c 'set ff=unix|w|q' $fil
167 # and also, you will need to make a mingw32 'libpython20.a' to link with:
169 # pexports python20.dll > python20.def
170 # dlltool -d python20.def -l libpython20.a
171 # on my Linux box, I put the Python stuff here:
172 #PYTHON=/home/ron/ActivePython-2.0.0-202/src/Core
173 # on my NT box, it's here:
177 ifndef DYNAMIC_PYTHON
185 ifeq (no
,$(DYNAMIC_PYTHON
))
186 PYTHONLIB
=-L
$(PYTHON
)/libs
-lpython
$(PYTHON_VER
)
188 # my include files are in 'win32inc' on Linux, and 'include' in the standard
189 # NT distro (ActiveState)
191 PYTHONINC
=-I
$(PYTHON
)/include
193 PYTHONINC
=-I
$(PYTHON
)/win32inc
198 # TCL=[Path to TCL directory]
199 # DYNAMIC_TCL=yes (to load the TCL DLL dynamically)
200 # TCL_VER=[TCL version, eg 83, 84] (default is 83)
209 TCLINC
+= -I
$(TCL
)/include
214 # RUBY=[Path to Ruby directory]
215 # DYNAMIC_RUBY=yes (to load the Ruby DLL dynamically)
216 # RUBY_VER=[Ruby version, eg 16, 17] (default is 16)
217 # RUBY_VER_LONG=[Ruby version, eg 1.6, 1.7] (default is 1.6)
218 # You must set RUBY_VER_LONG when change RUBY_VER.
233 ifeq ($(RUBY_VER
), 16)
234 RUBY_PLATFORM
= i586-mswin32
236 ifneq ($(wildcard $(RUBY
)/lib
/ruby
/$(RUBY_VER_LONG
)/i386-mingw32
),)
237 RUBY_PLATFORM
= i386-mingw32
239 RUBY_PLATFORM
= i386-mswin32
244 ifndef RUBY_INSTALL_NAME
245 ifeq ($(RUBY_VER
), 16)
246 RUBY_INSTALL_NAME
= mswin32-ruby
$(RUBY_VER
)
248 RUBY_INSTALL_NAME
= msvcrt-ruby
$(RUBY_VER
)
252 RUBYINC
=-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
)
253 ifeq (no
, $(DYNAMIC_RUBY
))
254 RUBYLIB
= -L
$(RUBY
)/lib
-l
$(RUBY_INSTALL_NAME
)
259 # See feature.h for a list of options.
260 # Any other defines can be included here.
261 DEF_GUI
=-DFEAT_GUI_W32
-DFEAT_CLIPBOARD
262 DEFINES
=-DWIN32
-DWINVER
=$(WINVER
) -D_WIN32_WINNT
=$(WINVER
) \
263 -DHAVE_PATHDEF
-DFEAT_
$(FEATURES
)
265 # cross-compiler prefix:
266 CROSS_COMPILE
= i586-pc-mingw32msvc-
271 # normal (Windows) compilation:
273 ifneq (sh.exe
, $(SHELL
))
283 CC
:= $(CROSS_COMPILE
)gcc
284 WINDRES
:= $(CROSS_COMPILE
)windres
286 #>>>>> end of choices
287 ###########################################################################
289 CFLAGS
= -Iproto
$(DEFINES
) -pipe
-w
-march
=$(ARCH
) -Wall
292 DEFINES
+= -DHAVE_GETTEXT
-DHAVE_LOCALE_H
293 GETTEXTINCLUDE
= $(GETTEXT
)/include
294 GETTEXTLIB
= $(INTLPATH
)
295 ifeq (yes
, $(GETTEXT
))
296 DEFINES
+= -DDYNAMIC_GETTEXT
298 ifdef DYNAMIC_GETTEXT
299 DEFINES
+= -D
$(DYNAMIC_GETTEXT
)
300 ifdef GETTEXT_DYNAMIC
301 DEFINES
+= -DGETTEXT_DYNAMIC
-DGETTEXT_DLL
=\"$(GETTEXT_DYNAMIC
)\"
308 CFLAGS
+= -I
$(PERLLIBS
) -DFEAT_PERL
-L
$(PERLLIBS
)
309 ifeq (yes
, $(DYNAMIC_PERL
))
310 CFLAGS
+= -DDYNAMIC_PERL
-DDYNAMIC_PERL_DLL
=\"perl
$(PERL_VER
).dll
\"
315 CFLAGS
+= -I
$(LUA
)/include -DFEAT_LUA
316 ifeq (yes
, $(DYNAMIC_LUA
))
317 CFLAGS
+= -DDYNAMIC_LUA
-DDYNAMIC_LUA_DLL
=\"lua
$(LUA_VER
).dll
\"
322 CFLAGS
+= -I
$(MZSCHEME
)/include -DFEAT_MZSCHEME
-DMZSCHEME_COLLECTS
=\"$(MZSCHEME
)/collects
\"
323 ifeq (yes
, $(DYNAMIC_MZSCHEME
))
324 CFLAGS
+= -DDYNAMIC_MZSCHEME
-DDYNAMIC_MZSCH_DLL
=\"libmzsch
$(MZSCHEME_VER
).dll
\" -DDYNAMIC_MZGC_DLL
=\"libmzgc
$(MZSCHEME_VER
).dll
\"
329 CFLAGS
+= -DFEAT_RUBY
$(RUBYINC
)
330 ifeq (yes
, $(DYNAMIC_RUBY
))
331 CFLAGS
+= -DDYNAMIC_RUBY
-DDYNAMIC_RUBY_DLL
=\"$(RUBY_INSTALL_NAME
).dll
\"
332 CFLAGS
+= -DDYNAMIC_RUBY_VER
=$(RUBY_VER
)
337 CFLAGS
+= -DFEAT_PYTHON
$(PYTHONINC
)
338 ifeq (yes
, $(DYNAMIC_PYTHON
))
339 CFLAGS
+= -DDYNAMIC_PYTHON
-DDYNAMIC_PYTHON_DLL
=\"python
$(PYTHON_VER
).dll
\"
344 CFLAGS
+= -DFEAT_TCL
$(TCLINC
)
345 ifeq (yes
, $(DYNAMIC_TCL
))
346 CFLAGS
+= -DDYNAMIC_TCL
-DDYNAMIC_TCL_DLL
=\"tcl
$(TCL_VER
).dll
\"
350 ifeq ($(POSTSCRIPT
),yes
)
355 DEFINES
+= -DFEAT_OLE
359 DEFINES
+= -DFEAT_CSCOPE
362 ifeq ($(NETBEANS
),yes
)
363 # Only allow NETBEANS for a GUI build.
365 DEFINES
+= -DFEAT_NETBEANS_INTG
367 ifeq ($(NBDEBUG
), yes
)
369 NBDEBUG_INCL
= nbdebug.h
370 NBDEBUG_SRC
= nbdebug.c
376 # Only allow XPM for a GUI build.
378 CFLAGS
+= -DFEAT_XPM_W32
-I
$(XPM
)/include
383 CFLAGS
+= -g
-fstack-check
386 ifeq ($(OPTIMIZE
), SIZE
)
389 ifeq ($(OPTIMIZE
), MAXSPEED
)
391 CFLAGS
+= -fomit-frame-pointer
-freg-struct-return
399 LIB
= -lkernel32
-luser32
-lgdi32
-ladvapi32
-lcomdlg32
-lcomctl32
-lversion
400 GUIOBJ
= $(OUTDIR
)/gui.o
$(OUTDIR
)/gui_w32.o
$(OUTDIR
)/gui_beval.o
$(OUTDIR
)/os_w32exe.o
403 $(OUTDIR
)/charset.o \
405 $(OUTDIR
)/digraph.o \
408 $(OUTDIR
)/ex_cmds.o \
409 $(OUTDIR
)/ex_cmds2.o \
410 $(OUTDIR
)/ex_docmd.o \
411 $(OUTDIR
)/ex_eval.o \
412 $(OUTDIR
)/ex_getln.o \
415 $(OUTDIR
)/getchar.o \
416 $(OUTDIR
)/hardcopy.o \
417 $(OUTDIR
)/hashtab.o \
420 $(OUTDIR
)/memfile.o \
421 $(OUTDIR
)/memline.o \
423 $(OUTDIR
)/message.o \
431 $(OUTDIR
)/os_win32.o \
432 $(OUTDIR
)/os_mswin.o \
433 $(OUTDIR
)/pathdef.o \
434 $(OUTDIR
)/popupmnu.o \
435 $(OUTDIR
)/quickfix.o \
445 $(OUTDIR
)/version.o \
450 OBJ
+= $(OUTDIR
)/if_perl.o
453 OBJ
+= $(OUTDIR
)/if_lua.o
456 OBJ
+= $(OUTDIR
)/if_mzsch.o
457 MZSCHEME_INCL
= if_mzsch.h
458 ifeq (yes
,$(MZSCHEME_GENERATE_BASE
))
459 CFLAGS
+= -DINCLUDE_MZSCHEME_BASE
460 MZ_EXTRA_DEP
+= mzscheme_base.c
462 ifeq (yes
,$(MZSCHEME_PRECISE_GC
))
463 CFLAGS
+= -DMZ_PRECISE_GC
467 OBJ
+= $(OUTDIR
)/if_python.o
470 OBJ
+= $(OUTDIR
)/if_ruby.o
473 OBJ
+= $(OUTDIR
)/if_tcl.o
476 OBJ
+= $(OUTDIR
)/if_cscope.o
478 ifeq ($(NETBEANS
),yes
)
479 # Only allow NETBEANS for a GUI build.
481 OBJ
+= $(OUTDIR
)/netbeans.o
486 # Only allow XPM for a GUI build.
488 OBJ
+= $(OUTDIR
)/xpm_w32.o
489 # You'll need libXpm.a from http://gnuwin32.sf.net
490 LIB
+= -L
$(XPM
)/lib
-lXpm
500 TARGET
:= gvim
$(DEBUG_SUFFIX
).exe
501 DEFINES
+= $(DEF_GUI
)
504 OUTDIR
= gobj
$(DEBUG_SUFFIX
)$(MZSCHEME_SUFFIX
)
506 TARGET
:= vim
$(DEBUG_SUFFIX
).exe
507 OUTDIR
= obj
$(DEBUG_SUFFIX
)$(MZSCHEME_SUFFIX
)
511 ifneq (yes
, $(GETTEXT
))
512 CFLAGS
+= -I
$(GETTEXTINCLUDE
)
513 ifndef STATIC_GETTEXT
514 LIB
+= -L
$(GETTEXTLIB
) -l
$(INTLLIB
)
515 ifeq (USE_SAFE_GETTEXT_DLL
, $(DYNAMIC_GETTEXT
))
516 OBJ
+=$(SAFE_GETTEXT_DLL_OBJ
)
519 LIB
+= -L
$(GETTEXTLIB
) -lintl
525 ifeq (no
, $(DYNAMIC_PERL
))
526 LIB
+= -lperl
$(PERL_VER
)
532 ifeq (yes
, $(DYNAMIC_TCL
))
533 LIB
+= -ltclstub
$(TCL_VER
)
535 LIB
+= -ltcl
$(TCL_VER
)
540 LIB
+= -loleaut32
-lstdc
++
541 OBJ
+= $(OUTDIR
)/if_ole.o
545 DEFINES
+= -DFEAT_MBYTE
549 DEFINES
+= -DFEAT_MBYTE_IME
550 ifeq (yes
, $(DYNAMIC_IME
))
551 DEFINES
+= -DDYNAMIC_IME
558 ifneq (yes
, $(ICONV
))
562 DEFINES
+=-DDYNAMIC_ICONV
565 all: $(TARGET
) vimrun.exe xxd
/xxd.exe
install.exe uninstal.exe GvimExt
/gvimext.dll
568 $(CC
) $(CFLAGS
) -o vimrun.exe vimrun.c
$(LIB
)
570 install.exe
: dosinst.c
571 $(CC
) $(CFLAGS
) -o
install.exe dosinst.c
$(LIB
) -lole32
-luuid
573 uninstal.exe
: uninstal.c
574 $(CC
) $(CFLAGS
) -o uninstal.exe uninstal.c
$(LIB
)
576 $(TARGET
): $(OUTDIR
) $(OBJ
)
577 $(CC
) $(CFLAGS
) $(LFLAGS
) -o
$@
$(OBJ
) $(LIB
) -lole32
-luuid
$(LUA_LIB
) $(MZSCHEME_LIBDIR
) $(MZSCHEME_LIB
) $(PYTHONLIB
) $(RUBYLIB
)
583 xxd
/xxd.exe
: xxd
/xxd.c
584 $(MAKE
) -C xxd
-f Make_cyg.mak CC
=$(CC
)
586 GvimExt
/gvimext.dll
: GvimExt
/gvimext.
cpp GvimExt
/gvimext.rc GvimExt
/gvimext.h
587 $(MAKE
) -C GvimExt
-f Make_ming.mak CROSS
=$(CROSS
) CROSS_COMPILE
=$(CROSS_COMPILE
)
590 -$(DEL
) $(OUTDIR
)$(DIRSLASH
)*.o
591 -$(DEL
) $(OUTDIR
)$(DIRSLASH
)*.res
599 -$(DEL
) mzscheme_base.c
601 $(MAKE
) -C GvimExt
-f Make_ming.mak
clean
602 $(MAKE
) -C xxd
-f Make_cyg.mak
clean
604 ###########################################################################
605 INCL
= vim.h feature.h os_win32.h os_dos.h ascii.h keymap.h term.h macros.h \
606 structs.h regexp.h option.h ex_cmds.h proto.h globals.h farsi.h \
609 $(OUTDIR
)/%.o
: %.c
$(INCL
)
610 $(CC
) -c
$(CFLAGS
) $< -o
$@
612 $(OUTDIR
)/vimres.res
: vim.rc version.h gui_w32_rc.h
613 $(WINDRES
) $(DEFINES
) vim.rc
$(OUTDIR
)/vimres.res
615 $(OUTDIR
)/vimrc.o
: $(OUTDIR
)/vimres.res
616 $(WINDRES
) $(OUTDIR
)/vimres.res
$(OUTDIR
)/vimrc.o
621 $(OUTDIR
)/ex_docmd.o
: ex_docmd.c
$(INCL
) ex_cmds.h
622 $(CC
) -c
$(CFLAGS
) ex_docmd.c
-o
$(OUTDIR
)/ex_docmd.o
624 $(OUTDIR
)/ex_eval.o
: ex_eval.c
$(INCL
) ex_cmds.h
625 $(CC
) -c
$(CFLAGS
) ex_eval.c
-o
$(OUTDIR
)/ex_eval.o
627 $(OUTDIR
)/if_cscope.o
: if_cscope.c
$(INCL
) if_cscope.h
628 $(CC
) -c
$(CFLAGS
) if_cscope.c
-o
$(OUTDIR
)/if_cscope.o
630 # Remove -D__IID_DEFINED__ for newer versions of the w32api
631 $(OUTDIR
)/if_ole.o
: if_ole.
cpp $(INCL
)
632 $(CC
) $(CFLAGS
) -c
-o
$(OUTDIR
)/if_ole.o if_ole.
cpp
634 $(OUTDIR
)/if_ruby.o
: if_ruby.c
$(INCL
)
636 $(CC
) $(CFLAGS
) -U_WIN32
-c
-o
$(OUTDIR
)/if_ruby.o if_ruby.c
639 if_perl.c
: if_perl.xs typemap
640 perl
$(PERLLIB
)/ExtUtils
/xsubpp
-prototypes
-typemap \
641 $(PERLLIB
)/ExtUtils
/typemap if_perl.xs
> $@
643 $(OUTDIR
)/netbeans.o
: netbeans.c
$(INCL
) $(NBDEBUG_INCL
) $(NBDEBUG_SRC
)
644 $(CC
) -c
$(CFLAGS
) netbeans.c
-o
$(OUTDIR
)/netbeans.o
646 $(OUTDIR
)/if_mzsch.o
: if_mzsch.c
$(INCL
) if_mzsch.h
$(MZ_EXTRA_DEP
)
647 $(CC
) -c
$(CFLAGS
) if_mzsch.c
-o
$(OUTDIR
)/if_mzsch.o
650 $(MZSCHEME
)/mzc
--c-mods mzscheme_base.c
++lib scheme
/base
653 ifneq (sh.exe
, $(SHELL
))
654 @echo creating pathdef.c
655 @echo
'/* pathdef.c */' > pathdef.c
656 @echo
'#include "vim.h"' >> pathdef.c
657 @echo
'char_u *default_vim_dir = (char_u *)"$(VIMRCLOC)";' >> pathdef.c
658 @echo
'char_u *default_vimruntime_dir = (char_u *)"$(VIMRUNTIMEDIR)";' >> pathdef.c
659 @echo
'char_u *all_cflags = (char_u *)"$(CC) $(CFLAGS)";' >> pathdef.c
660 @echo
'char_u *all_lflags = (char_u *)"$(CC) $(CFLAGS) $(LFLAGS) -o $(TARGET) $(LIB) -lole32 -luuid $(LUA_LIB) $(MZSCHEME_LIBDIR) $(MZSCHEME_LIB) $(PYTHONLIB) $(RUBYLIB)";' >> pathdef.c
661 @echo
'char_u *compiled_user = (char_u *)"$(USERNAME)";' >> pathdef.c
662 @echo
'char_u *compiled_sys = (char_u *)"$(USERDOMAIN)";' >> pathdef.c
664 @echo creating pathdef.c
665 @echo
/* pathdef.c
*/ > pathdef.c
666 @echo
#include "vim.h" >> pathdef.c
667 @echo char_u
*default_vim_dir
= (char_u
*)"$(VIMRCLOC)"; >> pathdef.c
668 @echo char_u
*default_vimruntime_dir
= (char_u
*)"$(VIMRUNTIMEDIR)"; >> pathdef.c
669 @echo char_u
*all_cflags = (char_u
*)"$(CC) $(CFLAGS)"; >> pathdef.c
670 @echo char_u
*all_lflags
= (char_u
*)"$(CC) $(CFLAGS) $(LFLAGS) -o $(TARGET) $(LIB) -lole32 -luuid $(LUA_LIB) $(MZSCHEME_LIBDIR) $(MZSCHEME_LIB) $(PYTHONLIB) $(RUBYLIB)"; >> pathdef.c
671 @echo char_u
*compiled_user
= (char_u
*)"$(USERNAME)"; >> pathdef.c
672 @echo char_u
*compiled_sys
= (char_u
*)"$(USERDOMAIN)"; >> pathdef.c