openrc/src/rc/Makefile

96 lines
3.1 KiB
Makefile
Raw Normal View History

PROG= openrc
SRCS= checkpath.c fstabinfo.c mountinfo.c start-stop-daemon.c \
rc-applets.c rc-depend.c rc-logger.c \
rc-misc.c rc-plugin.c rc-service.c rc-status.c rc-update.c \
runscript.c rc.c swclock.c
2008-01-05 20:49:48 +00:00
2008-01-07 09:39:44 +00:00
CLEANFILES= version.h
2008-01-05 20:49:48 +00:00
BINDIR= ${PREFIX}/bin
SBINDIR= ${PREFIX}/sbin
LINKDIR= ${LIBEXECDIR}
2008-01-05 20:49:48 +00:00
2008-01-07 09:39:44 +00:00
BINLINKS= rc-status
SBINLINKS= rc rc-service rc-update openrc-run runscript service \
start-stop-daemon
2008-01-05 20:49:48 +00:00
RC_BINLINKS= einfon einfo ewarnn ewarn eerrorn eerror ebegin eend ewend \
eindent eoutdent esyslog eval_ecolors ewaitfile \
2008-01-07 09:39:44 +00:00
veinfo vewarn vebegin veend vewend veindent veoutdent \
service_starting service_started \
service_stopping service_stopped \
service_inactive service_wasinactive \
service_hotplugged service_started_daemon service_crashed \
2008-01-07 09:39:44 +00:00
checkpath fstabinfo mountinfo rc-depend \
service_get_value service_set_value get_options save_options \
shell_var is_newer_than is_older_than
2008-01-05 20:49:48 +00:00
RC_SBINLINKS= mark_service_starting mark_service_started \
2008-01-07 09:39:44 +00:00
mark_service_stopping mark_service_stopped \
mark_service_inactive mark_service_wasinactive \
mark_service_hotplugged mark_service_failed \
rc-abort swclock
2008-03-03 13:04:08 +00:00
ALL_LINKS= ${BINLINKS} ${SBINLINKS} ${RC_BINLINKS} ${RC_SBINLINKS}
CLEANFILES+= ${ALL_LINKS}
2008-01-05 20:49:48 +00:00
CPPFLAGS+= -I../includes -I../librc -I../libeinfo
LDFLAGS+= -L../librc -L../libeinfo
LDADD+= -lutil -lrc -leinfo
2008-02-02 13:00:01 +00:00
2009-10-08 00:19:18 +01:00
include ../../Makefile.inc
MK= ../../mk
include ${MK}/prog.mk
include ${MK}/git.mk
include ${MK}/cc.mk
include ${MK}/termcap.mk
2008-01-07 09:39:44 +00:00
LDADD+= ${LIBDL} ${LIBKVM}
include ${MK}/pam.mk
2008-01-05 20:49:48 +00:00
# create symlinks to rc if not an SELINUX system, otherwise create a wrapper
# script to call rc with the proper name of the applet to execute.
# $1 is a list of the links
# $2 is the path+name of the target to link to (usually 'rc' or '/sbin/rc')
# $3 is the path where the links are created
define make-links
for x in $(1); do \
if [ "${MKSELINUX}" = yes ]; then \
printf '#!/bin/sh\nexec ${2} --applet %s "$$@"\n' $$x >${3}/$$x; \
chmod ${BINMODE} ${3}/$$x; \
else \
ln -sf ${2} ${3}/$$x; \
fi; \
done;
endef
2008-01-09 11:44:43 +00:00
${SRCS}: version.h
2009-10-16 08:13:34 +01:00
.PHONY: version.h.tmp
version.h.tmp:
echo "#define VERSION \"${VERSION}${GITVER}\"" >$@
2008-01-05 20:49:48 +00:00
if test -n "${BRANDING}"; then \
2009-10-16 08:13:34 +01:00
echo "#define BRANDING \"${BRANDING}\"" >> $@; \
2008-01-05 20:49:48 +00:00
fi
2009-10-16 08:13:34 +01:00
version.h: version.h.tmp
cmp -s $@.tmp $@ && rm $@.tmp || mv $@.tmp $@
install: all
${INSTALL} -d ${DESTDIR}${SBINDIR}
${INSTALL} -m ${BINMODE} ${PROG} ${DESTDIR}${SBINDIR}
2008-01-05 20:49:48 +00:00
${INSTALL} -d ${DESTDIR}${BINDIR}
$(call make-links,${BINLINKS},${SBINDIR}/${PROG},${DESTDIR}${BINDIR})
${INSTALL} -d ${DESTDIR}${SBINDIR}
$(call make-links,${SBINLINKS},${SBINDIR}/${PROG},${DESTDIR}${SBINDIR})
${INSTALL} -d ${DESTDIR}${LINKDIR}/bin
$(call make-links,${RC_BINLINKS},${SBINDIR}/${PROG},${DESTDIR}${LINKDIR}/bin)
${INSTALL} -d ${DESTDIR}${LINKDIR}/sbin
$(call make-links, ${RC_SBINLINKS},${SBINDIR}/${PROG},${DESTDIR}${LINKDIR}/sbin)
2008-01-13 10:21:22 +00:00
if test "${MKPAM}" = pam; then \
2008-01-05 20:54:34 +00:00
${INSTALL} -d ${DESTDIR}${PAMDIR}; \
2008-01-09 11:44:43 +00:00
${INSTALL} -m ${PAMMODE} start-stop-daemon.pam ${DESTDIR}${PAMDIR}/start-stop-daemon; \
2008-01-05 20:49:48 +00:00
fi
2008-01-14 05:32:39 +00:00
2008-03-24 06:10:40 +00:00
check test::
links: $PROG
$(call make-links,${ALL_LINKS},$PROG,.)