1
- MAKENSIS ="/cygdrive/c/Program Files/NSIS/makensis.exe"
1
+ MAKENSIS ="/cygdrive/c/Program Files (x86) /NSIS/makensis.exe"
2
2
# VCExpress.exe is devenv.com with the commercial Visual Studio suite instead of VC++ Express
3
3
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')
4
4
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% ')
@@ -7,44 +7,58 @@ export NMAP_NUM_VERSION := $(shell grep '^\#[ \t]*define[ \t]\+NMAP_NUM_VERSION'
7
7
export NPCAP_VERSION := $(shell ls npcap-* .exe | sed -e 's/npcap-\([-r0-9.]* \) \.exe/\1/' -e 'q')
8
8
COMMA_VERSION =$(shell echo $(NMAP_NUM_VERSION ) | tr '.' ',')
9
9
LOGLOC =c:nmapbuild.log
10
- NSE_FILES = scripts/script.db scripts/*.nse
10
+ NSE_FILES = ../ scripts/script.db ../ scripts/*.nse
11
11
NMAP_MSWIN32_AUX = ../../nmap-mswin32-aux
12
12
SIGNTOOL_ARGS = sign /a /n "Insecure.Com LLC" /tr http://timestamp.digicert.com /td sha256 /fd sha256
13
13
# escape quotes for NSIS
14
14
# escape for right side of sed regex replace
15
15
SIGNTOOL_SUBST = $(shell echo '"$(SIGNTOOL ) " $(SIGNTOOL_ARGS ) ' | sed -e 's/"/$$\\"/g' -e 's/[\/&]/\\&/g' )
16
16
17
+ PRODUCT_NAME =Nmap
18
+ PLATFORM =Win32
19
+ BASE_CONFIG =Release
20
+ VCCONFIG =$(BASE_CONFIG )
21
+ NSIS_DEFINES =
22
+ ifdef NMAP_OEM
23
+ PRODUCT_NAME =Nmap OEM
24
+ OEM_SUFFIX =-oem
25
+ VCCONFIG =$(BASE_CONFIG ) OEM
26
+ NSIS_DEFINES="/DNMAP_OEM =1"
27
+ endif
28
+
17
29
bundle-nmap : bundle-zip bundle-nsis
18
30
19
31
build-nmap : nmap.sln nmap.rc
20
- " $( VCEXPRESS) " nmap.sln /build release /out $(LOGLOC )
32
+ " $( VCEXPRESS) " nmap.sln /build " $( VCCONFIG ) | $( PLATFORM ) " /out $(LOGLOC )
21
33
# "$(VCEXPRESS)" nmap.sln /build release /project nmap-update /out $(LOGLOC)
22
34
23
35
stage-nmap : build-nmap LICENSE
24
36
rm -rf nmap-$(NMAP_VERSION )
25
37
mkdir nmap-$(NMAP_VERSION )
26
- cd Release && cp -r ../../ CHANGELOG ../../COPYING nmap-mac-prefixes nmap-os-db nmap-payloads nmap-protocols nmap-rpc nmap-service-probes nmap-services nmap.exe nmap.xsl nse_main.lua ../ nmap_performance.reg ../../ README-WIN32 ../../ docs/3rd-party-licenses.txt ../ nmap-$(NMAP_VERSION ) /
38
+ cp ../CHANGELOG ../COPYING ../nmap-mac-prefixes ../ nmap-os-db ../ nmap-payloads ../ nmap-protocols ../ nmap-rpc ../ nmap-service-probes ../ nmap-services $( VCCONFIG ) / nmap.exe ../docs/ nmap.xsl ../ nse_main.lua nmap_performance.reg ../README-WIN32 ../docs/3rd-party-licenses.txt nmap-$(NMAP_VERSION ) /
27
39
# Use "cmd /c copy" rather than "cp" to preserve Windows ACLs. Using
28
40
# "cp" means that the copied DLLs don't have the same ACL and cause an
29
41
# error on startup: 0xc0000022.
30
42
cmd /c copy $(subst /,\\,$(NMAP_MSWIN32_AUX))\\OpenSSL\\bin\\*.dll nmap-$(NMAP_VERSION)
31
- cmd /c copy Release\\libssh2.dll Release\\zlibwapi.dll nmap-$(NMAP_VERSION)
43
+ cmd /c copy ..\\libssh2\\win32\\$(BASE_CONFIG)_dll\\libssh2.dll nmap-$(NMAP_VERSION)
44
+ cmd /c copy ..\\libz\\contrib\\vstudio\\vc12\\x86\\ZlibDll$(BASE_CONFIG)\\zlibwapi.dll nmap-$(NMAP_VERSION)
32
45
mkdir nmap-$(NMAP_VERSION)/scripts
33
- cd Release && cp -f $(NSE_FILES) ../ nmap-$(NMAP_VERSION)/scripts/
34
- cd Release && for f in `find nselib -name .svn -prune -o -type d -print`; do \
35
- mkdir -p ../ nmap-$(NMAP_VERSION)/$$f; \
46
+ cp -f $(NSE_FILES) nmap-$(NMAP_VERSION)/scripts/
47
+ for f in `cd .. && find nselib -name .svn -prune -o -type d -print`; do \
48
+ mkdir -p nmap-$(NMAP_VERSION)/$$f; \
36
49
done
37
- cd Release && for f in `find nselib -name .svn -prune -o -type f -print`; do \
38
- cp -f $$f ../ nmap-$(NMAP_VERSION)/$$f; \
50
+ for f in `cd .. && find nselib -name .svn -prune -o -type f -print`; do \
51
+ cp -f ../ $$f nmap-$(NMAP_VERSION)/$$f; \
39
52
done
40
- cd Release && cp -r ../../ docs/licenses ../ nmap-$(NMAP_VERSION)/
53
+ cp -r ../docs/licenses nmap-$(NMAP_VERSION)/
41
54
rm -rf nmap-$(NMAP_VERSION)/licenses/.svn
42
- cp npcap-$(NPCAP_VERSION).exe nmap-$(NMAP_VERSION)
55
+ # TODO: change "-oem" to "$(OEM_SUFFIX)" when Npcap OEM is no longer needed for standard Nmap.
56
+ cp npcap-$(NPCAP_VERSION)-oem.exe nmap-$(NMAP_VERSION)
43
57
cp $(NMAP_MSWIN32_AUX)/vcredist_x86.exe nmap-$(NMAP_VERSION)
44
58
cp $(NMAP_MSWIN32_AUX)/vcredist2008_x86.exe nmap-$(NMAP_VERSION)
45
- cp ../ncat/Release /ncat.exe nmap-$(NMAP_VERSION)
46
- cp ../ncat/Release /ca-bundle.crt nmap-$(NMAP_VERSION)
47
- cp ../nping/Release /nping.exe nmap-$(NMAP_VERSION)
59
+ cp ../ncat/$(BASE_CONFIG) /ncat.exe nmap-$(NMAP_VERSION)
60
+ cp ../ncat/$(BASE_CONFIG) /ca-bundle.crt nmap-$(NMAP_VERSION)
61
+ cp ../nping/$(BASE_CONFIG) /nping.exe nmap-$(NMAP_VERSION)
48
62
# cp ../nmap-update/Release/nmap-update.exe nmap-$(NMAP_VERSION)
49
63
# Install the ndiff batch file wrapper in the zip distribution.
50
64
cp ../ndiff/ndiff.py nmap-$(NMAP_VERSION)/ndiff.py
@@ -61,25 +75,27 @@ sign-files: nmap-$(NMAP_VERSION)/nmap.exe nmap-$(NMAP_VERSION)/ncat.exe nmap-$(N
61
75
62
76
bundle-nsis : nsis/Nmap.nsi sign-files
63
77
cp nsis/AddToPath.nsh nsis/Nmap.nsi nsis/shortcuts.ini nsis/final.ini nmap-$(NMAP_VERSION )
64
- $(MAKENSIS ) nmap-$(NMAP_VERSION ) /Nmap.nsi
65
- mv nmap-$(NMAP_VERSION ) /NmapInstaller.exe nmap-$(NMAP_VERSION ) -setup.exe
66
- " $( SIGNTOOL) " $(SIGNTOOL_ARGS ) nmap-$(NMAP_VERSION ) -setup.exe
78
+ $(MAKENSIS ) " /XOutFile nmap- $( NMAP_VERSION ) $( OEM_SUFFIX ) -setup.exe " $( NSIS_DEFINES ) nmap-$(NMAP_VERSION ) /Nmap.nsi
79
+ mv nmap-$(NMAP_VERSION ) /nmap-$(NMAP_VERSION )$( OEM_SUFFIX ) -setup.exe .
80
+ " $( SIGNTOOL) " $(SIGNTOOL_ARGS ) nmap-$(NMAP_VERSION )$( OEM_SUFFIX ) -setup.exe
67
81
68
82
bundle-zip : sign-files
69
- rm -f nmap-$(NMAP_VERSION ) -win32.zip
83
+ rm -f nmap-$(NMAP_VERSION )$( OEM_SUFFIX ) -win32.zip
70
84
zip -x nmap-$(NMAP_VERSION ) /ZENMAP_README nmap-$(NMAP_VERSION ) /zenmap/\* \
71
85
nmap-$(NMAP_VERSION ) /zenmap.exe nmap-$(NMAP_VERSION ) /share/\* \
72
86
nmap-$(NMAP_VERSION ) /python27.dll nmap-$(NMAP_VERSION ) /py2exe/\* \
73
87
nmap-$(NMAP_VERSION ) /COPYING_HIGWIDGETS nmap-$(NMAP_VERSION ) /w9xpopen.exe \
88
+ nmap-$(NMAP_VERSION ) /vcredist2008_x86.exe \
74
89
nmap-$(NMAP_VERSION ) /ndiff.exe nmap-$(NMAP_VERSION ) /\* .ini \
75
90
nmap-$(NMAP_VERSION ) /Uninstall.exe nmap-$(NMAP_VERSION ) /\* .nsi \
76
91
nmap-$(NMAP_VERSION ) /\* .nsh \
77
- -r nmap-$(NMAP_VERSION ) -win32.zip nmap-$(NMAP_VERSION )
92
+ -r nmap-$(NMAP_VERSION )$( OEM_SUFFIX ) -win32.zip nmap-$(NMAP_VERSION )
78
93
79
94
nmap.rc : nmap.rc.in ../nmap.h
80
95
sed -e ' 1i// Automatically generated from $<.' \
81
96
-e ' s/@@FILEVERSION@@/"$(NMAP_VERSION)\\0"/' \
82
97
-e ' s/@@COMMAVERSION@@/$(COMMA_VERSION)/' \
98
+ -e ' s/@@PRODUCT_NAME@@/$(PRODUCT_NAME)/' \
83
99
" $<" > " $@ "
84
100
85
101
nsis/Nmap.nsi : nsis/Nmap.nsi.in ../nmap.h
@@ -89,11 +105,13 @@ nsis/Nmap.nsi: nsis/Nmap.nsi.in ../nmap.h
89
105
-e ' s/@@VERSION@@/"$(NMAP_VERSION)"/' \
90
106
-e ' s/@@NPCAP_VERSION@@/$(NPCAP_VERSION)/' \
91
107
-e ' s/@@SIGNTOOL@@/$(SIGNTOOL_SUBST)/' \
108
+ -e ' s/@@OEM_SUFFIX@@/$(OEM_SUFFIX)/' \
109
+ -e ' s/@@PRODUCT_NAME@@/$(PRODUCT_NAME)/' \
92
110
" $<" > " $@ "
93
111
94
112
LICENSE : ../COPYING
95
113
./license-format/licformat.sh " $<" > " $@ "
96
114
97
115
clean :
98
116
" $( VCEXPRESS) " nmap.sln /clean
99
- rm -rf Debug Release nmapbuild.log nmap.rc nsis/Nmap.nsi LICENSE
117
+ rm -rf Debug Release ReleaseOEM nmapbuild.log nmap.rc nsis/Nmap.nsi LICENSE
0 commit comments