aboutsummaryrefslogtreecommitdiff
path: root/src/rc/Makefile
blob: 15d073337ec205e9be7e711f05e3b47573158112 (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
PROG=		rc
SRCS=		checkpath.c fstabinfo.c mountinfo.c \
		rc-applets.c rc-depend.c rc-logger.c \
		rc-misc.c rc-plugin.c rc-status.c rc-update.c rc.c \
		runscript.c start-stop-daemon.c

CLEANFILES=	version.h

LDFLAGS+=	-L../librc -L../libeinfo
LDADD+=		-lutil -lrc -leinfo
CFLAGS+=	-I../includes -I../librc -I../libeinfo

BINDIR?=	/sbin

LINKDIR=	${LIBNAME}/${PROG}
BINLINKS=	rc-status
SBINLINKS=	rc-update runscript start-stop-daemon
RC_BINLINKS=	einfon einfo ewarnn ewarn eerrorn eerror ebegin eend ewend \
		eindent eoutdent esyslog eval_ecolors \
		veinfo vewarn vebegin veend vewend veindent veoutdent \
		service_starting service_started \
		service_stopping service_stopped \
		service_inactive service_wasinactive \
		service_coldplugged service_started_daemon \
		checkpath fstabinfo mountinfo rc-depend \
		service_get_value service_set_value get_options save_options \
		shell_var is_newer_than is_older_than
RC_SBINLINKS=	mark_service_starting mark_service_started \
		mark_service_stopping mark_service_stopped \
		mark_service_inactive mark_service_wasinactive \
		mark_service_coldplugged mark_service_failed \
		rc-abort

MK=		../../mk
include ${MK}/os.mk
CFLAGS+=	-DLIB=\"${LIBNAME}\"
include ${MK}/cc.mk
include ${MK}/prog.mk

include ${MK}/${MKTERMCAP}.mk
LDADD+=		${LIBDL} ${LIBKVM}
include ${MK}/${MKPAM}.mk

${SRCS}: version.h
version.h:
	sed -n -e 's/^VERSION=[[:space:]]*\([^[:space:]]*\).*/#define VERSION "\1\"/p' ../../Makefile > version.h
	if test -n "${BRANDING}"; then \
		echo "#define BRANDING \"${BRANDING}\"" >> version.h; \
	fi

install: all
	${INSTALL} -d ${DESTDIR}${BINDIR}
	${INSTALL} -m ${BINMODE} ${PROG} ${DESTDIR}${BINDIR}
	${INSTALL} -d ${DESTDIR}/bin
	for x in ${BINLINKS}; do ln -fs ${BINDIR}/${PROG} ${DESTDIR}/bin/$$x; done
	${INSTALL} -d ${DESTDIR}/bin
	for x in ${SBINLINKS}; do ln -fs ${PROG} ${DESTDIR}${BINDIR}/$$x; done
	${INSTALL} -d ${DESTDIR}/${LIBNAME}/${PROG}/bin
	for x in $(RC_BINLINKS); do ln -fs ${BINDIR}/${PROG} $(DESTDIR)/${LIBNAME}/${PROG}/bin/$$x; done
	${INSTALL} -d ${DESTDIR}/${LIBNAME}/${PROG}/sbin
	for x in ${RC_SBINLINKS}; do ln -fs ${BINDIR}/${PROG} ${DESTDIR}/${LIBNAME}/${PROG}/sbin/$$x; done
	if test "${MKPAM}" = pam; then \
		${INSTALL} -d ${DESTDIR}${PAMDIR}; \
		${INSTALL} -m ${PAMMODE} start-stop-daemon.pam ${DESTDIR}${PAMDIR}/start-stop-daemon; \
	fi

ALL_LINKS = $(BINLINKS) $(SBINLINKS) $(RC_BINLINKS) $(RC_SBINLINKS)
CLEANFILES += $(ALL_LINKS)
links: rc
	for l in $(ALL_LINKS) ; do ln -sf rc $$l || exit $$? ; done