windows: generate MSVC import lib when possible
[moonshot-ui.git] / Makefile.am
1 ACLOCAL_AMFLAGS = -I m4 ${ACLOCAL_FLAGS}
2
3 SUBDIRS = po
4
5
6 lib_LTLIBRARIES = libmoonshot/libmoonshot.la
7
8 bin_PROGRAMS = src/moonshot
9
10
11
12 AM_CFLAGS =
13
14 AM_CPPFLAGS = \
15         -include config.h \
16         -DLOCALEDIR=\""$(localedir)"\" \
17         -I$(top_srcdir)/libmoonshot
18
19 AM_VALAFLAGS = \
20         config.vapi \
21         --pkg gtk+-2.0
22
23
24 libmoonshot_libmoonshot_la_CPPFLAGS = \
25         $(libmoonshot_CFLAGS) \
26         $(AM_CPPFLAGS)
27
28 libmoonshot_libmoonshot_la_SOURCES = libmoonshot/libmoonshot-common.c
29
30 libmoonshot_libmoonshot_la_LIBADD = $(libmoonshot_LIBS)
31
32
33 src_moonshot_SOURCES = \
34         src/moonshot-id.vala \
35         src/moonshot-add-dialog.vala \
36         src/moonshot-idcard-widget.vala \
37         src/moonshot-custom-vbox.vala \
38         src/moonshot-identities-manager.vala \
39         src/moonshot-identity-request.vala \
40         src/moonshot-server.vala \
41         src/moonshot-window.vala \
42         src/moonshot-password-dialog.vala \
43         src/moonshot-utils.vala
44
45 src_moonshot_LDADD = \
46         $(moonshot_LIBS)
47
48 src_moonshot_CPPFLAGS = \
49         $(moonshot_CFLAGS) \
50         $(AM_CPPFLAGS)
51
52
53 if OS_WIN32
54
55 libmoonshot_libmoonshot_la_LDFLAGS = -no-undefined
56
57 src_moonshot_CFLAGS = -mwindows
58
59 AM_CPPFLAGS += -DOS_WIN32
60 AM_VALAFLAGS += --define=OS_WIN32
61
62 noinst_DATA = libmoonshot/libmoonshot.lib
63
64 libmoonshot/libmoonshot.lib: libmoonshot/libmoonshot.def
65         "${MSVC_LIB}" -def:$< -out:$@ -machine:x86
66
67 endif
68
69
70 if IPC_MSRPC
71
72 AM_CPPFLAGS += -Isrc
73
74 AM_VALAFLAGS += \
75         --pkg msrpc-1.0 \
76         --define=IPC_MSRPC
77
78 BUILT_SOURCES = libmoonshot/moonshot-msrpc.h \
79                 libmoonshot/moonshot-msrpc_s.c \
80                 libmoonshot/moonshot-msrpc_c.c
81
82 DISTCLEANFILES = ${BUILT_SOURCES}
83
84 libmoonshot/moonshot-msrpc.h: libmoonshot/moonshot-msrpc.idl libmoonshot/moonshot-msrpc.acf
85         ${AM_V_GEN} ${MIDL_WRAPPER} -o libmoonshot -m "${MIDL}" $^
86
87 libmoonshot/moonshot-msrpc_s.c: libmoonshot/moonshot-msrpc.h
88 libmoonshot/moonshot-msrpc_c.c: libmoonshot/moonshot-msrpc.h
89
90 libmoonshot_libmoonshot_la_SOURCES += \
91         libmoonshot/libmoonshot-msrpc.c \
92         libmoonshot/moonshot-msrpc_c.c
93
94 src_moonshot_SOURCES += \
95         src/moonshot-msrpc.vapi
96
97 nodist_src_moonshot_SOURCES = \
98         libmoonshot/moonshot-msrpc_s.c
99
100 endif
101
102 if IPC_DBUS
103
104 # DBus service file
105 dbusservicedir = $(datadir)/dbus-1/services
106 dbusservice_in_files = org.janet.Moonshot.service.in
107 dbusservice_DATA = $(dbusservice_in_files:.service.in=.service)
108
109 # Rule to make the service file with bindir expanded
110 $(dbusservice_DATA): $(dbusservice_in_files) Makefile
111         @sed -e "s|\@bindir\@|$(bindir)|" $< > $@
112
113 AM_VALAFLAGS += \
114         --pkg dbus-glib-1 \
115         --define=IPC_DBUS
116
117 libmoonshot_libmoonshot_la_SOURCES += libmoonshot/libmoonshot-dbus.c
118
119 CLEANFILES = $(dbusservice_DATA)
120 EXTRA_DIST = $(dbusservice_in_files)
121
122 endif
123
124
125 bin_PROGRAMS += src/moonshot-webp
126
127 src_moonshot_webp_SOURCES = src/moonshot-webp-parser.vala src/moonshot-id.vala
128 src_moonshot_webp_CPPFLAGS = $(moonshot_CFLAGS) $(AM_CPPFLAGS)
129 src_moonshot_webp_LDADD = $(moonshot_LIBS)
130
131 if OS_WIN32
132 moonshot_webp_CFLAGS = -mwindows
133 endif
134
135
136 noinst_PROGRAMS = \
137         examples/client \
138         tests/basic
139
140 examples_client_SOURCES = examples/client.c
141 examples_client_CPPFLAGS = $(libmoonshot_CFLAGS) $(AM_CPPFLAGS)
142 examples_client_LDADD = ${top_builddir}/libmoonshot/libmoonshot.la
143
144 tests_basic_SOURCES = tests/basic.c
145 tests_basic_CPPFLAGS = $(libmoonshot_CFLAGS) $(AM_CPPFLAGS)
146 tests_basic_LDADD = ${top_builddir}/libmoonshot/libmoonshot.la $(moonshot_LIBS)
147
148
149 if OS_WIN32
150
151 ## A couple of Windows-specific targets:
152
153 ## 1. Icons. You must have gnome-icon-theme and gnome-icon-theme-symbolic installed
154 ##    in c:/build prefix; and ImageMagick installed in c:/tools/ImageMagick. This
155 ##    pulls in the icons required by moonshot and converts svg's to png's (we have
156 ##    no svg support built in to Windows Gtk+ right now).
157
158 icons:
159         mkdir -p share/icons
160         cp c:/build/share/icons/gnome/48x48/status/avatar-default.png share/icons
161         "${IMAGEMAGICK_CONVERT}" -background none c:/build/share/icons/gnome/scalable/actions/edit-clear-symbolic.svg -size 13x13 share/icons/edit-clear-symbolic.png
162         "${IMAGEMAGICK_CONVERT}" -background none c:/build/share/icons/gnome/scalable/actions/edit-find-symbolic.svg -size 13x13 share/icons/edit-find-symbolic.png
163
164
165 ## 2. Installer. You must have the Windows Installer XML toolkit version 3.5
166 ##    installed in its default path. Note that this requires at least .NET
167 ##    runtime with service packs 1 and 2. The installer picks up files from
168 ##    the build prefix and mingw dir; you must change these if you have them
169 ##    in different locations I'm afraid.
170
171 installer: moonshot.msi
172
173 moonshot.msi: windows/app.wxs
174         "${WIX_CANDLE}" $<
175         "${WIX_LIGHT}" -b c:/build -b c:/tools/mingw -o moonshot.msi app.wixobj
176
177 endif