SHELL	= /bin/sh
SRCS	= nbdb_reindexd.c nbdb_sniffer.c nbdb_safe.c \
	nbdb_index_as.c nbdb_process.c
OBJS	= nbdb_reindexd.o nbdb_sniffer.o nbdb_safe.o \
	nbdb_index_as.o nbdb_process.o
HDRS	= nbdb_reindexd.h nbdb_sniffer.h nbdb_safe.h \
	nbdb_index_as.h nbdb_process.h
TESTSRC	= nbdb_sniffer_test.c nbdb_safe_test.c
DEFS	= -I. -I$(INC_DIR) -D$(SYSTYPE)
CFLAGS	= $(DEBUG) $(OPT) $(DEFS)
PROG	= nbdb_reindexd
TESTPROG= nbdb_sniffer_test nbdb_safe_test nbdb_index_as_test nbdb_process_test
TESTLIB	= ../../lib/libtesting.a
INC_DIR	= ../../include
LIBS	= ../../lib/lib$(LIB_PREFIX)master$(LIB_SUFFIX) \
	../../lib/lib$(LIB_PREFIX)global$(LIB_SUFFIX) \
	../../lib/lib$(LIB_PREFIX)util$(LIB_SUFFIX)

.c.o:;	$(CC) $(CFLAGS) -c $*.c

$(PROG):	$(OBJS) $(LIBS)
	$(CC) $(CFLAGS) $(SHLIB_RPATH) -o $@ $(OBJS) $(LIBS) $(SYSLIBS)

$(OBJS): ../../conf/makedefs.out

Makefile: Makefile.in
	cat ../../conf/makedefs.out $? >$@

test:	$(TESTPROG)

tests: test_nbdb_sniffer test_nbdb_safe test_nbdb_index_as test_nbdb_process

root_tests:

update: ../../libexec/$(PROG)

../../libexec/$(PROG): $(PROG)
	cp $(PROG) ../../libexec

clean:
	rm -f *.o *core $(PROG) $(TESTPROG) junk 

tidy:	clean

SNIFFER_TEST_OBJ = nbdb_sniffer.o $(TESTLIB)

nbdb_sniffer_test: nbdb_sniffer_test.o $(SNIFFER_TEST_OBJ) $(LIBS)
	$(CC) $(CFLAGS) -o $@ $@.o $(SNIFFER_TEST_OBJ) $(LIBS) $(SYSLIBS)

test_nbdb_sniffer: nbdb_sniffer_test
	$(SHLIB_ENV) $(VALGRIND) ./nbdb_sniffer_test

SAFE_TEST_OBJ = nbdb_safe.o

nbdb_safe_test: nbdb_safe_test.o $(SAFE_TEST_OBJ) $(LIBS)
	$(CC) $(CFLAGS) -o $@ $@.o $(SAFE_TEST_OBJ) $(LIBS) $(SYSLIBS)

test_nbdb_safe: nbdb_safe_test
	$(SHLIB_ENV) $(VALGRIND) ./nbdb_safe_test

INDEX_AS_TEST_OBJ = nbdb_index_as.o $(TESTLIB)

nbdb_index_as_test: nbdb_index_as_test.o $(INDEX_AS_TEST_OBJ) $(LIBS)
	$(CC) $(CFLAGS) -o $@ $@.o $(INDEX_AS_TEST_OBJ) $(LIBS) $(SYSLIBS)

test_nbdb_index_as: nbdb_index_as_test
	$(SHLIB_ENV) $(VALGRIND) ./nbdb_index_as_test

PROCESS_TEST_OBJ = nbdb_process.o nbdb_index_as.o nbdb_sniffer.o nbdb_safe.o \
	 $(TESTLIB)

nbdb_process_test: nbdb_process_test.o $(PROCESS_TEST_OBJ) $(LIBS)
	$(CC) $(CFLAGS) -o $@ $@.o $(PROCESS_TEST_OBJ) $(LIBS) $(SYSLIBS)

test_nbdb_process: nbdb_process_test
	$(SHLIB_ENV) $(VALGRIND) ./nbdb_process_test

depend: $(MAKES)
	(sed '1,/^# do not edit/!d' Makefile.in; \
	set -e; for i in [a-z][a-z0-9]*.c; do \
	    $(CC) -E $(DEFS) $(INCL) $$i | grep -v '[<>]' | sed -n -e '/^# *1 *"\([^"]*\)".*/{' \
	    -e 's//'`echo $$i|sed 's/c$$/o/'`': \1/' \
	    -e 's/o: \.\//o: /' -e p -e '}' ; \
	done | LANG=C sort -u) | grep -v '[.][o][:][ ][/]' >$$$$ && mv $$$$ Makefile.in
	@$(EXPORT) make -f Makefile.in Makefile 1>&2

