#	$Id: Makefile.in,v 1.14 2000/03/05 07:24:53 assar Exp $

SHELL		= /bin/sh

srcdir		= @srcdir@
VPATH		= @srcdir@

CC		= @CC@
RM		= rm

INSTALL		= @INSTALL@
INSTALL_PROGRAM = @INSTALL_PROGRAM@
INSTALL_DATA	= @INSTALL_DATA@
MKINSTALLDIRS 	= @top_srcdir@/mkinstalldirs

prefix 		= @prefix@
exec_prefix 	= @exec_prefix@
libdir 		= @libdir@
libexecdir 	= @libexecdir@
sysconfdir	= @sysconfdir@
bindir 		= @bindir@
transform	= @program_transform_name@
ARLACACHEDIR	= @ARLACACHEDIR@

DEFS		= @DEFS@ -DDEBUG
CFLAGS		= @CFLAGS@ 			\
		  -I$(srcdir)/../../../include	\
		  -I../../../include

XFS_BIN		= startarla
INIT_BIN	= arla

bin_PROGS	= mount_xfs

all:		startarla arla $(bin_PROGS)

.c.o:
	$(CC) -c $(CPPFLAGS) $(DEFS) $(CFLAGS) $<

clean:
	$(RM) -f startarla mount_xfs arla *.o *~

mount_xfs:	mount_xfs.o
	$(CC) -o $@ mount_xfs.o

startarla: startarla.in
	sed -e 's!%bindir%!$(bindir)!' $(srcdir)/startarla.in | sed -e 's!%ARLACACHEDIR%!$(ARLACACHEDIR)!' > $@
	chmod +x $@

arla: arla.init.in
	sed -e 's!%bindir%!$(bindir)!' $(srcdir)/arla.init.in | sed -e 's!%ARLACACHEDIR%!$(ARLACACHEDIR)!' | sed -e 's!%sysconfdir%!$(sysconfdir)!' > $@
	chmod +x $@

install: all
	$(MKINSTALLDIRS) $(DESTDIR)$(bindir)
	PROG_BIN='$(XFS_BIN)'; for x in $$PROG_BIN; do \
	  f=`echo $$x | sed '$(transform)'`; \
	  $(INSTALL_PROGRAM) $$x $(DESTDIR)$(bindir)/$$f; \
	done
	INIT_BIN='$(INIT_BIN)'; for x in $$INIT_BIN; do \
	  f=`echo $$x | sed '$(transform)'`; \
	  if test -d $(DESTDIR)/etc/rc.d/init.d ;then \
            DIR=$(DESTDIR)/etc/rc.d/init.d ; \
          elif test -d $(DESTDIR)/etc/init.d ;then \
            DIR=$(DESTDIR)/etc/init.d ; \
	  else \
            DIR=$(DESTDIR)/$(sysconfdir) ;\
	    $(MKINSTALLDIRS) $$DIR ; \
          fi ; \
          if test ! -f $$DIR/$$f; then \
	     $(INSTALL_PROGRAM) $$x $$DIR/$$f; \
          fi ; \
	  $(INSTALL_PROGRAM) $$x $$DIR/$$f.default; \
	done

uninstall:
	PROG_BIN='$(XFS_BIN)'; for x in $$PROG_BIN; do \
	  f=`echo $$x | sed '$(transform)'`; \
	  rm -f $(DESTDIR)$(bindir)/$$f; \
	done

Makefile: Makefile.in ../../../config.status
	cd ../../..; CONFIG_FILES=xfs/linux/bin/Makefile CONFIG_HEADERS= $(SHELL) config.status

.PHONY: all install uninstall clean
