diff --git a/Makefile.in b/Makefile.in index 8236bbd6b..ccfceda29 100644 --- a/Makefile.in +++ b/Makefile.in @@ -1,5 +1,5 @@ # Extract the version string from nmap.h. -export NMAP_VERSION := $(shell grep '^\#[ \t]*define[ \t]\+NMAP_VERSION' nmap.h | sed -e 's/.*"\(.*\)".*/\1/' -e 'q') +export NMAP_VERSION := $(shell echo NMAP_VERSION | $(CPP) -imacros nmap.h - | sed -n '$$s/[" ]//g;$$p') NMAP_PLATFORM=@host@ datarootdir = @datarootdir@ prefix = @prefix@ diff --git a/macosx/Makefile b/macosx/Makefile index 23caf6ada..506671cab 100644 --- a/macosx/Makefile +++ b/macosx/Makefile @@ -1,8 +1,8 @@ # This makefile builds a disk image (.dmg) containing the installer for Nmap, # Zenmap, Ncat, and Ndiff. -NMAP_VERSION := $(shell grep '^\#[ \t]*define[ \t]\+NMAP_VERSION' ../nmap.h | sed -e 's/.*"\(.*\)".*/\1/' -e 'q') -NMAP_NUM_VERSION := $(shell grep '^\#[ \t]*define[ \t]\+NMAP_NUM_VERSION' ../nmap.h | sed -e 's/.*"\(.*\)".*/\1/' -e 'q') +NMAP_VERSION := $(shell echo NMAP_VERSION | $(CPP) -imacros nmap.h - | sed -n '$$s/[" ]//g;$$p') +NMAP_VERSION := $(shell echo NMAP_NUM_VERSION | $(CPP) -imacros nmap.h - | sed -n '$$s/[" ]//g;$$p') #OSX_VERSION=$(shell sw_vers -productVersion | cut -d'.' -f1,2 | tr -d ' ') OSX_VERSION=10.11 OSX_MIN_VERSION = 10.9 diff --git a/mswin32/Makefile b/mswin32/Makefile index 4a687a1b7..e5c8f5f5d 100644 --- a/mswin32/Makefile +++ b/mswin32/Makefile @@ -5,8 +5,8 @@ VCEXPRESS := $(shell reg query "HKEY_CLASSES_ROOT\\Applications\\devenv.exe\\she SIGNTOOL := $(shell reg query "HKEY_LOCAL_MACHINE\\SOFTWARE\\Wow6432Node\\Microsoft\\Microsoft SDKs\\Windows\\v8.1" /v "InstallationFolder" | egrep InstallationFolder | cut -d ' ' -f13- | sed 's%\\%/%g' | tr -d '\r\n' | sed 's%$$%bin/x86/signtool.exe%') NMAPDIR=.. NMAPDIR_WIN=$(shell echo '$(NMAPDIR)' | sed 's|/cygdrive/\(.\)|\1:|;s|/|\\|g') -export NMAP_VERSION := $(shell grep '^\#[ \t]*define[ \t]\+NMAP_VERSION' $(NMAPDIR)/nmap.h | sed -e 's/.*"\(.*\)".*/\1/' -e 'q') -export NMAP_NUM_VERSION := $(shell grep '^\#[ \t]*define[ \t]\+NMAP_NUM_VERSION' $(NMAPDIR)/nmap.h | sed -e 's/.*"\(.*\)".*/\1/' -e 'q') +export NMAP_VERSION := $(shell echo NMAP_VERSION | $(CPP) -imacros $(NMAPDIR)/nmap.h - | sed -n '$$s/[" ]//g;$$p') +export NMAP_VERSION := $(shell echo NMAP_NUM_VERSION | $(CPP) -imacros $(NMAPDIR)/nmap.h - | sed -n '$$s/[" ]//g;$$p') export NPCAP_VERSION := $(shell ls npcap-*.exe | sed -e 's/npcap-\([0-9.]*\)[-oem]*\.exe/\1/' -e 'q') COMMA_VERSION=$(shell echo $(NMAP_NUM_VERSION) | tr '.' ',') LOGLOC=c:nmapbuild.log diff --git a/nmap.h b/nmap.h index 8e12fa6c6..549dbec0b 100644 --- a/nmap.h +++ b/nmap.h @@ -118,11 +118,20 @@ #endif #define NMAP_URL "https://nmap.org" +#define _STR(X) #X +#define STR(X) _STR(X) + #ifndef NMAP_VERSION /* Edit this definition only within the quotes, because it is read from this file by the makefiles. */ -#define NMAP_VERSION "7.91SVN" -#define NMAP_NUM_VERSION "7.91.1.0" +#define NMAP_MAJOR 7 +#define NMAP_MINOR 91 +#define NMAP_BUILD 1 +/* SVN, BETA, etc. */ +#define NMAP_SPECIAL "SVN" + +#define NMAP_VERSION STR(NMAP_MAJOR) "." STR(NMAP_MINOR) NMAP_SPECIAL +#define NMAP_NUM_VERSION STR(NMAP_MAJOR) "." STR(NMAP_MINOR) "." STR(NMAP_BUILD) ".0" #endif #define NMAP_XMLOUTPUTVERSION "1.05" @@ -136,8 +145,6 @@ #define MAX_TIMEOUTS MAX_SOCKETS /* How many timed out connection attempts in a row before we decide the host is dead? */ -#define _STR(X) #X -#define STR(X) _STR(X) #define DEFAULT_TCP_PROBE_PORT 80 /* The ports TCP ping probes go to if unspecified by user -- uber hackers change this to 113 */