include nessus.tmpl

ALLDEPS = nessus.tmpl

all: libnessus-client client sslstuff


nessus.tmpl: nessus.tmpl.in configure VERSION
	$(SHELL) configure $(CONFIGURE_ARGS)
	touch $@

install: all client-install install-bin install-man
	@echo
	@echo ' --------------------------------------------------------------'
	@echo ' NessusClient has been sucessfully installed. '
	@echo ' --------------------------------------------------------------'
	@echo

install-bin:
	test -d $(DESTDIR)${bindir} || $(INSTALL_DIR) -m 755 $(DESTDIR)${bindir}
	$(INSTALL) -m $(CLIENTMODE) nessusclient-mkcert $(DESTDIR)${bindir}
	$(INSTALL) -m $(CLIENTMODE) ssl/nessusclient-mkrand $(DESTDIR)${bindir}

sslstuff:
	cd ssl && $(MAKE)

install-man:
	@echo installing man pages ...
	@test -d $(DESTDIR)${mandir}/man1 || $(INSTALL_DIR) $(DESTDIR)${mandir}/man1
	@test -d $(DESTDIR)${mandir}/man8 || $(INSTALL_DIR) $(DESTDIR)${mandir}/man8
	@test -d $(DESTDIR)${datadir}/doc/ || $(INSTALL_DIR) $(DESTDIR)${datadir}/doc/
	@test -d $(DESTDIR)${datadir}/doc/NessusClient || $(INSTALL_DIR) $(DESTDIR)${datadir}/doc/NessusClient

	$(INSTALL) -c -m 0444 ${MAN_NESSUS_1} $(DESTDIR)${mandir}/man1/NessusClient.1
	$(INSTALL) -c -m 0444 doc/nessusclient-mkcert.1 $(DESTDIR)${mandir}/man1/nessusclient-mkcert.1
	$(INSTALL) -c -m 0444 doc/nessusclient-mkrand.1 $(DESTDIR)${mandir}/man1/nessusclient-mkrand.1
	$(INSTALL) -c -m 0444 doc/NessusClient_UserGuide.pdf $(DESTDIR)${datadir}/doc/NessusClient/NessusClient_UserGuide.pdf

win32: ${MAN_NESSUS_1}
	$(MANROFF) ${MAN_NESSUS_1}  > doc/NessusClient.1.cat
	@echo
	@echo ' --------------------------------------------------------------'
	@echo '    Go ahead and move the nessus-core tree to a windows'
	@echo '    box where it can be compiled using nmake.bat'
	@echo ' --------------------------------------------------------------'
	@echo

client-install : client
	test -d $(DESTDIR)${bindir} || $(INSTALL_DIR) -m 755 $(DESTDIR)${bindir}
	$(INSTALL) -m $(CLIENTMODE) ${make_bindir}/NessusClient $(DESTDIR)${bindir}

client : 
	cd nessus && $(MAKE)

libnessus-client:
	cd libnessus && $(MAKE)


doc : $(MAN_NESSUS_1)

$(MAN_NESSUS_1) : $(MAN_NESSUS_1).in
	@sed -e 's?@NESSUSD_CONFDIR@?${NESSUSD_CONFDIR}?g;s?@NESSUSD_DATADIR@?${NESSUSD_DATADIR}?g;s?@NESSUSD_PLUGINS@?${NESSUSD_PLUGINS}?g;' $(MAN_NESSUS_1).in  >$(MAN_NESSUS_1)


clean:
	cd nessus && $(MAKE) clean
	cd libnessus && $(MAKE) clean
	cd ssl && $(MAKE) clean

distclean: clean
	[ -z "${rootdir}" ] || rm -f ${rootdir}/include/config.h ${rootdir}/include/corevers.h
	rm -f nessus.tmpl doc/NessusClient.1.cat
	[ -z "${make_bindir}" ] || rm -f $(make_bindir)/[nN]essus*
	rm -f libtool config.cache config.status config.log 
	rm -f nessusclient-mkcert
	rm -f ${MAN_NESSUS_1} 


