merge changes from upstream
[MacVim/jjgod.git] / src / main.aap
blob54debd60766ba2da38793ef902e65b9b4c02aa5e
1 # A-A-P recipe for building Vim
3 # There are no user choices in here!
4 # Put configure arguments in the file config.arg.
5 # Later there will be a config.txt file that contains examples and
6 # explanations.
8 # Optional arguments:
9 #  PREFIX=dir           Overrules the install directory.
10 #                       Can be specified when installing only.
11 #                       Example: aap install PREFIX=$HOME
13 @if os.name != "posix":
14     :error Sorry, this recipe only works for Unix-like systems.
16 # Skip the configure stuff when "link.sh" is executing this recipe recursively
17 # to build pathdef.c or not building something and auto/config.aap does exist.
18 @if ((_no.TARGETARG != "pathdef" and has_build_target())
19 @       or not os.path.exists("auto/config.aap")):
21     #
22     # A U T O C O N F
23     #
25     # Run autoconf when configure.in has been changed since it was last run.
26     # This is skipped when the signatures in "mysign" are up-to-date.  When
27     # there is no autoconf program skip this (the signature is often the only
28     # thing that's outdated)
29     auto/configure {signfile = mysign} : configure.in
30         @if not program_path("autoconf"):
31             :print Can't find autoconf, using existing configure script.
32         @else:
33             # Move configure aside, autoconf would overwrite it
34             :move {exist} configure configure.save
35             :sys autoconf
36             :cat configure | :eval re.sub('\\./config.log', 'auto/config.log', stdin) | :eval re.sub('>config.log', '>auto/config.log', stdin) >! auto/configure
37             :chmod 755 auto/configure
38             :move configure.save configure
39             :del {force} auto/config.cache auto/config.status
41     # Change the configure script to produce config.aap instead of config.mk.
42     auto/configure.aap : auto/configure
43         :print Adjusting auto/configure for A-A-P.
44         :cat auto/configure | :eval re.sub("config.mk", "config.aap", stdin)
45                                                         >! auto/configure.aap
46         :chmod 755 auto/configure.aap
48     # The configure script uses the directory where it's located, use a link.
49     configure.aap:  {buildcheck=}
50         :symlink {f} auto/configure.aap configure.aap
52     # Dependency: run configure.aap to update config.h and config.aap in the
53     # "auto" directory.
54     # NOTE: we can only build for one architecture, because -MM doesn't work
55     # when building for both.
56     config {virtual} auto/config.h auto/config.aap :
57                          auto/configure.aap configure.aap
58                          config.arg config.h.in config.aap.in
59         # Use "uname -a" to detect the architecture of the system.
60         @ok, uname = redir_system('uname -a', 0)
61         @if string.find(uname, "i386") >= 0:
62         @   arch = "i386"
63         @else:
64         @   arch = "ppc"
65         :print Building for $arch system
66         :sys CONFIG_STATUS=auto/config.status
67                 ./configure.aap `file2string("config.arg")`
68                     --with-mac-arch=$arch
69                     --cache-file=auto/config.cache
71     # Configure arguments: create an empty "config.arg" file when its missing
72     config.arg:
73         :touch {exist} config.arg
75     # "auto/config.aap" contains a lot of settings, such as the name of the
76     # executable "Target".
77     # First update it, forcefully if the "reconfig" target was used.
78     @if _no.TARGETARG != "comment" and _no.TARGETARG != "make":
79         @if "reconfig" in var2list(_no.TARGETARG):
80             :del {force} auto/config.cache auto/config.status
81             :update {force} auto/config.aap
82         @else:
83             :update auto/config.aap
85 # Include the recipe that autoconf generated.
86 :include auto/config.aap
88 # Unfortunately "-M" doesn't work when building for two architectures.  Switch
89 # back to PPC only.
90 @if string.find(_no.CPPFLAGS, "-arch i386 -arch ppc") >= 0:
91     CPPFLAGS = `string.replace(_no.CPPFLAGS, "-arch i386 -arch ppc", "-arch ppc")`
93 # A "PREFIX=dir" argument overrules the value of $prefix
94 # But don't use the default "/usr/local".
95 @if _no.get("PREFIX") and _no.get("PREFIX") != '/usr/local':
96     prefix = $PREFIX
98 # Don't want "~/" in prefix.
99 prefix = `os.path.expanduser(prefix)`
101 # For Mac.
102 APPDIR = $(VIMNAME).app
104 ### Names of the programs and targets
105 VIMTARGET       = $VIMNAME$EXESUF
106 EXTARGET        = $EXNAME$LNKSUF
107 VIEWTARGET      = $VIEWNAME$LNKSUF
108 GVIMNAME        = g$VIMNAME
109 GVIMTARGET      = $GVIMNAME$LNKSUF
110 GVIEWNAME       = g$VIEWNAME
111 GVIEWTARGET     = $GVIEWNAME$LNKSUF
112 RVIMNAME        = r$VIMNAME
113 RVIMTARGET      = $RVIMNAME$LNKSUF
114 RVIEWNAME       = r$VIEWNAME
115 RVIEWTARGET     = $RVIEWNAME$LNKSUF
116 RGVIMNAME       = r$GVIMNAME
117 RGVIMTARGET     = $RGVIMNAME$LNKSUF
118 RGVIEWNAME      = r$GVIEWNAME
119 RGVIEWTARGET    = $RGVIEWNAME$LNKSUF
120 VIMDIFFNAME     = $(VIMNAME)diff
121 GVIMDIFFNAME    = g$VIMDIFFNAME
122 VIMDIFFTARGET   = $VIMDIFFNAME$LNKSUF
123 GVIMDIFFTARGET  = $GVIMDIFFNAME$LNKSUF
124 EVIMNAME        = e$VIMNAME
125 EVIMTARGET      = $EVIMNAME$LNKSUF
126 EVIEWNAME       = e$VIEWNAME
127 EVIEWTARGET     = $EVIEWNAME$LNKSUF
130 # G U I  variant
132 # The GUI is selected by configure, a lot of other things depend on it.
134 :variant GUI
135     GTK
136         GUI_SRC         = gui.c gui_gtk.c gui_gtk_x11.c pty.c gui_beval.c
137                             gui_gtk_f.c
138         GUI_OBJ         =
139         GUI_DEFS        = -DFEAT_GUI_GTK $NARROW_PROTO
140         GUI_IPATH       = $GUI_INC_LOC
141         GUI_LIBS_DIR    = $GUI_LIB_LOC
142         GUI_LIBS1       =
143         GUI_LIBS2       = $GTK_LIBNAME
144         GUI_INSTALL     = install_normal
145         GUI_TARGETS     = installglinks
146         GUI_MAN_TARGETS = yes
147         GUI_TESTTARGET  = gui
148         GUI_BUNDLE      =
149         GUI_TESTARG     =
150     MOTIF
151         GUI_SRC         = gui.c gui_motif.c gui_x11.c pty.c gui_beval.c
152                           gui_xmdlg.c gui_xmebw.c
153         GUI_OBJ         =
154         GUI_DEFS        = -DFEAT_GUI_MOTIF $NARROW_PROTO
155         GUI_IPATH       = $GUI_INC_LOC
156         GUI_LIBS_DIR    = $GUI_LIB_LOC
157         GUI_LIBS1       =
158         GUI_LIBS2       = $MOTIF_LIBNAME -lXt
159         GUI_INSTALL     = install_normal
160         GUI_TARGETS     = installglinks
161         GUI_MAN_TARGETS = yes
162         GUI_TESTTARGET  = gui
163         GUI_BUNDLE      =
164         GUI_TESTARG     =
165     ATHENA
166         # XAW_LIB et al. can be overruled to use Xaw3d widgets
167         XAW_LIB         ?= -lXaw
168         GUI_SRC         =  gui.c gui_athena.c gui_x11.c pty.c gui_beval.c \
169                             gui_at_sb.c gui_at_fs.c
170         GUI_OBJ         =
171         GUI_DEFS        = -DFEAT_GUI_ATHENA $NARROW_PROTO
172         GUI_IPATH       = $GUI_INC_LOC
173         GUI_LIBS_DIR    = $GUI_LIB_LOC
174         GUI_LIBS1       = $XAW_LIB
175         GUI_LIBS2       = -lXt
176         GUI_INSTALL     = install_normal
177         GUI_TARGETS     = installglinks
178         GUI_MAN_TARGETS = yes
179         GUI_TESTTARGET  = gui
180         GUI_BUNDLE      =
181         GUI_TESTARG     =
182     NEXTAW
183         # XAW_LIB et al. can be overruled to use Xaw3d widgets
184         XAW_LIB         ?= -lXaw
185         GUI_SRC         =  gui.c gui_athena.c gui_x11.c pty.c gui_beval.c
186                             gui_at_fs.c
187         GUI_OBJ         =
188         GUI_DEFS        = -DFEAT_GUI_ATHENA -DFEAT_GUI_NEXTAW $NARROW_PROTO
189         GUI_IPATH       = $GUI_INC_LOC
190         GUI_LIBS_DIR    = $GUI_LIB_LOC
191         GUI_LIBS1       = $NEXTAW_LIB
192         GUI_LIBS2       = -lXt
193         GUI_INSTALL     = install_normal
194         GUI_TARGETS     = installglinks
195         GUI_MAN_TARGETS = yes
196         GUI_TESTTARGET  = gui
197         GUI_BUNDLE      =
198         GUI_TESTARG     =
199     CARBONGUI
200         GUI_SRC         =  gui.c gui_mac.c pty.c
201         GUI_OBJ         =
202         GUI_DEFS        = -DFEAT_GUI_MAC -fno-common -fpascal-strings \
203                             -Wall -Wno-unknown-pragmas -mdynamic-no-pic -pipe
204         GUI_IPATH       = $GUI_INC_LOC
205         GUI_LIBS_DIR    = $GUI_LIB_LOC
206         GUI_LIBS1       = -framework Carbon
207         GUI_LIBS2       =
208         GUI_INSTALL     = install_macosx
209         GUI_TARGETS     = installglinks
210         GUI_MAN_TARGETS = yes
211         GUI_TESTTARGET  = gui
212         GUI_BUNDLE      = gui_bundle
213         GUI_TESTARG     = VIMPROG=../$(APPDIR)/Contents/MacOS/$(VIMTARGET)
214     PHOTONGUI
215         GUI_SRC         = gui.c gui_photon.c pty.c
216         GUI_OBJ         =
217         GUI_DEFS        = -DFEAT_GUI_PHOTON
218         GUI_IPATH       =
219         GUI_LIBS_DIR    =
220         GUI_LIBS1       = -lph -lphexlib
221         GUI_LIBS2       =
222         GUI_INSTALL     = install_normal
223         GUI_TARGETS     = installglinks
224         GUI_MAN_TARGETS = yes
225         GUI_TESTTARGET  = gui
226         GUI_BUNDLE      =
227         GUI_TESTARG     =
228     *
229         GUI_SRC         =
230         GUI_OBJ         =
231         GUI_DEFS        =
232         GUI_IPATH       =
233         GUI_LIBS_DIR    =
234         GUI_LIBS1       =
235         GUI_LIBS2       =
236         GUI_INSTALL     = install_normal
237         GUI_TARGETS     =
238         GUI_MAN_TARGETS =
239         GUI_TESTTARGET  =
240         GUI_BUNDLE      =
241         GUI_TESTARG     =
244 PRE_DEFS = -Iproto -I. $DEFS $GUI_DEFS $GUI_IPATH $CPPFLAGS $?(EXTRA_IPATHS)
245 POST_DEFS = $X_CFLAGS $MZSCHEME_CFLAGS $PERL_CFLAGS $PYTHON_CFLAGS $TCL_CFLAGS $RUBY_CFLAGS $?(EXTRA_DEFS)
246 CFLAGS = $PRE_DEFS $CONF_CFLAGS $?(PROFILE_CFLAGS) $POST_DEFS
247 CPPFLAGS =
249 ALL_LIB_DIRS = $GUI_LIBS_DIR $X_LIBS_DIR
250 LDFLAGS = $ALL_LIB_DIRS $CONF_LDFLAGS
251 LIBS = $GUI_LIBS1 $GUI_X_LIBS $GUI_LIBS2 $X_PRE_LIBS $X_LIBS $X_EXTRA_LIBS $CONF_LIBS $?(EXTRA_LIBS) $MZSCHEME_LIBS $PERL_LIBS $PYTHON_LIBS $TCL_LIBS $RUBY_LIBS $?(PROFILE_LIBS)
253 Target = $VIMNAME
255 # reconfig target also builds Vim (reconfiguration is handled above).
256 reconfig {virtual}: $Target
258 distclean: clean
259     :del {force} auto/config.h auto/config.aap
260     :del {force} auto/config.cache auto/config.status
263 # Execute the test scripts.  Run these after compiling Vim, before installing.
265 # This will produce a lot of garbage on your screen, including a few error
266 # messages.  Don't worry about that.
267 # If there is a real error, there will be a difference between "test.out" and
268 # a "test99.ok" file.
269 # If everything is alright, the final message will be "ALL DONE".
271 test check:
272     VimProg = ../$Target
273     :execute testdir/main.aap $GUI_TESTTARGET $GUI_TESTARG
275 testclean {virtual}:
276     :del {force} testdir/*.out testdir/test.log
278 # When no fetch target exists we are not a child of the ../main.aap recipe,
279 # Use ../main.aap to do the fetching.
280 # --- If you get an error here for wrong number of arguments, you need to
281 #     update to a newer version of A-A-P.
282 @if not has_target("fetch"):
283     fetch:
284         :execute ../main.aap fetch
287 # All the source files that need to be compiled.
288 # Some are optional and depend on configure.
289 # "version.c" is missing, it's always compiled (see below).
290 Source =
291         buffer.c
292         charset.c
293         diff.c
294         digraph.c
295         edit.c
296         eval.c
297         ex_cmds.c
298         ex_cmds2.c
299         ex_docmd.c
300         ex_eval.c
301         ex_getln.c
302         fileio.c
303         fold.c
304         getchar.c
305         hardcopy.c
306         hashtab.c
307         if_cscope.c
308         if_xcmdsrv.c
309         main.c
310         mark.c
311         memfile.c
312         memline.c
313         menu.c
314         message.c
315         misc1.c
316         misc2.c
317         move.c
318         mbyte.c
319         normal.c
320         ops.c
321         option.c
322         os_unix.c
323         auto/pathdef.c
324         popupmnu.c
325         quickfix.c
326         regexp.c
327         screen.c
328         search.c
329         spell.c
330         syntax.c
331         tag.c
332         term.c
333         ui.c
334         undo.c
335         window.c
336         $OS_EXTRA_SRC
337         $GUI_SRC
338         $HANGULIN_SRC
339         $MZSCHEME_SRC
340         $PERL_SRC
341         $NETBEANS_SRC
342         $PYTHON_SRC
343         $TCL_SRC
344         $RUBY_SRC
345         $SNIFF_SRC
346         $WORKSHOP_SRC
348 Objects =
349         $GUI_OBJ
351 # TODO: make is still used for subdirectories, need to write a recipe.
352 MAKE ?= make
354 all: $Target $GUI_BUNDLE
356 # This dependency is required to build auto/osdef.h before automatic
357 # dependencies are generated.
358 $Source version.c : auto/osdef.h
360 # Need to mention that the target also depends on version.c, since it's not
361 # included in $Source
362 $Target : version.c
364 # Some sources are to be found in the "auto" directory.
365 SRCPATH += auto
367 # When building Vim always compile version.c to get the timestamp.
368 :filetype
369     declare my_prog
370 :attr {filetype = my_prog} $Target
372 :program $Target : $Source $Objects
374 :action build my_prog object
375         version_obj = `src2obj("version.c")`
376         :do compile {target = $version_obj} version.c
377         #:do build {target = $target {filetype = program}} $source $version_obj
378         link_sed = $BDIR/link.sed
379         @if os.path.exists(link_sed):
380             :move {force} $link_sed auto/link.sed
381         @else:
382             :del {force} auto/link.sed
383         :update link2.sh
384         :sys LINK="$?(PURIFY) $?(SHRPENV) $CC $LDFLAGS \
385                 -o $target $source $version_obj $LIBS" \
386                 MAKE="aap" sh ./link2.sh
387         :copy {force} auto/link.sed $BDIR/link.sed
389 # "link.sh" must be modified for A-A-P
390 link2.sh : link.sh
391     :print Adjusting $-source for A-A-P.
392     :cat $source | :eval re.sub("objects/pathdef.o", "pathdef", stdin)
393                                                                       >! $target
395 xxd/xxd$EXESUF: xxd/xxd.c
396     :sys cd xxd; CC="$CC" CFLAGS="$CPPFLAGS $CFLAGS" \
397             $MAKE -f Makefile
399 # Build the language specific files if they were unpacked.
400 # Generate the converted .mo files separately, it's no problem if this fails.
401 languages {virtual}:
402         @if _no.MAKEMO:
403             :sys cd $PODIR; CC="$CC" $MAKE prefix=$DESTDIR$prefix
404             @try:
405                 :sys cd $PODIR; CC="$CC" $MAKE prefix=$DESTDIR$prefix converted
406             @except:
407                 :print Generated converted language files failed, continuing
409 # Update the *.po files for changes in the sources.  Only run manually.
410 update-po {virtual}:
411         cd $PODIR; CC="$CC" $MAKE prefix=$DESTDIR$prefix update-po
413 auto/if_perl.c: if_perl.xs
414         :sys $PERL -e 'unless ( $$] >= 5.005 ) { for (qw(na defgv errgv)) { print "#define PL_$$_ $$_\n" }}' > $target
415         :sys $PERL $PERLLIB/ExtUtils/xsubpp -prototypes -typemap \
416             $PERLLIB/ExtUtils/typemap if_perl.xs >> $target
418 auto/osdef.h: auto/config.h osdef.sh osdef1.h.in osdef2.h.in
419         :sys CC="$CC $CFLAGS" srcdir=$srcdir sh $srcdir/osdef.sh
421 pathdef {virtual} : $BDIR/auto/pathdef$OBJSUF
423 auto/pathdef.c: auto/config.aap
424         :print Creating $target
425         :print >! $target /* pathdef.c */
426         :print >> $target /* This file is automatically created by main.aap */
427         :print >> $target /* DO NOT EDIT!  Change main.aap only. */
428         :print >> $target $#include "vim.h"
429         :print >> $target char_u *default_vim_dir = (char_u *)"$VIMRCLOC";
430         :print >> $target char_u *default_vimruntime_dir = (char_u *)"$?VIMRUNTIMEDIR";
431         v = $CC -c -I$srcdir $CFLAGS
432         @v = string.replace(v, '"', '\\"')
433         :print >> $target char_u *all_cflags = (char_u *)"$v";
434         linkcmd = $CC $LDFLAGS -o $VIMTARGET $LIBS
435         link_sed = $BDIR/link.sed
436         @if os.path.exists(link_sed):
437             # filter $linkcmd through $BDIR/link.sed
438             :print $linkcmd | :syseval sed -f $link_sed | :eval re.sub("\n", "", stdin) | :assign linkcmd
439         @linkcmd = string.replace(linkcmd, '"', '\\"')
440         :print >> $target char_u *all_lflags = (char_u *)"$linkcmd";
441         @if _no.get("COMPILEDBY"):
442             who = $COMPILEDBY
443             where = ''
444         @else:
445             :syseval whoami | :eval re.sub("\n", "", stdin) | :assign who
447             :syseval hostname | :eval re.sub("\n", "", stdin) | :assign where
448         :print >> $target char_u *compiled_user = (char_u *)"$who";
449         :print >> $target char_u *compiled_sys = (char_u *)"$where";
452 ### Names of the tools that are also made
453 TOOLS = xxd/xxd$EXESUF
455 # Root of the installation tree.  Empty for a normal install, set to an
456 # existing path to install into a special place (for generating a package).
457 DESTDIR ?=
459 ### Location of man pages under $MANTOPDIR
460 MAN1DIR = /man1
462 ### Location of Vim files (should not need to be changed, and
463 ### some things might not work when they are changed!)
464 VIMDIR = /vim
465 @r = re.compile('.*VIM_VERSION_NODOT\\s*"(vim\\d\\d[^"]*)".*', re.S)
466 VIMRTDIR = /`r.match(open("version.h").read()).group(1)`
467 HELPSUBDIR = /doc
468 COLSUBDIR = /colors
469 SYNSUBDIR = /syntax
470 INDSUBDIR = /indent
471 AUTOSUBDIR = /autoload
472 PLUGSUBDIR = /plugin
473 FTPLUGSUBDIR = /ftplugin
474 LANGSUBDIR = /lang
475 COMPSUBDIR = /compiler
476 KMAPSUBDIR = /keymap
477 MACROSUBDIR = /macros
478 TOOLSSUBDIR = /tools
479 TUTORSUBDIR = /tutor
480 SPELLSUBDIR = /spell
481 PRINTSUBDIR = /print
482 PODIR = po
484 ### VIMLOC      common root of the Vim files (all versions)
485 ### VIMRTLOC    common root of the runtime Vim files (this version)
486 ### VIMRCLOC    compiled-in location for global [g]vimrc files (all versions)
487 ### VIMRUNTIMEDIR  compiled-in location for runtime files (optional)
488 ### HELPSUBLOC  location for help files
489 ### COLSUBLOC   location for colorscheme files
490 ### SYNSUBLOC   location for syntax files
491 ### INDSUBLOC   location for indent files
492 ### AUTOSUBLOC  location for standard autoload files
493 ### PLUGSUBLOC  location for standard plugin files
494 ### FTPLUGSUBLOC  location for ftplugin files
495 ### LANGSUBLOC  location for language files
496 ### COMPSUBLOC  location for compiler files
497 ### KMAPSUBLOC  location for keymap files
498 ### MACROSUBLOC location for macro files
499 ### TOOLSSUBLOC location for tools files
500 ### TUTORSUBLOC location for tutor files
501 ### PRINTSUBLOC location for print files
502 ### SCRIPTLOC   location for script files (menu.vim, bugreport.vim, ..)
503 ### You can override these if you want to install them somewhere else.
504 ### Edit feature.h for compile-time settings.
505 VIMLOC          = $DATADIR$VIMDIR
506 @if not _no.get("VIMRTLOC"):
507     VIMRTLOC        = $DATADIR$VIMDIR$VIMRTDIR
508 VIMRCLOC        = $VIMLOC
509 HELPSUBLOC      = $VIMRTLOC$HELPSUBDIR
510 COLSUBLOC       = $VIMRTLOC$COLSUBDIR
511 SYNSUBLOC       = $VIMRTLOC$SYNSUBDIR
512 INDSUBLOC       = $VIMRTLOC$INDSUBDIR
513 AUTOSUBLOC      = $VIMRTLOC$AUTOSUBDIR
514 PLUGSUBLOC      = $VIMRTLOC$PLUGSUBDIR
515 FTPLUGSUBLOC    = $VIMRTLOC$FTPLUGSUBDIR
516 LANGSUBLOC      = $VIMRTLOC$LANGSUBDIR
517 COMPSUBLOC      = $VIMRTLOC$COMPSUBDIR
518 KMAPSUBLOC      = $VIMRTLOC$KMAPSUBDIR
519 MACROSUBLOC     = $VIMRTLOC$MACROSUBDIR
520 TOOLSSUBLOC     = $VIMRTLOC$TOOLSSUBDIR
521 TUTORSUBLOC     = $VIMRTLOC$TUTORSUBDIR
522 SPELLSUBLOC     = $VIMRTLOC$SPELLSUBDIR
523 PRINTSUBLOC     = $VIMRTLOC$PRINTSUBDIR
524 SCRIPTLOC       = $VIMRTLOC
526 ### Only set VIMRUNTIMEDIR when VIMRTLOC is set to a different location and
527 ### the runtime directory is not below it.
528 #VIMRUNTIMEDIR = $VIMRTLOC
530 ### Name of the evim file target.
531 EVIM_FILE       = $DESTDIR$SCRIPTLOC/evim.vim
532 MSWIN_FILE      = $DESTDIR$SCRIPTLOC/mswin.vim
534 ### Name of the menu file target.
535 SYS_MENU_FILE   = $DESTDIR$SCRIPTLOC/menu.vim
536 SYS_SYNMENU_FILE = $DESTDIR$SCRIPTLOC/synmenu.vim
537 SYS_DELMENU_FILE = $DESTDIR$SCRIPTLOC/delmenu.vim
539 ### Name of the bugreport file target.
540 SYS_BUGR_FILE   = $DESTDIR$SCRIPTLOC/bugreport.vim
542 ### Name of the file type detection file target.
543 SYS_FILETYPE_FILE = $DESTDIR$SCRIPTLOC/filetype.vim
545 ### Name of the file type detection file target.
546 SYS_FTOFF_FILE  = $DESTDIR$SCRIPTLOC/ftoff.vim
548 ### Name of the file type detection script file target.
549 SYS_SCRIPTS_FILE = $DESTDIR$SCRIPTLOC/scripts.vim
551 ### Name of the ftplugin-on file target.
552 SYS_FTPLUGIN_FILE = $DESTDIR$SCRIPTLOC/ftplugin.vim
554 ### Name of the ftplugin-off file target.
555 SYS_FTPLUGOF_FILE = $DESTDIR$SCRIPTLOC/ftplugof.vim
557 ### Name of the indent-on file target.
558 SYS_INDENT_FILE = $DESTDIR$SCRIPTLOC/indent.vim
560 ### Name of the indent-off file target.
561 SYS_INDOFF_FILE = $DESTDIR$SCRIPTLOC/indoff.vim
563 ### Name of the option window script file target.
564 SYS_OPTWIN_FILE = $DESTDIR$SCRIPTLOC/optwin.vim
566 ### Permissions for binaries
567 BINMOD = 755
569 ### Permissions for man page
570 MANMOD = 644
572 ### Permissions for help files
573 HELPMOD = 644
575 ### Permissions for Perl and shell scripts
576 SCRIPTMOD = 755
578 ### Permission for Vim script files (menu.vim, bugreport.vim, ..)
579 VIMSCRIPTMOD = 644
581 ### Permissions for all directories that are created
582 DIRMOD = 755
584 ### Permissions for all other files that are created
585 FILEMOD = 644
587 # Where to copy the man and help files from
588 HELPSOURCE = ../runtime/doc
590 # Where to copy the script files from (menu, bugreport)
591 SCRIPTSOURCE = ../runtime
593 # Where to copy the colorscheme files from
594 COLSOURCE = ../runtime/colors
596 # Where to copy the syntax files from
597 SYNSOURCE = ../runtime/syntax
599 # Where to copy the indent files from
600 INDSOURCE = ../runtime/indent
602 # Where to copy the standard plugin files from
603 AUTOSOURCE = ../runtime/autoload
605 # Where to copy the standard plugin files from
606 PLUGSOURCE = ../runtime/plugin
608 # Where to copy the ftplugin files from
609 FTPLUGSOURCE = ../runtime/ftplugin
611 # Where to copy the macro files from
612 MACROSOURCE = ../runtime/macros
614 # Where to copy the tools files from
615 TOOLSSOURCE = ../runtime/tools
617 # Where to copy the tutor files from
618 TUTORSOURCE = ../runtime/tutor
620 # Where to copy the spell files from
621 SPELLSOURCE = ../runtime/spell
623 # Where to look for language specific files
624 LANGSOURCE = ../runtime/lang
626 # Where to look for compiler files
627 COMPSOURCE = ../runtime/compiler
629 # Where to look for keymap files
630 KMAPSOURCE = ../runtime/keymap
632 # Where to look for print resource files
633 PRINTSOURCE = ../runtime/print
635 # abbreviations
636 DEST_BIN = $DESTDIR$BINDIR
637 DEST_VIM = $DESTDIR$VIMLOC
638 DEST_RT = $DESTDIR$VIMRTLOC
639 DEST_HELP = $DESTDIR$HELPSUBLOC
640 DEST_COL = $DESTDIR$COLSUBLOC
641 DEST_SYN = $DESTDIR$SYNSUBLOC
642 DEST_IND = $DESTDIR$INDSUBLOC
643 DEST_AUTO = $DESTDIR$AUTOSUBLOC
644 DEST_PLUG = $DESTDIR$PLUGSUBLOC
645 DEST_FTP = $DESTDIR$FTPLUGSUBLOC
646 DEST_LANG = $DESTDIR$LANGSUBLOC
647 DEST_COMP = $DESTDIR$COMPSUBLOC
648 DEST_KMAP = $DESTDIR$KMAPSUBLOC
649 DEST_MACRO = $DESTDIR$MACROSUBLOC
650 DEST_TOOLS = $DESTDIR$TOOLSSUBLOC
651 DEST_TUTOR = $DESTDIR$TUTORSUBLOC
652 DEST_SPELL = $DESTDIR$SPELLSUBLOC
653 DEST_SCRIPT = $DESTDIR$SCRIPTLOC
654 DEST_PRINT = $DESTDIR$PRINTSUBLOC
655 DEST_MAN_TOP = $DESTDIR$?(MANDIR)
657 # We assume that the ".../man/xx/man1/" directory is for latin1 manual pages.
658 # Some systems use UTF-8, but these should find the ".../man/xx.UTF-8/man1/"
659 # directory first.
660 # FreeBSD uses ".../man/xx.ISO8859-1/man1" for latin1, use that one too.
661 DEST_MAN = $(DEST_MAN_TOP)$(MAN1DIR)
662 DEST_MAN_FR = $(DEST_MAN_TOP)/fr$(MAN1DIR)
663 DEST_MAN_FR_I = $(DEST_MAN_TOP)/fr.ISO8859-1$(MAN1DIR)
664 DEST_MAN_FR_U = $(DEST_MAN_TOP)/fr.UTF-8$(MAN1DIR)
665 DEST_MAN_IT = $(DEST_MAN_TOP)/it$(MAN1DIR)
666 DEST_MAN_IT_I = $(DEST_MAN_TOP)/it.ISO8859-1$(MAN1DIR)
667 DEST_MAN_IT_U = $(DEST_MAN_TOP)/it.UTF-8$(MAN1DIR)
668 DEST_MAN_PL = $(DEST_MAN_TOP)/pl.ISO8859-2$(MAN1DIR)
669 DEST_MAN_PL_U = $(DEST_MAN_TOP)/pl.UTF-8$(MAN1DIR)
670 DEST_MAN_RU = $(DEST_MAN_TOP)/ru.KOI8-R$(MAN1DIR)
671 DEST_MAN_RU_U = $(DEST_MAN_TOP)/ru.UTF-8$(MAN1DIR)
673 # These are directories, create them when needed.
674 :attr {directory = $DIRMOD} $DEST_BIN $DEST_VIM $DEST_RT $DEST_HELP $DEST_COL
675                 $DEST_SYN $DEST_IND $DEST_AUTO $DEST_AUTO/xml $DEST_PLUG
676                 $DEST_FTP $DEST_LANG
677                 $DEST_COMP $DEST_KMAP $DEST_MACRO $DEST_TOOLS $DEST_TUTOR
678                 $DEST_SCRIPT $DEST_PRINT $DEST_MAN $DEST_SPELL
679                 $DEST_MAN_FR $DEST_MAN_FR_I $DEST_MAN_FR_U $DEST_MAN_IT
680                 $DEST_MAN_IT_I $DEST_MAN_IT_U
681                 $DEST_MAN_PL $DEST_MAN_PL_U
682                 $DEST_MAN_RU $DEST_MAN_RU_U
685 # I N S T A L L
687 install: $GUI_INSTALL
689 install_normal:
690     @if not os.path.isdir(_no.DEST_BIN):
691         @try:
692             :mkdir $DEST_BIN
693         @except:
694         @   pass
695     @if os.access(_no.DEST_BIN, os.W_OK):
696         # Bin directory is writable, install directly.
697         :update installvim installtools $INSTALL_LANGS install-icons
698     @else:
699         # Bin directory is not writable, need to become root.
700         :print The destination directory "$DEST_BIN" is not writable.
701         :print If this is the wrong directory, use PREFIX to specify another one.
702         :print Otherwise, type the root password to continue installing.
703         :asroot $AAP install
705 installvim {virtual}: installvimbin  installtutorbin \
706                         installruntime installlinks installmanlinks
708 installvimbin {virtual}{force}: $Target $DEST_BIN
709         exe = $DEST_BIN/$VIMTARGET
710         @if os.path.exists(exe):
711             # Move the old executable aside and delete it.  Any other method
712             # may cause a crash if the executable is currently being used.
713             :move {force} $exe $(exe).rm
714             :del {force} $(exe).rm
715         :copy $VIMTARGET $DEST_BIN
716         :do strip $exe
717         :chmod $BINMOD $DEST_BIN/$VIMTARGET
718 # may create a link to the new executable from /usr/bin/vi
719         @if _no.get("LINKIT"):
720             :sys $LINKIT
722 # Long list of arguments for the shell script that installs the manual pages
723 # for one language.
724 INSTALLMANARGS = $(VIMLOC) $(SCRIPTLOC) $(VIMRCLOC) $(HELPSOURCE) $(MANMOD) \
725                 $(VIMNAME) $(VIMDIFFNAME) $(EVIMNAME)
727 # Install most of the runtime files
728 installruntime {virtual}: installrtbase installmacros installtutor installspell
730 # install the help files; first adjust the contents for the location
731 installrtbase {virtual}{force}: $HELPSOURCE/vim.1 $DEST_VIM
732                 $DEST_RT $DEST_HELP $DEST_COL $DEST_SYN $DEST_IND
733                 $DEST_FTP $DEST_AUTO $DEST_AUTO/xml $DEST_PLUG $DEST_TUTOR
734                 $DEST_COMP $DEST_SPELL $DEST_PRINT
735         :chmod 755 installman.sh
736         :sys ./installman.sh install $(DEST_MAN) "" $(INSTALLMANARGS)
738         :cd $HELPSOURCE
739         @try:
740             XTRA = `glob.glob("*.??x")` `glob.glob("tags-??")`
741         @except:
742             XTRA =       # It's OK if there are no matches.
743         :copy *.txt tags $XTRA $DEST_HELP
744         :cd -
745         :cd $DEST_HELP
746         :chmod $HELPMOD *.txt tags $XTRA
747         :cd -
748         :copy  $HELPSOURCE/*.pl $DEST_HELP
749         :chmod $SCRIPTMOD $DEST_HELP/*.pl
750 # install the menu files
751         :copy $SCRIPTSOURCE/menu.vim $SYS_MENU_FILE
752         :chmod $VIMSCRIPTMOD $SYS_MENU_FILE
753         :copy $SCRIPTSOURCE/synmenu.vim $SYS_SYNMENU_FILE
754         :chmod $VIMSCRIPTMOD $SYS_SYNMENU_FILE
755         :copy $SCRIPTSOURCE/delmenu.vim $SYS_DELMENU_FILE
756         :chmod $VIMSCRIPTMOD $SYS_DELMENU_FILE
757 # install the evim file
758         :copy $SCRIPTSOURCE/mswin.vim $MSWIN_FILE
759         :chmod $VIMSCRIPTMOD $MSWIN_FILE
760         :copy $SCRIPTSOURCE/evim.vim $EVIM_FILE
761         :chmod $VIMSCRIPTMOD $EVIM_FILE
762 # install the bugreport file
763         :copy $SCRIPTSOURCE/bugreport.vim $SYS_BUGR_FILE
764         :chmod $VIMSCRIPTMOD $SYS_BUGR_FILE
765 # install the example vimrc files
766         :copy $SCRIPTSOURCE/vimrc_example.vim $DEST_SCRIPT
767         :chmod $VIMSCRIPTMOD $DEST_SCRIPT/vimrc_example.vim
768         :copy $SCRIPTSOURCE/gvimrc_example.vim $DEST_SCRIPT
769         :chmod $VIMSCRIPTMOD $DEST_SCRIPT/gvimrc_example.vim
770 # install the file type detection files
771         :copy $SCRIPTSOURCE/filetype.vim $SYS_FILETYPE_FILE
772         :chmod $VIMSCRIPTMOD $SYS_FILETYPE_FILE
773         :copy $SCRIPTSOURCE/ftoff.vim $SYS_FTOFF_FILE
774         :chmod $VIMSCRIPTMOD $SYS_FTOFF_FILE
775         :copy $SCRIPTSOURCE/scripts.vim $SYS_SCRIPTS_FILE
776         :chmod $VIMSCRIPTMOD $SYS_SCRIPTS_FILE
777         :copy $SCRIPTSOURCE/ftplugin.vim $SYS_FTPLUGIN_FILE
778         :chmod $VIMSCRIPTMOD $SYS_FTPLUGIN_FILE
779         :copy $SCRIPTSOURCE/ftplugof.vim $SYS_FTPLUGOF_FILE
780         :chmod $VIMSCRIPTMOD $SYS_FTPLUGOF_FILE
781         :copy $SCRIPTSOURCE/indent.vim $SYS_INDENT_FILE
782         :chmod $VIMSCRIPTMOD $SYS_INDENT_FILE
783         :copy $SCRIPTSOURCE/indoff.vim $SYS_INDOFF_FILE
784         :chmod $VIMSCRIPTMOD $SYS_INDOFF_FILE
785         :copy $SCRIPTSOURCE/optwin.vim $SYS_OPTWIN_FILE
786         :chmod $VIMSCRIPTMOD $SYS_OPTWIN_FILE
787 # install the print resource files
788         :copy $PRINTSOURCE/*.ps $DEST_PRINT
789         :chmod $FILEMOD $DEST_PRINT/*.ps
790 # install the colorscheme files
791         :copy $COLSOURCE/*.vim $COLSOURCE/README.txt $DEST_COL
792         :chmod $HELPMOD $DEST_COL/*.vim $DEST_COL/README.txt
793 # install the syntax files
794         :copy $SYNSOURCE/*.vim $SYNSOURCE/README.txt $DEST_SYN
795         :chmod $HELPMOD $DEST_SYN/*.vim $DEST_SYN/README.txt
796 # install the indent files
797         :copy $INDSOURCE/*.vim $INDSOURCE/README.txt $DEST_IND
798         :chmod $HELPMOD $DEST_IND/*.vim
799 # install the standard autoload files
800         :copy $AUTOSOURCE/*.vim $AUTOSOURCE/README.txt $DEST_AUTO
801         :chmod $HELPMOD $DEST_AUTO/*.vim $DEST_AUTO/README.txt
802         :copy $AUTOSOURCE/xml/*.vim $DEST_AUTO/xml
803         :chmod $HELPMOD $DEST_AUTO/xml/*.vim
804 # install the standard plugin files
805         :copy $PLUGSOURCE/*.vim $PLUGSOURCE/README.txt $DEST_PLUG
806         :chmod $HELPMOD $DEST_PLUG/*.vim $DEST_PLUG/README.txt
807 # install the ftplugin files
808         :copy $FTPLUGSOURCE/*.vim $FTPLUGSOURCE/README.txt $DEST_FTP
809         :chmod $HELPMOD $DEST_FTP/*.vim $DEST_FTP/README.txt
810 # install the compiler files
811         :copy $COMPSOURCE/*.vim $COMPSOURCE/README.txt $DEST_COMP
812         :chmod $HELPMOD $DEST_COMP/*.vim $DEST_COMP/README.txt
814 installmacros {virtual}{force}: $MACROSOURCE $DEST_VIM $DEST_RT $DEST_MACRO
815         :copy {recursive}{force} $MACROSOURCE/* $DEST_MACRO
816         # Delete any CVS and AAPDIR directories.
817         # Use the ":tree" command if possible.  It was added later, fall back
818         # to using "find" when it doesn't work.
819         @try:
820            :tree $DEST_MACRO {dirname = CVS}
821               :del {recursive} $name
822            :tree $DEST_MACRO {dirname = AAPDIR}
823               :del {recursive} $name
824            :tree $DEST_MACRO {dirname = .*}
825               :chmod $DIRMOD $name
826            :tree $DEST_MACRO {filename = .*}
827               :chmod $FILEMOD $name
828         @except:
829         @  ok, cvsdirs = redir_system('find %s -name CVS -print' % _no.DEST_MACRO)
830         @  if ok and cvsdirs:
831              :del {recursive} $cvsdirs
832            :sys chmod $DIRMOD ``find $DEST_MACRO -type d -print``
833            :sys chmod $FILEMOD ``find $DEST_MACRO -type f -print``
834         :chmod $SCRIPTMOD $DEST_MACRO/less.sh
836 # install the tutor files
837 installtutorbin {virtual}{force}: $DEST_VIM
838         :copy vimtutor $DEST_BIN/$(VIMNAME)tutor
839         :chmod $SCRIPTMOD $DEST_BIN/$(VIMNAME)tutor
841 installtutor {virtual}{force}: $DEST_RT $DEST_TUTOR
842         :copy $TUTORSOURCE/tutor* $TUTORSOURCE/README* $DEST_TUTOR
843         :chmod $HELPMOD $DEST_TUTOR/*
845 # Install the spell files, if they exist.  This assumes at least the English
846 # spell file is there.
847 installspell {virtual}: $(DEST_VIM) $(DEST_RT) $(DEST_SPELL)
848         enspl = $(SPELLSOURCE)/en.latin1.spl
849         @if os.path.exists(enspl):
850             :copy $(SPELLSOURCE)/*.spl $(SPELLSOURCE)/*.vim $(DEST_SPELL)
851             :chmod $(HELPMOD) $(DEST_SPELL)/*.spl $(DEST_SPELL)/*.vim
852             @try:
853                 :copy $(SPELLSOURCE)/*.sug $(DEST_SPELL)
854                 :chmod $(HELPMOD) $(DEST_SPELL)/*.sug
855             @except:
856             @   pass
858 # install helper program xxd
859 installtools {virtual}{force}: $TOOLS $DEST_BIN $DEST_MAN \
860                 $TOOLSSOURCE $DEST_VIM $DEST_RT $DEST_TOOLS \
861                 $INSTALL_TOOL_LANGS
862         xxd = $DEST_BIN/xxd$EXESUF
863         @if os.path.exists(xxd):
864           :move {force} $xxd $(xxd).rm
865           :del $(xxd).rm
866         :copy xxd/xxd$EXESUF $DEST_BIN
867         :do strip $DEST_BIN/xxd$EXESUF
868         :chmod $BINMOD $DEST_BIN/xxd$EXESUF
869         :chmod 755 installman.sh
870         :sys ./installman.sh xxd $(DEST_MAN) "" $(INSTALLMANARGS)
872 # install the runtime tools
873         @try:
874         @  if aap_has(":tree"):
875               # New method: copy everything and delete CVS and AAPDIR dirs
876               :copy {recursive} $TOOLSSOURCE/* $DEST_TOOLS
877               :tree $DEST_TOOLS {dirname = CVS}
878                  :delete {recursive} $name
879               :tree $DEST_TOOLS {dirname = AAPDIR}
880                  :delete {recursive} $name
881         @except:
882             # Old method: copy only specific files and directories.
883             :copy {recursive} $TOOLSSOURCE/README.txt $TOOLSSOURCE/[a-z]* $DEST_TOOLS
884         :chmod $FILEMOD $DEST_TOOLS/*
885 # replace the path in some tools
886         :progsearch perlpath perl
887         @if perlpath:
888             :cat $TOOLSSOURCE/efm_perl.pl |
889                     :eval re.sub("/usr/bin/perl", perlpath, stdin)
890                     >! $DEST_TOOLS/efm_perl.pl
891         @else:
892             :copy $TOOLSSOURCE/efm_perl.pl $DEST_TOOLS
894         :progsearch awkpath nawk gawk awk
895         @if awkpath:
896             :cat $TOOLSSOURCE/mve.awk |
897                     :eval re.sub("/usr/bin/nawk", awkpath, stdin)
898                     >! $DEST_TOOLS/mve.awk
899         @else:
900             :copy $TOOLSSOURCE/mve.awk $DEST_TOOLS
902         :sys chmod $SCRIPTMOD ``grep -l "^#!" $DEST_TOOLS/*``
904 # install the language specific files for tools, if they were unpacked
905 install-tool-languages:
906         :chmod 755 installman.sh
907         :sys ./installman.sh xxd $(DEST_MAN_FR) "-fr" $(INSTALLMANARGS)
908         :sys ./installman.sh xxd $(DEST_MAN_FR_I) "-fr" $(INSTALLMANARGS)
909         :sys ./installman.sh xxd $(DEST_MAN_FR_U) "-fr.UTF-8" $(INSTALLMANARGS)
910         :sys ./installman.sh xxd $(DEST_MAN_IT) "-it" $(INSTALLMANARGS)
911         :sys ./installman.sh xxd $(DEST_MAN_IT_I) "-it" $(INSTALLMANARGS)
912         :sys ./installman.sh xxd $(DEST_MAN_IT_U) "-it.UTF-8" $(INSTALLMANARGS)
913         :sys ./installman.sh xxd $(DEST_MAN_PL) "-pl" $(INSTALLMANARGS)
914         :sys ./installman.sh xxd $(DEST_MAN_PL_U) "-pl.UTF-8" $(INSTALLMANARGS)
915         :sys ./installman.sh xxd $(DEST_MAN_RU) "-ru" $(INSTALLMANARGS)
916         :sys ./installman.sh xxd $(DEST_MAN_RU_U) "-ru.UTF-8" $(INSTALLMANARGS)
918 # install the language specific files, if they were unpacked
919 install-languages {virtual}{force}: languages $DEST_LANG $DEST_KMAP
920         :chmod 755 installman.sh
921         :sys ./installman.sh install $(DEST_MAN_FR) "-fr" $(INSTALLMANARGS)
922         :sys ./installman.sh install $(DEST_MAN_FR_I) "-fr" $(INSTALLMANARGS)
923         :sys ./installman.sh install $(DEST_MAN_FR_U) "-fr.UTF-8" $(INSTALLMANARGS)
924         :sys ./installman.sh install $(DEST_MAN_IT) "-it" $(INSTALLMANARGS)
925         :sys ./installman.sh install $(DEST_MAN_IT_I) "-it" $(INSTALLMANARGS)
926         :sys ./installman.sh install $(DEST_MAN_IT_U) "-it.UTF-8" $(INSTALLMANARGS)
927         :sys ./installman.sh install $(DEST_MAN_PL) "-pl" $(INSTALLMANARGS)
928         :sys ./installman.sh install $(DEST_MAN_PL_U) "-pl.UTF-8" $(INSTALLMANARGS)
929         :sys ./installman.sh install $(DEST_MAN_RU) "-ru" $(INSTALLMANARGS)
930         :sys ./installman.sh install $(DEST_MAN_RU_U) "-ru.UTF-8" $(INSTALLMANARGS)
931         :chmod 755 installml.sh
932         :sys ./installml.sh install "$(GUI_MAN_TARGETS)" \
933                 $(DEST_MAN_FR) $(INSTALLMLARGS)
934         :sys ./installml.sh install "$(GUI_MAN_TARGETS)" \
935                 $(DEST_MAN_FR_I) $(INSTALLMLARGS)
936         :sys ./installml.sh install "$(GUI_MAN_TARGETS)" \
937                 $(DEST_MAN_FR_U) $(INSTALLMLARGS)
938         :sys ./installml.sh install "$(GUI_MAN_TARGETS)" \
939                 $(DEST_MAN_IT) $(INSTALLMLARGS)
940         :sys ./installml.sh install "$(GUI_MAN_TARGETS)" \
941                 $(DEST_MAN_IT_I) $(INSTALLMLARGS)
942         :sys ./installml.sh install "$(GUI_MAN_TARGETS)" \
943                 $(DEST_MAN_IT_U) $(INSTALLMLARGS)
944         :sys ./installml.sh install "$(GUI_MAN_TARGETS)" \
945                 $(DEST_MAN_PL) $(INSTALLMLARGS)
946         :sys ./installml.sh install "$(GUI_MAN_TARGETS)" \
947                 $(DEST_MAN_PL_U) $(INSTALLMLARGS)
948         :sys ./installml.sh install "$(GUI_MAN_TARGETS)" \
949                 $(DEST_MAN_RU) $(INSTALLMLARGS)
950         :sys ./installml.sh install "$(GUI_MAN_TARGETS)" \
951                 $(DEST_MAN_RU_U) $(INSTALLMLARGS)
953         @if _no.MAKEMO:
954            :sys cd $PODIR; $MAKE prefix=$DESTDIR$prefix \
955                     LOCALEDIR=$DEST_LANG INSTALL_DATA=cp FILEMOD=$FILEMOD install
956         @if os.path.exists(_no.LANGSOURCE):
957            :print installing language files
958            :copy $LANGSOURCE/README.txt $LANGSOURCE/*.vim $DEST_LANG
959            :chmod $FILEMOD $DEST_LANG/*.vim
960         @if os.path.exists(_no.KMAPSOURCE):
961            :copy $KMAPSOURCE/README.txt $KMAPSOURCE/*.vim $DEST_KMAP
962            :chmod $FILEMOD $DEST_KMAP/*.vim
964 # install the icons for KDE, if the directory exists and the icon doesn't.
965 ICON48PATH = $DESTDIR$DATADIR/icons/hicolor/48x48/apps
966 ICON32PATH = $DESTDIR$DATADIR/icons/locolor/32x32/apps
967 ICON16PATH = $DESTDIR$DATADIR/icons/locolor/16x16/apps
968 KDEPATH = $HOME/.kde/share/icons
969 install-icons {virtual}:
970         gp = $ICON48PATH/gvim.png
971         @if os.path.isdir(_no.ICON48PATH) and not os.path.exists(gp):
972            :copy $SCRIPTSOURCE/vim48x48.png $gp
973         gp = $ICON32PATH/gvim.png
974         @if os.path.isdir(_no.ICON32PATH) and not os.path.exists(gp):
975            :copy $SCRIPTSOURCE/vim32x32.png $gp
976         gp = $ICON16PATH/gvim.png
977         @if os.path.isdir(_no.ICON16PATH) and not os.path.exists(gp):
978            :copy $SCRIPTSOURCE/vim16x16.png $gp
981 $HELPSOURCE/vim.1 $MACROSOURCE $TOOLSSOURCE:
982         @if not os.path.exists(_no.TOOLSSOURCE):
983             :print Runtime files not found.
984             :error You need to unpack the runtime archive before running "make install".
986 # create links from various names to vim.  This is only done when the links
987 # (or executables with the same name) don't exist yet.
988 installlinks {virtual}: $GUI_TARGETS \
989                         $DEST_BIN/$EXTARGET \
990                         $DEST_BIN/$VIEWTARGET \
991                         $DEST_BIN/$RVIMTARGET \
992                         $DEST_BIN/$RVIEWTARGET \
993                         $INSTALLVIMDIFF
995 installglinks {virtual}: $DEST_BIN/$GVIMTARGET \
996                         $DEST_BIN/$GVIEWTARGET \
997                         $DEST_BIN/$RGVIMTARGET \
998                         $DEST_BIN/$RGVIEWTARGET \
999                         $DEST_BIN/$EVIMTARGET \
1000                         $DEST_BIN/$EVIEWTARGET \
1001                         $INSTALLGVIMDIFF
1003 installvimdiff {virtual}: $DEST_BIN/$VIMDIFFTARGET
1004 installgvimdiff {virtual}: $DEST_BIN/$GVIMDIFFTARGET
1006 # These dependencies use an empty buildcheck so that they are only done when
1007 # the target doesn't exist.
1008 $DEST_BIN/$EXTARGET: {buildcheck = }
1009     :sys cd $DEST_BIN; ln -s $VIMTARGET $EXTARGET
1011 $DEST_BIN/$VIEWTARGET: {buildcheck = }
1012     :sys cd $DEST_BIN; ln -s $VIMTARGET $VIEWTARGET
1014 $DEST_BIN/$GVIMTARGET: {buildcheck = }
1015     :sys cd $DEST_BIN; ln -s $VIMTARGET $GVIMTARGET
1017 $DEST_BIN/$GVIEWTARGET: {buildcheck = }
1018     :sys cd $DEST_BIN; ln -s $VIMTARGET $GVIEWTARGET
1020 $DEST_BIN/$RVIMTARGET: {buildcheck = }
1021     :sys cd $DEST_BIN; ln -s $VIMTARGET $RVIMTARGET
1023 $DEST_BIN/$RVIEWTARGET: {buildcheck = }
1024     :sys cd $DEST_BIN; ln -s $VIMTARGET $RVIEWTARGET
1026 $DEST_BIN/$RGVIMTARGET: {buildcheck = }
1027     :sys cd $DEST_BIN; ln -s $VIMTARGET $RGVIMTARGET
1029 $DEST_BIN/$RGVIEWTARGET: {buildcheck = }
1030     :sys cd $DEST_BIN; ln -s $VIMTARGET $RGVIEWTARGET
1032 $DEST_BIN/$VIMDIFFTARGET: {buildcheck = }
1033     :sys cd $DEST_BIN; ln -s $VIMTARGET $VIMDIFFTARGET
1035 $DEST_BIN/$GVIMDIFFTARGET: {buildcheck = }
1036     :sys cd $DEST_BIN; ln -s $VIMTARGET $GVIMDIFFTARGET
1038 $DEST_BIN/$EVIMTARGET: {buildcheck = }
1039     :sys cd $DEST_BIN; ln -s $VIMTARGET $EVIMTARGET
1041 $DEST_BIN/$EVIEWTARGET: {buildcheck = }
1042     :sys cd $DEST_BIN; ln -s $VIMTARGET $EVIEWTARGET
1044 # create links for the manual pages with various names to vim.  This is only
1045 # done when the links (or manpages with the same name) don't exist yet.
1046 INSTALLMLARGS = $(VIMNAME) $(VIMDIFFNAME) $(EVIMNAME) \
1047                 $(EXNAME) $(VIEWNAME) $(RVIMNAME) $(RVIEWNAME) \
1048                 $(GVIMNAME) $(GVIEWNAME) $(RGVIMNAME) $(RGVIEWNAME) \
1049                 $(GVIMDIFFNAME) $(EVIEWNAME)
1051 installmanlinks {virtual}:
1052     :chmod 755 installml.sh
1053     :sys ./installml.sh install "$(GUI_MAN_TARGETS)" \
1054                 $(DEST_MAN) $(INSTALLMLARGS)
1057 # U N I N S T A L L
1059 uninstall {virtual}{force}: uninstall_runtime
1060     :del {force} $DEST_BIN/$VIMTARGET
1061     :del {force} $DEST_BIN/vimtutor
1062     :del {force} $DEST_BIN/$EXTARGET $DEST_BIN/$VIEWTARGET
1063     :del {force} $DEST_BIN/$GVIMTARGET $DEST_BIN/$GVIEWTARGET
1064     :del {force} $DEST_BIN/$RVIMTARGET $DEST_BIN/$RVIEWTARGET
1065     :del {force} $DEST_BIN/$RGVIMTARGET $DEST_BIN/$RGVIEWTARGET
1066     :del {force} $DEST_BIN/$VIMDIFFTARGET $DEST_BIN/$GVIMDIFFTARGET
1067     :del {force} $DEST_BIN/$EVIMTARGET $DEST_BIN/$EVIEWTARGET
1068     :del {force} $DEST_BIN/xxd$EXESUF
1070 # Note: "deldir" will fail if any files were added after "make install", that
1071 # is intentionally: Keep files the user added.
1072 uninstall_runtime {virtual}{force}:
1073     :chmod 755 installman.sh
1074     :sys ./installman.sh uninstall $(DEST_MAN) "" $(INSTALLMANARGS)
1075     :sys ./installman.sh uninstall $(DEST_MAN_FR) "" $(INSTALLMANARGS)
1076     :sys ./installman.sh uninstall $(DEST_MAN_FR_I) "" $(INSTALLMANARGS)
1077     :sys ./installman.sh uninstall $(DEST_MAN_FR_U) "" $(INSTALLMANARGS)
1078     :sys ./installman.sh uninstall $(DEST_MAN_IT) "" $(INSTALLMANARGS)
1079     :sys ./installman.sh uninstall $(DEST_MAN_IT_I) "" $(INSTALLMANARGS)
1080     :sys ./installman.sh uninstall $(DEST_MAN_IT_U) "" $(INSTALLMANARGS)
1081     :sys ./installman.sh uninstall $(DEST_MAN_PL) "" $(INSTALLMANARGS)
1082     :sys ./installman.sh uninstall $(DEST_MAN_PL_U) "" $(INSTALLMANARGS)
1083     :sys ./installman.sh uninstall $(DEST_MAN_RU) "" $(INSTALLMANARGS)
1084     :sys ./installman.sh uninstall $(DEST_MAN_RU_U) "" $(INSTALLMANARGS)
1085     :chmod 755 installml.sh
1086     :sys ./installml.sh uninstall "$(GUI_MAN_TARGETS)" \
1087             $(DEST_MAN) $(INSTALLMLARGS)
1088     :sys ./installml.sh uninstall "$(GUI_MAN_TARGETS)" \
1089             $(DEST_MAN_FR) $(INSTALLMLARGS)
1090     :sys ./installml.sh uninstall "$(GUI_MAN_TARGETS)" \
1091             $(DEST_MAN_FR_I) $(INSTALLMLARGS)
1092     :sys ./installml.sh uninstall "$(GUI_MAN_TARGETS)" \
1093             $(DEST_MAN_FR_U) $(INSTALLMLARGS)
1094     :sys ./installml.sh uninstall "$(GUI_MAN_TARGETS)" \
1095             $(DEST_MAN_IT) $(INSTALLMLARGS)
1096     :sys ./installml.sh uninstall "$(GUI_MAN_TARGETS)" \
1097             $(DEST_MAN_IT_I) $(INSTALLMLARGS)
1098     :sys ./installml.sh uninstall "$(GUI_MAN_TARGETS)" \
1099             $(DEST_MAN_IT_U) $(INSTALLMLARGS)
1100     :sys ./installml.sh uninstall "$(GUI_MAN_TARGETS)" \
1101             $(DEST_MAN_PL) $(INSTALLMLARGS)
1102     :sys ./installml.sh uninstall "$(GUI_MAN_TARGETS)" \
1103             $(DEST_MAN_PL_U) $(INSTALLMLARGS)
1104     :sys ./installml.sh uninstall "$(GUI_MAN_TARGETS)" \
1105             $(DEST_MAN_RU) $(INSTALLMLARGS)
1106     :sys ./installml.sh uninstall "$(GUI_MAN_TARGETS)" \
1107             $(DEST_MAN_RU_U) $(INSTALLMLARGS)
1108     :del {force} $DEST_MAN/xxd.1
1109     :del {force} $(DEST_MAN_FR)/xxd.1 $(DEST_MAN_FR_I)/xxd.1 $(DEST_MAN_FR_U)/xxd.1
1110     :del {force} $(DEST_MAN_IT)/xxd.1 $(DEST_MAN_IT_I)/xxd.1 $(DEST_MAN_IT_U)/xxd.1
1111     :del {force} $(DEST_MAN_PL)/xxd.1 $(DEST_MAN_PL_U)/xxd.1
1112     :del {force} $(DEST_MAN_RU)/xxd.1 $(DEST_MAN_RU_U)/xxd.1
1114     :del {force} $DEST_HELP/*.txt $DEST_HELP/tags $DEST_HELP/*.pl
1115     :del {force} $SYS_MENU_FILE $SYS_SYNMENU_FILE $SYS_DELMENU_FILE
1116     :del {force} $SYS_BUGR_FILE $EVIM_FILE $MSWIN_FILE
1117     :del {force} $DEST_SCRIPT/gvimrc_example.vim $DEST_SCRIPT/vimrc_example.vim
1118     :del {force} $SYS_FILETYPE_FILE $SYS_FTOFF_FILE $SYS_SCRIPTS_FILE
1119     :del {force} $SYS_INDOFF_FILE $SYS_INDENT_FILE
1120     :del {force} $SYS_FTPLUGOF_FILE $SYS_FTPLUGIN_FILE
1121     :del {force} $SYS_OPTWIN_FILE
1122     :del {force} $DEST_COL/*.vim $DEST_COL/README.txt
1123     :del {force} $DEST_SYN/*.vim $DEST_SYN/README.txt
1124     :del {force} $DEST_IND/*.vim $DEST_IND/README.txt
1125     :del {force} $DEST_PRINT/*.ps
1126     :del {force}{recursive} $DEST_MACRO
1127     :del {force}{recursive} $DEST_TUTOR
1128     :del {force}{recursive} $DEST_SPELL
1129     :del {force}{recursive} $DEST_TOOLS
1130     :del {force}{recursive} $DEST_LANG
1131     :del {force}{recursive} $DEST_KMAP
1132     :del {force}{recursive} $DEST_COMP
1133     :deldir {force} $DEST_HELP $DEST_COL $DEST_SYN $DEST_IND
1134     :del {force}{recursive} $DEST_FTP/*.vim $DEST_FTP/README.txt
1135     :del {force} $DEST_AUTO/*.vim $DEST_AUTO/README.txt $DEST_AUTO/xml/*.vim
1136     :del {force} $DEST_PLUG/*.vim $DEST_PLUG/README.txt
1137     :deldir {force} $DEST_FTP $DEST_AUTO/xml $DEST_AUTO $DEST_PLUG $DEST_PRINT $DEST_RT
1138 #       This will fail when other Vim versions are installed, no worries.
1139     @try:
1140         :deldir $DEST_VIM
1141     @except:
1142         :print Cannot delete $DEST_VIM
1144 ###############################################################################
1145 ### MacOS X installation
1147 ### This installs a runnable Vim.app in $(prefix)
1149 REZ    = /Developer/Tools/Rez
1150 RESDIR = $(APPDIR)/Contents/Resources
1151 @r = re.compile('.*VIM_VERSION_SHORT\\s*"(\\d[^"]*)".*', re.S)
1152 VERSION = /`r.match(open("version.h").read()).group(1)`
1154 ### Common flags
1155 M4FLAGSX = $?(M4FLAGS) -DAPP_EXE=$(VIMNAME) -DAPP_NAME=$(VIMNAME) \
1156                 -DAPP_VER=$(VERSION)
1158 # Resources used for the Mac are in one directory.
1159 RSRC_DIR = os_mac_rsrc
1161 :attr {directory = $DIRMOD} $RESDIR
1163 install_macosx {virtual}: gui_bundle
1164 # Remove the link to the runtime dir, don't want to copy all of that.
1165         :delete {force} $(RESDIR)/vim/runtime
1166         :copy {r} $APPDIR $DESTDIR$prefix
1167         :tree $DESTDIR$prefix {dirname = AAPDIR}
1168              :delete {recursive} $name
1169 # Install the runtime files.  Recursive!
1170         :mkdir {r}{f} $DESTDIR$prefix/$RESDIR/vim/runtime
1171 #       :mkdir $(DESTDIR)$(prefix)/$(APPDIR)/bin
1172         :execute main.aap PREFIX=$DESTDIR$prefix/$RESDIR/vim VIMRTLOC=$DESTDIR$prefix/$RESDIR/vim/runtime installruntime
1173 # Put the link back.
1174         :symlink `os.getcwd()`/../runtime $RESDIR/vim/runtime
1175 # TODO: Create the vimtutor application.
1177 gui_bundle {virtual}: $(RESDIR) bundle-dir bundle-executable bundle-info \
1178                         bundle-resource bundle-language
1180 bundle-dir {virtual}: $(APPDIR)/Contents $(VIMTARGET)
1181 # Make a link to the runtime directory, so that we can try out the executable
1182 # without installing it.
1183         :mkdir {r}{f} $(RESDIR)/vim
1184         :symlink {quiet} `os.getcwd()`/../runtime $(RESDIR)/vim/runtime
1186 bundle-executable {virtual}: $(VIMTARGET)
1187         :mkdir {r}{f} $(APPDIR)/Contents/MacOS
1188         :copy $(VIMTARGET) $(APPDIR)/Contents/MacOS/$(VIMTARGET)
1190 bundle-info {virtual}:  bundle-dir
1191         :print Creating PkgInfo
1192         :print "APPLVIM!" >! $(APPDIR)/Contents/PkgInfo
1193         :print Creating Info.plist
1194         :sys m4 $(M4FLAGSX) infplist.xml > $(APPDIR)/Contents/Info.plist
1196 bundle-resource {virtual}: bundle-dir bundle-rsrc
1197         :copy {force} $(RSRC_DIR)/*.icns $(RESDIR)
1199 ### Classic resources
1200 # Resource fork (in the form of a .rsrc file) for Classic Vim (Mac OS 9)
1201 # This file is also required for OS X Vim.
1202 bundle-rsrc {virtual}: os_mac.rsr.hqx
1203     :print Creating resource fork
1204     :sys python dehqx.py $source
1205     :del {force} gui_mac.rsrc
1206     :move gui_mac.rsrc.rsrcfork $(RESDIR)/$(VIMNAME).rsrc
1208 # po/Make_osx.pl says something about generating a Mac message file
1209 # for Ukrananian.  Would somebody using Mac OS X in Ukranian
1210 # *really* be upset that Carbon Vim was not localised in
1211 # Ukranian?
1213 #bundle-language: bundle-dir po/Make_osx.pl
1214 #       cd po && perl Make_osx.pl --outdir ../$(RESDIR) $(MULTILANG)
1215 bundle-language {virtual}: bundle-dir
1217 $(APPDIR)/Contents:
1218     :mkdir {r} $(APPDIR)/Contents/MacOS
1219     :mkdir {r} $(RESDIR)/English.lproj
1222 # vim: sts=4 sw=4 :