# INSTALLATION
#    The installation instructions are in the README file.
# COPYRIGHT
#    Skim - Off-line news reading package optimized for slow lines.
#    Copyright (C) 1995  Rene W.J. Pijlman
#
#    This program is free software; you can redistribute it and/or modify
#    it under the terms of the GNU General Public License as published by
#    the Free Software Foundation; either version 2 of the License, or
#    (at your option) any later version.
#
#    This program is distributed in the hope that it will be useful,
#    but WITHOUT ANY WARRANTY; without even the implied warranty of
#    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
#    GNU General Public License for more details.
#
#    You should have received a copy of the GNU General Public License
#    along with this program; if not, write to the Free Software
#    Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
# VERSION
#    Skim version 0.6.
#    /home/rene/sys/CVS_MasterSourceRepository/skim/Makefile,v 1.38 1995/08/15 18:27:53 rpijlman Exp

# Skim executables will be installed in this directory.
BINDIR = /usr/bin

CC=gcc

# Must use -fno-strength-reduce with -O2, to work around a bug in gcc (it's at 
# least in version 2.5.8, 2.6.3 and 2.7.0).

# Production:
CFLAGS = -Wall -Wstrict-prototypes -Wmissing-prototypes \
         -O2 -fno-strength-reduce -fomit-frame-pointer -pipe -m486 -s -DNDEBUG

# Debugging:
# CFLAGS = -Wall -Wstrict-prototypes -Wmissing-prototypes -g -pipe -m486

# Source profiling:
# CFLAGS = -Wall -Wstrict-prototypes -Wmissing-prototypes -pg -pipe -m486

BINARIES = GetSubjectsOfNewArticlesInGroup \
           SplitArticle \
           PostArticle \
           GetListOfGroups \
           GetSelectedArticlesInGroup \
           Dispatch \
           AutoSelectAndKill \
           RebuildArticleIndexes

TEST_BINARIES = VarBufTest

SCRIPTS =  ReplyTo \
	   NewArticle \
	   GetSubjectsInGroup \
	   GetArticlesInGroup \
	   ListSubscribedNewsGroups \
	   skim \
	   xskim

SKIM_COMMON_OBJECTS = NNTPStream.o SkimUtils.o

BASIC_LIBRARY_OBJECTS = VarBuf.o MemAlloc.o

all: .depend $(BINARIES)

clean:
	rm -f $(BINARIES) $(TEST_BINARIES) *.o core *.tgz .depend

install:
	install -m 755 $(SCRIPTS) $(BINARIES) $(BINDIR)

VarBufTest: VarBufTest.o $(BASIC_LIBRARY_OBJECTS)
	$(CC) $(CFLAGS) -o $@ VarBufTest.o $(BASIC_LIBRARY_OBJECTS)

SplitArticle: SplitArticle.o Article.o $(BASIC_LIBRARY_OBJECTS)
	$(CC) $(CFLAGS) -o $@ SplitArticle.o Article.o $(BASIC_LIBRARY_OBJECTS)

AutoSelectAndKill: AutoSelectAndKill.o SkimUtils.o $(BASIC_LIBRARY_OBJECTS)
	$(CC) $(CFLAGS) -o $@ AutoSelectAndKill.o SkimUtils.o \
	      $(BASIC_LIBRARY_OBJECTS)

GetSubjectsOfNewArticlesInGroup: GetSubjectsOfNewArticlesInGroup.o \
				 NNTPStream.o $(BASIC_LIBRARY_OBJECTS)
	$(CC) $(CFLAGS) -o $@ GetSubjectsOfNewArticlesInGroup.o NNTPStream.o \
	                      $(BASIC_LIBRARY_OBJECTS)

GetListOfGroups: GetListOfGroups.o NNTPStream.o $(BASIC_LIBRARY_OBJECTS)
	$(CC) $(CFLAGS) -o $@ GetListOfGroups.o NNTPStream.o $(BASIC_LIBRARY_OBJECTS)

GetSelectedArticlesInGroup: GetSelectedArticlesInGroup.o \
                            $(SKIM_COMMON_OBJECTS) $(BASIC_LIBRARY_OBJECTS) \
                            ArticleIndex.o Article.o
	$(CC) $(CFLAGS) -o $@ GetSelectedArticlesInGroup.o \
                            $(SKIM_COMMON_OBJECTS) $(BASIC_LIBRARY_OBJECTS) \
                            ArticleIndex.o Article.o

RebuildArticleIndexes: RebuildArticleIndexes.o \
                            $(SKIM_COMMON_OBJECTS) $(BASIC_LIBRARY_OBJECTS) \
                            ArticleIndex.o Article.o
	$(CC) $(CFLAGS) -o $@ RebuildArticleIndexes.o \
                            $(SKIM_COMMON_OBJECTS) $(BASIC_LIBRARY_OBJECTS) \
                            ArticleIndex.o Article.o

PostArticle: PostArticle.o NNTPStream.o $(BASIC_LIBRARY_OBJECTS)
	$(CC) $(CFLAGS) -o $@ PostArticle.o NNTPStream.o \
	      $(BASIC_LIBRARY_OBJECTS)

Dispatch: Dispatch.o
	$(CC) $(CFLAGS) -o $@ Dispatch.o

.depend:
	@echo "You must do 'make depend' first!" 1>&2
	exit 1

dep: depend

depend:
	$(CPP) -M *.c > .depend

#
# include a dependency file if one exists
# 
ifeq (.depend,$(wildcard .depend))
include .depend
endif
