# $Id: Makefile,v 1.2 1996/02/17 22:01:29 alex Exp alex $
# 
# Makefile
#
# This Makefile controls buid of the PAM subsystem for Linux.
#
# $Log: Makefile,v $
# Revision 1.2  1996/02/17 22:01:29  alex
# small bugs fixed
#
# Revision 1.1  1996/02/08 04:12:18  alex
# Initial revision
#
# Manual revisions by Andrew Morgan <morgan@physics.ucla.edu> 1996/3/6
#

CC=gcc
CFLAG=-O7 -pipe
AR=ar r
RANLIB=ranlib

INCLUDEDIR=`pwd`/include

PREFIX=/usr
SYSINCLUDES=$(PREFIX)/include/security
LIBDIR=$(PREFIX)/lib
SECUREDIR=/usr/lib/security

# ////////////////////////////////////////////////////
# // You should not modify anything below this line //
# ////////////////////////////////////////////////////

# this should be the name of this directory
RELNAME = Linux-PAM-0.2
DISTFILE = $(RELNAME).tgz

DIRS = libpam conf libmisc modules test examples

WARNINGS = -ansi -D_POSIX_SOURCE -Wall -Wwrite-strings \
        -Wpointer-arith -Wcast-qual -Wcast-align \
        -Wtraditional -Wstrict-prototypes -Wmissing-prototypes \
        -Wnested-externs -Winline -Wshadow -pedantic
# -Wenum-clash

DEBUG   = -g #-DDEBUG
CFLAGS  = $(WARNINGS) $(DEBUG) $(CFLAG) -I$(INCLUDEDIR) -fPIC

all:	
	for i in $(DIRS) ; do \
		make -C $$i all "CC=$(CC)" "CFLAGS=$(CFLAGS)"  "AR=$(AR)" \
		"RANLIB=$(RANLIB)" "LIBDIR=$(LIBDIR)" \
		"INCLUDEDIR=$(SYSINCLUDEDIR)" ; \
	  done

install:	
	for i in $(DIRS) ; do \
		make -C $$i install "CC=$(CC)" "CFLAGS=$(CFLAGS)"  "AR=$(AR)" \
		"RANLIB=$(RANLIB)" "LIBDIR=$(LIBDIR)" \
		"INCLUDEDIR=$(SYSINCLUDES)" "SECUREDIR=$(SECUREDIR)" ; \
	  done

clean:
	rm -f *~ core
	for i in $(DIRS) ; do \
		make -C $$i clean ; \
	done

extraclean:
	rm -f *~ core bin/*
	for i in $(DIRS) ; do \
		make -C $$i extraclean ; \
	done

release:
	@make extraclean
	rm -f .filelist
	cd .. ; tar zcvf $(DISTFILE) $(RELNAME)
#	find . -type f -print | grep -v RCS | grep -v $(DISTFILE) > .filelist
#	tar czvf $(DISTFILE) `cat .filelist`
