# @(#) $Header: makefile,v 66.11 93/06/25 17:02:52 ssa Exp $
#
# Common makefile for libsec/libmisc
#
INC=/usr/include
LIBNAME=libmisc

OBJECTS = \
	initgroups.o \
	lockdev.o \
	lstatil.o \
	lstatsl.o \
	chsecattr.o \
	symlink.o

OBJECTS_SL = $(OBJECTS:.o=_sl.o)

all: shared archive

archive:
	@$(MAKE) OBJS="$(OBJECTS)" DIR=tmp $(LIBNAME)

shared:	
	@$(MAKE) OBJS="$(OBJECTS_SL)" DIR=tmp_sl $(LIBNAME)

$(LIBNAME): $(OBJS)
	@echo "\tLinking objects to ../$(DIR)..."
	@if [ ! -d ../$(DIR) ]; then            \
            mkdir ../$(DIR) >/dev/null 2>&1;    \
	fi;                                     \
	exit 0
	@cd ../$(DIR); rm -f $(OBJS) OK.$@
	@ln $(OBJS) ../$(DIR)
	touch ../$(DIR)/OK.$@

#
# cleanup
#
clean:
	@echo Removing '*.o'
	@rm -f $(OBJECTS) $(OBJECTS_SL)

clobber:
	@echo "Clobbering is done by the top-level makefile"

#
# special cc invocations for shared library objects and archive objects
#
.SUFFIXES:	_sl.o

.c_sl.o:
	$(CC) -c $(CFLAGS) +z  $< -o $@

.c.o:
	$(CC) -c $(CFLAGS) $< -o $@

lockdev.o: \
	../libmand/libsec.h \
	$(INC)/sys/types.h \
	$(INC)/sys/ipc.h \
	$(INC)/sys/sem.h \
	$(INC)/errno.h \
	$(INC)/sys/security.h \
	$(INC)/prot.h

lstatil.o: \
	../libmand/libsec.h \
	$(INC)/sys/types.h \
	$(INC)/sys/errno.h \
	$(INC)/sys/security.h \
	$(INC)/sys/audit.h \
	$(INC)/sys/secpolicy.h \
	$(INC)/mandatory.h

lstatsl.o: \
	../libmand/libsec.h \
	$(INC)/sys/types.h \
	$(INC)/sys/errno.h \
	$(INC)/sys/security.h \
	$(INC)/sys/audit.h \
	$(INC)/sys/secpolicy.h \
	$(INC)/mandatory.h

gsecerrno.o: \
	$(INC)/sys/secdefines.h \
	$(INC)/sys/security.h \
	$(INC)/sys/auditsysc.h

psecerror.o: \
	$(INC)/sys/secdefines.h \
	$(INC)/stdio.h

sec_errlst.o: \
	$(INC)/sys/secdefines.h

session.o: \
	$(INC)/sys/secdefines.h \
	$(INC)/sys/types.h \
	$(INC)/sys/security.h \
	$(INC)/sys/audit.h \
	$(INC)/sys/auditsysc.h \
	$(INC)/prot.h
