#
# Version: @(#)Makefile		1.12	09/23/97
#
# Light Bar 1.12 Makefile
# This may be freely distrubted with Light Bar.
#

include ./MConfig

CFILES=\
main.c login.c init.c lb_chk.c env.c shell.c utmp.c mail.c log.c tty.c \
database.c macro.c btmp.c daemon.c

OFILES=${CFILES:.c=.o}

HFILES=\
config.h lb_def.h

# 
# Command and libraries along with gcc options here.  Libraries to
# use are stored in 'MConfig' and generated by ./configure script.
# 
CC=gcc
CP=cp -a
RM=rm -f
CFLAGS=-O2 -I../include -fomit-frame-pointer -Wall $(PCKG)
FLAGS=-s -v
PROG1=lightbar
PROG2=badlog

all:
	@make login
	@make lbd
	@make badlog
	@make crypt
	@make pwdcf
	@make -f Makefile.telnetd

install:
	@chmod +x ../install.sh ; ../install.sh ; chmod -x ../install.sh

badlog:
	gcc -o badlog badlog.c -I../include

crypt:
	gcc -o crypt encrypt.c -I../include

pwdcf:
	gcc -o pwdcf pwdcf.c -I../include

lbd:
	gcc -o in.lbd lb_d.c db_d.c -I../include $(LIBS)

login: $(OFILES)
	$(CC) -o $(PROG1) $(FLAGS) $(OFILES) $(LIBS)


clean:
	$(RM) -rf *.o $(PROG1) $(PROG2) pwdcf
	$(RM) -rf install.log* MConfig in.lbd badlog crypt telnetd agetty
	@chmod -x ../install.sh
