/**/# Makefile for Joe's Own Editor

/**/###############
/**/# Configuration
/**/###############

/**/# Uncomment one of the lines below to select
/**/# which TTY structure your system uses:

#if defined(ibm032) || defined(vax) || defined(sun)
TTY = -DBSDTTY
#else
TTY = -DPOSIXTTY
#endif

/**/# Uncomment the second line below if your
/**/# system has the 'setitimer' system call:

/**/#TIM =
TIM = -DBSDTIMER

/**/# Uncomment which ever addition include
/**/# files you need in 'tty.c' to get the
/**/# timer or the tty structure to work .
/**/#
/**/# SCO is for sys/stream.h and sys/ptem.h
/**/# SYSPARAM is for sys/param.h
/**/# SYSTIM is for sys/time.h
/**/# TIM is for time.h

/**/#IA = -DSCO
IA =
/**/#IB = -DSYSPARAM
IB =
IC = -DSYSTIM
/**/#IC =
/**/#ID = -DTIM
ID =

/**/# Uncomment the second line below if your
/**/# system has the Xenix-style 'nap' system
/**/# call:

CHK =
/**/#CHK = -DXENIX

/**/# Uncomment the second line below if your
/**/# system is real BSD, and hence uses
/**/# 'getwd' instead of 'getcwd':

/**/#REAL =
#if defined(vax) || defined(ibm032)
REAL = -DREALBSD
#endif

/**/# Uncomment the second line below if your
/**/# POSIX system has 'sigaction', but not
/**/# 'signal':

HARDER =
/**/#HARDER = -DREALPOSIX

/**/# Uncomment the method to make new session
/**/# leaders (or none if you don't have joe control
/**/# or ptys).  GRPCALL is for 'setpgrp(getpid(),0)'
/**/# and SIDCALL is for 'setsid()'.  GRPCALL
/**/# is supposed to be more portable, but
/**/# 'SIDCALL' always works, if it's provided.

/**/#PGRP = -DSIDCALL
#if defined(sun) || defined(ultrix) || defined(_IBMR2)
PGRP = -DSIDCALL
#else
PGRP = -DGRPCALL
#endif

/**/# Set directory where ptys and corresponding ttys can be found

WHEREPTY = /dev/
WHERETTY = /dev/

/**/# Set where you want joe to go and where you
/**/# want joe's initialization file (joerc) to go:

WHERERC = /usr/sipb/lib
WHEREJOE = /usr/sipb/bin

/**/# You may also have to add some additional
/**/# defines to get the include files to work
/**/# right on some systems.
/**/#
/**/# for newer HPUX systems, you need to add:  -D_HPUX_SOURCE

CFLAGS = -O9 \
 $(TTY) $(TIM) $(CHK) $(REAL) $(HARDER) $(PGRP) \
 $(IA) $(IB) $(IC) $(ID) \
 -DJOERC=\"$(WHERERC)/joerc\" \
 -DPTYPREFIX=\"$(WHEREPTY)\" \
 -DTTYPREFIX=\"$(WHERETTY)\"

/**/# You may have to include some extra libraries
/**/# for some systems
/**/#
/**/# for Xenix, add: -lx
/**/#
/**/# for some systems you might have to add: -lbsd
/**/# to get enough BSD extensions to use -DBSDTIMER
/**/# above (I think ESIX needs this)
/**/#
/**/# If you wish to use terminfo, you have to
/**/# add '-ltinfo', '-lcurses' or '-ltermlib',
/**/# depending on the system.

EXTRALIBS =

/**/# Object files
/**/#
/**/# for systems with no 'opendir' (older SYS V)
/**/# or confused 'opendir' (Xenix), add: olddir.o
/**/#
/**/# If you wish to use terminfo instead of
/**/# termcap, replace 'termcap.o' below with 'terminfo.o'

OBJS = main.o termcap.o vfile.o pathfunc.o queue.o blocks.o vs.o va.o scrn.o \
       b.o bw.o tw.o pw.o help.o heap.o toomany.o queue.o zstr.o edfuncs.o \
       kbd.o w.o reg.o tab.o pattern.o random.o regex.o undo.o menu.o macro.o \
       poshist.o tty.o msgs.o qw.o

CC = gcc

/**/# That's it!

all:: joe

joe: $(OBJS)
	$(CC) $(CFLAGS) -o joe $(OBJS) $(EXTRALIBS)

termidx: termidx.o
	$(CC) $(CFLAGS) -o termidx termidx.o

install:: joe termidx
	if [ ! -d $(WHEREJOE) ]; then mkdir $(WHEREJOE); chmod a+rx $(WHEREJOE); fi
	$(INSTALL) -s -m 755 joe $(WHEREJOE)
	if [ ! -d $(WHERERC) ]; then mkdir $(WHERERC); chmod a+rx $(WHERERC); fi
	$(INSTALL) -m 444 joerc $(WHERERC)
	$(INSTALL) -m 444 joe.1 /usr/sipb/man/man1
clean::
	rm -f $(OBJS) termidx.o *~ *.bak
