# set to top of path for X libraries/includes
# (note that this should be unnecessary on Athena b/c everything's under
#  /usr/athena; on other systems it might this or /usr/X11R5 or /usr/X11R6)
X11=/usr/X11
XLIB=$(X11)/lib
XINC=$(X11)/include

# to do profiling, use
#   gmake profile DO='<type>'
# (on suns)
#   gmake profile DO='sun LIBS="$(LIBS) -lc -ldl"'

# set if other libraries (like -lsocket -lnsl for sun) are needed
MORE_LIBS=

# use -g to be able to to run under a debugger
# use -Wall to get more warnings (way too many on suns now, though)
CFLAGS=-g -Wall -DDEBUG
LDFLAGS=

CC=gcc

SRCS=main.c xfuncs.c xinit.c xmain.c xinfo.c xmenu.c zfuncs.c strdup.c
HDRS=xzul.h xzul.xbm
INCLUDES=-I$(XINC) -I/usr/athena/include -I/usr/athena/include/kerberosIV
LIBS=-L$(XLIB) -L/usr/athena/lib -lcom_err -lzephyr -lkrb4 -lkrb5 -ldes425 -lcrypto -lX11

OBJS=$(SRCS:.c=.o)

all: xzul

profile:
	$(MAKE) DO= CFLAGS="$(CFLAGS) -DPROFILE -pg" LDFLAGS="$(LDFLAGS) -pg" $(DO)

sun:
	$(MAKE) X11=/usr/openwin MORE_LIBS="-lsocket -lnsl" CFLAGS="-g -DDEBUG" $(DO)

rs6k:
	$(MAKE) X11=/usr $(DO)

sgi:
	$(MAKE) X11=/usr CC=cc CFLAGS="-g -DDEBUG" $(DO)

hp:
	if [ ! -d /mit/x11 ]; then attach -h -n hp-x11r5; fi
	$(MAKE) XLIB=/usr/lib/X11R5 $(DO)

dec:
	if [ ! -d /mit/x11 ]; then attach -h -n x11r5; else :; fi
	$(MAKE) CFLAGS="$(CFLAGS) -DNLSPATH='"'"/afs/athena.mit.edu/astaff/project/x11r5/decmipslib/X11/nls"'"'" $(DO)

# add "-b i486-linuxaout" to CFLAGS and "-b i486-linuxaout -m i386linux"
# to LDFLAGS on olders systems
linux:
	$(MAKE) LIBS="-L$(XLIB) -L/usr/athena/lib -lcom_err -lzephyr -lkrb -ldes -lX11" $(DO)

netbsd:
	$(MAKE) X11=/usr/X11R6 $(DO)

xzul: $(OBJS)
	$(CC) $(LDFLAGS) -o xzul $(OBJS) $(LIBS) $(MORE_LIBS)

install: xzul
	mv xzul /afs/sipb/project/outland/bin/xzul.beta

.c.o:
	$(CC) $(CFLAGS) $(INCLUDES) -c $<

sources: $(SRCS) $(HDRS)

clean:
	rm -f $(OBJS) xzul
