1 # build.mk - Makefile to build libgpg-error using Visual-C
2 # Copyright 2010 g10 Code GmbH
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.
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.
12 # This is a helper make script to build libgpg-error for WindowsCE
13 # using the Microsoft Visual C compiler.
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:
20 # TARGET/src - Source directories: One directory for each project
21 # /bin - Installed DLLs
22 # /lib - Installed import libs.
23 # /include - Instaled header files.
25 targetdir = /home/smb/xppro-gnu
26 targetsrc = $(targetdir)/src
28 # Install directories (relative)
31 incdir = ../../../include
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"
42 ce_defines = -DWINCE -D_WIN32_WCE=0x502 -DUNDER_CE \
43 -DWIN32_PLATFORM_PSPC -D_UNICODE -DUNICODE \
44 -D_CONSOLE -DARM -D_ARM_
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
53 # Standard source files
139 # The object files we need to create from sources.
202 # Sources files in this directory inclduing this Makefile
207 # Source files built by running the standard build system.
214 @if [ ! -f ./gpgme.c ]; then \
215 echo "Please cd to the src/ directory first"; \
218 cp -t $(targetsrc)/gpgme/src $(sources);
219 cd ../contrib/conf-w32ce-msc ; \
220 cp -t $(targetsrc)/gpgme/src $(conf_sources)
222 # We create a dummy sehmap.h which will be included first due to -I. .
223 # For some reasons sehmap.h is included by MSC for WindowsCE and
224 # introduces a macro "leave" which conflicts of our use of "leave" for
225 # a label (leave and enter are pretty common names for pro- and epilog
228 @if [ ! -f ./gpgme.h ]; then \
229 echo "Please build using ./autogen.sh --build-w32ce first"; \
232 cp -t $(targetsrc)/gpgme/src $(built_sources)
233 echo '/* Dummy replacement for useless header. */' \
234 > $(targetsrc)/gpgme/src/sehmap.h
236 copy-source: copy-static-source copy-built-source
240 $(CC) $(CFLAGS) -c $<
242 all: $(sources) $(conf_sources) $(built_sources) $(objs)
243 link /DLL /IMPLIB:libgpgme-11-msc.lib \
244 /OUT:libgpgme-11-msc.dll \
245 /DEF:gpgme.def /NOLOGO /MANIFEST:NO \
246 /NODEFAULTLIB:"oldnames.lib" /DYNAMICBASE:NO \
248 $(libdir)/libgpg-error-0-msc.lib \
249 $(libdir)/libassuan-0-msc.lib \
250 coredll.lib corelibc.lib ole32.lib oleaut32.lib uuid.lib \
251 commctrl.lib /subsystem:windowsce,5.02
253 # Note that we don't need to create the install directories because
254 # libgpg-error must have been build and installed prior to this
257 copy /y gpgme.h $(incdir:/=\)
258 copy /y libgpgme-11-msc.dll $(bindir:/=\)
259 copy /y libgpgme-11-msc.lib $(libdir:/=\)