Nmap Development mailing list archives
Eliminating NMAP_VERSION redundancy
From: David Fifield <david () bamsoftware com>
Date: Mon, 28 May 2007 12:51:17 -0600
Right now the Nmap version string NMAP_VERSION is specified in two different places: in Makefile.in, and in nmap_winconfig.h. The NMAP_VERSION from Makefile.in is transfered to Makefile by configure, and from there it is defined in the code using the -D compiler switch. However, a common method of compiling Nmap on Windows doesn't use Makefile.in or configure at all, so NMAP_VERSION is defined in nmap_winconfig.h. This means that the version string has to be changed in two places whenever it is updated. The attached patch aims to eliminate this redundancy. It defines NMAP_VERSION in only one place, nmap.h. The version string is extracted from that file by the makefiles. This technique is used in the GNU Make manual: http://www.gnu.org/software/make/manual/html_node/Complex-Makefile.html (look at the shar and dist targets). I did some research and didn't find anything more satisfactory. Some projects live with the redundancy, some require using configure and make even on Windows. I've tested the patch on Linux only. I need some Windows developers to try building the code and making a distribution to see if it works. In particular, try building NmapFE and doing a "make winbuild" in the mswin32 directory, because those parts are sensitive to the version string. It's possible to add error checking for the version string extraction using a rule like this (which the "all" target would depend on): check-version: @if test -z "$(NMAP_VERSION)"; then \ echo "Couldn't find a definition for NMAP_VERSION in nmap.h."; \ false; \ fi This would uncover the error in case someone accidentally breaks the format of the definition such that it can't be read by the makefile. David Fifield
Attachment:
nmap-version.diff
Description:
_______________________________________________ Sent through the nmap-dev mailing list http://cgi.insecure.org/mailman/listinfo/nmap-dev Archived at http://SecLists.Org
Current thread:
- Eliminating NMAP_VERSION redundancy David Fifield (May 28)
- Re: Eliminating NMAP_VERSION redundancy David Fifield (Jun 01)