aboutsummaryrefslogtreecommitdiffstats
path: root/packaging/portableapps/win32/Makefile.nmake
blob: 0bc838d20ebd91d092a5bbfd0fdfdcb3dfdef14e (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
#
# $Id$
#

include ../../../config.nmake
include <win32.mak>

FILES 		= Files
APP 		= App
DATA		= Data
OTHER		= Other
APPINFO		= AppInfo
WIRESHARK 	= Wireshark
SOURCE		= WiresharkPortableSource

WSMANIFEST	= ../../wireshark.manifest

NSIS_PLUGINS	= nsis-plugins
FINDPROCDLL	= $(WIRESHARK_LIBS)\$(NSIS_PLUGINS)\FindProcDLL.dll

TOPDIR		= ..\..\..
U3DIST		= ..\..\u3\win32
COPY		= xcopy
MKDIR		= mkdir
COPY_FLAGS	= /d /y
!IFNDEF WIN32_SETUP_OPT
WIN32_SETUP_OPT=--download
!ENDIF

UPX_FLAGS = -q

PAPPS_VERSION=$(VERSION_MAJOR).$(VERSION_MINOR).$(VERSION_MICRO).0

all:	package

package:	WiresharkPortable-$(VERSION).paf.exe

dirs:
	if not exist $(FILES) $(MKDIR) $(FILES)
	if not exist $(FILES)\$(APP) $(MKDIR) $(FILES)\$(APP)
	if not exist $(FILES)\$(APP)\$(APPINFO) $(MKDIR) $(FILES)\$(APP)\$(APPINFO)
	if not exist $(FILES)\$(APP)\$(WIRESHARK) $(MKDIR) $(FILES)\$(APP)\$(WIRESHARK)
	if not exist $(FILES)\$(DATA) $(MKDIR) $(FILES)\$(DATA)
	if not exist $(FILES)\$(OTHER) $(MKDIR) $(FILES)\$(OTHER)
	if not exist $(FILES)\$(OTHER)\$(SOURCE) $(MKDIR) $(FILES)\$(OTHER)\$(SOURCE)

nsis-bits:
	cd ../../nsis
	$(MAKE) /$(MAKEFLAGS) -f Makefile.nmake user-guide.chm
	cd ../portableapps/win32

$(WSMANIFEST):
	cd ../..
	$(MAKE) /$(MAKEFLAGS) -f makefile.nmake wireshark.manifest
	cd portableapps/win32

distribution.nmake:	$(WSMANIFEST) makenmake.pl
	$(PERL) makenmake.pl $(WSMANIFEST) > $@

distribution:	distribution.nmake
	nmake -f distribution.nmake

pack:	distribution
!IFDEF UPX
	-$(UPX) $(UPX_FLAGS) $(FILES)\$(APP)\$(WIRESHARK)\[a-z]*.exe
	-$(UPX) $(UPX_FLAGS) $(FILES)\$(APP)\$(WIRESHARK)\*.dll
	-$(UPX) $(UPX_FLAGS) $(FILES)\$(APP)\$(WIRESHARK)\plugins\$(VERSION)\*.dll
	-$(UPX) $(UPX_FLAGS) $(FILES)\$(APP)\$(WIRESHARK)\lib\gtk-2.0\$(GTK_LIB_DIR)\loaders\*.dll
	-$(UPX) $(UPX_FLAGS) $(FILES)\$(APP)\$(WIRESHARK)\lib\gtk-2.0\$(GTK_LIB_DIR)\immodules\*.dll
	-$(UPX) $(UPX_FLAGS) $(FILES)\$(APP)\$(WIRESHARK)\$(GTK_WIMP_DLLDST_DIR)\*.dll
!ENDIF


appinfo.ini: appinfo.tmpl $(TOPDIR)\config.nmake
	sed -e 's/$$(PAPPS_VERSION)/$(PAPPS_VERSION)/g' \
            -e 's/$$(VERSION_MAJOR)/$(VERSION_MAJOR)/g' \
            -e 's/$$(VERSION_MINOR)/$(VERSION_MINOR)/g' \
	< appinfo.tmpl > appinfo.ini

WiresharkPortable.ini: WiresharkPortable.tmpl $(TOPDIR)\config.nmake
	sed -e 's/$$(PCAP_VERSION)/$(PCAP_VERSION)/g' \
            -e 's/$$(TARGET_MACHINE)/$(TARGET_MACHINE)/g' \
	< WiresharkPortable.tmpl > WiresharkPortable.ini

appinfo: appinfo.ini
	$(COPY) appinfo.ini $(FILES)\$(APP)\$(APPINFO) $(COPY_FLAGS)
	$(COPY) installer.ini $(FILES)\$(APP)\$(APPINFO) $(COPY_FLAGS)
	copy $(TOPDIR)\image\wireshark.ico $(FILES)\$(APP)\$(APPINFO)\appicon.ico /y
	copy $(TOPDIR)\image\wsicon16.png $(FILES)\$(APP)\$(APPINFO)\appicon_16.png /y
	copy $(TOPDIR)\image\wsicon32.png $(FILES)\$(APP)\$(APPINFO)\appicon_32.png /y

source:  WiresharkPortable.ini
	$(COPY) WiresharkPortable.ini $(FILES)\$(OTHER)\$(SOURCE) $(COPY_FLAGS)
	$(COPY) readme.txt $(FILES)\$(OTHER)\$(SOURCE) $(COPY_FLAGS)
	$(COPY) WiresharkPortable.nsi $(FILES)\$(OTHER)\$(SOURCE) $(COPY_FLAGS)
	$(COPY) Installer.nsi $(FILES)\$(OTHER)\$(SOURCE) $(COPY_FLAGS)

findprocdll:
	if not exist $(FINDPROCDLL) \
	@$(SH) ../../../tools/win32-setup.sh "$(WIN32_SETUP_OPT)" "$(WIRESHARK_LIBS)" \
		$(NSIS_PLUGINS) FindProc.zip


WiresharkPortable-$(VERSION).paf.exe : dirs appinfo nsis-bits pack source Files/WiresharkPortable.exe Installer.nsi
	$(MAKENSIS) \
	/DVERSION=$(PAPPS_VERSION) \
	/DWSVERSION=$(VERSION) \
	/DEXTRA_PLUGINS="$(WIRESHARK_LIBS)\$(NSIS_PLUGINS)" \
	Installer.nsi

Files/WiresharkPortable.exe : WiresharkPortable.nsi findprocdll
	$(MAKENSIS) \
	/DVERSION=$(PAPPS_VERSION) \
	/DWSVERSION=$(VERSION) \
	/DEXTRA_PLUGINS="$(WIRESHARK_LIBS)\$(NSIS_PLUGINS)" \
	/DDEFAULTWINPCAP=WinPcap_$(PCAP_VERSION).exe \
	/DDEFAULTMSVCREDIST=vcredist_$(TARGET_MACHINE).exe \
	WiresharkPortable.nsi

clean:
	cd ../../
	$(MAKE) -f makefile.nmake $@
	cd portableapps/win32
	rm -rf $(FILES)
	rm -rf appinfo.ini
	rm -rf WiresharkPortable.ini
	rm -rf distribution.nmake
	rm -rf WiresharkPortable-$(VERSION).paf.exe
   	rm -rf *~ *.*~

distclean:	clean
	rm -rf WiresharkPortable-*.paf.exe

maintainer-clean:	distclean