#------------------------------------------------------------------------------
# Copyright 1996-2016 United States Government as represented by the
# Administrator of the National Aeronautics and Space Administration.
# All Rights Reserved.
#------------------------------------------------------------------------------
#
#  NSSDC/CDF						zlib makefile.
#
#  Version 1.0, 27-Mar-12, GSFC/SPDF.
#
#  Modification history:
#
#   V1.0  27-Mar-12, M Liu	Original version.
#------------------------------------------------------------------------------

.SILENT:

SHELL=/bin/sh
NULL=true

PIC=
CCx=
COPTIONS=
MAKE=make
SRCDIR=
BLDDIR=

INCLUDEzlib=.

CC=$(CCx)

CFLAGS=$(COPTIONS) $(PIC) -I$(INCLUDEzlib) -DZ_PREFIX

OBJs= $(BLDDIR)/adler32.o $(BLDDIR)/inffast.o $(BLDDIR)/trees.o \
      $(BLDDIR)/crc32.o $(BLDDIR)/inflate.o $(BLDDIR)/infback.o \
      $(BLDDIR)/zutil.o $(BLDDIR)/deflate.o $(BLDDIR)/inftrees.o

ZLIB1h= zutil.h zlib.h zconf.h
ZLIB2h= inftrees.h inflate.h inffast.h

#------------------------------------------------------------------------------
# Compile/link.
#------------------------------------------------------------------------------

all:	$(OBJs)

$(BLDDIR)/%.o: %.c
	@echo $(CC) $(CFLAGS) -c $< -o $@
	      $(CC) $(CFLAGS) -c $< -o $@

$(BLDDIR)/adler32.o: adler32.c $(ZLIB1h)
$(BLDDIR)/crc32.o: crc32.c $(ZLIB1h) $(INCLUDEzlib)/crc32.h
$(BLDDIR)/deflate.o: deflate.c $(ZLIB1h) $(INCLUDEzlib)/deflate.h
$(BLDDIR)/inffast.o: inffast.c $(ZLIB1h) $(ZLIB2h)
$(BLDDIR)/inflate.o: inflate.c $(ZLIB1h) $(ZLIB2h)
$(BLDDIR)/infback.o: infback.c $(ZLIB1h) $(ZLIB2h)
$(BLDDIR)/inftrees.o: inftrees.c $(ZLIB1h) $(INCLUDEzlib)/inftrees.h
$(BLDDIR)/trees.o: trees.c $(INCLUDEzlib)/deflate.h $(INCLUDEzlib)/trees.h $(ZLIB1h)
$(BLDDIR)/zutil.o: zutil.c $(ZLIB1h)

#------------------------------------------------------------------------------
# Clean/purge.
#------------------------------------------------------------------------------

clean:
	@-rm -f $(BLDDIR)/*.o
	@-rm -f $(BLDDIR)/core

purge:
	@-rm -f $(BLDDIR)/*~
	@-rm -f $(BLDDIR)/*#
