# Makefile for slrn                               -*- sh -*-
# This file is divided into five configurable sections.  The last two sections
# are optional: Section 4 deals with setting up slrn to read the server name 
# from a file.  If you are compiling this on Linux and you want it to work 
# with 'term', look at the 5th section.

#-----------------------------------------------------------------------------
# 1. Choose a C compiler.  It must understand prototypes.
#-----------------------------------------------------------------------------
CC = cc -g -DHAS_TERMIOS                              # <--- generic unix
#CC = gcc -g -traditional-cpp -DHAS_TERMIOS            # <--- SunOS with gcc
CC = acc -g -Xa -vc -DHAS_TERMIOS                     # <--- SunOS with acc
#CC = gcc -g -Wall -DHAS_TERMIOS                       # <--- Linux -g
#CC = gcc -O2 -Wall -DHAS_TERMIOS -fno-strength-reduce # <--- Linux -O2
#CC = cc -g -Aa -D_HPUX_SOURCE -DHAS_TERMIOS           # <--- HP-UX
#CC = xlc -O -D_ALL_SOURCE -DHAS_TERMIOS               # <--- AIX
#  Note: gcc -O2 is buggy under Linux.  If you use it, include the
#        -fno-strength-reduce flag!!

#-----------------------------------------------------------------------------
# 2. On a few systems, additional libraries are required.
#-----------------------------------------------------------------------------
#MISCLIBS = -lnsl -lsocket                             # Solaris
#MISCLIBS = -ltermcap                                  # NeXT

#-----------------------------------------------------------------------------
# 3. Directory where the slang library, slanglib.a, is located.
#    BUILD SLANG FIRST!!!!  If you do not have it, get it from the same place
#    you picked up slrn.  The current home is space.mit.edu:/pub/davis/slang.
#-----------------------------------------------------------------------------
SDIR = ../slang/src

#-----------------------------------------------------------------------------
# 4. If you want to read the server from a file, uncomment the following
#    lines and edit it as appropriate.  See INSTALL for more information.
#    It is also possible to provide defaults for other variables such as the
#    HOSTNAME, etc...  by editing the config.h file.  Again, read INSTALL.
#-----------------------------------------------------------------------------
#NNTPSERVERFILE = -DNNTPSERVER_FILE=\"/usr/local/lib/news/nntp_server\"
#SLRNLIBDIR = -DSLRN_LIB_DIR=\"/usr/local/lib/news\"
#SLRNLIBDIR = -DSLRN_LIB_DIR=\"$(HOME)/lib/slrn\"

#----------------------------------------------------------------------------
# 5.  Uncomment the following lines for Linux Term compatability.
#MISCLIBS += -ltermnet
#MISCINCLUDES = -include /usr/local/include/termnet.h
#----------------------------------------------------------------------------


#----------------------------------------------------------------------------
# Nothing below here should require changing.
#----------------------------------------------------------------------------
GCC_FLAGS = -Wstrict-prototypes -Wpointer-arith -Wcast-align -Wcast-qual\
  -Wtraditional\
  -Wshadow\
  -Wconversion\
  -Waggregate-return\
  -Wmissing-prototypes\
  -Wnested-externs
#CC = gcc -g -Wall -DHAS_TERMIOS $(GCC_FLAGS)

OBJS = slrn.o group.o misc.o clientlib.o nntp.o art.o post.o startup.o\
       help.o hash.o score.o uudecode.o mime.o
       
CFLAGS = -I$(SDIR) $(MISCINCLUDES) $(NNTPSERVERFILE) $(SLRNLIBDIR) -Dunix



slrn: slangversion $(OBJS)
	$(CC) $(OBJS) -o slrn -L$(SDIR) -lslang $(MISCLIBS)

slangversion: chkslang
	./chkslang slrn 9923 9923

chkslang: chkslang.o
	$(CC) chkslang.o -o chkslang

chkslang.o: chkslang.c $(SDIR)/slang.h
	$(CC) -c -I$(SDIR) chkslang.c

uudecode: uudecode.c
	$(CC) $(CFLAGS) -DSTANDALONE -o uudecode uudecode.c
	touch uudecode.c

clean:
	/bin/rm -f *.o *~ slrn uudecode *.log \
	core out out.* typescript files.pck*
