#
# Makefile for Vim on Acorn Archimedes, using gcc and UnixLib
#

MACHINE = -DARCHIE

### gcc on the Arc.
CC=gcc

### Name of target
TARGET = vim

### See makefile.txt for a list of defines that can be included

# To keep the command line down, all the defs have gone into
# the macro file "defs"
DEFS = -include defs -O2

#>>>>> link with termlib or termcap only if HAVE_TGETENT is defined
### default
LIBS =

#>>>>> end of choices
###########################################################################

CFLAGS = -c $(MACHINE) $(DEFS)

INCL = h.vim h.globals h.option h.keymap h.macros h.ascii h.term h.os_unix h.debug

OBJ = \
	o.buffer \
	o.charset \
	o.digraph \
	o.edit \
	o.eval \
	o.ex_cmds \
	o.ex_docmd \
	o.ex_getln \
	o.fileio \
	o.getchar \
	o.main \
	o.mark \
	o.memfile \
	o.memline \
	o.message \
	o.misc1 \
	o.misc2 \
	o.normal \
	o.ops \
	o.option \
	o.os_archie \
	o.quickfix \
	o.regexp \
	o.screen \
	o.search \
	o.syntax \
	o.tag \
	o.term \
	o.ui \
	o.undo \
	o.window

$(TARGET): $(OBJ) c.version h.version
	$(CC) $(CFLAGS) version.c
	rename o.mkcmdtab tempfile
	$(CC) -o $(TARGET) o.* $(LIBS)
	rename tempfile o.mkcmdtab

###########################################################################

o.buffer:	c.buffer  $(INCL)
	$(CC) $(CFLAGS) buffer.c

o.charset:	c.charset  $(INCL)
	$(CC) $(CFLAGS) charset.c

o.digraph:	c.digraph  $(INCL)
	$(CC) $(CFLAGS) digraph.c

o.edit:	c.edit  $(INCL)
	$(CC) $(CFLAGS) edit.c

o.eval:	c.eval  $(INCL)
	$(CC) $(CFLAGS) eval.c

o.ex_cmds:	c.ex_cmds  $(INCL) h.ex_cmds
	$(CC) $(CFLAGS) ex_cmds.c

o.ex_docmd:	c.ex_docmd  $(INCL) h.ex_docmd h.ex_cmds
	$(CC) $(CFLAGS) ex_docmd.c

o.ex_getln:	c.ex_getln  $(INCL)
	$(CC) $(CFLAGS) ex_getln.c

o.fileio:	c.fileio  $(INCL)
	$(CC) $(CFLAGS) fileio.c

o.getchar:	c.getchar  $(INCL)
	$(CC) $(CFLAGS) getchar.c

o.main:	c.main  $(INCL)
	$(CC) $(CFLAGS) main.c

o.mark:	c.mark  $(INCL)
	$(CC) $(CFLAGS) mark.c

o.memfile:	c.memfile  $(INCL)
	$(CC) $(CFLAGS) memfile.c

o.memline:	c.memline  $(INCL)
	$(CC) $(CFLAGS) memline.c

o.message:	c.message  $(INCL)
	$(CC) $(CFLAGS) message.c

o.misc1:	c.misc1  $(INCL)
	$(CC) $(CFLAGS) misc1.c

o.misc2:	c.misc2  $(INCL)
	$(CC) $(CFLAGS) misc2.c

o.normal:	c.normal  $(INCL) h.ops
	$(CC) $(CFLAGS) normal.c

o.ops:	c.ops  $(INCL) h.ops
	$(CC) $(CFLAGS) ops.c

o.option:	c.option  $(INCL)
	$(CC) $(CFLAGS) option.c

o.os_archie:	c.os_archie  $(INCL) h.os_archie
	$(CC) $(CFLAGS) os_archie.c

o.quickfix:	c.quickfix  $(INCL)
	$(CC) $(CFLAGS) quickfix.c

o.regexp:	c.regexp  $(INCL)
	$(CC) $(CFLAGS) regexp.c

o.screen:	c.screen  $(INCL)
	$(CC) $(CFLAGS) screen.c

o.search:	c.search  $(INCL)
	$(CC) $(CFLAGS) search.c

o.syntax:	c.syntax  $(INCL)
	$(CC) $(CFLAGS) syntax.c

o.tag:	c.tag  $(INCL)
	$(CC) $(CFLAGS) tag.c

o.term:	c.term  $(INCL)
	$(CC) $(CFLAGS) term.c

o.ui:	c.ui  $(INCL)
	$(CC) $(CFLAGS) ui.c

o.undo:	c.undo  $(INCL)
	$(CC) $(CFLAGS) undo.c

o.window:	c.window  $(INCL)
	$(CC) $(CFLAGS) window.c

h.ex_cmds: h.ex_docmd mkcmdtab
	mkcmdtab h.ex_docmd h.ex_cmds

mkcmdtab: o.mkcmdtab
	$(CC) -o mkcmdtab mkcmdtab.o
