#
# Makefile for savecrash -- based on lkcdutil Makefile
#
DEPTH  = .
include $(DEPTH)/commondefs

TARGET    = savecrash
CFILES    = savecrash.c dump_lib.c cksum.c lbz2.c
LFLAGS    = -L$(TOPDIR) 
OFILES    = $(CFILES:.c=.o)
SUB_DIRS  = man

default: $(TARGET)

$(TARGET): subdirs_make
	$(CC) -g -o $@ $(LDFLAGS) $(LFLAGS) $(OFILES) $(LIBS)

subdirs_make: $(OFILES)
	for dir in $(SUB_DIRS) ; do \
		( cd $$dir ; make TOPDIR=$(TOPDIR); cd ..) \
	done

clean:
	/bin/rm -f *.o
	for dir in $(SUB_DIRS) ; do \
		( cd $$dir ; make TOPDIR=$(TOPDIR) ARCH=$(ARCH) clean; cd .. ); \
	done

clobber: clean
	/bin/rm -f $(TARGET)

$(OFILES): $(HEADERS)

#
# We avoid this for now -- you'll need to do a make clobber followed
# by a make if you want to fix this later.
#
$(HEADERS): 

install: $(TARGET)
	mkdir -p $(ROOT)/sbin
	mkdir -p $(ROOT)/usr/man/man1
	install -m 755 $(TARGET) $(ROOT)/sbin
	install -m 644 man/$(TARGET).1 $(ROOT)/usr/man/man1
