# Makefile for Citadel/UX
# If programs seem to crash for no reason, try increasing the stack size!
# Anything that seems to be missing probably isn't critical.

#  HOW TO MAKE IT WORK:
#
# Uncomment the "CFLAGS" and "LFLAGS" lines for the operating system you are
# using.  If yours isn't listed, try various ones until you find one that
# works.
# 
#  WHAT THE VARIOUS FLAGS MEAN:
# 
# VISUAL_SETUP		- Compile the full-screen version of the "setup"
#			  program.  If you can't get the full-screen setup
#			  to work properly, see below for compiling a
#			  line-oriented version!
# ENABLE_AUTOLOGIN      - If your system supports the crypt() routine and
#                         does not use shadow passwords, you can automatically
#                         bind Citadel user accounts to accounts on the host
#                         computer by defining this.
# ANSI_COLOR            - The text client will display in color using ANSI
#                         escape sequences.  Intended for non Unix displays.


# BBSDIR is normally set to "." (the current directory)
BBSDIR=.

# Use this one for Linux.
CFLAGS=-DVISUAL_SETUP -DENABLE_AUTOLOGIN -DBBSDIR=\"$(BBSDIR)\" -Wall
LFLAGS=
CC=cc

# Use this one for Cygnus GNU-Win32 (experimental)
#CFLAGS=-DBBSDIR=\"$(BBSDIR)\" -DANSI_COLOR -Wall
#LFLAGS=
#CC=gcc

# Use this one for SunOS or Solaris (tested on a SPARCstation IPX)
#
#CFLAGS=-DENABLE_AUTOLOGIN -DBBSDIR=\"$(BBSDIR)\"
#LFLAGS=
#CC=cc

# This was tested with FreeBSD v2.1 by BTx
# CFLAGS=-DBBSDIR=\"$(BBSDIR)\" -DFreeBSD
# LFLAGS=-lcompat
# CC=cc

# This seems to work with other BSD flavours
#
#CFLAGS=-DVISUAL_SETUP -DENABLE_AUTOLOGIN -DBBSDIR=\"$(BBSDIR)\" -Wall
#LFLAGS=-lcompat
#CC=cc

# This one seems to work on AIX (tested on an RS/6000)
#
#CFLAGS=-DVISUAL_SETUP -DBBSDIR=\"$(BBSDIR)\"
#LFLAGS=
#CC=cc

# Use this one for SCO UNIX or SCO Xenix.
#
# CFLAGS=-s -i -DVISUAL_SETUP -DBBSDIR=\"$(BBSDIR)\"
# LFLAGS=
# CC=cc

# This works for SCO Xenix 286.
#
# CFLAGS=-Ms2 -LARGE -F 4096 -s -i -DENABLE_AUTOLOGIN -DVISUAL_SETUP -DBBSDIR=\"$(BBSDIR)\"
# LFLAGS=
# CC=cc

# for Xenix 2.3.4 with termcap...
#
# CFLAGS=-s -i -DENABLE_AUTOLOGIN -DVISUAL_SETUP -DBBSDIR=\"$(BBSDIR)\"
# LFLAGS=
# CC=cc

# This should work for Microport or any 'generic' System V.
#
# CFLAGS=-i -DBBSDIR=\"$(BBSDIR)\"
# LFLAGS=
# CC=cc


########################################################################

all: citadel whobbs

#
#

citadel: ipc_c_tcp.o citadel.o rooms.o routines.o routines2.o messages.o \
	commands.o client_chat.o
	$(CC) $(CFLAGS) ipc_c_tcp.o citadel.o rooms.o routines.o routines2.o \
	messages.o commands.o client_chat.o $(LFLAGS) -o citadel

ipc_c_tcp.o: ipc_c_tcp.c sysdep.h
	$(CC) $(CFLAGS) -c ipc_c_tcp.c

citadel.o: citadel.c axdefs.h citadel.h
	$(CC) -O $(CFLAGS) -c citadel.c

rooms.o: rooms.c citadel.h
	$(CC) -O $(CFLAGS) -c rooms.c

messages.o: messages.c citadel.h
	$(CC) -O $(CFLAGS) -c messages.c

commands.o: commands.c citadel.h
	$(CC) -O $(CFLAGS) -c commands.c

routines.o: routines.c citadel.h
	$(CC) -O $(CFLAGS) -c routines.c

routines2.o: routines2.c citadel.h
	$(CC) -O $(CFLAGS) -c routines2.c

client_chat.o: client_chat.c citadel.h
	$(CC) -O $(CFLAGS) -c client_chat.c

whobbs: whobbs.c ipc_c_tcp.o
	$(CC) -O $(CFLAGS) whobbs.c ipc_c_tcp.o $(LFLAGS) -o whobbs

citadel.h: sysdep.h sysconfig.h ipcdef.h
	touch citadel.h

sysdep.h: configure.sh
	sh configure.sh $(CC)
