File: Makefile.am

package info (click to toggle)
shepherd 1.0.9-2
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 1,828 kB
  • sloc: lisp: 8,779; sh: 3,586; makefile: 289; ansic: 50
file content (376 lines) | stat: -rw-r--r-- 12,385 bytes parent folder | download
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
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
# Makefile.am -- How to build and install the Shepherd.
# Copyright © 2002, 2003 Wolfgang Jährling <wolfgang@pro-linux.de>
# Copyright © 2013-2016, 2018-2020, 2022-2025 Ludovic Courtès <ludo@gnu.org>
# Copyright © 2018 Carlo Zancanaro <carlo@zancanaro.id.au>
# Copyright © 2023 Oleg Pykhalov <go.wigust@gmail.com>
#
# This file is part of the GNU Shepherd.
#
# The GNU Shepherd is free software; you can redistribute it and/or modify it
# under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 3 of the License, or (at
# your option) any later version.
#
# The GNU Shepherd is distributed in the hope that it will be useful, but
# WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with the GNU Shepherd.  If not, see <https://www.gnu.org/licenses/>.

# The main programs.
bin_SCRIPTS = shepherd herd
sbin_SCRIPTS = halt reboot
templates =					\
  shepherd.in herd.in halt.in reboot.in		\
  modules/shepherd/config.scm.in		\
  modules/shepherd/system.scm.in

# Build this module first.
BUILT_SOURCES = modules/shepherd/config.scm

# The source files.
# XXX: we can't use 'nobase_' because of the modules/ subdirectory.
dist_guilemodule_DATA =				\
  modules/shepherd.scm
nodist_guileobject_DATA = $(dist_guilemodule_DATA:%.scm=%.go)

shepherdsubdir = $(guilemoduledir)/shepherd
servicesubdir = $(guilemoduledir)/shepherd/service
dist_shepherdsub_DATA =				\
  modules/shepherd/args.scm			\
  modules/shepherd/colors.scm			\
  modules/shepherd/endpoints.scm		\
  modules/shepherd/logger.scm			\
  modules/shepherd/service.scm			\
  modules/shepherd/support.scm			\
  modules/shepherd/comm.scm
nodist_shepherdsub_DATA =			\
  modules/shepherd/config.scm			\
  modules/shepherd/system.scm
dist_servicesub_DATA =				\
  modules/shepherd/service/log-rotation.scm	\
  modules/shepherd/service/monitoring.scm	\
  modules/shepherd/service/repl.scm		\
  modules/shepherd/service/system-log.scm	\
  modules/shepherd/service/timer.scm		\
  modules/shepherd/service/transient.scm

shepherdgosubdir = $(guileobjectdir)/shepherd
servicegosubdir = $(guileobjectdir)/shepherd/service
nodist_shepherdgosub_DATA =			\
  modules/shepherd/config.go			\
  modules/shepherd/system.go			\
  $(dist_shepherdsub_DATA:%.scm=%.go)
nodist_servicegosub_DATA =			\
  $(dist_servicesub_DATA:%.scm=%.go)

scriptsdir = $(shepherdsubdir)/scripts
dist_scripts_DATA =				\
  modules/shepherd/scripts/halt.scm		\
  modules/shepherd/scripts/herd.scm		\
  modules/shepherd/scripts/reboot.scm

scriptsgodir = $(shepherdgosubdir)/scripts
nodist_scriptsgo_DATA =				\
  $(dist_scripts_DATA:%.scm=%.go)

CLEANFILES =						\
  $(nodist_guilemodule_DATA) $(nodist_shepherdsub_DATA)	\
  $(nodist_guileobject_DATA)				\
  $(nodist_shepherdgosub_DATA)				\
  $(nodist_servicegosub_DATA)				\
  $(nodist_scriptsgo_DATA)				\
  $(bin_SCRIPTS) $(sbin_SCRIPTS)


# Crash handler.

EXTRA_DIST =					\
  etc/crash-handler.c				\
  build-aux/announcement-text.scm		\
  build-aux/announcement-template.txt		\
  build-aux/test-driver.scm			\
  build-aux/xgettext.scm			\
  guix.scm					\
  .guix/modules/shepherd-package.scm		\
  .guix/manifest.scm

if BUILD_CRASH_HANDLER

