# This is the makefile for ne. The standard (default), noposix, debug, debug noposix,
# termcap and termcapnoposix targets build the obviously varied versions of the program.
# You can try standard, noposix, termcap and termcapnoposix if you get errors from the compiler.

PROGRAM       = ne

CC	      = mwcc -DSTDC_HEADERS

LIBS	      = # -lcurses

OBJS	      = actions.o \
		buffer.o \
		clips.o \
		cm.o \
		command.o \
		display.o \
		edit.o \
		errors.o \
		exec.o \
		hash.o \
		help.o \
		input.o \
		inputclass.o \
		keys.o \
		menu.o \
		names.o \
		navigation.o \
		ne.o \
		prefs.o \
		regex.o \
		request.o \
		search.o \
		signals.o \
		streams.o \
		support.o \
		term.o \
		undo.o


TERMCAPOBJS   = tparam.o \
		info2cap.o \
		termcap.o


standard:
	make $(PROGRAM) CFLAGS="-O2 -DNODEBUG -D_POSIX_SOURCE"

noposix:
	make $(PROGRAM) CFLAGS="-O2 -DNODEBUG"

debug:
	make $(PROGRAM) CFLAGS="-g -D_POSIX_SOURCE" LDFLAGS=-g
	
debugnoposix:
	make $(PROGRAM) CFLAGS=-g LDFLAGS=-g
	
termcap:
	make $(PROGRAM)t CFLAGS="-O2 -DTERMCAP -DNODEBUG -D_POSIX_SOURCE"

termcapnoposix:
	make $(PROGRAM)t CFLAGS="-O2 -DTERMCAP -DNODEBUG"


$(PROGRAM):	$(OBJS)
		$(CC) $(LDFLAGS) $(OBJS) $(LIBS) -o $(PROGRAM)


$(PROGRAM)t:	$(OBJS) $(TERMCAPOBJS)
		$(CC) $(LDFLAGS) $(OBJS) $(TERMCAPOBJS) $(LIBS) -o $(PROGRAM)

###
actions.o: ne.h	keycodes.h names.h errors.h protos.h version.h

buffer.o: ne.h keycodes.h names.h errors.h protos.h

clips.o: ne.h keycodes.h names.h errors.h protos.h

cm.o: cm.h

command.o: ne.h keycodes.h names.h errors.h protos.h help.h

display.o: ne.h keycodes.h names.h errors.h protos.h termchar.h

edit.o: ne.h keycodes.h names.h errors.h protos.h

errors.o: errors.h

exec.o: ne.h keycodes.h names.h errors.h protos.h

info2cap.o: info2cap.c info2cap.h

input.o: ne.h keycodes.h names.h errors.h protos.h

inputclass.o: ne.h keycodes.h names.h errors.h protos.h

keys.o: ne.h keycodes.h names.h errors.h protos.h

menu.o: ne.h keycodes.h names.h errors.h protos.h

navigation.o: ne.h keycodes.h names.h errors.h protos.h

ne.o: ne.h keycodes.h names.h errors.h protos.h version.h regex.h

prefs.o: ne.h keycodes.h names.h errors.h protos.h

regex.o: regex.h 
	$(CC) $(CFLAGS) -DREGEX_MALLOC -DSTDC_HEADERS -c regex.c

request.o: ne.h keycodes.h names.h errors.h protos.h

search.o: ne.h keycodes.h names.h errors.h protos.h regex.h

signals.o: ne.h keycodes.h names.h errors.h protos.h

streams.o: ne.h keycodes.h names.h errors.h protos.h

support.o: ne.h keycodes.h names.h errors.h protos.h

term.o: termchar.h cm.h

termcap.o: termcap.c termcap.h

tparam.o: tparam.c termcap.h
	$(CC) $(CFLAGS) -DNO_ARG_ARRAY -DSTDC_HEADERS -c tparam.c

undo.o: ne.h keycodes.h names.h errors.h protos.h
