PROGS	= scsi_vpd_std scsi_vpd_custom 

DATAS	= scsihost.conf scsivpd.conf

GEN_SRC	= scsi_vpd_custom.c.in

GEN	= $(GEN_SRC:.in=)

INSTALL = /usr/bin/install -c
INSTALL_PROGRAM = $(INSTALL) -m 755
INSTALL_DATA = $(INSTALL) -m 644

all:	$(GEN) $(PROGS)

scsi_vpd_std:		scsi_vpd_std.o scsi_vpd_common.o ../lib/libvpd.a

scsi_vpd_std.o:		scsi_vpd_std.c scsi_vpd_common.h ../lib/util.h

scsi_vpd_custom: 	scsi_vpd_custom.o scsi_vpd_common.o ../lib/libvpd.a

scsi_vpd_custom.o: 	scsi_vpd_custom.c scsi_vpd_common.h ../lib/util.h

scsi_vpd_common.o:	scsi_vpd_common.c scsi_vpd_common.h  ../lib/util.h

scsi_vpd_custom.c:	scsi_vpd_custom.c.in
	sed -e "s%@libdir@%$(libdir)%g" $< > $@

install:	all
	@ for f in $(PROGS) ; do \
		$(INSTALL_PROGRAM) $$f $(DESTDIR)$(libdir) ;\
	done
	@ for f in $(DATAS) ; do \
		$(INSTALL_DATA) $$f $(DESTDIR)$(libdir) ;\
	done

clean:
	rm -f $(GEN) $(PROGS) *.o *~