# Build the crash handler "manually" rather than with Libtool.

all-local: etc/crash-handler.so
install-crash-handler:
	$(MKDIR_P) $(DESTDIR)$(pkglibdir)
	$(INSTALL) -m 755 etc/crash-handler.so \
	           $(DESTDIR)$(pkglibdir)/crash-handler.so

etc/crash-handler.so: etc/crash-handler.c
	$(AM_V_GEN)$(MKDIR_P) etc;			\
	$(CC) $(CPPFLAGS) $(CFLAGS) $(LDFLAGS) -Wall -shared -fPIC -o "$@" "$^"

CLEANFILES += etc/crash-handler.so

else !BUILD_CRASH_HANDLER

install-crash-handler:

endif !BUILD_CRASH_HANDLER

.PHONY: install-crash-handler


# Documentation.
info_TEXINFOS = doc/shepherd.texi
doc_shepherd_TEXINFOS = doc/fdl-1.3.texi

AM_V_HELP2MAN = $(AM_V_HELP2MAN_$(V))
AM_V_HELP2MAN_ = $(AM_V_HELP2MAN_$(AM_DEFAULT_VERBOSITY))
AM_V_HELP2MAN_0 = @echo "  HELP2MAN" $@;

HELP2MANFLAGS = --source=GNU --info-page=$(PACKAGE_TARNAME)
gen_man = $(AM_V_HELP2MAN)LANGUAGE= $(HELP2MAN) $(HELP2MANFLAGS)

doc/shepherd.1: modules/shepherd.scm configure.ac
	$(gen_man) --name="Service manager for the GNU system" \
	--output="$@" "$(top_builddir)/`basename "$@" .1`"

doc/herd.1: modules/shepherd/scripts/herd.scm configure.ac
	$(gen_man) --name="Control the shepherd(1) service manager" \
	--output="$@" "$(top_builddir)/`basename "$@" .1`"

doc/%.8: modules/shepherd/scripts/%.scm configure.ac
	$(gen_man) --section=8 --output="$@"	\
	--include=$(srcdir)/$@.h2m			\
	  "$(top_builddir)/`basename "$@" .8`"

EXTRA_DIST += doc/halt.8.h2m doc/reboot.8.h2m

dist_man1_MANS = doc/shepherd.1 doc/herd.1
dist_man8_MANS = doc/halt.8 doc/reboot.8

# Shell completion files.
dist_bashcompletion_DATA = etc/completion/bash/herd
dist_fishcompletion_DATA = etc/completion/fish/herd.fish

# Things not automatically included in the distribution.
EXTRA_DIST +=					\
  build-aux/config.rpath			\
  ChangeLog-2003				\
  $(templates)					\
  doc/examples/README				\
  doc/examples/awesomeadam.scm			\
  doc/examples/wolfgangj.scm

# Create the socket directory (aka. 'default-socket-dir'.)  Make it
# accessible only by its owner since otherwise 'shepherd' suggests using
# '--insecure'.  This is just a convenience, so allow it to fail.
install-data-local:
	-$(MKDIR_P) $(DESTDIR)$(localstatedir)/run/shepherd
	-chmod 700 $(DESTDIR)$(localstatedir)/run/shepherd

# Relocate the script---i.e., have them refer to the installed module
# directory.
install-exec-hook: install-executable-symlinks install-crash-handler
	for script in							\
	   $(bin_SCRIPTS:%=$(DESTDIR)$(bindir)/%)			\
	   $(sbin_SCRIPTS:%=$(DESTDIR)$(sbindir)/%) ;			\
	do								\
	  $(SED) -e's|$(abs_top_srcdir)/modules\(.*\)%load-path|$(guilemoduledir)\1%load-path|g' \
	         -e's|$(abs_top_builddir)/modules\(.*\)%load-compiled-path|$(guileobjectdir)\1%load-compiled-path|g' \
	         -i $$script ;						\
	done

# Download PO files (translations).
download-po-files:
	for lang in `grep -v '^[[:blank:]]*#' < "$(top_srcdir)/po/LINGUAS"`; do	\
	  if wget -nv -O "$(top_srcdir)/po/$$lang.po.tmp"			\
	    "https://translationproject.org/latest/shepherd/$$lang.po" ;	\
	  then									\
	    mv "$(top_srcdir)/po/$$lang.po"{.tmp,} ;				\
	  else									\
	    rm "$(top_srcdir)/po/$$lang.po.tmp"	;				\
	  fi ;									\
	done

