comparison src/Make_cyg.mak @ 7:3fc0f57ecb91 v7.0001

updated for version 7.0001
author vimboss
date Sun, 13 Jun 2004 20:20:40 +0000
parents
children bdeee1504ac1
comparison
equal deleted inserted replaced
6:c2daee826b8f 7:3fc0f57ecb91
1 #
2 # Makefile for VIM on Win32, using Cygnus gcc
3 # Last updated by Dan Sharp. Last Change: 2004 Apr 23
4 #
5 # This compiles Vim as a Windows application. If you want Vim to run as a
6 # Cygwin application use the Makefile (just like on Unix).
7 #
8 # GUI no or yes: set to yes if you want the GUI version (yes)
9 # PERL define to path to Perl dir to get Perl support (not defined)
10 # PERL_VER define to version of Perl being used (56)
11 # DYNAMIC_PERL no or yes: set to yes to load the Perl DLL dynamically (yes)
12 # PYTHON define to path to Python dir to get PYTHON support (not defined)
13 # PYTHON_VER define to version of Python being used (22)
14 # DYNAMIC_PYTHON no or yes: use yes to load the Python DLL dynamically (yes)
15 # TCL define to path to TCL dir to get TCL support (not defined)
16 # TCL_VER define to version of TCL being used (83)
17 # DYNAMIC_TCL no or yes: use yes to load the TCL DLL dynamically (yes)
18 # RUBY define to path to Ruby dir to get Ruby support (not defined)
19 # RUBY_VER define to version of Ruby being used (16)
20 # DYNAMIC_RUBY no or yes: use yes to load the Ruby DLL dynamically (yes)
21 # GETTEXT no or yes: set to yes for dynamic gettext support (yes)
22 # ICONV no or yes: set to yes for dynamic iconv support (yes)
23 # MBYTE no or yes: set to yes to include multibyte support (yes)
24 # IME no or yes: set to yes to include IME support (yes)
25 # DYNAMIC_IME no or yes: set to yes to load imm32.dll dynamically (yes)
26 # OLE no or yes: set to yes to make OLE gvim (no)
27 # DEBUG no or yes: set to yes if you wish a DEBUGging build (no)
28 # CPUNR i386 through pentium4: select -mcpu argument to compile with (i386)
29 # ARCH i386 through pentium4: select -march argument to compile with (i386)
30 # USEDLL no or yes: set to yes to use the Runtime library DLL (no)
31 # For USEDLL=yes the cygwin1.dll is required to run Vim.
32 # POSTSCRIPT no or yes: set to yes for PostScript printing (no)
33 # FEATURES TINY, SMALL, NORMAL, BIG or HUGE (BIG)
34 # WINVER Lowest Win32 version to support. (0x0400)
35 # CSCOPE no or yes: to include cscope interface support (yes)
36 # OPTIMIZE SPACE, SPEED, or MAXSPEED: set optimization level (MAXSPEED)
37 # NETBEANS no or yes: to include netbeans interface support (yes when GUI
38 # is yes)
39 # XPM define to path to XPM dir to get XPM image support (not defined)
40 #>>>>> choose options:
41 ifndef GUI
42 GUI=yes
43 endif
44
45 ifndef FEATURES
46 FEATURES = BIG
47 endif
48
49 ifndef GETTEXT
50 GETTEXT = yes
51 endif
52
53 ifndef ICONV
54 ICONV = yes
55 endif
56
57 ifndef MBYTE
58 MBYTE = yes
59 endif
60
61 ifndef IME
62 IME = yes
63 endif
64
65 ifndef CPUNR
66 CPUNR = i386
67 endif
68
69 ifndef ARCH
70 ARCH = i386
71 endif
72
73 ifndef WINVER
74 WINVER = 0x0400
75 endif
76
77 ifndef CSCOPE
78 CSCOPE = yes
79 endif
80
81 ifndef NETBEANS
82 ifeq ($(GUI),yes)
83 NETBEANS = yes
84 endif
85 endif
86
87 ifndef OPTIMIZE
88 OPTIMIZE = MAXSPEED
89 endif
90
91 ### See feature.h for a list of optionals.
92 ### Any other defines can be included here.
93
94 DEFINES = -DWIN32 -DHAVE_PATHDEF -DFEAT_$(FEATURES) \
95 -DWINVER=$(WINVER) -D_WIN32_WINNT=$(WINVER)
96 INCLUDES = -mcpu=$(CPUNR) -march=$(ARCH) -Iproto
97
98 #>>>>> name of the compiler and linker, name of lib directory
99 CC = gcc
100 RC = windres
101
102 ##############################
103 # DYNAMIC_PERL=yes and no both work
104 ##############################
105 ifdef PERL
106 DEFINES += -DFEAT_PERL
107 INCLUDES += -I$(PERL)/lib/CORE
108 EXTRA_OBJS += $(OUTDIR)/if_perl.o
109
110 ifndef DYNAMIC_PERL
111 DYNAMIC_PERL = yes
112 endif
113
114 ifndef PERL_VER
115 PERL_VER = 56
116 endif
117
118 ifeq (yes, $(DYNAMIC_PERL))
119 DEFINES += -DDYNAMIC_PERL -DDYNAMIC_PERL_DLL=\"perl$(PERL_VER).dll\"
120 else
121 EXTRA_LIBS += $(PERL)/lib/CORE/perl$(PERL_VER).lib
122 endif
123 endif
124
125 ##############################
126 # DYNAMIC_PYTHON=yes works.
127 # DYNAMIC_PYTHON=no does not (unresolved externals on link).
128 ##############################
129 ifdef PYTHON
130 DEFINES += -DFEAT_PYTHON
131 INCLUDES += -I$(PYTHON)/include
132 EXTRA_OBJS += $(OUTDIR)/if_python.o
133
134 ifndef DYNAMIC_PYTHON
135 DYNAMIC_PYTHON = yes
136 endif
137
138 ifndef PYTHON_VER
139 PYTHON_VER = 22
140 endif
141
142 ifeq (yes, $(DYNAMIC_PYTHON))
143 DEFINES += -DDYNAMIC_PYTHON -DDYNAMIC_PYTHON_DLL=\"python$(PYTHON_VER).dll\"
144 else
145 EXTRA_LIBS += $(PYTHON)/libs/python$(PYTHON_VER).lib
146 endif
147 endif
148
149 ##############################
150 # DYNAMIC_RUBY=yes works.
151 # DYNAMIC_RUBY=no does not (process exits).
152 ##############################
153 ifdef RUBY
154
155 ifndef RUBY_VER
156 RUBY_VER=16
157 endif
158
159 ifndef RUBY_VER_LONG
160 RUBY_VER_LONG=1.6
161 endif
162
163 ifndef DYNAMIC_RUBY
164 DYNAMIC_RUBY = yes
165 endif
166
167 ifeq ($(RUBY_VER), 16)
168 ifndef RUBY_PLATFORM
169 RUBY_PLATFORM = i586-mswin32
170 endif
171 ifndef RUBY_INSTALL_NAME
172 RUBY_INSTALL_NAME = mswin32-ruby$(RUBY_VER)
173 endif
174 else
175 ifndef RUBY_PLATFORM
176 RUBY_PLATFORM = i386-mswin32
177 endif
178 ifndef RUBY_INSTALL_NAME
179 RUBY_INSTALL_NAME = msvcrt-ruby$(RUBY_VER)
180 endif
181 endif
182
183 DEFINES += -DFEAT_RUBY
184 INCLUDES += -I$(RUBY)/lib/ruby/$(RUBY_VER_LONG)/$(RUBY_PLATFORM)
185 EXTRA_OBJS += $(OUTDIR)/if_ruby.o
186
187 ifeq (yes, $(DYNAMIC_RUBY))
188 DEFINES += -DDYNAMIC_RUBY -DDYNAMIC_RUBY_DLL=\"$(RUBY_INSTALL_NAME).dll\"
189 DEFINES += -DDYNAMIC_RUBY_VER=$(RUBY_VER)
190 else
191 EXTRA_LIBS += $(RUBY)/lib/$(RUBY_INSTALL_NAME).lib
192 endif
193 endif
194
195 ##############################
196 # DYNAMIC_TCL=yes and no both work.
197 ##############################
198 ifdef TCL
199 DEFINES += -DFEAT_TCL
200 INCLUDES += -I$(TCL)/include
201 EXTRA_OBJS += $(OUTDIR)/if_tcl.o
202
203 ifndef DYNAMIC_TCL
204 DYNAMIC_TCL = yes
205 endif
206
207 ifndef TCL_VER
208 TCL_VER = 83
209 endif
210
211 ifeq (yes, $(DYNAMIC_TCL))
212 DEFINES += -DDYNAMIC_TCL -DDYNAMIC_TCL_DLL=\"tcl$(TCL_VER).dll\"
213 EXTRA_LIBS += $(TCL)/lib/tclstub$(TCL_VER).lib
214 else
215 EXTRA_LIBS += $(TCL)/lib/tcl$(TCL_VER).lib
216 endif
217 endif
218
219 ##############################
220 ifeq (yes, $(GETTEXT))
221 DEFINES += -DDYNAMIC_GETTEXT
222 endif
223
224 ##############################
225 ifeq (yes, $(ICONV))
226 DEFINES += -DDYNAMIC_ICONV
227 endif
228
229 ##############################
230 ifeq (yes, $(MBYTE))
231 DEFINES += -DFEAT_MBYTE
232 endif
233
234 ##############################
235 ifeq (yes, $(IME))
236 DEFINES += -DFEAT_MBYTE_IME
237
238 ifndef DYNAMIC_IME
239 DYNAMIC_IME = yes
240 endif
241
242 ifeq (yes, $(DYNAMIC_IME))
243 DEFINES += -DDYNAMIC_IME
244 else
245 EXTRA_LIBS += -limm32
246 endif
247 endif
248
249 ##############################
250 ifeq (yes, $(DEBUG))
251 DEFINES += -DDEBUG
252 INCLUDES += -g -fstack-check
253 DEBUG_SUFFIX = d
254 else
255
256 ifeq ($(OPTIMIZE), SIZE)
257 OPTFLAG = -Os
258 else
259 ifeq ($(OPTIMIZE), MAXSPEED)
260 OPTFLAG = -O3 -fomit-frame-pointer -freg-struct-return -malign-double
261 else
262 OPTFLAG = -O2
263 endif
264 endif
265
266 # A bug in the GCC <= 3.2 optimizer can cause a crash. The
267 # following option removes the problem optimization.
268 OPTFLAG += -fno-strength-reduce
269
270 INCLUDES += -s
271
272 endif
273
274 ##############################
275 # USEDLL=yes will build a Cygwin32 executable that relies on cygwin1.dll.
276 # USEDLL=no will build a Mingw32 executable with no extra dll dependencies.
277 ##############################
278 ifeq (yes, $(USEDLL))
279 DEFINES += -D_MAX_PATH=256 -D__CYGWIN__
280 else
281 INCLUDES += -mno-cygwin
282 endif
283
284 ##############################
285 ifeq (yes, $(POSTSCRIPT))
286 DEFINES += -DMSWINPS
287 endif
288
289 ##############################
290 ifeq (yes, $(CSCOPE))
291 DEFINES += -DFEAT_CSCOPE
292 EXTRA_OBJS += $(OUTDIR)/if_cscope.o
293 endif
294
295 ##############################
296 ifeq (yes, $(NETBEANS))
297 DEFINES += -DFEAT_NETBEANS_INTG
298 EXTRA_OBJS += $(OUTDIR)/netbeans.o $(OUTDIR)/gui_beval.o
299 EXTRA_LIBS += -lwsock32
300
301 ifeq (yes, $(DEBUG))
302 DEFINES += -DNBDEBUG
303 NBDEBUG_DEP = nbdebug.h nbdebug.c
304 endif
305
306 endif
307
308 ##############################
309 ifdef XPM
310 DEFINES += -DFEAT_XPM_W32
311 INCLUDES += -I$(XPM)/include
312 EXTRA_OBJS += $(OUTDIR)/xpm_w32.o
313 EXTRA_LIBS += -L$(XPM)/lib -lXpm
314 endif
315
316 ##############################
317 ifeq (yes, $(OLE))
318 DEFINES += -DFEAT_OLE
319 EXTRA_OBJS += $(OUTDIR)/if_ole.o
320 EXTRA_LIBS += -loleaut32 -lstdc++
321 endif
322
323 ##############################
324 ifeq ($(GUI),yes)
325 EXE = gvim$(DEBUG_SUFFIX).exe
326 OUTDIR = gobj$(DEBUG_SUFFIX)
327 DEFINES += -DFEAT_GUI_W32 -DFEAT_CLIPBOARD
328 EXTRA_OBJS += $(OUTDIR)/gui.o $(OUTDIR)/gui_w32.o $(OUTDIR)/os_w32exe.o
329 EXTRA_LIBS += -mwindows -lcomctl32
330 else
331 EXE = vim$(DEBUG_SUFFIX).exe
332 OUTDIR = obj$(DEBUG_SUFFIX)
333 LIBS += -luser32 -lgdi32 -lcomdlg32
334 endif
335
336 ##############################
337 ifneq (sh.exe, $(SHELL))
338 DEL = rm
339 DIRSLASH = /
340 else
341 DEL = del
342 DIRSLASH = \\
343 endif
344
345 #>>>>> end of choices
346 ###########################################################################
347
348 INCL = vim.h globals.h option.h keymap.h macros.h ascii.h term.h os_win32.h \
349 structs.h version.h
350
351 CFLAGS = $(OPTFLAG) $(DEFINES) $(INCLUDES)
352
353 RCFLAGS = -O coff $(DEFINES)
354
355 OBJ = \
356 $(OUTDIR)/buffer.o \
357 $(OUTDIR)/charset.o \
358 $(OUTDIR)/diff.o \
359 $(OUTDIR)/digraph.o \
360 $(OUTDIR)/edit.o \
361 $(OUTDIR)/eval.o \
362 $(OUTDIR)/ex_cmds.o \
363 $(OUTDIR)/ex_cmds2.o \
364 $(OUTDIR)/ex_docmd.o \
365 $(OUTDIR)/ex_eval.o \
366 $(OUTDIR)/ex_getln.o \
367 $(OUTDIR)/fileio.o \
368 $(OUTDIR)/fold.o \
369 $(OUTDIR)/getchar.o \
370 $(OUTDIR)/main.o \
371 $(OUTDIR)/mark.o \
372 $(OUTDIR)/memfile.o \
373 $(OUTDIR)/memline.o \
374 $(OUTDIR)/menu.o \
375 $(OUTDIR)/message.o \
376 $(OUTDIR)/misc1.o \
377 $(OUTDIR)/misc2.o \
378 $(OUTDIR)/move.o \
379 $(OUTDIR)/mbyte.o \
380 $(OUTDIR)/normal.o \
381 $(OUTDIR)/ops.o \
382 $(OUTDIR)/option.o \
383 $(OUTDIR)/os_win32.o \
384 $(OUTDIR)/os_mswin.o \
385 $(OUTDIR)/pathdef.o \
386 $(OUTDIR)/quickfix.o \
387 $(OUTDIR)/regexp.o \
388 $(OUTDIR)/screen.o \
389 $(OUTDIR)/search.o \
390 $(OUTDIR)/syntax.o \
391 $(OUTDIR)/tag.o \
392 $(OUTDIR)/term.o \
393 $(OUTDIR)/ui.o \
394 $(OUTDIR)/undo.o \
395 $(OUTDIR)/version.o \
396 $(OUTDIR)/vimrc.o \
397 $(OUTDIR)/window.o \
398 $(EXTRA_OBJS)
399
400 all: $(EXE) xxd/xxd.exe vimrun.exe install.exe uninstal.exe GvimExt/gvimext.dll
401
402 # According to the Cygwin doc 1.2 FAQ, kernel32 should not be specified for
403 # linking unless calling ld directly.
404 # See /usr/doc/cygwin-doc-1.2/html/faq_toc.html#TOC93 for more information.
405 $(EXE): $(OUTDIR) $(OBJ)
406 $(CC) $(CFLAGS) -o $(EXE) $(OBJ) $(LIBS) -luuid -lole32 $(EXTRA_LIBS)
407
408 xxd/xxd.exe: xxd/xxd.c
409 $(MAKE) -C xxd -f Make_cyg.mak USEDLL=$(USEDLL)
410
411 GvimExt/gvimext.dll: GvimExt/gvimext.cpp GvimExt/gvimext.rc GvimExt/gvimext.h
412 $(MAKE) -C GvimExt -f Make_ming.mak
413
414 vimrun.exe: vimrun.c
415 $(CC) $(CFLAGS) -o vimrun.exe vimrun.c $(LIBS)
416
417 install.exe: dosinst.c
418 $(CC) $(CFLAGS) -o install.exe dosinst.c $(LIBS) -luuid -lole32
419
420 uninstal.exe: uninstal.c
421 $(CC) $(CFLAGS) -o uninstal.exe uninstal.c $(LIBS)
422
423 $(OUTDIR):
424 mkdir $(OUTDIR)
425
426 tags:
427 command /c ctags *.c $(INCL)
428
429 clean:
430 -$(DEL) $(OUTDIR)$(DIRSLASH)*.o
431 -rmdir $(OUTDIR)
432 -$(DEL) *.exe
433 ifdef PERL
434 -$(DEL) if_perl.c
435 endif
436 -$(DEL) pathdef.c
437 $(MAKE) -C xxd -f Make_cyg.mak clean
438 $(MAKE) -C GvimExt -f Make_ming.mak clean
439
440 ###########################################################################
441
442 $(OUTDIR)/%.o : %.c $(INCL)
443 $(CC) -c $(CFLAGS) $< -o $@
444
445 $(OUTDIR)/ex_docmd.o: ex_docmd.c $(INCL) ex_cmds.h
446 $(CC) -c $(CFLAGS) ex_docmd.c -o $(OUTDIR)/ex_docmd.o
447
448 $(OUTDIR)/ex_eval.o: ex_eval.c $(INCL) ex_cmds.h
449 $(CC) -c $(CFLAGS) ex_eval.c -o $(OUTDIR)/ex_eval.o
450
451 $(OUTDIR)/if_cscope.o: if_cscope.c $(INCL) if_cscope.h
452 $(CC) -c $(CFLAGS) if_cscope.c -o $(OUTDIR)/if_cscope.o
453
454 $(OUTDIR)/if_ole.o: if_ole.cpp $(INCL)
455 $(CC) -c $(CFLAGS) -D__IID_DEFINED__ if_ole.cpp -o $(OUTDIR)/if_ole.o
456
457 if_perl.c: if_perl.xs typemap
458 perl $(PERL)/lib/ExtUtils/xsubpp -prototypes -typemap \
459 $(PERL)/lib/ExtUtils/typemap if_perl.xs > $@
460
461 $(OUTDIR)/if_perl.o: if_perl.c $(INCL)
462 ifeq (yes, $(USEDLL))
463 $(CC) -c $(CFLAGS) -I/usr/include/mingw -D__MINGW32__ if_perl.c -o $(OUTDIR)/if_perl.o
464 endif
465
466 $(OUTDIR)/if_ruby.o: if_ruby.c $(INCL)
467 ifeq (16, $(RUBY_VER))
468 $(CC) -c $(CFLAGS) -U_WIN32 if_ruby.c -o $(OUTDIR)/if_ruby.o
469 endif
470
471 $(OUTDIR)/netbeans.o: netbeans.c $(INCL) $(NBDEBUG_DEP)
472 $(CC) -c $(CFLAGS) netbeans.c -o $(OUTDIR)/netbeans.o
473
474 $(OUTDIR)/vimrc.o: vim.rc version.h gui_w32_rc.h
475 $(RC) $(RCFLAGS) vim.rc -o $(OUTDIR)/vimrc.o
476
477 pathdef.c: $(INCL)
478 ifneq (sh.exe, $(SHELL))
479 @echo creating pathdef.c
480 @echo '/* pathdef.c */' > pathdef.c
481 @echo '#include "vim.h"' >> pathdef.c
482 @echo 'char_u *default_vim_dir = (char_u *)"$(VIMRCLOC)";' >> pathdef.c
483 @echo 'char_u *default_vimruntime_dir = (char_u *)"$(VIMRUNTIMEDIR)";' >> pathdef.c
484 @echo 'char_u *all_cflags = (char_u *)"$(CC) $(CFLAGS)";' >> pathdef.c
485 @echo 'char_u *all_lflags = (char_u *)"$(CC) -s -o $(EXE) $(LIBS) -luuid -lole32 $(EXTRA_LIBS)";' >> pathdef.c
486 @echo 'char_u *compiled_user = (char_u *)"$(USERNAME)";' >> pathdef.c
487 @echo 'char_u *compiled_sys = (char_u *)"$(USERDOMAIN)";' >> pathdef.c
488 else
489 @echo creating pathdef.c
490 @echo /* pathdef.c */ > pathdef.c
491 @echo #include "vim.h" >> pathdef.c
492 @echo char_u *default_vim_dir = (char_u *)"$(VIMRCLOC)"; >> pathdef.c
493 @echo char_u *default_vimruntime_dir = (char_u *)"$(VIMRUNTIMEDIR)"; >> pathdef.c
494 @echo char_u *all_cflags = (char_u *)"$(CC) $(CFLAGS)"; >> pathdef.c
495 @echo char_u *all_lflags = (char_u *)"$(CC) -s -o $(EXE) $(LIBS) -luuid -lole32 $(EXTRA_LIBS)"; >> pathdef.c
496 @echo char_u *compiled_user = (char_u *)"$(USERNAME)"; >> pathdef.c
497 @echo char_u *compiled_sys = (char_u *)"$(USERDOMAIN)"; >> pathdef.c
498 endif