#
# makefile for security-enhanced system
#
CC = gcc -ansi -pedantic

# set -DSTRDUP if strdup is a library function on your system
# set -DMAX_MPOPEN=n if you'll make more than 20 popen calls at the same time
#	(here, n is the maximum number you will make at once)
# you can reset the following to change the default command encironment
# within msystem:
# DEF_UMASK	077			umask
# DEF_PATH	/bin:/usr/bin:/usr/ucb	search path
# DEF_SHELL	/bin/sh			shell
# DEF_IFS	 \t\n			IFS (blank, tab, newline)
# UID_RESET	-2			reset EUID to RUID
# GID_RESET	-2			reset EGID to RGID
#
DEFINES = -DSTRDUP
CFLAGS = -g $(DEFINES)

#
# programs
#
ARCH = ar		# archiver (library builder)
ARFLAGS = rv		# on BSD, it's rv; on System V, it's rvs
LINT = lint		# lint (strict K&R C checker)
LINTFLAGS = -abch	# on BSD, it's -abch; on System V, it's nothing
RANLIB = ranlib		# on BSD, it's ranlib; on System V, it's true
RM = rm			# file deletion command
RMFLAGS = -f		# options to file deletion command

#
# library file names
#
LIBSRC = msystem.c
LIBOBJ = msystem.o
LIB = libmsystem.a

#
# the rules
#
lib:	$(LIB)

all:	tester testfd

tester: $(LIB) tester.o
	$(CC) $(CFLAGS) -o tester tester.o $(LIB)

testfd: $(LIB) testfd.o
	$(CC) $(CFLAGS) -o testfd testfd.o $(LIB)

$(LIB):	$(LIBOBJ)
	$(AR) $(ARFLAGS) $(LIB) $(LIBOBJ)
	$(RANLIB) $(LIB)

#
# support stuff
#
lint:
	lint $(LINTFLAGS) msystem.c

clean:
	$(RM) $(RMFLAGS) tester.o testfd.o $(LIBOBJ)

clobber:
	$(RM) $(RMFLAGS) tester.o testfd.o $(LIBOBJ) tester testfd $(LIB) a.out core ERRS
