CP = @cp@
MKDIR = @mkdir@
RANLIB = @ranlib@
RM = @rm@
TAR = @tar@

PREFIX = @prefix@
LIBDIR = $(PREFIX)/lib
INCDIR = $(PREFIX)/include

CMDLINE_ROOT =	CmdLine
LIBCMDLINE_ROOT = $(CMDLINE_ROOT)/src/lib

LIBCMDLINE =	libcmdline.a
INCLUDES =	cmdline.h cmdargs.h

all:	$(LIBCMDLINE_ROOT)/$(LIBCMDLINE)

$(LIBCMDLINE_ROOT)/$(LIBCMDLINE):
	( cd $(LIBCMDLINE_ROOT); $(MAKE) library )

install:	$(LIBCMDLINE_ROOT)/$(LIBCMDLINE)
	$(MKDIR) $(LIBDIR)
	$(MKDIR) $(INCDIR)
	$(CP) $(LIBCMDLINE_ROOT)/$(LIBCMDLINE) $(LIBDIR)/$(LIBCMDLINE)
	$(RANLIB) $(LIBDIR)/$(LIBCMDLINE)
	for f in $(INCLUDES); do \
		$(CP) $(LIBCMDLINE_ROOT)/$$f $(INCDIR)/$$f; \
	done

clean:
	$(RM) core *.core *~ *.bak *.out

distclean:	clean
	$(RM) Makefile files/Config.mk files/doc/mantocatman
	( cd $(CMDLINE_ROOT); $(MAKE) clobber )
