# Sun May  5 16:42:20 GMT+0100 1996 -vkyr
# Makefile for MicroEmacs 'me' (NeXT version) 
# 

#
# Application name for MicroEmacs, we choose "me" for a shortcut. 
#
NAME = me

#
# Setup the installation directories for 'make install',
# must be the same for LIBDIR as it is defined in 'src/epath.h'!
#
BINDIR = /usr/local/bin
LIBDIR = /usr/local/lib/memacs

#
# Set up C compiler and required flags
#
CC      = cc
CFLAGS  = -O 
LDFLAGS = -ltermcap    # this is important for NeXTstep/BSD
SHELL = /bin/sh

#
# Source files for MicroEmacs NeXTstep version.
#
CFILES =		basic.c bind.c buffer.c char.c crypt.c display.c eval.c \
		exec.c file.c fileio.c input.c isearch.c line.c lock.c main.c \
		mouse.c random.c region.c search.c tcap.c unix.c window.c word.c

HFILES =		estruct.h edef.h efunc.h epath.h ebind.h evar.h etype.h

#
# Make rules.
#
SRCFILES = $(CFILES) 
OBJFILES = $(CFILES:.c=.o)

$(NAME): $(OBJFILES) 
	$(CC) -o $@ $(CFLAGS) $(OBJFILES) $(LDFLAGS)
	strip $(NAME)
	
clean: 
	rm -f *.o $(NAME)

install:	
	if [ ! -d "$(BINDIR)" ]; \
	then \
		mkdir $(BINDIR); \
	fi 
	- cp $(NAME)  $(BINDIR)
	if [ ! -d "$(LIBDIR)" ]; \
	then \
		mkdir $(LIBDIR); \
	fi
	- cp ../cmd/* $(LIBDIR)
	cp ../cmd/.emacsrc $(LIBDIR)

help: 
	@echo '  make'
	@echo '   or  make $(NAME) - to build MicroEmacs for NeXTstep.'
	@echo '  make clean   - to remove all files but the source.'
	@echo '  make install - to install the binary in $(BINDIR) and the'
	@echo '                 setup, help files etc. in $(LIBDIR).'

$(OFILES):	$(HFILES)