.PHONY: download-po-files

# Install 'shutdown' as a symlink to 'halt; XXX: someday we'll do
# better.
install-executable-symlinks:
	cd $(DESTDIR)$(sbindir); ln -sf halt shutdown

# Remove the 'shutdown' symlink and 'crash-handler.so'.
uninstall-hook:
	cd $(DESTDIR)$(sbindir); rm -f shutdown
	cd $(DESTDIR)$(pkglibdir); rm -f crash-handler.so

# 'sed' expression to instantiate templates.
instantiate =						\
  -e 's,%PREFIX%,${prefix},g'				\
  -e 's,%modsrcdir%,${abs_top_srcdir}/modules,g'	\
  -e 's,%modbuilddir%,${abs_top_builddir}/modules,g'	\
  -e 's,%localstatedir%,${localstatedir},g'		\
  -e 's,%runstatedir%,${runstatedir},g'			\
  -e 's,%pkglibdir%,${pkglibdir},g'			\
  -e 's,%sysconfdir%,${sysconfdir},g'			\
  -e 's,%localedir%,${localedir},g'			\
  -e 's,%VERSION%,@VERSION@,g'				\
  -e 's,%PACKAGE_BUGREPORT%,@PACKAGE_BUGREPORT@,g'	\
  -e 's,%PACKAGE_NAME%,@PACKAGE_NAME@,g'		\
  -e 's,%PACKAGE_URL%,@PACKAGE_URL@,g'			\
  -e 's,%FIBERS_SOURCE_DIRECTORY%,@FIBERS_SOURCE_DIRECTORY@,g' \
  -e 's,%FIBERS_OBJECT_DIRECTORY%,@FIBERS_OBJECT_DIRECTORY@,g' \
  -e 's,%GUILE%,$(GUILE),g'

# Instantiate templates.

# Emit a 'chmod +x' command only if $@ matches one of the scripts.
maybe_executable =					\
   $(subst $@,chmod +x $@,				\
      $(findstring $@,$(bin_SCRIPTS) $(sbin_SCRIPTS)))

%: %.in Makefile
	$(AM_V_GEN)$(MKDIR_P) "`dirname $@`" ;		\
	$(SED) $(instantiate) < $< >$@ ;		\
	$(maybe_executable)

modules/shepherd/config.scm: modules/shepherd/config.scm.in Makefile
	$(MKDIR_P) "`dirname $@`"
	$(SED) $(instantiate) < $< >$@

GUILE_WARNINGS =					\
  -Wformat -Wunbound-variable -Warity-mismatch		\
  -Wmacro-use-before-definition -Wuse-before-definition

AM_V_GUILEC = $(AM_V_GUILEC_$(V))
AM_V_GUILEC_ = $(AM_V_GUILEC_$(AM_DEFAULT_VERBOSITY))
AM_V_GUILEC_0 = @echo "  GUILEC  " $@;

# Make sure 'modules/shepherd/{config,system.scm}' are built first.
# Unset 'GUILE_LOAD_COMPILED_PATH' so we can be sure that any .go file that we
# load comes from the build directory.
# XXX: Use the C locale for when Guile lacks
# <http://git.sv.gnu.org/cgit/guile.git/commit/?h=stable-2.0&id=e2c6bf3866d1186c60bacfbd4fe5037087ee5e3f>.
%.go: %.scm $(templates:%.in=%)
	$(AM_V_GUILEC)$(MKDIR_P) "`dirname "$@"`" ;	\
	$(AM_V_P) && out=1 || out=- ;			\
	unset GUILE_LOAD_COMPILED_PATH ; 		\
	LC_ALL=C GUILE_AUTO_COMPILE=0			\
	$(GUILD) compile --target="$(host)"		\
	  -L "$(top_builddir)/modules"			\
	  -L "$(top_srcdir)/modules"			\
	  $(GUILE_WARNINGS)				\
	  -o "$@" "$<" >&$$out

SUFFIXES = .go

