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
|
.include "defaults.mk"
.include "/etc/mrc.mk"
.export
OTHER_TARGETS:=_service _earlyservice
STARTER?=svc
.for starter in ${:!find /etc/mrc -name '*.starter.mk'!:S/\/etc\/mrc\///}
.include "${starter}"
.endfor
.if !target(_service) || !target(_earlyservice)
.error No service handler defined.
.endif
.SILENT:
install:
install rc /etc/rc
SCRIPTS=${:!find /etc/mrc -name '*.service.mk'!:S/\/etc\/mrc\///}
TARGETS:=${SCRIPTS:S/.service.mk//}
.if defined(AUTOBOOT)
.include "init.mk"
.ERROR:
: ERROR: ABORTING BOOT (sending SIGTERM to parent)!
: target ${.ERROR_TARGET} failed to execute:
: ${.ERROR_CMD}
kill 1
.else
DAEMON: NETWORK SERVERS
LOGIN: DAEMON
NETWORK:
SERVERS:
SERVICE:
mount:
root:
netif:
newsyslog:
.endif
test:
echo Empty target.
.for file in ${SCRIPTS}
#.info ${file}
.include "${file}"
.if !target(${file:S/.service.mk//})
${file:S/.service.mk//}: _service
.endif
.if !target(${file:S/.service.mk/_status/})
${file:S/.service.mk/_status/}: _status
.endif
.if !target(${file:S/.service.mk/_restart/})
${file:S/.service.mk/_restart/}: _restart
.endif
.endfor
.MAIN: ${TARGETS}
.PHONY: ${TARGETS} ${OTHER_TARGETS}
.undef TARGETS OTHER_TARGETS SCRIPTS
ENABLED=${:!env!:C/=.*//:M*_ENABLE}
.for var in ${ENABLED}
.if !empty(${var}:tl:Mno)
#.info ${var}
.undef ${var}
.endif
.endfor
.undef ENABLED
.unexport-env
.export
#.info ${:!env!}
|
>
|
<
<
|
<
<
<
<
<
>
|
<
<
<
<
<
<
<
<
<
<
<
<
>
|
<
|
>
>
|
|
|
>
>
|
|
|
>
>
|
|
|
>
>
|
|
<
|
|
|
|
|
|
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
|
.include "defaults.mk"
.include "order.mk"
.include "/etc/mrc.mk"
.export
OTHER_TARGETS:=
.include "starter.mk"
.SILENT:
install:
install rc /etc/rc
install rc.shutdown /etc/rc.shutdown
SCRIPTS:=${:!find /etc/mrc -name '*.service.mk'!:S/^\/etc\/mrc\///:S/.service.mk$//}
.if defined(AUTOBOOT)
.include "init.mk"
.ERROR:
: ERROR: ABORTING BOOT (sending SIGTERM to parent)!
: target ${.ERROR_TARGET} failed to execute:
: ${.ERROR_CMD}
kill 1
.endif
test:
echo Empty target.
# Create service targets
.for service in ${SCRIPTS}
. include "${service}.service.mk"
# Service creation targets
. if !target(${service})
${service}: ${_SERVICE}
. endif
# Service creation targets
. if !target(${service}_status)
${service}_status: ${_SERVICE_STATUS}
. endif
# Service exit targets
. if !target(${service}_exit)
${service}_exit: ${_SERVICE_EXIT}
. endif
DAEMON_EXIT: ${service}_exit
.endfor
.MAIN: ${SCRIPTS} ${TARGETS}
.PHONY: ${SCRIPTS} ${OTHER_TARGETS} ${TARGETS}
.undef OTHER_TARGETS SCRIPTS TARGETS
ENABLED:=${:!env!:C/=.*//:M*_ENABLE}
.for var in ${ENABLED}
. if !empty(${var}:tl:Mno)
#.info ${var}
. undef ${var}
. endif
.endfor
.undef ENABLED
.unexport-env
.export
#.info ${:!env!}
|