# Generated automatically from Makefile.in by configure.
# Yes, I know I need to get around to learning autoconf so's you'll never
# have to look at this file again. :)  Ain't there yet; sue me. :P

PROG = logtool
# the abbreviation we symlink to $(PROG)
ABBRPROG = lt
LIB = liblogtool.a
OBJS = readconf.o getopt.o regex.o parser.o ansi.o ascii.o\
	 csv.o html.o raw.o logtool.o main.o
SRC = logtool.c
# These options affect where logtool gets installed
PREFIX = /usr
prefix = $(PREFIX)
ETCDIR = /etc/logtool
MANDIR = ${prefix}/man
CC = gcc
INSTALL = /usr/bin/install -c
CFLAGS= -O3 -Wall -DHAVE_CONFIG_H 

### The stuff below is (I hope) no longer needed now that we us autoconf/configure and friends
# Solaris users should probably use the following instead (thanks Christoph Krempe <ck@ub.fu-berlin.de>)
# INSTALL = /usr/ucb/install
# For RedHat (and most other) Linux'es, this should be ideal
# CFLAGS= -Wall -O3 -ansi -pedantic -Werror # -DDEBUG -g # uncomment this for debugging stuff's
# For portability to non-linux'es/non-standard-linux'es, try this
# CFLAGS = -Wall
### However, on the off chance that it does become of use someday, I leave it here.  



### The main build stuff
logtool: logtool.o $(OBJS)
	$(CC) $(ADDCFLAGS) -o $(PROG) $(OBJS) 
	@echo "strip $(PROG)"	
	@strip $(PROG)

lib: $(LIB)

# The library build stuff (seems broken under OpenBSD 2.8???)
$(LIB): $(LIB)(regex.o) $(LIB)(parser.o) $(LIB)(ansi.o) $(LIB)(ascii.o)\
	$(LIB)(csv.o) $(LIB)(html.o) $(LIB)(raw.o) $(LIB)(main.o) \
	$(LIB)(getopt.o) $(LIB)(readconf.o) $(LIB)(logtool.o)

# Things for the library build stuff
logtool.o: logtool.c logtool.h

regex.o: regex.c logtool.h

parser.o: parser.c logtool.h

ansi.o: ansi.c logtool.h

ascii.o: ascii.c logtool.h

csv.o: csv.c logtool.h

html.o: html.c logtool.h

raw.o: raw.c logtool.h

main.o: main.c logtool.h

getopt.o: getopt.c logtool.h

readconf.o: readconf.c logtool.h

### How to install this puppy
install: logtool
	mkdir -p $(DESTDIR)$(ETCDIR)
	mkdir -p $(DESTDIR)$(PREFIX)/bin
	mkdir -p $(DESTDIR)$(MANDIR)/man1
	$(INSTALL) -m 0644 -o root ../conf/logtool.conf $(DESTDIR)$(ETCDIR)/logtool.conf
	$(INSTALL) -m 0644 -o root ../conf/green $(DESTDIR)$(ETCDIR)/green
	$(INSTALL) -m 0644 -o root ../conf/yellow $(DESTDIR)$(ETCDIR)/yellow
	$(INSTALL) -m 0644 -o root ../conf/include $(DESTDIR)$(ETCDIR)/include
	$(INSTALL) -m 0644 -o root ../conf/exclude $(DESTDIR)$(ETCDIR)/exclude
	$(INSTALL) -m 0555 -o root -s $(PROG) $(DESTDIR)$(PREFIX)/bin/$(PROG)
	$(INSTALL) -m 0444 -o root ../doc/logtool.1 $(DESTDIR)$(MANDIR)/man1
#	if [ ! -s "$(PREFIX)/bin/$(ABBRPROG)" ] ; then ln -s $(PREFIX)/bin/$(PROG) $(PREFIX)/bin/$(ABBRPROG) ; fi
#	$(INSTALL) -c -m 0555 -o root -s $(LIB) $(PREFIX)/lib/$(LIB)
#############################################################################
# If you want to install the library, uncomment the above line
#############################################################################

clean:
	-rm -f a.out core *~ *.o *.a $(PROG)
