add missing mt.exe calls, to include manifest files into exe / dll files
[obnox/wireshark/wip.git] / packaging / u3 / win32 / makefile.nmake
1 #
2 # $Id$
3 #
4
5 include ../../../config.nmake
6 include <win32.mak>
7
8 CC      = cl
9 LINK    = link
10
11 LDFLAGS = /NOLOGO /INCREMENTAL:no /MACHINE:I386 /ENTRY:mainCRTStartup $(LOCAL_LDFLAGS)
12
13 DEVICE  = device
14 HOST    = host
15 MANIFEST= manifest
16 DATA    = data
17
18 WSMANIFEST      = ../../wireshark.manifest
19
20 TOPDIR  = ..\..\..
21 TOOLSDIR= ..\tools
22 COPY    = xcopy
23 MKDIR   = mkdir
24 COPY_FLAGS      = /d /y
25
26 UPX_FLAGS = -q
27
28 U3_VERSION=$(VERSION_MAJOR).$(VERSION_MINOR).$(VERSION_MICRO)
29
30 all:    package
31
32
33 uuid.sed: $(TOPDIR)\config.nmake
34         cd $(TOOLSDIR)
35         $(MAKE) /$(MAKEFLAGS) -f makefile.nmake
36         cd ..\win32
37         $(TOOLSDIR)\utest.exe "$(VERSION)" > $@
38
39 manifest.u3i:   manifest.tmpl uuid.sed
40         sed -e 's/$$(U3_VERSION)/$(U3_VERSION)/g' \
41             -e 's/$$(VERSION)/$(VERSION)/g' \
42 #ifdef UPX
43             -e 's/$$(SIZE)/50/g' \
44 #else
45             -e 's/$$(SIZE)/65/g' \
46 #endif
47             -f  uuid.sed < manifest.tmpl > manifest.u3i
48
49 u3-dirs:
50         if not exist $(HOST) $(MKDIR) $(HOST)
51         if not exist $(DEVICE) $(MKDIR) $(DEVICE)
52         if not exist $(DATA) $(MKDIR) $(DATA)
53         if not exist $(DATA)\"My Captures" $(MKDIR) $(DATA)\"My Captures"
54         if not exist $(MANIFEST) $(MKDIR) $(MANIFEST)
55
56 nsis-bits:
57         cd ../../nsis
58         $(MAKE) /$(MAKEFLAGS) -f Makefile.nmake user-guide.chm NEWS.txt
59         cd ../u3/win32
60
61 $(WSMANIFEST):
62         cd ../..
63         $(MAKE) /$(MAKEFLAGS) -f makefile.nmake wireshark.manifest
64         cd u3/win32
65
66 distribution.nmake:     $(WSMANIFEST)  makenmake.pl
67         $(PERL) makenmake.pl $(WSMANIFEST) > $@ 
68
69 distribution: u3-dirs manifest.u3i u3util.exe nsis-bits wireshark.bat distribution.nmake
70 # manifest
71         $(COPY) manifest.u3i $(MANIFEST) $(COPY_FLAGS)
72         $(COPY) $(TOPDIR)\image\wireshark.ico $(MANIFEST) $(COPY_FLAGS)
73         $(COPY) u3util.exe $(HOST) $(COPY_FLAGS)
74         $(MAKE) /$(MAKEFLAGS) -f distribution.nmake 
75
76 verify-tools:   
77 !IFDEF UPX
78         @if not exist $(UPX) echo Error: $(UPX) not found. &&\
79 echo Either: &&\
80 echo a) run 'nmake -f makefile.nmake setup' at the toplevel; or &&\
81 echo b) comment out UPX in config.nmake at the top level, to build without compressing the dlls and exes \
82 && exit 2
83 !endif
84
85 pack:   distribution
86 !IFDEF UPX
87         -$(UPX) $(UPX_FLAGS) $(DEVICE)\plugins\$(VERSION)\*.dll
88         -$(UPX) $(UPX_FLAGS) $(HOST)\*.dll
89         -$(UPX) $(UPX_FLAGS) $(HOST)\lib\gtk-2.0\$(GTK_LIB_DIR)\loaders\*.dll
90         -$(UPX) $(UPX_FLAGS) $(HOST)\lib\gtk-2.0\$(GTK_LIB_DIR)\immodules\*.dll
91         -$(UPX) $(UPX_FLAGS) $(HOST)\$(GTK_WIMP_DLLDST_DIR)\*.dll
92         -$(UPX) $(UPX_FLAGS) $(HOST)\[a-z]*.exe 
93 !ENDIF
94
95 test:           pack
96         wireshark.bat -D
97
98 package:        verify-tools test
99         zip -r wireshark-$(VERSION).u3p $(MANIFEST) $(DEVICE) $(DATA) $(HOST) wireshark.bat
100
101
102
103 u3util_LIBS= user32.lib shell32.lib
104
105 u3util.exe:     u3util.obj
106         @echo Linking $@
107         $(LINK) /OUT:u3util.exe $(guiflags) $(LDFLAGS) u3util.obj $(u3util_LIBS) $(guilibsdll)
108 !IF $(MSC_VER_REQUIRED) >= 1400
109         mt.exe -nologo -manifest "u3util.exe.manifest" -outputresource:u3util.exe;1
110 !ENDIF
111
112 clean:
113         cd ../tools
114         $(MAKE) -f makefile.nmake $@
115         cd ../win32
116         cd ../../
117         $(MAKE) -f makefile.nmake $@
118         cd u3/win32
119         rm -rf manifest.u3i
120         rm -rf uuid.sed
121         rm -rf nodeid state
122         rm -rf $(HOST)
123         rm -rf $(DEVICE)
124         rm -rf $(DATA)
125         rm -rf $(MANIFEST)
126         rm -rf u3util.{exe,obj,pdb}
127         rm -rf wireshark*.u3p
128         rm -rf distribution.nmake
129         rm -rf *~ *.*~
130
131 distclean:      clean
132
133 maintainer-clean:       distclean