summaryrefslogtreecommitdiff
path: root/src/Makefile.am
blob: 16ae5e9673cd7699787221b15d23b4d8e648db3f (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
## Process this file with automake to produce Makefile.in

DIST_SUBDIRS = dummy freebsd linux openbsd bsd
SUBDIRS = dummy freebsd linux openbsd

if BACKEND_TYPE_FREEBSD
SUBDIRS += bsd
endif

if BACKEND_TYPE_OPENBSD
SUBDIRS += bsd
endif

AM_CPPFLAGS = \
	$(PIE_CFLAGS)						\
	-I$(top_builddir)/src -I$(top_srcdir)/src		\
	-DPACKAGE_LIBEXEC_DIR=\""$(libexecdir)"\"		\
	-DPACKAGE_SYSCONF_DIR=\""$(sysconfdir)"\"		\
	-DPACKAGE_DATA_DIR=\""$(datadir)"\"			\
	-DPACKAGE_BIN_DIR=\""$(bindir)"\"			\
	-DPACKAGE_LOCALSTATE_DIR=\""$(localstatedir)"\"		\
	-DPACKAGE_LOCALE_DIR=\""$(localedir)"\"			\
	-DPACKAGE_LIB_DIR=\""$(libdir)"\"			\
	-DHISTORY_DIR=\""$(historydir)"\"			\
	-D_POSIX_PTHREAD_SEMANTICS -D_REENTRANT			\
	-DUP_COMPILATION					\
	-DG_LOG_DOMAIN=\"UPower\"				\
	-I$(top_srcdir)/libupower-glib				\
	-I$(top_srcdir)						\
	$(GIO_CFLAGS)						\
	$(GIO_UNIX_CFLAGS)					\
	$(GUDEV_CFLAGS)						\
	$(GLIB_CFLAGS)

UPOWER_LIBS = $(top_builddir)/libupower-glib/libupower-glib.la

BUILT_SOURCES =							\
	up-daemon-generated.h					\
	up-daemon-generated.c					\
	up-device-generated.h					\
	up-device-generated.c					\
	up-kbd-backlight-generated.h				\
	up-kbd-backlight-generated.c				\
	up-wakeups-generated.h					\
	up-wakeups-generated.c					\
	up-marshal.h						\
	up-marshal.c

up-marshal.h: up-marshal.list
	glib-genmarshal $< --prefix=up_marshal --header > $@

up-marshal.c: up-marshal.list
	echo "#include \"up-marshal.h\"" > $@ && glib-genmarshal $< --prefix=up_marshal --body >> $@

up-daemon-generated.h: org.freedesktop.UPower.xml Makefile.am
	$(AM_V_GEN) gdbus-codegen --interface-prefix org.freedesktop.UPower. \
	--generate-c-code up-daemon-generated \
	--c-namespace Up \
	--annotate "org.freedesktop.UPower" "org.gtk.GDBus.C.Name" ExportedDaemon \
	$(srcdir)/org.freedesktop.UPower.xml

up-device-generated.h: org.freedesktop.UPower.Device.xml Makefile.am
	$(AM_V_GEN) gdbus-codegen --interface-prefix org.freedesktop.UPower.Device. \
	--generate-c-code up-device-generated \
	--c-namespace Up \
	--annotate "org.freedesktop.UPower.Device" "org.gtk.GDBus.C.Name" ExportedDevice \
	$(srcdir)/org.freedesktop.UPower.Device.xml

up-kbd-backlight-generated.h: org.freedesktop.UPower.KbdBacklight.xml Makefile.am
	$(AM_V_GEN) gdbus-codegen --interface-prefix org.freedesktop.UPower.KbdBacklight. \
	--generate-c-code up-kbd-backlight-generated \
	--c-namespace Up \
	--annotate "org.freedesktop.UPower.KbdBacklight" "org.gtk.GDBus.C.Name" ExportedKbdBacklight \
	$(srcdir)/org.freedesktop.UPower.KbdBacklight.xml

up-wakeups-generated.h: org.freedesktop.UPower.Wakeups.xml Makefile.am
	$(AM_V_GEN) gdbus-codegen --interface-prefix org.freedesktop.UPower.Wakeups. \
	--generate-c-code up-wakeups-generated \
	--c-namespace Up \
	--annotate "org.freedesktop.UPower.Wakeups" "org.gtk.GDBus.C.Name" ExportedWakeups \
	$(srcdir)/org.freedesktop.UPower.Wakeups.xml

libexec_PROGRAMS = upowerd

dbusifdir = $(datadir)/dbus-1/interfaces
dbusif_DATA =							\
	org.freedesktop.UPower.xml				\
	org.freedesktop.UPower.Device.xml			\
	org.freedesktop.UPower.KbdBacklight.xml			\
	org.freedesktop.UPower.Wakeups.xml

upowerd_SOURCES =						\
	up-daemon.h						\
	up-daemon.c						\
	up-device.h						\
	up-device.c						\
	up-device-list.h					\
	up-device-list.c					\
	up-config.h						\
	up-config.c						\
	up-kbd-backlight.h					\
	up-kbd-backlight.c					\
	up-wakeups.h						\
	up-wakeups.c						\
	up-history.h						\
	up-history.c						\
	up-backend.h						\
	up-native.h						\
	up-main.c						\
	up-backend-bsd-private.h			\
	$(BUILT_SOURCES)

upowerd_CPPFLAGS =						\
	-I$(top_srcdir)/src					\
	$(AM_CPPFLAGS)

upowerd_LDADD =							\
	-lm							\
	$(USB_LIBS)						\
	$(GIO_LIBS)						\
	$(GIO_UNIX_LIBS)					\
	$(UPOWER_LIBS)

if BACKEND_TYPE_DUMMY
upowerd_LDADD += 						\
	dummy/libupshared.la
endif

if BACKEND_TYPE_FREEBSD
upowerd_LDADD +=						\
	freebsd/libupshared.la				\
	bsd/libupsharedcommon.la
endif

if BACKEND_TYPE_OPENBSD
upowerd_LDADD +=						\
	openbsd/libupshared.la				\
	bsd/libupsharedcommon.la
endif

if BACKEND_TYPE_LINUX
upowerd_LDADD += 						\
	linux/libupshared.la					\
	$(USB_LIBS)						\
	$(GUDEV_LIBS)						\
	$(IDEVICE_LIBS)						\
	$(NULL)

upowerd_LDFLAGS =						\
	$(PIE_LDFLAGS)						\
	$(RELRO_LDFLAGS)

if UP_BUILD_TESTS
check-local: upowerd
	env GI_TYPELIB_PATH=$(top_builddir)/libupower-glib:$(GI_TYPELIB_PATH) LD_LIBRARY_PATH=$(top_builddir)/libupower-glib/.libs:$(LD_LIBRARY_PATH) top_builddir=$(top_builddir) $(srcdir)/linux/integration-test -v
endif

endif

upowerd_CFLAGS =						\
	$(WARNINGFLAGS_C)					\
	$(NULL)

if UP_BUILD_TESTS

check_PROGRAMS =						\
	up-self-test

up_self_test_SOURCES =						\
	up-self-test.c						\
	up-config.h						\
	up-config.c						\
	up-daemon.h						\
	up-daemon.c						\
	up-device.h						\
	up-device.c						\
	up-device-list.h					\
	up-device-list.c					\
	up-kbd-backlight.h					\
	up-kbd-backlight.c					\
	up-wakeups.h						\
	up-wakeups.c						\
	up-history.h						\
	up-history.c						\
	up-backend.h						\
	up-native.h						\
	$(BUILT_SOURCES)

up_self_test_LDADD =						\
	-lm							\
	dummy/libuptest.la					\
	$(GLIB_LIBS)						\
	$(GIO_CFLAGS)						\
	$(POLKIT_LIBS)						\
	$(UPOWER_LIBS)

up_self_test_CFLAGS = $(AM_CFLAGS) $(WARNINGFLAGS_C)

TESTS_ENVIRONMENT = $(DBUS_LAUNCH)
TESTS = up-self-test

endif

dbusservicedir       = $(datadir)/dbus-1/system-services
dbusservice_in_files = org.freedesktop.UPower.service.in
dbusservice_DATA     = $(dbusservice_in_files:.service.in=.service)

$(dbusservice_DATA): $(dbusservice_in_files) Makefile
	@sed -e "s|\@libexecdir\@|$(libexecdir)|" $< > $@

dbusconfdir = $(sysconfdir)/dbus-1/system.d
dbusconf_in_files = org.freedesktop.UPower.conf.in
dbusconf_DATA = $(dbusconf_in_files:.conf.in=.conf)

$(dbusconf_DATA): $(dbusconf_in_files) Makefile
	cp $< $@

if HAVE_SYSTEMDSYSTEMUNITDIR
systemdservicedir       = $(systemdsystemunitdir)
systemdservice_in_files = upower.service.in
systemdservice_DATA     = $(systemdservice_in_files:.service.in=.service)

$(systemdservice_DATA): $(systemdservice_in_files) Makefile
	@sed -e "s|\@libexecdir\@|$(libexecdir)|" $< > $@
endif

install-data-hook:
	if test -w $(DESTDIR)$(prefix)/; then \
		mkdir -p $(DESTDIR)$(historydir); \
	fi

CLEANFILES = $(BUILT_SOURCES)

MAINTAINERCLEANFILES =						\
	$(dbusconf_DATA)					\
	$(systemdservice_DATA)					\
	$(dbusservice_DATA)

EXTRA_DIST =							\
	org.freedesktop.UPower.xml				\
	org.freedesktop.UPower.Device.xml			\
	org.freedesktop.UPower.KbdBacklight.xml			\
	org.freedesktop.UPower.Wakeups.xml			\
	up-marshal.list						\
	$(systemdservice_in_files)				\
	$(dbusservice_in_files)					\
	$(dbusconf_in_files)

if HAVE_SYSTEMDSYSTEMUNITDIR
EXTRA_DIST += $(systemdservice_in_files)
endif

clean-local :
	rm -f *~ $(dbusservice_DATA) $(dbusconf_DATA) $(systemdservice_DATA)

-include $(top_srcdir)/git.mk