mirror of
https://github.com/nmap/nmap.git
synced 2025-12-28 18:39:03 +00:00
Updates to build with VS 2019
This commit is contained in:
15
mswin32/Build.bat
Normal file
15
mswin32/Build.bat
Normal file
@@ -0,0 +1,15 @@
|
||||
@echo off
|
||||
set TARGET=%1
|
||||
set VCCONFIG=%2
|
||||
|
||||
for /f "usebackq delims=#" %%a in (`"%ProgramFiles(x86)%\Microsoft Visual Studio\Installer\vswhere" -version 16 -property installationPath`) do call "%%a\VC\Auxiliary\Build\vcvarsall.bat" x86
|
||||
|
||||
@echo on
|
||||
if "%TARGET%" == "Vars" ( goto :vars )
|
||||
|
||||
msbuild -nologo nmap.sln -m -t:%TARGET% -p:Configuration="%VCCONFIG%" -p:Platform="Win32" -fl
|
||||
exit /b %errorlevel%
|
||||
|
||||
:vars
|
||||
cl.exe /nologo /EP make-vars.h > make-vars.make
|
||||
exit /b %errorlevel%
|
||||
@@ -1,15 +1,12 @@
|
||||
MAKENSIS=/cygdrive/c/Program Files (x86)/NSIS-strlen/makensis.exe
|
||||
MAKENSIS_WIN=$(shell echo '$(MAKENSIS)' | sed 's|/cygdrive/\(.\)|\1:|;s|/|\\|g')
|
||||
# VCExpress.exe is devenv.com with the commercial Visual Studio suite instead of VC++ Express
|
||||
VCEXPRESS := $(shell reg query "HKEY_CLASSES_ROOT\\Applications\\devenv.exe\\shell\\edit\\command" | egrep -i '[A-Z]:\\' | cut -d\" -f2 | sed 's%\\%/%g' | tr -d '\r\n')
|
||||
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%')
|
||||
SIGNTOOL := $(shell reg query "HKEY_LOCAL_MACHINE\\SOFTWARE\\Wow6432Node\\Microsoft\\Microsoft SDKs\\Windows\\v10.0" /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 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')
|
||||
|
||||
include make-vars.make
|
||||
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
|
||||
|
||||
NSE_FILES = $(NMAPDIR)/scripts/script.db $(NMAPDIR)/scripts/*.nse
|
||||
NMAP_MSWIN32_AUX = $(NMAPDIR)/../nmap-mswin32-aux
|
||||
SIGNTOOL_ARGS = sign /a /n "Insecure.Com LLC" /tr http://timestamp.digicert.com /td sha256 /fd sha256
|
||||
@@ -22,12 +19,17 @@ PLATFORM=Win32
|
||||
VCCONFIG=Release
|
||||
NSIS_DEFINES=
|
||||
|
||||
all: build-nmap
|
||||
|
||||
make-vars.make: make-vars.h
|
||||
cmd /c Build.bat Vars
|
||||
|
||||
bundle-nmap: bundle-zip bundle-nsis
|
||||
|
||||
build-nmap${OEM_SUFFIX}: nmap.sln nmap${OEM_SUFFIX}.rc
|
||||
"$(VCEXPRESS)" nmap.sln /build "$(VCCONFIG)${OEM_SUFFIX}|$(PLATFORM)" /out $(LOGLOC)
|
||||
build-nmap${OEM_SUFFIX}: nmap.sln
|
||||
cmd /c Build.bat Build "$(VCCONFIG)${OEM_SUFFIX}"
|
||||
|
||||
stage-common: $(NMAPDIR)/CHANGELOG $(NMAPDIR)/LICENSE $(NMAPDIR)/nmap-mac-prefixes $(NMAPDIR)/nmap-os-db $(NMAPDIR)/nmap-payloads $(NMAPDIR)/nmap-protocols $(NMAPDIR)/nmap-rpc $(NMAPDIR)/nmap-service-probes $(NMAPDIR)/nmap-services $(NMAPDIR)/docs/nmap.xsl $(NMAPDIR)/nse_main.lua $(NMAPDIR)/mswin32/nmap_performance.reg $(NMAPDIR)/README-WIN32 $(NMAPDIR)/docs/3rd-party-licenses.txt icon1.ico LICENSE.formatted
|
||||
stage-common: $(NMAPDIR)/CHANGELOG $(NMAPDIR)/LICENSE $(NMAPDIR)/nmap-mac-prefixes $(NMAPDIR)/nmap-os-db $(NMAPDIR)/nmap-payloads $(NMAPDIR)/nmap-protocols $(NMAPDIR)/nmap-rpc $(NMAPDIR)/nmap-service-probes $(NMAPDIR)/nmap-services $(NMAPDIR)/docs/nmap.xsl $(NMAPDIR)/nse_main.lua $(NMAPDIR)/mswin32/nmap_performance.reg $(NMAPDIR)/README-WIN32 $(NMAPDIR)/docs/3rd-party-licenses.txt icon1.ico LICENSE.formatted VC_redist.x86.exe
|
||||
mkdir -p nmap-$(NMAP_VERSION)
|
||||
cp $^ nmap-$(NMAP_VERSION)/
|
||||
# Use "cmd /c copy" rather than "cp" to preserve Windows ACLs. Using
|
||||
@@ -46,8 +48,8 @@ stage-common: $(NMAPDIR)/CHANGELOG $(NMAPDIR)/LICENSE $(NMAPDIR)/nmap-mac-prefix
|
||||
done
|
||||
cp -r $(NMAPDIR)/docs/licenses nmap-$(NMAP_VERSION)/
|
||||
rm -rf nmap-$(NMAP_VERSION)/licenses/.svn
|
||||
cp $(NMAP_MSWIN32_AUX)/vcredist_x86.exe nmap-$(NMAP_VERSION)
|
||||
cp $(NMAP_MSWIN32_AUX)/vcredist2008_x86.exe nmap-$(NMAP_VERSION)
|
||||
cp VC_redist.x86.exe nmap-$(NMAP_VERSION)
|
||||
#cp $(NMAP_MSWIN32_AUX)/vcredist2008_x86.exe nmap-$(NMAP_VERSION)
|
||||
cp $(NMAPDIR)/ncat/$(VCCONFIG)/ncat.exe nmap-$(NMAP_VERSION)
|
||||
cp $(NMAPDIR)/ncat/$(VCCONFIG)/ca-bundle.crt nmap-$(NMAP_VERSION)
|
||||
cp $(NMAPDIR)/nping/$(VCCONFIG)/nping.exe nmap-$(NMAP_VERSION)
|
||||
@@ -118,20 +120,6 @@ bundle-zip-main: sign-files
|
||||
-r nmap-$(NMAP_VERSION)${OEM_SUFFIX}-win32.zip nmap-$(NMAP_VERSION)${OEM_SUFFIX}
|
||||
rm nmap-$(NMAP_VERSION)${OEM_SUFFIX}/npcap-$(NPCAP_VERSION)${OEM_SUFFIX}.exe
|
||||
|
||||
nmap.rc: nmap.rc.in $(NMAPDIR)/nmap.h
|
||||
sed -e '1i// Automatically generated from $<.' \
|
||||
-e 's/@@FILEVERSION@@/"$(NMAP_VERSION)\\0"/' \
|
||||
-e 's/@@COMMAVERSION@@/$(COMMA_VERSION)/' \
|
||||
-e 's/@@PRODUCT_NAME@@/$(PRODUCT_NAME)/' \
|
||||
"$<" > "$@"
|
||||
|
||||
nmap-oem.rc: nmap.rc.in $(NMAPDIR)/nmap.h
|
||||
sed -e '1i// Automatically generated from $<.' \
|
||||
-e 's/@@FILEVERSION@@/"$(NMAP_VERSION)\\0"/' \
|
||||
-e 's/@@COMMAVERSION@@/$(COMMA_VERSION)/' \
|
||||
-e 's/@@PRODUCT_NAME@@/$(PRODUCT_NAME) OEM/' \
|
||||
"$<" > "$@"
|
||||
|
||||
nmap-$(NMAP_VERSION)/Nmap.nsi: nsis/Nmap.nsi.in $(NMAPDIR)/nmap.h
|
||||
test -n "$(NPCAP_VERSION)" # Make sure NPcap is present
|
||||
mkdir -p nmap-$(NMAP_VERSION)
|
||||
@@ -147,5 +135,5 @@ LICENSE.formatted: $(NMAPDIR)/LICENSE
|
||||
./license-format/licformat.sh "$<" > "$@"
|
||||
|
||||
clean:
|
||||
"$(VCEXPRESS)" nmap.sln /clean
|
||||
rm -rf nmap-$(NMAP_VERSION) nmap-$(NMAP_VERSION)-oem Debug Release Release-oem nmapbuild.log nmap.rc nmap-oem.rc LICENSE.formatted
|
||||
./Build.bat Clean "$(VCCONFIG)${OEM_SUFFIX}"
|
||||
rm -rf nmap-$(NMAP_VERSION) nmap-$(NMAP_VERSION)-oem Debug Release Release-oem msbuild.log LICENSE.formatted
|
||||
|
||||
9
mswin32/make-vars.h
Normal file
9
mswin32/make-vars.h
Normal file
@@ -0,0 +1,9 @@
|
||||
define IGNORE
|
||||
#include "../nmap.h"
|
||||
endef
|
||||
|
||||
#define EXPORT(_var) export $(name)##_var:= $(patsubst "%",%,$(subst " ",,NMAP##_var))
|
||||
|
||||
name = NMAP
|
||||
EXPORT(_VERSION)
|
||||
EXPORT(_NUM_VERSION)
|
||||
@@ -244,8 +244,7 @@
|
||||
</ClCompile>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<ResourceCompile Condition="'$(Configuration)'=='Release-oem'" Include="nmap-oem.rc" />
|
||||
<ResourceCompile Condition="'$(Configuration)'!='Release-oem'" Include="nmap.rc" />
|
||||
<ResourceCompile Include="nmap.rc" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<ClInclude Include="..\charpool.h" />
|
||||
@@ -446,4 +445,4 @@
|
||||
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
|
||||
<ImportGroup Label="ExtensionTargets">
|
||||
</ImportGroup>
|
||||
</Project>
|
||||
</Project>
|
||||
|
||||
Reference in New Issue
Block a user