#
# $Id: Makefile,v 1.19 1998/11/19 19:20:40 bazsi Exp $
#

#################################
# configure paths
#################################
PREFIX=/usr/local
SBINDIR=$(PREFIX)/sbin
CONFDIR=/etc/nsyslogd
MANDIR=$(PREFIX)/man8

#################################
# tools to use (gcc/bison/flex recommended)
#################################
CC=gcc
#CC=cc
INSTALL=install 
YACC=yacc 
FLEX=flex

#################################
# use one of the following here:
#   __LINUX__  for compiling on linux
#   __BSD__    for compiling on BSD
#   __SUNOS26__  for compiling on Solaris 2.6 or later
#   __SUNOS25__  for compiling on Solaris 2.5.1 or earlier
# if you have a system not listed
# above, you should add a config
# section to config.h, and add 
# the define here
#################################
PLATFORM=__LINUX__
#PLATFORM=__BSD__
#PLATFORM=__SUNOS26__
#PLATFORM=__SUNOS25__


#################################
# CFLAGS
#################################
# debugging
CFLAGS=-g -Wall -D$(PLATFORM) 
#CFLAGS=-Wall -O2 -D$(PLATFORM)

#################################
# Libraries
#################################
# Solaris, SunOS 2.6 or later
#LIBS=-lnsl -lsocket -ll -ldoor -lpthread
# Solaris 2.5.1 or earlier
#LIBS=-lnsl -lsocket -ll
# Linux or BSDi
LIBS=-ll # -lefence
#-L. -lefence

#################################
# No modification below this part
#################################

OBJSNSYSLOGD=y.tab.o lex.yy.o var.o cfgfile.o log.o oldcf.o hash.o sha1.o main.o htcp.o utils.o ftable.o afinet.o afunix.o affile.o afuser.o afpipe.o afstreams.o afdoor.o
OBJSGENH0=genh0.o hash.o sha1.o utils.o
OBJSCHECKHASH=checkhash.o hash.o sha1.o utils.o

all: nsyslogd genh0 checkhash

install: nsyslogd genh0 checkhash
	$(INSTALL) nsyslogd $(SBINDIR)
	$(INSTALL) genh0 $(SBINDIR)
	$(INSTALL) checkhash $(SBINDIR)

nsyslogd: $(OBJSNSYSLOGD)
	$(CC) $(CFLAGS) $(OBJSNSYSLOGD) -o $@ $(LIBS)

genh0: $(OBJSGENH0)
	$(CC) $(CFLAGS) $(OBJSGENH0) -o $@ $(LIBS)

checkhash: $(OBJSCHECKHASH)
	$(CC) $(CFLAGS) $(OBJSCHECKHASH) -o $@ $(LIBS)

y.tab.c: yac.y
	$(YACC) -d yac.y

lex.yy.c: lex.l
	$(FLEX) lex.l

clean:
	rm -f *.o lex.yy.c y.tab.* nsyslogd y.output core *.ln *.core genh0 checkhash *~

lint: y.tab.c lex.yy.c
	 lint -aa -c -h -x -I. -H *.c

dep:
	$(CC) $(INCLUDE) -MM *.c >.depend

ifeq (.depend,$(wildcard .depend))
include .depend
endif
