# @(#) $Header: makefile,v 70.1 93/10/14 15:52:33 ssa Exp $
#
# Common makefile for libsec/libacl
#
INC=/usr/include
LIBNAME=libacl

OBJECTS =	\
    acllib.o	\
    chacl.o	\
    msg_acl.o	\
    sem_acl.o	\
    shm_acl.o	\
    copyacl.o   \
    statacl.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 $@

acllib.o	\
acllib_sl.o :	\
        $(INC)/acl.h $(INC)/sys/types.h $(INC)/sys/security.h

statacl.o    chacl.o    shm_acl.o    sem_acl.o    msg_acl.o	 \
statacl_sl.o chacl_sl.o shm_acl_sl.o sem_acl_sl.o msg_acl_sl.o : \
	$(INC)/sys/types.h $(INC)/sys/security.h \
	$(INC)/sys/secpolicy.h $(INC)/acl.h $(INC)/sys/audit.h
