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