# EVMS Utilities

include ../../make.rules

MAJOR_VERSION	= 1
MINOR_VERSION	= 0
PATCH_LEVEL	= 0

TARGETS	=	evms_devnode_fixup	\
		evms_info_level		\
		evms_rediscover

SRCS	:= $(shell ls *.c)
OBJS	:= $(shell ls *.c | sed s/\\.c/\\.o/)

all: .depend $(TARGETS)

install: all
	../../mkinstalldirs.sh $(DESTDIR)$(sbindir)
	@for f in $(TARGETS); do \
		echo "$(INSTALL) -m 755 $$f $(DESTDIR)$(sbindir)"; \
		$(INSTALL) -m 755 $$f $(DESTDIR)$(sbindir); \
	done

uninstall:
	@for f in $(TARGETS); do \
		echo "rm -f $(DESTDIR)$(sbindir)/$$f"; \
		rm -f $(DESTDIR)$(sbindir)/$$f; \
	done

$(TARGETS): $(OBJS)
	@for f in $(TARGETS); do \
		echo "$(CC) $(LIBDIRS) $(EFENCE) -static -o $$f $$f.o -levms -ldlist -ldl"; \
		$(CC) $(LIBDIRS) $(EFENCE) -static -o $$f $$f.o -levms -ldlist -lpthread -ldl; \
		if [ -z $(ENGINE_DEBUG) ]; then \
			echo "strip --strip-unneeded $$f"; \
			strip --strip-unneeded $$f; \
		fi; \
	done

clean:
	rm -f .depend *.o $(TARGETS)

distclean: clean

.depend:
	$(CPP) -M $(EVMSCFLAGS) *.c > .depend

dep: .depend

# grab our dep file
ifeq (.depend,$(wildcard .depend))
include .depend
endif