TESTS =						\
  tests/basic.sh				\
  tests/config-failure.sh			\
  tests/dependent-service-stop.sh		\
  tests/starting-status.sh			\
  tests/stopping-status.sh			\
  tests/startup-failure.sh			\
  tests/socket-deletion.sh			\
  tests/replacement.sh				\
  tests/respawn-inhibition.sh			\
  tests/respawn-throttling.sh			\
  tests/restart.sh				\
  tests/misbehaved-client.sh			\
  tests/no-home.sh				\
  tests/pid-file.sh				\
  tests/logging.sh				\
  tests/logging-ENOSPC.sh			\
  tests/logging-failure.sh			\
  tests/file-creation-mask.sh			\
  tests/status-sexp.sh				\
  tests/forking-service.sh			\
  tests/one-shot.sh				\
  tests/transient.sh				\
  tests/inetd.sh				\
  tests/systemd.sh				\
  tests/signals.sh				\
  tests/system-star.sh				\
  tests/daemonize.sh				\
  tests/eval-load.sh				\
  tests/power-off.sh				\
  tests/terminate-before-running.sh		\
  tests/unload.sh				\
  tests/service.scm				\
  tests/services/monitoring.sh			\
  tests/services/repl.sh			\
  tests/services/timer.sh			\
  tests/services/timer-at.sh			\
  tests/services/timer-events.scm		\
  tests/services/log-rotation-internal.scm	\
  tests/services/system-log.sh			\
  tests/services/system-log-internal.scm	\
  tests/services/system-log-self.sh		\
  tests/services/transient.sh

TEST_EXTENSIONS = .sh .scm
EXTRA_DIST += $(TESTS)

AM_TESTS_ENVIRONMENT =				\
  unset XDG_CONFIG_HOME; unset LANGUAGE;	\
  LC_ALL=C LC_MESSAGES=C			\
  PATH="$(abs_top_builddir):$$PATH"		\
  SHELL="$(SHELL)" GUILE="$(GUILE)" CC="$(CC)"	\
  GUILE_LOAD_PATH="$(abs_top_srcdir)/modules:$(abs_top_builddir)/modules:$$GUILE_LOAD_PATH" \
  GUILE_LOAD_COMPILED_PATH="$(abs_top_srcdir)/modules:$(abs_top_builddir)/modules:$$GUILE_LOAD_COMPILED_PATH"

if HAVE_TIMEOUT
# Tests should never take more than a few seconds on modern machines.
SH_LOG_COMPILER = $(TIMEOUT) 3m $(SHELL)
else
SH_LOG_COMPILER = $(SHELL)
endif

AM_SH_LOG_FLAGS = -x -e

SCM_LOG_DRIVER =					\
  $(GUILE) --no-auto-compile -e main			\
      -L "$(top_srcdir)/modules" -L "$(top_srcdir)"	\
      -C "$(top_builddir)/modules"			\
      "$(top_srcdir)/build-aux/test-driver.scm"

AM_SCM_LOG_DRIVER_FLAGS = --brief=no

# Make sure source files are installed first, so that the mtime of
# installed compiled files is greater than that of installed source
# files.  See
# <http://lists.gnu.org/archive/html/guile-devel/2010-07/msg00125.html>
# for details.
shepherd_install_go_files = install-nodist_guileobjectDATA
$(shepherd_install_go_files): install-dist_guilemoduleDATA

shepherdsub_install_go_files = install-nodist_shepherdgosubDATA
$(shepherdsub_install_go_files): install-dist_shepherdsubDATA install-nodist_shepherdsubDATA

scripts_install_go_files = install-nodist_scriptsgoDATA
$(scripts_install_go_files): install-dist_scriptsDATA



# Reproducible tarball.

# Don't embed a timestamp in the gzip header.
override GZIP_ENV = --best --no-name

# Use either the time of last commit, or $SOURCE_DATE_EPOCH, or the Epoch as
# the timestamp for all the files in the tarball.
override am__tar = $${TAR-tar}			\
 --format=ustar					\
 --sort=name					\
 --mode=go=rX,u+rw,a-s				\
 --mtime=@$$(git log -1 --format="%at" || echo $${SOURCE_DATE_EPOCH:-0}) \
 --owner=0 --group=0 --numeric-owner		\
 -cf -						\
 "$$tardir"

SUBDIRS = po

ACLOCAL_AMFLAGS = -I m4