.SUFFIXES:
.SUFFIXES: .c .o

CC = gcc
AR = ar cru
RANLIB = ranlib
#CCFLAGS = -g -Wall
CCFLAGS = -O3 -Wall
CHECKOUT = co
DEPEND = gccmakedep

DATE = $$(date +%m%d%y)

LFLAGS = -lm

LIBSRCS = hash.c parse.c misc.c eXdbm.c
LIBOBJS = hash.o parse.o misc.o eXdbm.o

LIBINC = hash.h parse.h eXdbm.h eXdbmErrors.h eXdbmTypes.h misc.h

INCPATH = ./

INCDIR = /usr/local/include/
LIBDIR = /usr/local/lib/
DOCDIR = /usr/local/doc/eXdbm

LIBNAME = libeXdbm.a

all : depend lib examples

build : getheaders depend lib examples

getheaders : $(LIBINC)
	$(CHECKOUT) $(LIBINC)

depend : $(LIBSRCS)
	  $(DEPEND) $(LIBSRCS)

lib : $(LIBOBJS) 
	$(AR) $(LIBNAME) $(LIBOBJS) 
	$(RANLIB) $(LIBNAME) 

examples : test1 test2 test3

test1 : test1.o test1.cfg.orig
	cp test1.cfg.orig test1.cfg
	$(CC) $< $(LIBNAME) $(LFLAGS) -o $@  

test2 : test2.o test1.cfg.orig 
	cp test1.cfg.orig test1.cfg
	$(CC) $< $(LIBNAME) $(LFLAGS) -o $@  

test3 : test3.o test1.cfg.orig
	cp test1.cfg.orig test1.cfg
	$(CC) $< $(LIBNAME) $(LFLAGS) -o $@  

.c.o :
	$(CC) -I$(INCPATH) -c $(CCFLAGS) -o $@ $<

archive : $(LIBINC) $(LIBSRCS) test1.c test2.c test3.c test1.cfg.orig eXdbm.txt
	cp Makefile.orig Makefile 
	cp test1.cfg.orig test1.cfg
	tar cvzf eXdbm-beta-1.0b1.tar.gz $(LIBINC) $(LIBSRCS) test1.c test2.c test3.c test1.cfg eXdbm.txt

install :
	cp eXdbmErrors.h eXdbmTypes.h eXdbm.h $(INCDIR)
	cp libeXdbm.a $(LIBDIR)
	mkdir $(DOCDIR)
	cp eXdbm.txt $(DOCDIR)
	@echo "installation done"
	
clean :
	rm -f *.o *~

realclean : clean
	rm -f *.a test1 test1.cfg ; cp Makefile.orig Makefile





syntax highlighted by Code2HTML, v. 0.9.1