#-
#  Copyright (c) 1998 Robert N. Watson
#  All rights reserved.
# 
#  Redistribution and use in source and binary forms, with or without
#  modification, are permitted provided that the following conditions
#  are met:
#  1. Redistributions of source code must retain the above copyright
#     notice, this list of conditions and the following disclaimer.
#  2. Redistributions in binary form must reproduce the above copyright
#     notice, this list of conditions and the following disclaimer in the
#     documentation and/or other materials provided with the distribution.
#  3. The name Robert N. Watson may not be used to endorse or promote
#     products derived from this software without specific prior written
#     permission.
# 
#  THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
#  ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
#  IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
#  ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
#  FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
#  DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
#  OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
#  HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
#  LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
#  OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
#  SUCH DAMAGE.
# 
# 	$Id: Makefile,v 1.5 1998/07/15 15:24:33 robert Exp $
#

bins=suidcontrol applysuid statfile
objs=policy.lex.o policy.yacc.o implementation.lex.o implementation.yacc.o \
	checker.o utils.o globals.o 
otherobjs=main.o apply.o interface.o statfile.o
allincludes=types.h const.h globals.h
CFLAGS+=-Wall -g

# be cautious about checking pointers, freeing things
CFLAGS+=-DCAUTIOUS

all: ${bins}

suidcontrol: ${objs} main.o
	cc -o ${.TARGET} main.o interface.o ${objs} -ll -ldialog
applysuid: ${objs} apply.o
	cc -o ${.TARGET} apply.o ${objs} -ll -ldialog
statfile: statfile.o
	cc -o ${.TARGET} statfile.o

policy.lex.o: policy.lex.c
policy.lex.c: policy.l policy.yacc.h ${allincludes}
	lex -o${.TARGET} -Ppolicy policy.l

implementation.lex.o: implementation.lex.c
implementation.lex.c: implementation.l implementation.yacc.h ${allincludes}
	lex -o${.TARGET} -Pimplementation implementation.l

policy.yacc.o: policy.yacc.c
policy.yacc.h: policy.yacc.c
policy.yacc.c: policy.y ${allincludes}
	yacc -o${.TARGET} -ppolicy -d policy.y

implementation.yacc.o: implementation.yacc.c
implementation.yacc.h: implementation.yacc.c
implementation.yacc.c: implementation.y ${allincludes}
	yacc -o ${.TARGET} -pimplementation -d implementation.y

main.o: checker.o interface.o utils.o main.c ${allincludes}
checker.o: utils.o checker.c checker.h ${allincludes}
statfile.o: statfile.c
utils.o: utils.c utils.h ${allincludes}
globals.o: globals.c globals.h ${allincludes}
interface.o: interface.c interface.h ${allincludes}
apply.o: checker.o utils.o apply.c ${allincludes}

clean:
	rm -f policy.lex.c policy.yacc.c policy.yacc.h policy.lex.h ${objs} \
		${bins} \
		${otherobjs} implementation.yacc.c implementation.yacc.h \
		implementation.lex.c \
