# Makefile for Various Shells

# Put the information that you want to appear when the shell is run
# in the quotes.
 
MAIL_FLAG="root@kpw104"
ADMIN_FLAG="Ken Wilcox, Eylon Geva, or Lance Knight"
ROOM_FLAG="107 or 131 Beaver Hall"

# Your favorite C Compiler
CC = cc

# Your favorite compiler flags
CFLAGS = -O
#CFLAGS = -g

# Install options
# Base Dirctory
BASEDIR = /usr/new

# It will create this directory in BASEDIR to keep the shells in
PROGDIR = $(BASEDIR)/misc

# The system administration groups name
ADMGRP = adm

# Install is going to put these in a directory with the folowing permissions.
SYS_PERMS = 775


# Other things. You shouldn't have to touch this

SRC = message.c badpasswd.c moving.c disabled.c nosharing.c
PROG = message badpasswd moving disabled nosharing
OTHERFLAGS = '-DMAIL_FLAG=$(MAIL_FLAG)' '-DADMIN_FLAG=$(ADMIN_FLAG)' \
	     '-DROOM_FLAG=$(ROOM_FLAG)' 

all : message badpasswd moving disabled nosharing

message : 
	$(CC) $(CFLAGS) $(OTHERFLAGS) -o $@ message.c

badpasswd : 
	$(CC) $(CFLAGS) $(OTHERFLAGS) -o $@ badpasswd.c

moving :
	$(CC) $(CFLAGS) $(OTHERFLAGS) -o $@ moving.c

disabled :
	$(CC) $(CFLAGS) $(OTHERFLAGS)  -o $@ disabled.c

nosharing : 
	$(CC) $(CFLAGS) $(OTHERFLAGS) -o $@ nosharing.c

clean: 
	rm -f $(PROG) *.o

install:
	umask 2
	mkdir $(PROGDIR)
	mv message $(PROGDIR)
	chgrp $(ADMGRP) $(PROGDIR)/message
	chmod $(SYS_PERMS) $(PROGDIR)/message
	mv badpasswd $(PROGDIR)
	chgrp $(ADMGRP) $(PROGDIR)/badpasswd
	chmod $(SYS_PERMS) $(PROGDIR)/badpasswd
	mv moving $(PROGDIR)
	chgrp $(ADMGRP) $(PROGDIR)/moving
	chmod $(SYS_PERMS) $(PROGDIR)/moving
	mv disabled $(PROGDIR)
	chgrp $(ADMGRP) $(PROGDIR)/disabled
	chmod $(SYS_PERMS) $(PROGDIR)/disabled
	mv nosharing $(PROGDIR)
	chgrp $(ADMGRP) $(PROGDIR)/nosharing
	chmod $(SYS_PERMS) $(PROGDIR)/nosharing

