# lde and fsck (Scott Heavner -- sdh@po.cwru.edu)
#
# make install:
#	installs lde and fsck as the same file with a hard link
# make install_both:
#	installs them as separate files
#	  fsck = 13k
#	  lde  = 46k

# What does the new fsck convention dictate for a filename here?
FSCK=fsck

INSTALL_DIR=/etc
OWNER=root
GROUP=system

# Where is your ncurses stuff?
# Define NC_HEADER if your include file is called <ncurses.h>,
# otherwise undefine it and set INCLUDE_DIR to point to the directory
# which contains curses.h for ncurses.
LIBCURSES= -lncurses
CURSES_HEADER=-DNC_HEADER
# INCLUDE_DIR=/usr/local/include

# -DEMERGENCY will cause the ALPHA search code to be included
CFLAGS=-Wall -O6 -N -s -DEMERGENCY
CC=gcc

lde:	filemode.o nc_fsck.c fsck.c
	$(CC) -I$(INCLUDE_DIR) $(CFLAGS) -DLDE_CURSES $(CURSES_HEADER) \
		-o lde fsck.c filemode.o $(LIBCURSES)

$(FSCK):	filemode.o fsck.c
	$(CC) $(CFLAGS) -o $(FSCK) fsck.c filemode.o

install_lde:	lde
	install -o $(OWNER) -g $(GROUP) -m0300 lde $(INSTALL_DIR)/lde

install_fsck:	$(FSCK)
	install -o $(OWNER) -g $(GROUP) -m0300 $(FSCK) $(INSTALL_DIR)/$(FSCK)

install_both:	install_lde install_fsck

install:	install_lde
	ln -f $(INSTALL_DIR)/lde $(INSTALL_DIR)/$(FSCK)

clean:
	rm -f *.o lde $(FSCK) fsck

filemode.o:	filemode.c
