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