2010-11-15 Marcus Brinkmann <mb@g10code.com>
[gpgme.git] / contrib / conf-w32ce-msc / build.mk
1 # build.mk - Makefile to build libgpg-error using Visual-C
2 # Copyright 2010 g10 Code GmbH
3 #
4 # This file is free software; as a special exception the author gives
5 # unlimited permission to copy and/or distribute it, with or without
6 # modifications, as long as this notice is preserved.
7 #
8 # This file is distributed in the hope that it will be useful, but
9 # WITHOUT ANY WARRANTY, to the extent permitted by law; without even the
10 # implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
11
12 # This is a helper make script to build libgpg-error for WindowsCE
13 # using the Microsoft Visual C compiler.  
14
15 targetdir = /home/smb/xppro-gnu/src/gpgme/src
16 # The target build directory where we run the Visual C compiler/ This
17 # needs to be an absolute directory name.  Further we expect this
18 # structure of the tree:
19
20 #   TARGET/src - Source directories:  One directory for each project
21 #         /bin - Installed DLLs
22 #         /lib - Installed import libs.
23 #         /include - Instaled header files.
24
25 targetdir = /home/smb/xppro-gnu
26 targetsrc = $(targetdir)/src
27
28 # Install directories (relative)
29 bindir = ../../../bin
30 libdir = ../../../lib
31 incdir = ../../../include
32
33
34 help:
35         @echo "Run "
36         @echo "  make -f ../contrib/conf-w32ce-msc/build.mk copy-source"
37         @echo "on the POSIX system and then"
38         @echo "  nmake -f build.mk all"
39         @echo "  nmake -f build.mk install"
40         @echo "on the Windows system"
41
42 ce_defines = -DWINCE -D_WIN32_WCE=0x502 -DUNDER_CE \
43              -DWIN32_PLATFORM_PSPC -D_UNICODE -DUNICODE \
44              -D_CONSOLE -DARM -D_ARM_
45 #-D_DEBUG -DDEBUG 
46
47 CFLAGS = -nologo -W3 -fp:fast -Os $(ce_defines) \
48          -DHAVE_CONFIG_H -DDLL_EXPORT -D_CRT_SECURE_NO_WARNINGS \
49          -I. -I$(incdir) -I$(incdir)/gpg-extra
50
51 LDFLAGS =
52
53 # Standard source files
54 sources = \
55         assuan-support.c    \
56         ath-pth.c           \
57         ath-pthread.c       \
58         ath.c               \
59         ath.h               \
60         context.h           \
61         conversion.c        \
62         data-compat.c       \
63         data-fd.c           \
64         data-mem.c          \
65         data-stream.c       \
66         data-user.c         \
67         data.c              \
68         data.h              \
69         debug.c             \
70         debug.h             \
71         decrypt-verify.c    \
72         decrypt.c           \
73         delete.c            \
74         dirinfo.c           \
75         edit.c              \
76         encrypt-sign.c      \
77         encrypt.c           \
78         engine-assuan.c     \
79         engine-backend.h    \
80         engine-g13.c        \
81         engine-gpg.c        \
82         engine-gpgconf.c    \
83         engine-gpgsm.c      \
84         engine-uiserver.c   \
85         engine.c            \
86         engine.h            \
87         error.c             \
88         export.c            \
89         funopen.c           \
90         genkey.c            \
91         get-env.c           \
92         getauditlog.c       \
93         gpgconf.c           \
94         gpgme-tool.c        \
95         gpgme-w32spawn.c    \
96         gpgme.c             \
97         import.c            \
98         isascii.c           \
99         kdpipeiodevice.h    \
100         key.c               \
101         keylist.c           \
102         memrchr.c           \
103         op-support.c        \
104         opassuan.c          \
105         ops.h               \
106         passphrase.c        \
107         passwd.c            \
108         priv-io.h           \
109         progress.c          \
110         putc_unlocked.c     \
111         sema.h              \
112         setenv.c            \
113         sig-notation.c      \
114         sign.c              \
115         signers.c           \
116         stpcpy.c            \
117         trust-item.c        \
118         trustlist.c         \
119         ttyname_r.c         \
120         util.h              \
121         vasprintf.c         \
122         verify.c            \
123         version.c           \
124         vfs-create.c        \
125         vfs-mount.c         \
126         w32-ce.c            \
127         w32-ce.h            \
128         w32-glib-io.c       \
129         w32-io.c            \
130         w32-sema.c          \
131         w32-util.c          \
132         wait-global.c       \
133         wait-private.c      \
134         wait-user.c         \
135         wait.c              \
136         wait.h              \
137         gpgme.def
138
139 # The object files we need to create from sources.
140 objs = \
141         conversion.obj     \
142         get-env.obj        \
143         data.obj           \
144         data-fd.obj        \
145         data-stream.obj    \
146         data-mem.obj       \
147         data-user.obj      \
148         data-compat.obj    \
149         signers.obj        \
150         sig-notation.obj   \
151         wait.obj           \
152         wait-global.obj    \
153         wait-private.obj   \
154         wait-user.obj      \
155         op-support.obj     \
156         encrypt.obj        \
157         encrypt-sign.obj   \
158         decrypt.obj        \
159         decrypt-verify.obj \
160         verify.obj         \
161         sign.obj           \
162         passphrase.obj     \
163         progress.obj       \
164         key.obj            \
165         keylist.obj        \
166         trust-item.obj     \
167         trustlist.obj      \
168         import.obj         \
169         export.obj         \
170         genkey.obj         \
171         delete.obj         \
172         edit.obj           \
173         getauditlog.obj    \
174         opassuan.obj       \
175         passwd.obj         \
176         engine.obj         \
177         engine-gpg.obj     \
178         engine-gpgsm.obj     \
179         assuan-support.obj   \
180         engine-assuan.obj    \
181         engine-gpgconf.obj   \
182         engine-g13.obj     \
183         vfs-mount.obj      \
184         vfs-create.obj     \
185         gpgconf.obj        \
186         w32-ce.obj         \
187         w32-util.obj       \
188         w32-sema.obj       \
189         w32-io.obj         \
190         dirinfo.obj        \
191         debug.obj          \
192         gpgme.obj          \
193         version.obj        \
194         error.obj          \
195         ath.obj            \
196         vasprintf.obj      \
197         ttyname_r.obj      \
198         stpcpy.obj         \
199         setenv.obj
200
201
202 # Sources files in this directory inclduing this Makefile
203 conf_sources = \
204         build.mk \
205         config.h \
206         stdint.h io.h
207
208 # Source files built by running the standard build system.
209 built_sources = \
210         gpgme.h         \
211         status-table.h
212
213 copy-static-source:
214         @if [ ! -f ./gpgme.c ]; then \
215            echo "Please cd to the src/ directory first"; \
216            exit 1; \
217         fi
218         cp -t $(targetsrc)/gpgme/src $(sources);
219         cd ../contrib/conf-w32ce-msc ; \
220             cp -t $(targetsrc)/gpgme/src $(conf_sources)
221
222 copy-built-source:
223         @if [ ! -f ./gpgme.h ]; then \
224            echo "Please build using ./autogen.sh --build-w32ce first"; \
225            exit 1; \
226         fi
227         cp -t $(targetsrc)/gpgme/src $(built_sources)
228
229 copy-source: copy-static-source copy-built-source 
230
231
232 .c.obj:
233         $(CC) $(CFLAGS) -c $<
234
235 all:  $(sources) $(conf_sources) $(built_sources) $(objs)
236         link    /DLL /IMPLIB:libgpgme-11-msc.lib \
237                 /OUT:libgpgme-11-msc.dll \
238                 /DEF:gpgme.def /NOLOGO /MANIFEST:NO \
239                 /NODEFAULTLIB:"oldnames.lib" /DYNAMICBASE:NO \
240                 $(objs) \
241                 $(libdir)/libgpg-error-0-msc.lib \
242                 $(libdir)/libassuan-0-msc.lib \
243                 coredll.lib corelibc.lib ole32.lib oleaut32.lib uuid.lib \
244                 commctrl.lib ws2.lib /subsystem:windowsce,5.02
245
246 # Note that we don't need to create the install directories because
247 # libgpg-error must have been build and installed prior to this
248 # package.
249 install: all
250         copy /y gpgme.h $(incdir:/=\)
251         copy /y libgpgme-11-msc.dll $(bindir:/=\)
252         copy /y libgpgme-11-msc.lib $(libdir:/=\)
253
254
255 clean:
256         del *.obj libgpgme-11-msc.lib libgpgme-11-msc.dll libgpgme-11-msc.exp
257