aboutsummaryrefslogtreecommitdiffstats
path: root/packaging/u3/win32/Makefile.nmake
blob: 4a9cf085446cc6732abfac99e3867ce70a2d5d20 (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
135
136
137
#
# $Id$
#

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

CC 	= cl
LINK	= link

LDFLAGS = /NOLOGO /INCREMENTAL:no /MACHINE:I386 /ENTRY:mainCRTStartup $(LOCAL_LDFLAGS)

DEVICE 	= device
HOST 	= host
MANIFEST= manifest
DATA	= data

WSMANIFEST	= ../../wireshark.manifest

TOPDIR	= ..\..\..
TOOLSDIR= ..\tools
COPY	= xcopy
MKDIR	= mkdir
COPY_FLAGS	= /d /y

!undef UPX
UPX_FLAGS = -q

U3_VERSION=$(VERSION_MAJOR).$(VERSION_MINOR).$(VERSION_MICRO)

all:	package


uuid.sed: $(TOPDIR)\config.nmake
	cd $(TOOLSDIR)
	$(MAKE) /$(MAKEFLAGS) -f Makefile.nmake
	cd ..\win32
	$(TOOLSDIR)\utest.exe "$(VERSION)" > $@

manifest.u3i:	manifest.tmpl uuid.sed
	sed -e 's/$$(U3_VERSION)/$(U3_VERSION)/g' \
	    -e 's/$$(VERSION)/$(VERSION)/g' \
#ifdef UPX
	    -e 's/$$(SIZE)/50/g' \
#else
	    -e 's/$$(SIZE)/65/g' \
#endif
	    -f  uuid.sed < manifest.tmpl > manifest.u3i

u3-dirs:
	if not exist $(HOST) $(MKDIR) $(HOST)
	if not exist $(DEVICE) $(MKDIR) $(DEVICE)
	if not exist $(DATA) $(MKDIR) $(DATA)
	if not exist $(DATA)\"My Captures" $(MKDIR) $(DATA)\"My Captures"
	if not exist $(MANIFEST) $(MKDIR) $(MANIFEST)

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

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

distribution.nmake:	makenmake.pl $(WSMANIFEST) ../../ws-manifest.pl
	$(PERL) makenmake.pl $(WSMANIFEST) > $@	

distribution: u3-dirs manifest.u3i u3util.exe nsis-bits wireshark.bat distribution.nmake
# manifest
	$(COPY) manifest.u3i $(MANIFEST) $(COPY_FLAGS)
	$(COPY) $(TOPDIR)\image\wireshark.ico $(MANIFEST) $(COPY_FLAGS)
	$(COPY) u3util.exe $(HOST) $(COPY_FLAGS)
	$(MAKE) /$(MAKEFLAGS) -f distribution.nmake 

verify-tools:	
!IFDEF UPX
	@if not exist $(UPX) echo Error: $(UPX) not found. &&\
echo Either: &&\
echo a) run 'nmake -f Makefile.nmake setup' at the toplevel; or &&\
echo b) comment out UPX in config.nmake at the top level, to build without compressing the dlls and exes \
&& exit 2
!endif

pack:	distribution
!IFDEF UPX
	-$(UPX) $(UPX_FLAGS) $(DEVICE)\plugins\$(VERSION)\*.dll
	-$(UPX) $(UPX_FLAGS) $(HOST)\*.dll
	-$(UPX) $(UPX_FLAGS) $(HOST)\lib\gtk-2.0\$(GTK_LIB_DIR)\loaders\*.dll
	-$(UPX) $(UPX_FLAGS) $(HOST)\lib\gtk-2.0\$(GTK_LIB_DIR)\engines\*.dll
	-$(UPX) $(UPX_FLAGS) $(HOST)\$(GTK_WIMP_DLLDST_DIR)\*.dll
	-$(UPX) $(UPX_FLAGS) $(HOST)\*.exe	
!ENDIF

test:		pack
	wireshark.bat -D

package:	verify-tools test
	zip -r Wireshark-$(VERSION).u3p $(MANIFEST) $(DEVICE) $(DATA) $(HOST) wireshark.bat

CFLAGS	= -DWINPCAP_PACKAGE="\"\\\\WinPcap_$(PCAP_VERSION).exe\""

u3util_LIBS= user32.lib shell32.lib

u3util.exe:	u3util.obj ../../../config.nmake
	@echo Linking $@
	$(LINK) @<<
		/OUT:u3util.exe $(guiflags) $(LDFLAGS) u3util.obj $(u3util_LIBS) $(guilibsdll)
<<
!IFDEF MANIFEST_INFO_REQUIRED
	mt.exe -nologo -manifest "u3util.exe.manifest" -outputresource:u3util.exe;1
!ENDIF

clean:
	cd ../tools
	$(MAKE) -f Makefile.nmake $@
	cd ../win32
	cd ../../
	$(MAKE) -f Makefile.nmake $@
	cd u3/win32
	rm -rf manifest.u3i
	rm -rf uuid.sed
	rm -rf nodeid state
	rm -rf $(HOST)
	rm -rf $(DEVICE)
	rm -rf $(DATA)
	rm -rf $(MANIFEST)
	rm -rf u3util.{exe,obj,pdb}
	rm -rf wireshark-$(VERSION).u3p
	rm -rf distribution.nmake
	rm -rf *~ *.*~

distclean:	clean
	rm -rf wireshark*.u3p

maintainer-clean:	distclean