# @(#)Makefile	1.4 21/9/92 (UKC)
#
CC= gcc

#usually, DESTDIR is empty
# May want to change /usr/?/X11 to /usr/X386/?, depending on
# your set-up.
MANDIR=$(DESTDIR)/usr/man/man1
BINDIR=$(DESTDIR)/usr/bin/X11
USRLIBDIR=$(DESTDIR)/usr/lib/X11

#INCROOT=-I$(DESTDIR)/usr/include

# Rxvt now include optional utmp support.
# including utmp support allows rxvt to update /etc/utmp so
# that the commands who and w show rxvt logins.
# In order for this to work, /etc/utmp must be world writeable, or
# rxvt must be setuid root.
# to make rxvt setuid root, do this
# su
# chown root.root rxvt
# chmod a+s rxvt
# Do it at your own risk. 

# This define makes SYSV type systems to include utmp support ("who");
# This is ok for Linux
#DEFS = -DUTMP_SUPPORT -DUTMP=\"/etc/utmp\" 

# this should work for UNIXWARE svr4
#DEFS = -DUTMP_SUPPORT -DUTMP=\"/etc/utmp\" -DSVR4

# this should work for INTEL-ESIX svr4
#DEFS = -DUTMP_SUPPORT -DUTMP=\"/etc/utmp\" -DSVR4 -DESIX
#EXTRA_LOAD_FLAGS= -lsocket -lnsl -lc /usr/ucblib/libucb.a

# Using this defines adds in UTMP support for Sun OS 4.1.x
DEFS = -DUTMP_SUPPORT -DUTMP=\"/etc/utmp\" -DBSD -DTTYTAB=\"/etc/ttytab\"
  
# for FreeBSD 
#DEFS = -DUTMP_SUPPORT -DUTMP=\"/var/run/utmp\" -DBSD -DFREEBSD -DTTYTAB=\"/etc/ttys\"
  
# for NetBSD 0.9
#DEFS = -DUTMP_SUPPORT -DUTMP=\"/var/run/utmp\" -DBSD -DFREEBSD -DTTYTAB=\"/etc/ttys\"




# for most systems:
LIBS = $(EXTRA_LOAD_FLAGS) -L$(USRLIBDIR) -lX11 

# for solaris2 & some others
#LIBS = -L$(USRLIBDIR) -lX11 -lsocket

CFLAGS= -O2 -s $(INCROOT) $(DEFS) -fomit-frame-pointer

OBJ=rxvt.o xsetup.o command.o screen.o sbar.o utmp.o
SRC=rxvt.c xsetup.c command.c screen.c sbar.c utmp.c

rxvt: $(OBJ)
	$(CC) $(CFLAGS) -o rxvt $(OBJ) $(MALLOC) $(LIBS)

install: $(BINDIR)/rxvt $(MANDIR)/rxvt.1

$(MANDIR)/rxvt.1: rxvt.1
	install -c -m644 $? $@
$(BINDIR)/rxvt: rxvt
	install -c -m 4755 -o root $? $@

clean:
	rm -f $(OBJ)
	rm -f  rxvt 
	rm -f *~

depend:
	makedepend -- $(CFLAGS) -- $(SRC)




