# makefile for cdunifpp

OBJS = \
     cdunifpp.o \
     cdunifpp_attribute.o \
     cdunifpp_axisvals.o \
     cdunifpp_check.o \
     cdunifpp_compare.o \
     cdunifpp_data.o \
     cdunifpp_debug.o \
     cdunifpp_env.o \
     cdunifpp_error.o \
     cdunifpp_filetype.o \
     cdunifpp_linklist.o \
     cdunifpp_malloc.o \
     cdunifpp_ppcode.o \
     cdunifpp_process.o \
     cdunifpp_read.o \
     cdunifpp_rotgrid.o \
     cdunifpp_stash2pp.o \
     cdunifpp_stashname.o \
     cdunifpp_struct.o \
     cdunifpp_unwgdoswrap.o \
     cdunifpp_varinfo.o \
     cdunifpp_genaxis.o \
     unwgdos.o \
     unwgdos_crayio.o

HEADERS=../../../include/cdunifint.h ../../../include/cdunifpp/cdunifpp.h

UNWGDOS_HDRS=../../../include/cdunifpp/crayio.h \
             ../../../include/cdunifpp/util.h \
             ../../../include/cdunifpp/vardef.h \
             ../../../include/cdunifpp/cdunifpp_frename.h

# EXTRAHDR=-I../../../include/cdunifpp
# set to blank if you don't want to rename symbols in unpacking routines

CC = cc
CFLAGS = -I../../../include/cdunifpp -I/usr/include -fPIC -I../../../include $(DEBUG)
CPPFLAGS =  -Dnetcdf -DBYTESWAP -DpgiFortran -DHAVE_PP -Uhdf
LIBRARY = ../../../lib/libcdms.a

all: $(OBJS)
	ar rv $(LIBRARY) $(OBJS)
# (ranlib called by higher-level makefile)

%.o: %.c $(HEADERS)

clean:
	-rm -f *.o

distclean: clean

cdunifpp_unwgdoswrap.o: cdunifpp_unwgdoswrap.c $(HEADERS) $(UNWGDOS_HDRS)
	$(CC) $(CFLAGS) $(CPPFLAGS) $(EXTRAHDR) -c $<

unwgdos.o: unwgdos.c $(UNWGDOS_HDRS)
	$(CC) $(CFLAGS) $(EXTRAHDR) -c $<

unwgdos_crayio.o: unwgdos_crayio.c $(UNWGDOS_HDRS)
	$(CC) $(CFLAGS) $(EXTRAHDR) -c $<

cdunifpp.o: cdunifpp.c $(HEADERS)
	$(CC) $(CPPFLAGS) $(CFLAGS) $(EXTRAHDR) -c $<

cdunifpp_attribute.o: cdunifpp_attribute.c $(HEADERS)
	$(CC) $(CPPFLAGS) $(CFLAGS) $(EXTRAHDR) -c $<

cdunifpp_axisvals.o: cdunifpp_axisvals.c $(HEADERS)
	$(CC) $(CPPFLAGS) $(CFLAGS) $(EXTRAHDR) -c $<

cdunifpp_check.o: cdunifpp_check.c $(HEADERS)
	$(CC) $(CPPFLAGS) $(CFLAGS) $(EXTRAHDR) -c $<

cdunifpp_compare.o: cdunifpp_compare.c $(HEADERS)
	$(CC) $(CPPFLAGS) $(CFLAGS) $(EXTRAHDR) -c $<

cdunifpp_data.o: cdunifpp_data.c $(HEADERS)
	$(CC) $(CPPFLAGS) $(CFLAGS) $(EXTRAHDR) -c $<

cdunifpp_debug.o: cdunifpp_debug.c $(HEADERS)
	$(CC) $(CPPFLAGS) $(CFLAGS) $(EXTRAHDR) -c $<

cdunifpp_env.o: cdunifpp_env.c $(HEADERS)
	$(CC) $(CPPFLAGS) $(CFLAGS) $(EXTRAHDR) -c $<

cdunifpp_error.o: cdunifpp_error.c $(HEADERS)
	$(CC) $(CPPFLAGS) $(CFLAGS) $(EXTRAHDR) -c $<

cdunifpp_filetype.o: cdunifpp_filetype.c $(HEADERS)
	$(CC) $(CPPFLAGS) $(CFLAGS) $(EXTRAHDR) -c $<

cdunifpp_linklist.o: cdunifpp_linklist.c $(HEADERS)
	$(CC) $(CPPFLAGS) $(CFLAGS) $(EXTRAHDR) -c $<

cdunifpp_malloc.o: cdunifpp_malloc.c $(HEADERS)
	$(CC) $(CPPFLAGS) $(CFLAGS) $(EXTRAHDR) -c $<

cdunifpp_ppcode.o: cdunifpp_ppcode.c $(HEADERS)
	$(CC) $(CPPFLAGS) $(CFLAGS) $(EXTRAHDR) -c $<

cdunifpp_process.o: cdunifpp_process.c $(HEADERS)
	$(CC) $(CPPFLAGS) $(CFLAGS) $(EXTRAHDR) -c $<

cdunifpp_read.o: cdunifpp_read.c $(HEADERS)
	$(CC) $(CPPFLAGS) $(CFLAGS) $(EXTRAHDR) -c $<

cdunifpp_stash2pp.o: cdunifpp_stash2pp.c $(HEADERS)
	$(CC) $(CPPFLAGS) $(CFLAGS) $(EXTRAHDR) -c $<

cdunifpp_stashname.o: cdunifpp_stashname.c $(HEADERS)
	$(CC) $(CPPFLAGS) $(CFLAGS) $(EXTRAHDR) -c $<

cdunifpp_struct.o: cdunifpp_struct.c $(HEADERS)
	$(CC) $(CPPFLAGS) $(CFLAGS) $(EXTRAHDR) -c $<

cdunifpp_varinfo.o: cdunifpp_varinfo.c $(HEADERS)
	$(CC) $(CPPFLAGS) $(CFLAGS) $(EXTRAHDR) -c $<

