.KEEP_STATE:












   

MCAST_INCLUDE=-I/sys
LDLIBS= -lsocket -lnsl
CFLAGS=	 -g -DSYSV ${MCAST_INCLUDE} 
OUTPUT_OPTION= -I/sys
SRCS=	mtest.c
OBJS=	mtest.o
D_OBJS= $(OBJS:%=debug/%)
OBJ_LINTS= $(OBJS:%.o=%.ln)

all: mtest
debug: debug/mtest
lint: mtest.L

debug := CFLAGS += -g -DDEBUG


mtest: ${OBJS} 
	${CC} -o $@ ${CFLAGS} ${OBJS} ${LDLIBS}

debug/mtest: $(D_OBJS)
	$(LINK.c) -o $@ $(D_OBJS)

mtest.L: $(OBJ_LINTS)
	@echo Global cross checks for $@
	@-($(LINT.c) $(OUTPUT_OPTION) $(OBJ_LINTS) $(LINT_LIBRARIES)) 2>&1 | $(LINT_TAIL)
	@touch  $@
	
clean: FRC
	rm -f ${OBJS} core mtest

tags: FRC
	ctags ${SRCS}

FRC:

debug/%.o: %.c
	$(COMPILE.c) $(OUTPUT_OPTION) $< -o $@

#****************************************************
# Lint.
#
# .L is the psuedo file representing the result of
# lint phase 2.
#****************************************************

LINT_TAIL = egrep -v 'possible pointer alignment problem' ; true

%.L: %.c 
	@echo Global cross checks for $@
	@-($(LINT.c) $(OUTPUT_OPTION) $< $(LINT_LIBRARIES)) 2>&1 | $(LINT_TAIL)
	@touch  $@

%.ln: %.c
	@echo $<:
	@-($(LINT.c) $(OUTPUT_OPTION) -i $< ) 2>&1 | $(LINT_TAIL)


