Debian Codegraph @

src/evc.mak

raw
1 # wce.mak for stunnel.exe by Michal Trojnara 1998-2026
2 # with help of Pierre Delaage <[email protected]>
3 # pdelaage 20140610 : added UNICODE optional FLAG, always ACTIVE on WCE because of poor ANSI support
4 # pdelaage 20140610 : added _WIN32_WCE flag for RC compilation, to preprocess out "HELP" unsupported menu flag on WCE
5 # pdelaage 20140610 : ws2 lib is required to get WSAGetLastError routine (absent from winsock lib)
6 # pdelaage 20140610 : /Dx86 flag required for X86/Emulator targets, to get proper definition for InterlockedExchange
7 # pdelaage 20140610 : /MT flag is NON-SENSE for X86-WCE platforms, it is only meaningful for X86-W32-Desktop.
8 # for X86-WCE targets, although compiler "cl.exe" is REALLY the same as desktop W32 VS6 C++ compiler,
9 # the MT flags relating to LIBCMT is useless BECAUSE LIBCMT does NOT exist on WCE. No msvcrt on WCE either...
10
11 # pdelaage 20140610 : Note on /MC flag
12 # For other targets than X86/Emulator, /MC flag is redundant with "/nodefaultlib coredll.lib corelibc.lib" LD lib list.
13 # For << X86 / Emulator >> target, as the cl.exe compiler IS the SAME as the standard VS6.0 C++ compiler for Desktop Pentium processor,
14 # /MC flag is in fact NOT existing, thus requiring an explicit linking with core libs by using :
15 # /NODEFAULTLIB coredll.lib corelibc.lib,
16 # something that is correct for any WCE target, X86 and other, and leading /MC flag to be useless ALSO for other target than X86.
17
18
19 #
20 # DEFAULTLIB management: only 2 are necessary
21 # defaultlibS, as given for CLxxx in the MS doc, ARE WRONG
22
23 # !!!!!!!!!!!!!!
24 # CUSTOMIZE THIS according to your wcecompat and openssl directories
25 # !!!!!!!!!!!!!!
26
27 # Modify this to point to your actual openssl compile directory
28 # (You did already compile openssl, didn't you???)
29 SSLDIR=C:\Users\pdelaage\Dvts\Contrib\openssl
30
31 # Note that we currently use a multi-target customized version of legacy Essemer/wcecompat lib
32 COMPATDIR=C:\Users\pdelaage\Dvts\Contrib\wcecompat\v12\patched3emu
33
34 WCEVER=420
35
36 # !!!!!!!!!!!!!!!!!!
37 # END CUSTOMIZATION
38 # !!!!!!!!!!!!!!!!!!
39
40 !IF "$(TARGETCPU)"=="X86"
41 WCETARGETCPU=_X86_
42 LDTARGETCPU=X86
43 #pdelaage 20140621 /Dx86 for inline defs of InterlockedExchange inline in winbase.h; no more /MT
44 MORECFLAGS=/Dx86
45
46 # TODO: continue list for other targets : see wcecompat/wcedefs.mak for a good ref.
47 # see also openssl/util/pl/vc-32.pl, also link /?
48 # for LDTARGETCPU: /MACHINE:{AM33|ARM|IA64|M32R|MIPS|MIPS16|MIPSFPU|MIPSFPU16|MIPSR41XX|SH3|SH3DSP|SH4|SH5|THUMB|X86}
49 # see wce/include/winnt.h for other "target architecture" flag
50
51 !ELSEIF "$(TARGETCPU)"=="emulator"
52 WCETARGETCPU=_X86_
53 LDTARGETCPU=X86
54 #pdelaage 20140621 /Dx86 for inline defs of InterlockedExchange inline in winbase.h; no more /MT
55 MORECFLAGS=/Dx86
56
57 !ELSEIF "$(TARGETCPU)"=="MIPS16" || "$(TARGETCPU)"=="MIPSII" || "$(TARGETCPU)"=="MIPSII_FP" || "$(TARGETCPU)"=="MIPSIV" || "$(TARGETCPU)"=="MIPSIV_FP"
58 WCETARGETCPU=_MIPS_
59 LDTARGETCPU=MIPS
60 #pdelaage 20140621 no more /MC required
61 MORECFLAGS=/DMIPS
62
63 !ELSEIF "$(TARGETCPU)"=="SH3" || "$(TARGETCPU)"=="SH4"
64 WCETARGETCPU=SHx
65 LDTARGETCPU=$(TARGETCPU)
66 #pdelaage 20140621 no more /MC required
67 MORECFLAGS=
68
69 !ELSE
70 # default is ARM !
71 # !IF "$(TARGETCPU)"=="ARMV4" || "$(TARGETCPU)"=="ARMV4I" || "$(TARGETCPU)"=="ARMV4T"
72 # the following flag is required by (eg) winnt.h, and is different from targetcpu (armV4)
73 WCETARGETCPU=ARM
74 LDTARGETCPU=ARM
75 #pdelaage 20140621 no more /MC required
76 MORECFLAGS=
77 !ENDIF
78
79 # ceutilsdir probably useless (nb : were tools from essemer; but ms delivers a cecopy anyway, see ms dld site)
80 CEUTILSDIR=..\..\ceutils
81 # "ce:" is not a correct location , but we never "make install"
82 DSTDIR=ce:\stunnel
83 # use MS env vars, as in wcecompat and openssl makefiles
84 SDKDIR=$(SDKROOT)\$(OSVERSION)\$(PLATFORM)
85 INCLUDES=-I$(SSLDIR)\inc32 -I$(COMPATDIR)\include -I"$(SDKDIR)\include\$(TARGETCPU)"
86 # for X86 and other it appears that /MC or /ML flags are absurd,
87 # we always have to override runtime lib list to coredll and corelibc
88 #LIBS=/NODEFAULTLIB winsock.lib wcecompatex.lib libeay32.lib ssleay32.lib coredll.lib corelibc.lib
89 LIBS=/NODEFAULTLIB ws2.lib wcecompatex.lib libeay32.lib ssleay32.lib coredll.lib corelibc.lib
90
91 DEFINES=/DHOST=\"$(TARGETCPU)-WCE-eVC-$(WCEVER)\"
92 # pdelaage 20140610 added unicode flag : ALWAYS ACTIVE on WCE, because of poor ANSI support by the MS SDK
93 UNICODEFLAGS=/DUNICODE -D_UNICODE
94 # /O1 /Oi more correct vs MS doc
95 CFLAGS=/nologo $(MORECFLAGS) /O1 /Oi /W3 /WX /GF /Gy $(DEFINES) /D$(WCETARGETCPU) /D$(TARGETCPU) /DUNDER_CE=$(WCEVER) /D_WIN32_WCE=$(WCEVER) $(UNICODEFLAGS) $(INCLUDES)
96 # pdelaage 20140610 : RC compilation requires D_WIN32_WCE flag to comment out unsupported "HELP" flag in menu definition, in resources.rc file
97 RFLAGS=$(DEFINES) /D_WIN32_WCE=$(WCEVER) $(INCLUDES)
98
99 # LDFLAGS: since openssl >> 098a (eg 098h) out32dll is out32dll_targetCPU for WCE
100 # delaage added $(TARGETCPU) in legacy Essemer/wcecompat libpath
101 # to ease multitarget compilation without recompiling everything
102 # this customized version is available on:
103 # http://delaage.pierre.free.fr/contrib/wcecompat/wcecompat12_patched.zip
104
105 LDFLAGS=/nologo /subsystem:windowsce,3.00 /machine:$(LDTARGETCPU) /libpath:"$(SDKDIR)\lib\$(TARGETCPU)" /libpath:"$(COMPATDIR)\lib\$(TARGETCPU)" /libpath:"$(SSLDIR)\out32dll_$(TARGETCPU)"
106
107 # Multi-target support for stunnel
108
109 SRC=..\src
110 OBJROOT=..\obj
111 OBJ=$(OBJROOT)\$(TARGETCPU)
112 BINROOT=..\bin
113 BIN=$(BINROOT)\$(TARGETCPU)
114
115 OBJS=$(OBJ)\stunnel.obj $(OBJ)\ssl.obj $(OBJ)\ctx.obj $(OBJ)\verify.obj \
116 $(OBJ)\file.obj $(OBJ)\client.obj $(OBJ)\protocol.obj $(OBJ)\sthreads.obj \
117 $(OBJ)\log.obj $(OBJ)\options.obj $(OBJ)\network.obj $(OBJ)\resolver.obj \
118 $(OBJ)\str.obj $(OBJ)\tls.obj $(OBJ)\fd.obj $(OBJ)\dhparam.obj \
119 $(OBJ)\ocsp.obj $(OBJ)\cron.obj
120
121 GUIOBJS=$(OBJ)\ui_win_gui.obj $(OBJ)\resources.res
122 CLIOBJS=$(OBJ)\ui_win_cli.obj
123
124 {$(SRC)\}.c{$(OBJ)\}.obj:
125 $(CC) $(CFLAGS) -Fo$@ -c $<
126
127 {$(SRC)\}.cpp{$(OBJ)\}.obj:
128 $(CC) $(CFLAGS) -Fo$@ -c $<
129
130 {$(SRC)\}.rc{$(OBJ)\}.res:
131 $(RC) $(RFLAGS) -fo$@ -r $<
132
133 all: makedirs $(BIN)\stunnel.exe $(BIN)\tstunnel.exe
134
135 makedirs:
136 -@ IF NOT EXIST $(OBJROOT) mkdir $(OBJROOT) >NUL 2>&1
137 -@ IF NOT EXIST $(OBJ) mkdir $(OBJ) >NUL 2>&1
138 -@ IF NOT EXIST $(BINROOT) mkdir $(BINROOT) >NUL 2>&1
139 -@ IF NOT EXIST $(BIN) mkdir $(BIN) >NUL 2>&1
140
141 $(BIN)\stunnel.exe:$(OBJS) $(GUIOBJS)
142 link $(LDFLAGS) /out:$(BIN)\stunnel.exe $(LIBS) commctrl.lib $**
143
144 $(BIN)\tstunnel.exe:$(OBJS) $(CLIOBJS)
145 link $(LDFLAGS) /out:$(BIN)\tstunnel.exe $(LIBS) $**
146
147 $(OBJ)\resources.res: $(SRC)\resources.rc $(SRC)\resources.h $(SRC)\version.h
148 $(OBJ)\ui_win_gui.obj: $(SRC)\ui_win_gui.c $(SRC)\version.h
149 $(OBJ)\stunnel.obj: $(SRC)\stunnel.c $(SRC)\version.h
150
151 # now list of openssl dll has more files,
152 # but we do not use "make install" for stunnel
153 # ceutils come from essemer/wcecompat website
154 # some tools can be found at MS website
155 # TODO: update all this ceutils stuff, or suppress it
156
157 install: stunnel.exe tstunnel.exe
158 $(CEUTILSDIR)\cemkdir $(DSTDIR) || echo Directory exists?
159 $(CEUTILSDIR)\cecopy stunnel.exe $(DSTDIR)
160 $(CEUTILSDIR)\cecopy tstunnel.exe $(DSTDIR)
161 $(CEUTILSDIR)\cecopy $(SSLDIR)\out32dll_$(TARGETCPU)\libeay32.dll $(DSTDIR)
162 $(CEUTILSDIR)\cecopy $(SSLDIR)\out32dll_$(TARGETCPU)\ssleay32.dll $(DSTDIR)
163
164 clean:
165 -@ IF NOT "$(TARGETCPU)"=="" del $(OBJS) $(GUIOBJS) $(CLIOBJS) $(BIN)\stunnel.exe $(BIN)\tstunnel.exe >NUL 2>&1
166 -@ IF NOT "$(TARGETCPU)"=="" rmdir $(OBJ) >NUL 2>&1
167 -@ IF NOT "$(TARGETCPU)"=="" rmdir $(BIN) >NUL 2>&1