include nessus.tmpl

all : mkplugins

mkplugins :
	cd plugins && ./make_world
	
clean : 
	cd plugins && ./make_world clean

install-updater :
	test -d ${sbindir} || $(INSTALL_DIR) -m 755 ${sbindir}
	$(INSTALL) -o $(installuser) -m 0555 nessus-update-plugins ${sbindir}/
	@test -d ${mandir}/man8 || $(INSTALL_DIR) ${mandir}/man8
	$(INSTALL) -o $(installuser) -m 0444 docs/nessus-update-plugins.8 ${mandir}/man8
	
	
install : all $(INSTALL_UPDATER)
	$(INSTALL_DIR) -m 755 ${libdir}/nessus
	$(INSTALL_DIR) -m 755 ${libdir}/nessus/plugins

	for scripts in scripts/*.nasl; do \
	$(INSTALL) -o $(installuser) -m 444 $$scripts ${libdir}/nessus/plugins; \
	done
	
	for plugins in bin/*.nes; do \
	$(INSTALL) -o $(installuser) -m 555 $$plugins ${libdir}/nessus/plugins; \
	done
	
	$(INSTALL_DIR) -m 755 ${libdir}/nessus/plugins_factory
	$(INSTALL) -m 444 pf/Makefile ${libdir}/nessus/plugins_factory/
	$(INSTALL) -m 444 libtool ${libdir}/nessus/plugins_factory/
	$(INSTALL) -m 444 nessus.tmpl ${libdir}/nessus/plugins_factory/
	test -d ${prefix}/bin || $(INSTALL_DIR) -m 755 ${prefix}/bin
	$(INSTALL) -m 755 pf/nessus-build ${prefix}/bin/
	
	test -d ${sysconfdir}/nessus || $(INSTALL_DIR) -m 755 ${sysconfdir}/nessus
	
	$(INSTALL) -m 444 plugins/queso/queso.conf ${sysconfdir}/nessus/
	
	$(INSTALL) -m 444 plugins/accounts/accounts.txt ${sysconfdir}/nessus/
	
	test -d ${mandir}/man1 || $(INSTALL_DIR) -m 755 ${mandir}/man1
	$(INSTALL) -m 644 pf/nessus-build.1 ${mandir}/man1

distclean : clean
	rm -f libtool config.cache config.status config.log nessus.tmpl nessus-update-plugins
	rm -f bin/*.nes pf/nessus-build plugins/queso/queso.h
	
