LIBDIR		= ../../libsecure
LIBS		= $(LIBDIR)/libsecure.a
LLIBS		= -lsecure
BINDIR		=  ../bin
#
# compile-time definitions that are specific to this code
# NL     If defined, the program terminates its output with a newline.
#        If this is to be used by shell scripts, you may not want the newline
# ERROUT controls whether diagnostic output is sent to stderr. If not defined,
#        the program will not print any diagnostics.
#
NL              = -DNL
ERROUT          = -DERROUT
DEFS            = ${NL} ${ERROUT}

CFLAGS		= -c -I../../include -I../../kernel/include ${DEFS}
DEPFLAG		= -M
CC		= gcc 
SRC 		= $(wildcard *.c)
EXECUTABLE	= $(shell basename $(SRC) .c)
OBJ		= $(EXECUTABLE).o


it: $(EXECUTABLE)

$(EXECUTABLE): $(OBJ) $(LIBS)
	$(CC) -o $@ -L$(LIBDIR) $(OBJ) $(LLIBS)
	chmod 755 $@ 
	@echo $@ be done...

%.o:  %.c
	$(CC) $(CFLAGS) $<

$(OBJ): $(MAKEFILE)

$(LIBS): 
	(cd $(LIBDIR); make)

# Support for the install target
install : $(BINDIR)/$(EXECUTABLE)

$(BINDIR)/$(EXECUTABLE) : $(EXECUTABLE)
	install -m 755 $(EXECUTABLE) $@
	@echo $(EXECUTABLE) be installed in $(BINDIR)

# Support for the clean target
clean : 
	rm -f $(OBJ)

# Support for the bare target
bare : clean
	rm -f $(EXECUTABLE) *% *~ *.bak

# Support for the depend target
depend : $(SRC)
	$(CC) $(DEPFLAG) $(CFLAGS) $(SRC) > dependlist
	sed -e '1,/^# DO NOT DELETE/!d' Makefile > mkdep
	cat dependlist >> mkdep
	mv mkdep Makefile
	rm -f dependlist 
	@echo Makefile updated
	@echo

# DO NOT DELETE THIS LINE
compute_av.o: compute_av.c /usr/include/stdio.h \
 /usr/include/features.h /usr/include/sys/cdefs.h \
 /usr/include/gnu/stubs.h \
 /usr/lib/gcc-lib/i386-redhat-linux/egcs-2.91.66/include/stddef.h \
 /usr/lib/gcc-lib/i386-redhat-linux/egcs-2.91.66/include/stdarg.h \
 /usr/include/bits/types.h /usr/include/libio.h \
 /usr/include/_G_config.h /usr/include/bits/stdio_lim.h \
 ../../include/ss.h /usr/include/unistd.h \
 /usr/include/bits/posix_opt.h /usr/include/bits/confname.h \
 /usr/include/getopt.h ../../kernel/include/linux/flask/security.h \
 ../../kernel/include/linux/flask/flask.h \
 ../../kernel/include/linux/flask/flask_types.h \
 ../../kernel/include/asm/types.h /usr/include/errno.h \
 /usr/include/bits/errno.h ../../kernel/include/linux/errno.h \
 ../../kernel/include/asm/errno.h
