OSVER	      = BSD

HDRS	      = def.h \
		extern.h \
		include.h \
		struct.h \
		tunable.h

LDFLAGS	      = -s
CFLAGS        = $(UNISTD) -O -D$(OSVER) -DDEST='$(DEST)'
YFLAGS        =	-d

LIBS	      = -ll -lm -lcurses $(USETERML)

MAKEFILE      = Makefile

OBJS	      = extern.o \
		grammar.o \
		input.o \
		lex.o \
		list.o \
		log.o \
		main.o \
		tunable.o \
		graphics.o \
		update.o

PRINT	      = pr

SRCS	      = extern.c \
		grammar.y \
		graphics_curses.c \
		input.c \
		lex.l \
		list.c \
		log.c \
		main.c \
		tunable.c \
		update.c

MAKEFILES     = Makefile.dist Makefile.parent

ASRCS	      = $(SRCS) $(HDRS) $(MAKEFILES)

atc:		$(OBJS)
		$(CC) $(LDFLAGS) $(OFILE) $(OBJS) $(LIBS) -o atc

co:
		co $(ASRCS)

clean:		
		rm -f $(OBJS) y.tab.h y.tab.c lex.yy.c lint.out

clobber:	clean
		rm -f atc

depend:;	@mkmf -f $(MAKEFILE) LIBR=$(LIBR) DEST=$(DEST)

index:;		@ctags -wx $(HDRS) $(ASRCS)

install:	$(LIBR)
		@echo Installing $(LIBR) in $(DEST)
		@install -s $(LIBR) $(DEST)

print:;		@$(PRINT) $(HDRS) $(ASRCS)

program:        $(LIBR)

tags:           $(HDRS) $(ASRCS); @ctags $(HDRS) $(ASRCS)

update:		$(DEST)/$(LIBR)

$(DEST)/$(LIBR): $(ASRCS) $(HDRS)
		@make -f $(MAKEFILE) DEST=$(DEST) install

lex.o: grammar.o

extern.o: include.h 
grammar.o: include.h 
graphics.o: include.h 
input.o: include.h 
list.o: include.h
log.o: include.h
main.o: include.h
update.o: include.h

include.h: def.h struct.h extern.h tunable.h
