# $Id: Makefile.in,v 1.1.1.1 2002/05/29 20:17:14 csieh Exp $

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@

DEFSNOARCH	:= -I$(srcdir)/../include -D_GNU_SOURCE @DEFS@ $(EXTRA_DEFS)
DEFS		:= -DELF_MACHINE_H='"elf_$(ARCH).h"' -DARCH_$(ARCH)
OBJS		:= depmod.o

ifeq (@COMMON_sparc@,yes)
DEFSNOARCH	+= -DCOMMON_3264
DEFS		+= -DONLY_32
DEFS64		:= -DONLY_64 -DELF_MACHINE_H='"elf_sparc64.h"' -DARCH_sparc64
OBJS		+= depmod_64.o
endif

# Rule for building 64 bit versions, only used when building common code
# for 32 and 64 bit systems.
%_64.o: %.c
	$(CC) $(CFLAGS) $(DEFSNOARCH) $(DEFS64) -c -o $@ $<

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

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

all: .depend depmod

depmod: $(OBJS) ../util/libutil.a ../obj/libobj.a
	$(CC) $(CFLAGS) -o $@ $^ $(LDFLAGS)

clean:
	rm -f *.o
	rm -f depmod

realclean: clean
	rm -f .depend

distclean: realclean
	rm -f Makefile

install install-bin: all
	$(INSTALL) $(STRIP) depmod $(sbindir)

dep depend .depend: depmod.c
	$(CC) -M $(CFLAGS) $(DEFSNOARCH) $(DEFS) $^ > .depend

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