# do not edit below this line - it is generated by 'make depend'
nbdb_index_as.o: ../../include/argv.h
nbdb_index_as.o: ../../include/check_arg.h
nbdb_index_as.o: ../../include/dict.h
nbdb_index_as.o: ../../include/iostuff.h
nbdb_index_as.o: ../../include/mail_params.h
nbdb_index_as.o: ../../include/mail_parm_split.h
nbdb_index_as.o: ../../include/myflock.h
nbdb_index_as.o: ../../include/nbdb_util.h
nbdb_index_as.o: ../../include/spawn_command.h
nbdb_index_as.o: ../../include/stringops.h
nbdb_index_as.o: ../../include/sys_defs.h
nbdb_index_as.o: ../../include/vbuf.h
nbdb_index_as.o: ../../include/vstream.h
nbdb_index_as.o: ../../include/vstring.h
nbdb_index_as.o: nbdb_index_as.c
nbdb_index_as.o: nbdb_index_as.h
nbdb_index_as_test.o: ../../include/argv.h
nbdb_index_as_test.o: ../../include/check_arg.h
nbdb_index_as_test.o: ../../include/dict.h
nbdb_index_as_test.o: ../../include/mock_spawn_command.h
nbdb_index_as_test.o: ../../include/msg.h
nbdb_index_as_test.o: ../../include/msg_vstream.h
nbdb_index_as_test.o: ../../include/myflock.h
nbdb_index_as_test.o: ../../include/nbdb_util.h
nbdb_index_as_test.o: ../../include/spawn_command.h
nbdb_index_as_test.o: ../../include/stringops.h
nbdb_index_as_test.o: ../../include/sys_defs.h
nbdb_index_as_test.o: ../../include/vbuf.h
nbdb_index_as_test.o: ../../include/vstream.h
nbdb_index_as_test.o: ../../include/vstring.h
nbdb_index_as_test.o: nbdb_index_as.h
nbdb_index_as_test.o: nbdb_index_as_test.c
nbdb_process.o: ../../include/allowed_prefix.h
nbdb_process.o: ../../include/argv.h
nbdb_process.o: ../../include/attr.h
nbdb_process.o: ../../include/check_arg.h
nbdb_process.o: ../../include/dict.h
nbdb_process.o: ../../include/htable.h
nbdb_process.o: ../../include/mail_params.h
nbdb_process.o: ../../include/msg.h
nbdb_process.o: ../../include/myflock.h
nbdb_process.o: ../../include/mymalloc.h
nbdb_process.o: ../../include/nbdb_util.h
nbdb_process.o: ../../include/nvtable.h
nbdb_process.o: ../../include/spawn_command.h
nbdb_process.o: ../../include/sys_defs.h
nbdb_process.o: ../../include/vbuf.h
nbdb_process.o: ../../include/vstream.h
nbdb_process.o: ../../include/vstring.h
nbdb_process.o: ../../include/wrap_stat.h
nbdb_process.o: nbdb_index_as.h
nbdb_process.o: nbdb_process.c
nbdb_process.o: nbdb_process.h
nbdb_process.o: nbdb_reindexd.h
nbdb_process.o: nbdb_safe.h
nbdb_process.o: nbdb_sniffer.h
nbdb_process_test.o: ../../include/allowed_prefix.h
nbdb_process_test.o: ../../include/argv.h
nbdb_process_test.o: ../../include/check_arg.h
nbdb_process_test.o: ../../include/dict.h
nbdb_process_test.o: ../../include/dict_cdb.h
nbdb_process_test.o: ../../include/dict_lmdb.h
nbdb_process_test.o: ../../include/mail_params.h
nbdb_process_test.o: ../../include/mkmap.h
nbdb_process_test.o: ../../include/mock_dict.h
nbdb_process_test.o: ../../include/mock_open_as.h
nbdb_process_test.o: ../../include/mock_spawn_command.h
nbdb_process_test.o: ../../include/mock_stat.h
nbdb_process_test.o: ../../include/msg.h
nbdb_process_test.o: ../../include/msg_capture.h
nbdb_process_test.o: ../../include/msg_vstream.h
nbdb_process_test.o: ../../include/myflock.h
nbdb_process_test.o: ../../include/nbdb_util.h
nbdb_process_test.o: ../../include/open_as.h
nbdb_process_test.o: ../../include/spawn_command.h
nbdb_process_test.o: ../../include/stringops.h
nbdb_process_test.o: ../../include/sys_defs.h
nbdb_process_test.o: ../../include/vbuf.h
nbdb_process_test.o: ../../include/vstream.h
nbdb_process_test.o: ../../include/vstring.h
nbdb_process_test.o: nbdb_index_as.h
nbdb_process_test.o: nbdb_process.h
nbdb_process_test.o: nbdb_process_test.c
nbdb_process_test.o: nbdb_safe.h
nbdb_reindexd.o: ../../include/allowed_prefix.h
nbdb_reindexd.o: ../../include/argv.h
nbdb_reindexd.o: ../../include/attr.h
nbdb_reindexd.o: ../../include/check_arg.h
nbdb_reindexd.o: ../../include/dict.h
nbdb_reindexd.o: ../../include/htable.h
nbdb_reindexd.o: ../../include/iostuff.h
nbdb_reindexd.o: ../../include/mail_conf.h
nbdb_reindexd.o: ../../include/mail_params.h
nbdb_reindexd.o: ../../include/mail_proto.h
nbdb_reindexd.o: ../../include/mail_server.h
nbdb_reindexd.o: ../../include/mail_task.h
nbdb_reindexd.o: ../../include/mail_version.h
nbdb_reindexd.o: ../../include/msg.h
nbdb_reindexd.o: ../../include/msg_vstream.h
nbdb_reindexd.o: ../../include/myflock.h
nbdb_reindexd.o: ../../include/mymalloc.h
nbdb_reindexd.o: ../../include/nbdb_util.h
nbdb_reindexd.o: ../../include/nvtable.h
nbdb_reindexd.o: ../../include/set_eugid.h
nbdb_reindexd.o: ../../include/split_at.h
nbdb_reindexd.o: ../../include/sys_defs.h
nbdb_reindexd.o: ../../include/vbuf.h
nbdb_reindexd.o: ../../include/vstream.h
nbdb_reindexd.o: ../../include/vstring.h
nbdb_reindexd.o: ../../include/wrap_stat.h
nbdb_reindexd.o: nbdb_index_as.h
nbdb_reindexd.o: nbdb_process.h
nbdb_reindexd.o: nbdb_reindexd.c
nbdb_reindexd.o: nbdb_reindexd.h
nbdb_reindexd.o: nbdb_safe.h
nbdb_reindexd.o: nbdb_sniffer.h
nbdb_safe.o: ../../include/allowed_prefix.h
nbdb_safe.o: ../../include/argv.h
nbdb_safe.o: ../../include/check_arg.h
nbdb_safe.o: ../../include/mail_conf.h
nbdb_safe.o: ../../include/mail_params.h
nbdb_safe.o: ../../include/sys_defs.h
nbdb_safe.o: ../../include/vbuf.h
nbdb_safe.o: ../../include/vstring.h
nbdb_safe.o: ../../include/wrap_stat.h
nbdb_safe.o: nbdb_reindexd.h
nbdb_safe.o: nbdb_safe.c
nbdb_safe.o: nbdb_safe.h
nbdb_safe_test.o: ../../include/allowed_prefix.h
nbdb_safe_test.o: ../../include/argv.h
nbdb_safe_test.o: ../../include/check_arg.h
nbdb_safe_test.o: ../../include/mail_conf.h
nbdb_safe_test.o: ../../include/mail_params.h
nbdb_safe_test.o: ../../include/msg.h
nbdb_safe_test.o: ../../include/msg_vstream.h
nbdb_safe_test.o: ../../include/stringops.h
nbdb_safe_test.o: ../../include/sys_defs.h
nbdb_safe_test.o: ../../include/vbuf.h
nbdb_safe_test.o: ../../include/vstream.h
nbdb_safe_test.o: ../../include/vstring.h
nbdb_safe_test.o: nbdb_safe.h
nbdb_safe_test.o: nbdb_safe_test.c
nbdb_sniffer.o: ../../include/allowed_prefix.h
nbdb_sniffer.o: ../../include/argv.h
nbdb_sniffer.o: ../../include/check_arg.h
nbdb_sniffer.o: ../../include/dict.h
nbdb_sniffer.o: ../../include/mail_params.h
nbdb_sniffer.o: ../../include/msg.h
nbdb_sniffer.o: ../../include/myflock.h
nbdb_sniffer.o: ../../include/nbdb_util.h
nbdb_sniffer.o: ../../include/open_as.h
nbdb_sniffer.o: ../../include/readlline.h
nbdb_sniffer.o: ../../include/resolve_clnt.h
nbdb_sniffer.o: ../../include/stringops.h
nbdb_sniffer.o: ../../include/sys_defs.h
nbdb_sniffer.o: ../../include/tok822.h
nbdb_sniffer.o: ../../include/vbuf.h
nbdb_sniffer.o: ../../include/vstream.h
nbdb_sniffer.o: ../../include/vstring.h
nbdb_sniffer.o: nbdb_reindexd.h
nbdb_sniffer.o: nbdb_sniffer.c
nbdb_sniffer.o: nbdb_sniffer.h
nbdb_sniffer_test.o: ../../include/check_arg.h
nbdb_sniffer_test.o: ../../include/mock_open_as.h
nbdb_sniffer_test.o: ../../include/msg.h
nbdb_sniffer_test.o: ../../include/msg_vstream.h
nbdb_sniffer_test.o: ../../include/open_as.h
nbdb_sniffer_test.o: ../../include/stringops.h
nbdb_sniffer_test.o: ../../include/sys_defs.h
nbdb_sniffer_test.o: ../../include/vbuf.h
nbdb_sniffer_test.o: ../../include/vstream.h
nbdb_sniffer_test.o: ../../include/vstring.h
nbdb_sniffer_test.o: nbdb_sniffer.h
nbdb_sniffer_test.o: nbdb_sniffer_test.c
