# Makefile fopr the dbf2msql-utility
# Maarten Boekhold (boekhold@cindy.et.tudelft.nl) 1995

# Set this to your C-compiler
CC=gcc

# set this to your install-program (what does Solaris have
# in /usr/sbin/install? SYSV install?)
INSTALL=/usr/sbin/install

# Set this to whatever your compiler accepts. Nothing special is needed
CFLAGS=-O2 -Wall
#CFLAGS=-g3 -Wall

# Set this to your Minerva (mSQL) installation-path
MSQLINC=-I/usr/local/Minerva/include
MSQLLIB=-L/usr/local/Minerva/lib

# Set this to where you want the binary (no man-page yet, don't know
# how to write them)
INSTALLDIR=/usr/local/bin

# Set this if your system needs extra libraries
#
# For Solaris use:
#EXTRALIBS=-lsocket -lnsl
EXTRALIBS=

# You should not have to change this unless your system doesn't have gzip
# or doesn't have it in the standard place (/usr/local/bin for ex.).
# Anyways, it is not needed for just a simple compile and install
RM=/bin/rm -f
GZIP=/bin/gzip
TAR=/bin/tar

OBJS=dbf.o endian.o dbf2msql.o

VERSION=0.4

all: dbf2msql

dbf2msql: $(OBJS)
	$(CC) $(CFLAGS) $(MSQLLIB) -o $@ $(OBJS) -lmsql $(EXTRALIBS)

install: dbf2msql
	$(INSTALL) -f $(INSTALLDIR) -m 0775 dbf2msql

clean:
	$(RM) $(OBJS) dbf2msql

dist:
	(cd .. ; $(TAR) cf dbf2msql-$(VERSION).tar dbf2msql-$(VERSION)/*.[ch] \
	dbf2msql-$(VERSION)/Makefile dbf2msql-$(VERSION)/README ; \
	$(GZIP) -9 dbf2msql-$(VERSION).tar)
	
dbf.o: dbf.c dbf.h endian.h
	$(CC) $(CFLAGS) -c -o $@ dbf.c

endian.o: endian.c endian.h
	$(CC) $(CFLAGS) -c -o $@ endian.c

dbf2msql.o: dbf2msql.c dbf.h
	$(CC) $(CFLAGS) -DVERSION=\"$(VERSION)\" $(MSQLINC) -c -o $@ dbf2msql.c
