Fix Windows build; tidy up examples
[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 endif
63
64
65 if IPC_MSRPC
66
67 AM_CPPFLAGS += -Isrc
68
69 AM_VALAFLAGS += \
70         --pkg msrpc-1.0 \
71         --define=IPC_MSRPC
72
73 BUILT_SOURCES = libmoonshot/moonshot-msrpc.h \
74                 libmoonshot/moonshot-msrpc_s.c \
75                 libmoonshot/moonshot-msrpc_c.c
76
77 DISTCLEANFILES = ${BUILT_SOURCES}
78
79 libmoonshot/moonshot-msrpc.h: libmoonshot/moonshot-msrpc.idl libmoonshot/moonshot-msrpc.acf
80         ${AM_V_GEN} ${MIDL_WRAPPER} -o libmoonshot -m "${MIDL}" $^
81
82 libmoonshot/moonshot-msrpc_s.c: libmoonshot/moonshot-msrpc.h
83 libmoonshot/moonshot-msrpc_c.c: libmoonshot/moonshot-msrpc.h
84
85 libmoonshot_libmoonshot_la_SOURCES += \
86         libmoonshot/libmoonshot-msrpc.c \
87         libmoonshot/moonshot-msrpc_c.c
88
89 src_moonshot_SOURCES += \
90         src/moonshot-msrpc.vapi
91
92 nodist_src_moonshot_SOURCES = \
93         libmoonshot/moonshot-msrpc_s.c
94
95 endif
96
97 if IPC_DBUS
98
99 # DBus service file
100 dbusservicedir = $(datadir)/dbus-1/services
101 dbusservice_in_files = org.janet.Moonshot.service.in
102 dbusservice_DATA = $(dbusservice_in_files:.service.in=.service)
103
104 # Rule to make the service file with bindir expanded
105 $(dbusservice_DATA): $(dbusservice_in_files) Makefile
106         @sed -e "s|\@bindir\@|$(bindir)|" $< > $@
107
108 AM_VALAFLAGS += \
109         --pkg dbus-glib-1 \
110         --define=IPC_DBUS
111
112 libmoonshot_libmoonshot_la_SOURCES += libmoonshot/libmoonshot-dbus.c
113
114 CLEANFILES = $(dbusservice_DATA)
115 EXTRA_DIST = $(dbusservice_in_files)
116
117 endif
118
119
120 bin_PROGRAMS += src/moonshot-webp
121
122 src_moonshot_webp_SOURCES = src/moonshot-webp-parser.vala src/moonshot-id.vala
123 src_moonshot_webp_CPPFLAGS = $(moonshot_CFLAGS) $(AM_CPPFLAGS)
124 src_moonshot_webp_LDADD = $(moonshot_LIBS)
125
126 if OS_WIN32
127 moonshot_webp_CFLAGS = -mwindows
128 endif
129
130
131 noinst_PROGRAMS = \
132         examples/client \
133         tests/basic
134
135 examples_client_SOURCES = examples/client.c
136 examples_client_CPPFLAGS = $(libmoonshot_CFLAGS) $(AM_CPPFLAGS)
137 examples_client_LDADD = ${top_builddir}/libmoonshot/libmoonshot.la
138
139 tests_basic_SOURCES = tests/basic.c
140 tests_basic_CPPFLAGS = $(libmoonshot_CFLAGS) $(AM_CPPFLAGS)
141 tests_basic_LDADD = ${top_builddir}/libmoonshot/libmoonshot.la $(moonshot_LIBS)
142
143
144 if OS_WIN32
145
146 ## A couple of Windows-specific targets:
147
148 ## 1. Icons. You must have gnome-icon-theme and gnome-icon-theme-symbolic installed
149 ##    in c:/build prefix; and ImageMagick installed in c:/tools/ImageMagick. This
150 ##    pulls in the icons required by moonshot and converts svg's to png's (we have
151 ##    no svg support built in to Windows Gtk+ right now).
152
153 icons:
154         mkdir -p share/icons
155         cp c:/build/share/icons/gnome/48x48/status/avatar-default.png share/icons
156         "${IMAGEMAGICK_CONVERT}" -background none c:/build/share/icons/gnome/scalable/actions/edit-clear-symbolic.svg -size 13x13 share/icons/edit-clear-symbolic.png
157         "${IMAGEMAGICK_CONVERT}" -background none c:/build/share/icons/gnome/scalable/actions/edit-find-symbolic.svg -size 13x13 share/icons/edit-find-symbolic.png
158
159
160 ## 2. Installer. You must have the Windows Installer XML toolkit version 3.5
161 ##    installed in its default path. Note that this requires at least .NET
162 ##    runtime with service packs 1 and 2. The installer picks up files from
163 ##    the build prefix and mingw dir; you must change these if you have them
164 ##    in different locations I'm afraid.
165
166 installer: moonshot.msi
167
168 moonshot.msi: windows/app.wxs
169         "${WIX_CANDLE}" $<
170         "${WIX_LIGHT}" -b c:/build -b c:/tools/mingw -o moonshot.msi app.wixobj
171
172 endif