# Makefile for gtool4/gt3conv

include ../Config.mk

TARGET=gt3conv
INCLUDE_GT=-I../src

all: $(TARGET)

install: $(TARGET)
	install -d $(DEST_BIN)
	install $(TARGET) $(DEST_BIN)

OBJS=$(TARGET).o gt3read.o findfile.o gt3map.o ../src/libgtool4.a

$(TARGET): $(OBJS)
	$(FC) -o $(TARGET) $(SYSFFLAGS) $(OBJS) $(LIBS) $(SYSLDFLAGS) $(SYSLDLIBS)

$(TARGET).o: ../src/gtool.o gt3map.o work.pcl

gt3map.o: gt3read.o findfile.o

findfile.o: gt3read.o

gt3read.o: work.pcl

work.pcl: Makefile ../Config.mk
	sh ../chkpcl.sh $(SYSFFLAGS) $(INCLUDE_GT)

../src/libgtool4.a:
	cd ../src; $(MAKE)

gtool.nc: gtool.cdl
	-ncgen -b gtool.cdl

.PHONY: clean all

clean:
	-rm -f *.o $(MODS) $(TARGET)
	-rm -rf gt3conv.plg Makefile.bak Debug/* work.pc* *.nc
