#
# Makefile for VIM, using MWCC with unlimited linker
#
#

include $(BUILDHOME)/buildprefs/make.pre

#>>>>> choose options:
### See feature.h for a list of optionals.
### Any other defines can be included here.
OPTIMIZER=-O2
DEFINES = -DALL_BUILTIN_TCAPS
# Only use optimisation if you have lots of time and/or lots of memory.
# With 16M it thrashes like it's a top without safeword.


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

CFLAGS += -DUNIX -DHAVE_CONFIG_H $(DEFINES)

LDFLAGS += -ltermcap -lnet
INSTALL = install -c

SRCS =	alloc.c buffer.c charset.c cmdcmds.c cmdline.c \
	csearch.c digraph.c edit.c fileio.c getchar.c help.c \
	linefunc.c main.c mark.c memfile.c memline.c message.c misccmds.c \
	normal.c ops.c option.c pathdef.c quickfix.c regexp.c \
	regsub.c screen.c search.c \
	tables.c tag.c term.c undo.c unix.c window.c version.c

OBJS := $(SRCS_LIST_TO_OBJS)

TARGET	= $(OBJ_DIR)/vim

APP_VERSION		= -app 4 5 0 f 0 -short 4.5 -long "4.5 "`echo -n -e '\302\251'`" 1999 The Free Software Foundation"

all: $(TARGET)  ctags_dir

$(TARGET):	$(OBJ_DIR) $(OBJS)
	$(LD) -o $@ $(OBJS) $(LDFLAGS)
	$(SETVERSION) $@ $(SYSTEM_VERSION) $(APP_VERSION)


install:: all
	cd $(INSTALL_BIN); /bin/rm -f view vi ; /bin/ln -s vim vi ; /bin/ln -s vim view
	cd ctags ; $(MAKE) $(PARALLELMFLAGS) install

debug: $(OBJ) version.c
	${CC} $(CFLAGS) version.c -o version.o
	${LD} -s -o vim $(OBJ) version.o $(LIBS)

ctags:
	csh -c ctags $(SRC) *.h

ctags_dir:
	cd ctags ; $(MAKE) $(PARALLELMFLAGS)

osdef.h: osdef1.h.in osdef2.h.in osdef.sh
#	CC=mwcc osdef.sh
#	echo "" >osdef.h

clean::
	cd ctags ; $(MAKE) $(PARALLELMFLAGS) clean

$(OBJS):	osdef.h config.h

#######
include $(BUILDHOME)/buildprefs/make.post
#######

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

alloc.o:	alloc.c 

buffer.o:	buffer.c 

charset.o:	charset.c 

cmdcmds.o:	cmdcmds.c 

cmdline.o:	cmdline.c  cmdtab.h

csearch.o:	csearch.c  regexp.h

digraph.o: digraph.c

edit.o: edit.c

fileio.o:	fileio.c 

getchar.o: getchar.c

help.o: help.c

linefunc.o:	linefunc.c 

main.o: main.c

mark.o: mark.c

memfile.o:	memfile.c 

memline.o:	memline.c 

message.o:	message.c 

misccmds.o:	misccmds.c 

normal.o:	normal.c  ops.h

ops.o:	ops.c  ops.h

option.o:	option.c 

pathdef.o:	pathdef.c

quickfix.o:	quickfix.c 

regexp.o:	regexp.c  regexp.h

regsub.o:	regsub.c  regexp.h

screen.o:	screen.c 

search.o:	search.c  regexp.h

tables.o:	tables.c 

tag.o:	tag.c 

term.o:	term.c  term.h

termlib.o:	termlib.c

undo.o: undo.c

window.o: window.c

#cmdtab.h: cmdtab.tab mkcmdtab
#	./mkcmdtab cmdtab.tab cmdtab.h

#mkcmdtab: mkcmdtab.o
#	${LD} -o mkcmdtab mkcmdtab.o

#mkcmdtab.o: mkcmdtab.c
