set 68kTarget "68k"
set ppcTarget "ppc"
set carbonTarget "carbon"
set vimTargets "`getlistitem -m " Select the vim target platform" -c -q "{68kTarget}" "{ppcTarget}" "{carbonTarget}"`"
if !"{vimTargets}"
   echo "No Makefile created"
   exit 0
end
#
set generalSources "buffer.c charset.c diff.c digraph.c edit.c eval.c ex_cmds.c ex_cmds2.c ex_docmd.c ex_eval.c ex_getln.c fileio.c fold.c getchar.c gui.c gui_mac.c if_cscope.c main.c mark.c memfile.c memline.c menu.c message.c misc1.c misc2.c move.c mbyte.c normal.c ops.c option.c os_mac.c pty.c quickfix.c regexp.c screen.c search.c tag.c term.c termlib.c ui.c undo.c version.c window.c"
set generalOpts "-app -c 'VIM!' -t 'APPL' -i :proto"
set generalCOpts "-w 2,35 -enum int"
set generalLOpts "-mf -d"
set generalLibs ""
#
#
set 68kSources ""
set 68kOpts "-model far"
set 68kCOpts ""
set 68kLOpts ""
set 68kLibs ""
#
set ppcSources "syntax.c"
set ppcOpts "-powerpc"
set ppcCOpts ""
set ppcLOpts "{SharedLibraries}AppearanceLib"
set ppcLibs "{SharedLibraries}ContextualMenu"
#
set carbonSources ""
set carbonOpts "-carbon"
set carbonCOpts "-d TARGET_API_MAC_CARBON"
set carbonLOpts ""
set carbonLibs "{SharedLibraries}CarbonLib"
#
for vTarget in {vimTargets}
   set vSources "{generalSources}"
   set vLibs "{generalLibs}"
   set vOpts "{generalOpts}"
   set vCOpts "{generalCOpts}"
   set vLOpts "{generalLOpts}"
   set ppc ""
   if "{vTarget}" == "{68kTarget}"
      set vSources "{vSources} {68kSources}"
      set vOpts "{vOpts} {68kOpts}"
      set vLibs "{vLibs} {68kLibs}"
      if  "{68kCOpts}"
         set vCOpts "{vCOpts} {68kCOpts}"
      end
      if  "{68kLOpts}"
         set vLOpts "{vLOpts} {68kLOpts}"
      end
   else
      set ppc "ppc"
      set vSources "{vSources} {ppcSources}"
      set vOpts "{vOpts} {ppcOpts}"
      set vLibs "{vLibs} {ppcLibs}"
      if  "{ppcCOpts}"
         set vCOpts "{vCOpts} {ppcCOpts}"
      end
      if  "{ppcLOpts}"
         set vLOpts "{vLOpts} {ppcLOpts}"
      end
      if "{vTarget}" == "{carbonTarget}"
         set vSources "{vSources} {carbonSources}"
         set vLibs "{vLibs} {carbonLibs}"
         set vOpts "{vOpts} {carbonOpts}"
         if  "{carbonCOpts}"
            set vCOpts "{vCOpts} {carbonCOpts}"
         end
         if  "{carbonLOpts}"
            set vLOpts "{vLOpts} {carbonLOpts}"
         end
      end
   end
   set vODir :obj-{vTarget}:
   if !"`exists -d {vOdir}`"
      newFolder {vODir}
   end
   set vApp vim-{vTarget}
   if "{vCOpts}"
      set vOpts "{vOpts} -{ppc}COptions '{vCOpts}'"
   end
   if "{vLOpts}"
      set vOpts "{vOpts} -{ppc}LinkOptions '{vLOpts}'"
   end
   set vOpts "{vOpts} -objdir {vODir}"
   createmake {vApp} {vOpts} {vSources} {vLibs}
   if !{Status}
      echo "Makefile for {vApp} successfully created"
   end
end
