# $Id: Makefile.in 1.9 Sun, 26 Dec 1999 20:47:58 +1100 keith $

srcdir=@srcdir@
VPATH=@srcdir@
prefix=@prefix@
exec_prefix=@exec_prefix@
sbindir=@sbindir@
mandir=@mandir@

ARCH		= @ARCH@
CC		= @CC@
CFLAGS		= @CFLAGS@
LDFLAGS		= @LDFLAGS@
HOSTCC		= @HOSTCC@
HOSTCFLAGS	= @HOSTCFLAGS@
AR		= @AR@
RANLIB		= @RANLIB@
INSTALL		= @INSTALL_LOCAL@
STRIP		= @STRIP@

DEFS = -I$(srcdir)/../include -D_GNU_SOURCE @DEFS@
DEFS += -DELF_MACHINE_H='"elf_$(ARCH).h"' -DARCH_$(ARCH) $(EXTRA_DEFS)

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

######################################################################

all: .depend libutil.a

OBJS = sys_cm.o sys_dm.o sys_gks.o sys_nim.o sys_oim.o sys_qm.o \
	xmalloc.o xrealloc.o xstrdup.o logger.o \
	modstat.o meta_expand.o config.o snap_shot.o arch64.o \
	xstrcat.o xsystem.o

meta_expand.o: meta_expand.c
	$(CC) $(CFLAGS) $(DEFS) @HAVE_WORDEXP@ @HAVE_GLOB@ -c $<

libutil.a: $(OBJS)
	$(AR) rv $@ $?
	$(RANLIB) $@

clean:
	rm -f *.o *.a

realclean: clean
	rm -f .depend

distclean: realclean
	rm -f Makefile

install-bin: all

dep depend .depend: $(OBJS:.o=.c)
	$(CC) -M $(CFLAGS) $(DEFS) $^ > .depend

ifeq (.depend,$(wildcard .depend))
include .depend
endif
