OBJ = main.o check_nodes.o curses_intfc.o \
	display_menu.o die.o do_node.o dump_tree.o \
	init_env.o \
	intro_message.o jump.o line_help.o \
	log.o read_and_move.o \
	read_descrip.o ring_bell.o run_menu.o	\
	save_status.o search_menu.o  \
	setenv.o short_cuts.o suspend.o

VERS = 2.01

BIN = ../bin
DIRS = $(MENU)/etc $(MENU)/lib $(MENU)/logs
UCL = /usr/local/uclink
MENU = $(UCL)/menu$(VERS)

# If POSIX, like Linux, use the following:
# CFLAGS = -DPOSIX -O 
# If the screen appears fails to use a carrage return with each linefeed,
# or the screen appears wierd, try using the following:
CFLAGS = -DPOSIX -DBROKEN_CURSES -O 
# Otherwise
# CFLAGS = -O

$(BIN)/newmenu:	$(OBJ)
	cc $(OBJ) -lcurses -ltermcap  -o $(BIN)/newmenu

install: $(BIN)/newmenu
	/usr/bin/install $(BIN)/newmenu $(UCL)/bin/menu$(VERS)
	/usr/ucb/rcp -rp $(UCL)/bin/menu$(VERS) uclink2:$(UCL)/bin/menu$(VERS)
	
install_all: install_dirs install_etc install_lib install_logs

install_dirs:
	@echo "*** does not install the binary - just everything else ***"
	mkdir -p $(DIRS)

install_etc:
	cp -pr ../etc $(MENU)
	chmod a+rx $(MENU)/etc  $(MENU)/etc/help
	chmod a+r $(MENU)/etc/* $(MENU)/etc/help/*

install_lib:
	cp -pr ../lib $(MENU)
	chmod a+rx $(MENU)/lib $(MENU)/lib/*

install_logs:
	chmod a+rx $(MENU)/etc
	/usr/bin/install -c -m 700 ../logs/Create_logs $(MENU)/logs
	/usr/bin/install -c -m 700 ../logs/Start_logging $(MENU)/logs
	/usr/bin/install -c -m 700 ../logs/Stop_logging $(MENU)/logs

clean:
	/bin/rm -rf $(OBJ) core

clobber:	clean
	/bin/rm -rf $(BIN)/newmenu

$(OBJ): *.h
