# @(#) $Revision: 66.6 $
#
# Common makefile for libsec/libmand
#
INC=/usr/include
LIBNAME=libmand

OBJECTS =	\
    chilabel.o		\
    chslabel.o		\
    getclrnce.o		\
    getilabel.o		\
    getslabel.o		\
    lchilabel.o		\
    lchslabel.o		\
    lstatslabel.o	\
    mand_init.o		\
    mand_tag.o		\
    mandlib.o		\
    mld.o		\
    msg_ilabel.o	\
    msg_slabel.o	\
    sem_ilabel.o	\
    sem_slabel.o	\
    setclrnce.o		\
    setilabel.o		\
    setslabel.o		\
    shm_ilabel.o	\
    shm_slabel.o	\
    statilabel.o	\
    statslabel.o	\
    std_labels.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 $@

mandlib.o	\
mandlib_sl.o:	\
	$(INC)/mandatory.h $(INC)/sys/types.h $(INC)/sys/security.h

chilabel.o	\
getclrnce.o	\
getilabel.o	\
getslabel.o	\
hslabel.o	\
lchilabel.o	\
mand_tag.o	\
mld.o		\
mld_sl.o	\
msg_ilabel.o	\
msg_slabel.o	\
sem_ilabel.o	\
sem_slabel.o	\
setclrnce.o	\
setilabel.o	\
setslabel.o	\
shm_ilabel.o	\
shm_slabel.o	\
statilabel.o	\
statslabel.o	\
std_labels.o	\
statslabel_sl.o	\
getclrnce_sl.o	\
getslabel_sl.o	\
hslabel_sl.o	\
mand_tag_sl.o	\
msg_slabel_sl.o	\
sem_slabel_sl.o	\
setclrnce_sl.o	\
setslabel_sl.o	\
shm_slabel_sl.o:\
	$(INC)/sys/types.h $(INC)/mandatory.h $(INC)/sys/security.h \
	$(INC)/sys/audit.h $(INC)/sys/secpolicy.h
