libmoonshot: spawn moonshot-dbus-launch
[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 = \
9          src/moonshot \
10          src/moonshot-webp
11
12 AM_CFLAGS = -g -O0 -Wall
13
14 AM_CPPFLAGS =  \
15         -include config.h \
16         -DLOCALEDIR=\""$(localedir)"\" \
17         -DMOONSHOT_LAUNCH_SCRIPT='"$(pkglibexecdir)/moonshot-dbus-launch"' \
18         -I$(top_srcdir)/libmoonshot \
19         -I$(top_builddir)/libmoonshot
20
21 AM_VALAFLAGS = -g \
22         config.vapi \
23         --vapidir=$(top_srcdir)/vapi \
24         --pkg gio-2.0
25
26
27 libmoonshot_libmoonshot_la_CPPFLAGS = \
28         $(libmoonshot_CFLAGS) \
29         $(AM_CPPFLAGS) 
30
31 libmoonshot_libmoonshot_la_SOURCES = libmoonshot/libmoonshot-common.c
32
33 libmoonshot_libmoonshot_la_LIBADD = $(libmoonshot_LIBS)
34
35 include_HEADERS = libmoonshot/libmoonshot.h
36 noinst_HEADERS = libmoonshot/libmoonshot-common.h
37
38 src_moonshot_SOURCES = \
39         src/moonshot-identity-manager-app.vala \
40         src/moonshot-identity-management-view.vala \
41         src/moonshot-local-flat-file-store.vala \
42         src/moonshot-idcard-store.vala \
43         src/moonshot-id.vala \
44         src/moonshot-add-dialog.vala \
45         src/moonshot-idcard-widget.vala \
46         src/moonshot-custom-vbox.vala \
47         src/moonshot-identities-manager.vala \
48         src/moonshot-identity-request.vala \
49         src/moonshot-server.vala \
50         src/moonshot-password-dialog.vala \
51         src/moonshot-provisioning-common.vala \
52         src/moonshot-utils.vala
53
54 src_moonshot_webp_SOURCES = \
55         src/moonshot-webp-parser.vala \
56         src/moonshot-provisioning-common.vala \
57         src/moonshot-id.vala
58
59 src_moonshot_VALAFLAGS = --pkg gdk-2.0 --pkg gtk+-2.0 --pkg gee-1.0 $(AM_VALAFLAGS)
60 src_moonshot_CPPFLAGS = $(moonshot_CFLAGS) $(AM_CPPFLAGS)  
61 src_moonshot_LDADD = $(moonshot_LIBS) 
62 src_moonshot_LDFLAGS = -g -O0
63
64 src_moonshot_webp_VALAFLAGS = --vapidir=$(top_srcdir)/libmoonshot  --pkg gtk+-2.0 --pkg gdk-2.0 --pkg libmoonshot $(AM_VALAFLAGS)
65 src_moonshot_webp_CPPFLAGS = $(moonshot_CFLAGS) $(AM_CPPFLAGS)
66 src_moonshot_webp_LDADD = $(moonshot_LIBS) ${top_builddir}/libmoonshot/libmoonshot.la
67
68 if OS_WIN32
69
70 libmoonshot_libmoonshot_la_LDFLAGS = -no-undefined
71
72 src_moonshot_CFLAGS = -mwindows
73 src_moonshot_webp_CFLAGS = -mwindows
74     
75 AM_CPPFLAGS += -DOS_WIN32
76 AM_VALAFLAGS += --define=OS_WIN32
77
78 noinst_DATA = libmoonshot/libmoonshot.lib
79
80 # Build the MSVC lib. The sed hack fixes execution in the case that
81 # the MSVC toolchain isn't in the PATH.
82 libmoonshot/libmoonshot.lib: libmoonshot/libmoonshot.def
83         PATH="$(shell echo "${MSVC_LIB}" | sed -e s,/VC/bin/lib,/Common7/IDE,)":$$PATH "${MSVC_LIB}" -def:$< -out:$@ -machine:x86
84
85 endif
86
87 if  OS_MACOS
88
89 AM_CPPFLAGS += -DOS_MACOS $(MAC_CFLAGS)
90 AM_VALAFLAGS += --define=OS_MACOS --pkg gtk-mac-integration
91 moonshot_LIBS += $(MAC_LIBS)
92 src_moonshot_LDADD += $(MAC_LIBS)
93 endif
94
95 if OS_LINUX
96
97 ## Installing mime type data
98 mimedir = $(datadir)/mime/packages
99 mime_DATA = webprovisioning/moonshot.xml
100
101 ## Installing
102 dotdesktopdir = $(datadir)/applications
103 dotdesktop_DATA = moonshot.desktop moonshot-webp.desktop
104
105 endif
106
107 if IPC_MSRPC
108
109 AM_CPPFLAGS += -Isrc
110
111 AM_VALAFLAGS += \
112         --pkg moonshot-msrpc.vapi --pkg msrpc-1.0 \
113         --define=IPC_MSRPC
114
115 BUILT_SOURCES = libmoonshot/moonshot-msrpc.h \
116                 libmoonshot/moonshot-msrpc_s.c \
117                 libmoonshot/moonshot-msrpc_c.c
118
119 DISTCLEANFILES = ${BUILT_SOURCES}
120
121 libmoonshot/moonshot-msrpc.h: libmoonshot/moonshot-msrpc.idl libmoonshot/moonshot-msrpc.acf
122         ${AM_V_GEN} ${MIDL_WRAPPER} -o libmoonshot -m "${MIDL}" $^
123
124 libmoonshot/moonshot-msrpc_s.c: libmoonshot/moonshot-msrpc.h
125 libmoonshot/moonshot-msrpc_c.c: libmoonshot/moonshot-msrpc.h
126
127 libmoonshot_libmoonshot_la_SOURCES += \
128         libmoonshot/libmoonshot-msrpc.c
129
130
131 nodist_src_moonshot_SOURCES = \
132         libmoonshot/moonshot-msrpc_s.c
133
134 nodist_libmoonshot_libmoonshot_la_SOURCES = \
135         libmoonshot/moonshot-msrpc_c.c
136
137 endif
138
139 if IPC_DBUS
140
141 # DBus service file
142 dbusservicedir = $(datadir)/dbus-1/services
143 if  OS_MACOS
144 dbusservice_in_files = org.janet.Moonshot.service.mac
145 dbusservice_DATA = $(dbusservice_in_files:.service.mac=.service)
146 else
147 dbusservice_in_files = org.janet.Moonshot.service.in
148 dbusservice_DATA = $(dbusservice_in_files:.service.in=.service)
149 endif 
150
151 # Rule to make the service file with bindir expanded
152 $(dbusservice_DATA): $(dbusservice_in_files) Makefile
153         @sed -e "s|\@bindir\@|$(bindir)|" $< > $@
154
155 libmoonshot_libmoonshot_la_SOURCES += libmoonshot/libmoonshot-dbus.c
156
157 CLEANFILES = $(dbusservice_DATA)
158
159 if IPC_DBUS_GLIB
160 AM_VALAFLAGS += \
161         --pkg dbus-glib-1 \
162         --define=IPC_DBUS_GLIB \
163         --define=IPC_DBUS
164 else
165 AM_VALAFLAGS += \
166         --pkg gio-2.0 \
167         --define=IPC_GDBUS \
168         --define=IPC_DBUS
169 endif
170 endif
171
172 EXTRA_DIST = webprovisioning/moonshot.xml $(dbusservice_in_files) \
173         moonshot-ui.spec
174
175 noinst_PROGRAMS = \
176         examples/client \
177         examples/service-selection \
178         tests/basic
179
180 examples_service_selection_SOURCES = examples/service-selection.c
181 examples_service_selection_CPPFLAGS = $(moonshot_CFLAGS) $(AM_CPPFLAGS)
182 examples_service_selection_LDADD = ${top_builddir}/libmoonshot/libmoonshot.la $(moonshot_LIBS)
183
184 examples_client_SOURCES = examples/client.c
185 examples_client_CPPFLAGS = $(libmoonshot_CFLAGS) $(AM_CPPFLAGS)
186 examples_client_LDADD = ${top_builddir}/libmoonshot/libmoonshot.la
187
188 tests_basic_SOURCES = tests/basic.c
189 tests_basic_CPPFLAGS = $(moonshot_CFLAGS) $(AM_CPPFLAGS)
190 tests_basic_LDADD = ${top_builddir}/libmoonshot/libmoonshot.la $(moonshot_LIBS)
191
192 ##if OS_LINUX
193 ##install-data-hook:
194 ##      "${UPDATE_MIME_DATABASE}" $(datadir)/mime
195 ##      "${UPDATE_DESKTOP_DATABASE}" $(datadir)/applications
196 ##uninstall-hook:
197 ##      "${UPDATE_MIME_DATABASE}" $(datadir)/mime
198 ##      "${UPDATE_DESKTOP_DATABASE}" $(datadir)/applications
199 ##endif
200
201 if OS_WIN32
202
203 ## A couple of Windows-specific targets:
204
205 ## 1. Icons. You must have gnome-icon-theme and gnome-icon-theme-symbolic installed
206 ##    in the install prefix; and ImageMagick installed in c:/tools/ImageMagick. This
207 ##    pulls in the icons required by moonshot and converts svg's to png's (we have
208 ##    no svg support built in to Windows Gtk+ right now).
209
210 icons:
211         mkdir -p share/icons
212         cp ${prefix}/share/icons/gnome/48x48/status/avatar-default.png share/icons
213         "${IMAGEMAGICK_CONVERT}" -background none ${prefix}/share/icons/gnome/scalable/actions/edit-clear-symbolic.svg -size 13x13 share/icons/edit-clear-symbolic.png
214         "${IMAGEMAGICK_CONVERT}" -background none ${prefix}/share/icons/gnome/scalable/actions/edit-find-symbolic.svg -size 13x13 share/icons/edit-find-symbolic.png
215
216
217 ## 2. Installer. You must have the Windows Installer XML toolkit version 3.5
218 ##    installed in its default path. Note that this requires at least .NET
219 ##    runtime with service packs 1 and 2. The installer picks up files from
220 ##    the build prefix and mingw dir; you must change these if you have them
221 ##    in different locations I'm afraid.
222
223 installer: moonshot.msi
224
225 moonshot.msi: windows/app.wxs windows/config.wxi $(bin_PROGRAMS)
226         "${WIX_CANDLE}" $<
227         "${WIX_LIGHT}" -b ${prefix} -b ${prefix}/mingw -o moonshot.msi app.wixobj
228
229 endif
230
231 if  OS_MACOS
232 ## Mac-specific targets
233
234 ## 1. Icons. 
235
236 icons:
237         mkdir -p share/icons
238         cp mac/icons/process-stop.png share/icons
239         cp mac/icons/edit-find.png share/icons
240         cp mac/icons/avatar-default.png share/icons
241
242 ## 2. App bundle
243 ## gtk-app-bundler must be installed
244 ## moonshot-ui.app will be built in moonshot/mac-client-installer/moonshot-ui/
245 app-bundle:
246         gtk-mac-bundler ./mac/moonshot-ui.bundle
247
248 ## 3: Installer Package
249
250 installerdir = $(HOME)/moonshot/mac-client-installer
251
252 endif