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

OBJECTS =	\
    auditlib.o	\
    compress.o	\
    audnetd.o

OBJECTS_SL = $(OBJECTS:.o=_sl.o) stub_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 $@

auditlib.o	\
auditlib_sl.o:	\
	$(INC)/errno.h		\
	$(INC)/malloc.h		\
	$(INC)/fcntl.h		\
	$(INC)/pwd.h		\
	$(INC)/grp.h		\
	$(INC)/time.h		\
	$(INC)/string.h		\
	$(INC)/sys/types.h	\
	$(INC)/sys/security.h	\
	$(INC)/sys/audit.h

compress.o	\
compress_sl.o:	\
	$(INC)/stdio.h		\
	$(INC)/ctype.h		\
	$(INC)/sys/types.h

