2009-09-10 13:58:49 +05:30
|
|
|
#
|
|
|
|
# Makefile Makefile for the systemV init suite.
|
|
|
|
# Targets: all compiles everything
|
|
|
|
# install installs the binaries (not the scripts)
|
|
|
|
# clean cleans up object files
|
|
|
|
# clobber really cleans up
|
|
|
|
#
|
|
|
|
# Version: @(#)Makefile 2.85-13 23-Mar-2004 miquels@cistron.nl
|
|
|
|
#
|
|
|
|
|
2010-04-01 14:36:35 +05:30
|
|
|
CPPFLAGS =
|
2018-06-22 04:04:25 +05:30
|
|
|
CFLAGS ?= -O2
|
2018-07-02 03:14:57 +05:30
|
|
|
override CFLAGS += -ansi -fomit-frame-pointer -fstack-protector-strong -W -Wall -Wunreachable-code -Wformat -Werror=format-security -D_FORTIFY_SOURCE=2 -D_XOPEN_SOURCE -D_GNU_SOURCE -DVERSION=\"$(VERSION)\"
|
2018-02-21 04:56:09 +05:30
|
|
|
override CFLAGS += $(shell getconf LFS_CFLAGS)
|
2009-09-10 13:58:49 +05:30
|
|
|
STATIC =
|
2011-04-27 19:11:04 +05:30
|
|
|
MANDB := s@^\('\\\\\"\)[^\*-]*-\*- coding: [^[:blank:]]\+ -\*-@\1@
|
2009-09-10 13:58:49 +05:30
|
|
|
|
2011-07-01 19:26:45 +05:30
|
|
|
#
|
|
|
|
# Leave empty if the mountpoint(1) command from util-linux 2.20
|
|
|
|
# and above should be used, otherwise set it to yes.
|
|
|
|
#
|
|
|
|
MNTPOINT=
|
|
|
|
|
2009-09-10 13:58:49 +05:30
|
|
|
# For some known distributions we do not build all programs, otherwise we do.
|
|
|
|
BIN =
|
2010-03-23 20:07:01 +05:30
|
|
|
SBIN = init halt shutdown runlevel killall5 fstab-decode
|
2009-09-10 13:58:49 +05:30
|
|
|
USRBIN = last mesg
|
|
|
|
|
|
|
|
MAN1 = last.1 lastb.1 mesg.1
|
2018-04-15 03:49:18 +05:30
|
|
|
MAN5 = initscript.5 inittab.5 initctl.5
|
2009-09-10 13:58:49 +05:30
|
|
|
MAN8 = halt.8 init.8 killall5.8 pidof.8 poweroff.8 reboot.8 runlevel.8
|
2010-03-23 20:07:01 +05:30
|
|
|
MAN8 += shutdown.8 telinit.8 fstab-decode.8
|
2009-09-10 13:58:49 +05:30
|
|
|
|
|
|
|
ifeq ($(DISTRO),)
|
|
|
|
SBIN += sulogin bootlogd
|
|
|
|
USRBIN += utmpdump wall
|
2011-07-01 19:26:45 +05:30
|
|
|
MAN1 += utmpdump.1 wall.1
|
2009-09-10 13:58:49 +05:30
|
|
|
MAN8 += sulogin.8 bootlogd.8
|
|
|
|
endif
|
|
|
|
|
|
|
|
ifeq ($(DISTRO),Debian)
|
2010-03-23 20:07:01 +05:30
|
|
|
CPPFLAGS+= -DACCTON_OFF
|
2009-09-10 13:58:49 +05:30
|
|
|
SBIN += sulogin bootlogd
|
|
|
|
MAN8 += sulogin.8 bootlogd.8
|
2011-04-27 19:11:04 +05:30
|
|
|
MANDB :=
|
2009-09-10 13:58:49 +05:30
|
|
|
endif
|
|
|
|
|
|
|
|
ifeq ($(DISTRO),Owl)
|
|
|
|
USRBIN += wall
|
|
|
|
MAN1 += wall.1
|
2011-04-27 19:11:04 +05:30
|
|
|
MANDB :=
|
2009-09-10 13:58:49 +05:30
|
|
|
endif
|
|
|
|
|
2010-02-19 21:21:36 +05:30
|
|
|
ifeq ($(DISTRO),SuSE)
|
2010-03-30 23:09:19 +05:30
|
|
|
CPPFLAGS+= -DUSE_SYSFS -DSANE_TIO -DSIGINT_ONLYONCE -DUSE_ONELINE
|
2010-02-19 21:21:36 +05:30
|
|
|
SBIN += sulogin
|
|
|
|
USRBIN += utmpdump
|
2011-07-01 19:26:45 +05:30
|
|
|
MAN1 += utmpdump.1
|
2010-02-19 21:21:36 +05:30
|
|
|
MAN8 += sulogin.8
|
2011-04-27 19:11:04 +05:30
|
|
|
MANDB :=
|
2010-02-19 21:21:36 +05:30
|
|
|
endif
|
|
|
|
|
2011-07-01 19:26:45 +05:30
|
|
|
ifeq ($(MNTPOINT),yes)
|
|
|
|
BIN += mountpoint
|
|
|
|
MAN1 += mountpoint.1
|
|
|
|
endif
|
|
|
|
|
2010-03-23 20:07:01 +05:30
|
|
|
ID = $(shell id -u)
|
2009-09-10 13:58:49 +05:30
|
|
|
BIN_OWNER = root
|
|
|
|
BIN_GROUP = root
|
|
|
|
BIN_COMBO = $(BIN_OWNER):$(BIN_GROUP)
|
2010-03-23 20:07:01 +05:30
|
|
|
ifeq ($(ID),0)
|
|
|
|
INSTALL_EXEC = install -o $(BIN_OWNER) -g $(BIN_GROUP) -m 755
|
|
|
|
INSTALL_DATA = install -o $(BIN_OWNER) -g $(BIN_GROUP) -m 644
|
|
|
|
else
|
|
|
|
INSTALL_EXEC = install -m 755
|
|
|
|
INSTALL_DATA = install -m 644
|
|
|
|
endif
|
2009-11-21 04:25:47 +05:30
|
|
|
INSTALL_DIR = install -m 755 -d
|
2009-09-10 13:58:49 +05:30
|
|
|
MANDIR = /usr/share/man
|
|
|
|
|
|
|
|
ifeq ($(WITH_SELINUX),yes)
|
2010-03-23 20:07:01 +05:30
|
|
|
SELINUX_DEF = -DWITH_SELINUX
|
|
|
|
INITLIBS += -lsepol -lselinux
|
|
|
|
SULOGINLIBS = -lselinux
|
2009-09-10 13:58:49 +05:30
|
|
|
else
|
2010-03-23 20:07:01 +05:30
|
|
|
SELINUX_DEF =
|
|
|
|
INITLIBS =
|
|
|
|
SULOGINLIBS =
|
|
|
|
endif
|
|
|
|
|
2009-09-10 13:58:49 +05:30
|
|
|
# Additional libs for GNU libc.
|
2014-01-26 03:27:25 +05:30
|
|
|
ifneq ($(wildcard /usr/lib*/libcrypt.*),)
|
|
|
|
SULOGINLIBS += -lcrypt
|
|
|
|
endif
|
|
|
|
|
|
|
|
# Additional libs for GNU libc / multiarch on Debian based systems.
|
|
|
|
ifneq ($(wildcard /usr/lib/*/libcrypt.*),)
|
2010-03-23 20:07:01 +05:30
|
|
|
SULOGINLIBS += -lcrypt
|
2009-09-10 13:58:49 +05:30
|
|
|
endif
|
|
|
|
|
|
|
|
all: $(BIN) $(SBIN) $(USRBIN)
|
|
|
|
|
2009-11-21 04:25:47 +05:30
|
|
|
#%: %.o
|
|
|
|
# $(CC) $(CFLAGS) $(LDFLAGS) -o $@ $^ $(LDLIBS)
|
|
|
|
#%.o: %.c
|
|
|
|
# $(CC) $(CFLAGS) $(CPPFLAGS) -c $^ -o $@
|
|
|
|
|
2010-03-23 20:07:01 +05:30
|
|
|
init: LDLIBS += $(INITLIBS) $(STATIC)
|
2018-07-08 04:49:03 +05:30
|
|
|
init: init.o init_utmp.o runlevellog.o
|
2009-09-10 13:58:49 +05:30
|
|
|
|
2014-01-29 03:41:34 +05:30
|
|
|
halt: LDLIBS += $(STATIC)
|
2018-07-08 04:49:03 +05:30
|
|
|
halt: halt.o ifdown.o hddown.o utmp.o runlevellog.o
|
2009-09-10 13:58:49 +05:30
|
|
|
|
2014-01-29 03:41:34 +05:30
|
|
|
last: LDLIBS += $(STATIC)
|
2010-05-04 13:20:12 +05:30
|
|
|
last: last.o
|
2009-09-10 13:58:49 +05:30
|
|
|
|
2014-01-29 03:41:34 +05:30
|
|
|
mesg: LDLIBS += $(STATIC)
|
2009-09-10 13:58:49 +05:30
|
|
|
mesg: mesg.o
|
|
|
|
|
2014-01-29 03:41:34 +05:30
|
|
|
mountpoint: LDLIBS += $(STATIC)
|
2009-09-10 13:58:49 +05:30
|
|
|
mountpoint: mountpoint.o
|
|
|
|
|
2014-01-29 03:41:34 +05:30
|
|
|
utmpdump: LDLIBS += $(STATIC)
|
2009-09-10 13:58:49 +05:30
|
|
|
utmpdump: utmpdump.o
|
|
|
|
|
2014-01-29 03:41:34 +05:30
|
|
|
runlevel: LDLIBS += $(STATIC)
|
2018-07-08 03:19:04 +05:30
|
|
|
runlevel: runlevel.o runlevellog.o
|
2009-09-10 13:58:49 +05:30
|
|
|
|
2010-03-23 20:07:01 +05:30
|
|
|
sulogin: LDLIBS += $(SULOGINLIBS) $(STATIC)
|
2011-04-04 19:27:54 +05:30
|
|
|
sulogin: sulogin.o consoles.o
|
2009-09-10 13:58:49 +05:30
|
|
|
|
2014-01-29 03:41:34 +05:30
|
|
|
wall: LDLIBS += $(STATIC)
|
2009-09-10 13:58:49 +05:30
|
|
|
wall: dowall.o wall.o
|
|
|
|
|
2014-01-29 03:41:34 +05:30
|
|
|
shutdown: LDLIBS += $(STATIC)
|
2010-05-04 13:20:12 +05:30
|
|
|
shutdown: dowall.o shutdown.o utmp.o
|
2009-09-10 13:58:49 +05:30
|
|
|
|
2014-01-29 03:41:34 +05:30
|
|
|
bootlogd: LDLIBS += -lutil $(STATIC)
|
2009-09-10 13:58:49 +05:30
|
|
|
bootlogd: bootlogd.o
|
|
|
|
|
2014-01-29 03:41:34 +05:30
|
|
|
fstab-decode: LDLIBS += $(STATIC)
|
|
|
|
fstab-decode: fstab-decode.o
|
|
|
|
|
2009-11-21 04:25:47 +05:30
|
|
|
sulogin.o: CPPFLAGS += $(SELINUX_DEF)
|
2009-09-10 13:58:49 +05:30
|
|
|
sulogin.o: sulogin.c
|
|
|
|
|
2018-07-08 03:19:04 +05:30
|
|
|
runlevellog.o: runlevellog.h runlevellog.c paths.h
|
|
|
|
|
2009-11-21 04:25:47 +05:30
|
|
|
init.o: CPPFLAGS += $(SELINUX_DEF)
|
2018-07-08 04:49:03 +05:30
|
|
|
init.o: init.c init.h initreq.h paths.h reboot.h runlevellog.h runlevellog.c set.h paths.h
|
2009-09-10 13:58:49 +05:30
|
|
|
|
2010-05-04 13:20:12 +05:30
|
|
|
utmp.o:
|
2009-09-10 13:58:49 +05:30
|
|
|
|
2009-11-21 04:25:47 +05:30
|
|
|
init_utmp.o: CPPFLAGS += -DINIT_MAIN
|
2010-05-04 13:20:12 +05:30
|
|
|
init_utmp.o: utmp.c init.h initreq.h paths.h
|
2009-11-21 04:25:47 +05:30
|
|
|
$(CC) $(CFLAGS) $(CPPFLAGS) -c -o $@ $<
|
2009-09-10 13:58:49 +05:30
|
|
|
|
2010-05-04 13:20:12 +05:30
|
|
|
utmpdump.o: utmpdump.c oldutmp.h
|
|
|
|
|
|
|
|
shutdown.o: shutdown.c paths.h reboot.h initreq.h init.h
|
|
|
|
|
2018-07-08 04:49:03 +05:30
|
|
|
halt.o: halt.c reboot.h paths.h runlevellog.c runlevellog.h
|
2010-05-04 13:20:12 +05:30
|
|
|
|
|
|
|
last.o: last.c oldutmp.h
|
|
|
|
|
2011-03-11 22:59:36 +05:30
|
|
|
consoles.o: consoles.c consoles.h
|
|
|
|
|
2009-09-10 13:58:49 +05:30
|
|
|
cleanobjs:
|
|
|
|
rm -f *.o *.bak
|
|
|
|
|
|
|
|
clean: cleanobjs
|
|
|
|
@echo Type \"make clobber\" to really clean up.
|
|
|
|
|
|
|
|
clobber: cleanobjs
|
|
|
|
rm -f $(BIN) $(SBIN) $(USRBIN)
|
|
|
|
|
|
|
|
distclean: clobber
|
|
|
|
|
|
|
|
install:
|
2009-11-21 04:25:47 +05:30
|
|
|
$(INSTALL_DIR) $(ROOT)/bin/ $(ROOT)/sbin/
|
|
|
|
$(INSTALL_DIR) $(ROOT)/usr/bin/
|
2009-09-10 13:58:49 +05:30
|
|
|
for i in $(BIN); do \
|
|
|
|
$(INSTALL_EXEC) $$i $(ROOT)/bin/ ; \
|
|
|
|
done
|
|
|
|
for i in $(SBIN); do \
|
|
|
|
$(INSTALL_EXEC) $$i $(ROOT)/sbin/ ; \
|
|
|
|
done
|
|
|
|
for i in $(USRBIN); do \
|
|
|
|
$(INSTALL_EXEC) $$i $(ROOT)/usr/bin/ ; \
|
|
|
|
done
|
2010-03-26 22:01:05 +05:30
|
|
|
# $(INSTALL_DIR) $(ROOT)/etc/
|
2018-02-21 05:06:21 +05:30
|
|
|
# $(INSTALL_EXEC) ../doc/initscript.sample $(ROOT)/etc/
|
2009-09-10 13:58:49 +05:30
|
|
|
ln -sf halt $(ROOT)/sbin/reboot
|
|
|
|
ln -sf halt $(ROOT)/sbin/poweroff
|
|
|
|
ln -sf init $(ROOT)/sbin/telinit
|
|
|
|
ln -sf /sbin/killall5 $(ROOT)/bin/pidof
|
|
|
|
if [ ! -f $(ROOT)/usr/bin/lastb ]; then \
|
|
|
|
ln -sf last $(ROOT)/usr/bin/lastb; \
|
|
|
|
fi
|
2009-11-21 04:25:47 +05:30
|
|
|
$(INSTALL_DIR) $(ROOT)/usr/include/
|
2009-09-10 13:58:49 +05:30
|
|
|
$(INSTALL_DATA) initreq.h $(ROOT)/usr/include/
|
2009-11-21 04:25:47 +05:30
|
|
|
$(INSTALL_DIR) $(ROOT)$(MANDIR)/man1/
|
|
|
|
$(INSTALL_DIR) $(ROOT)$(MANDIR)/man5/
|
|
|
|
$(INSTALL_DIR) $(ROOT)$(MANDIR)/man8/
|
2011-04-27 19:11:04 +05:30
|
|
|
for man in $(MAN1); do \
|
|
|
|
$(INSTALL_DATA) ../man/$$man $(ROOT)$(MANDIR)/man1/; \
|
|
|
|
sed -i "1{ $(MANDB); }" $(ROOT)$(MANDIR)/man1/$$man ; \
|
2009-09-10 13:58:49 +05:30
|
|
|
done
|
2011-04-27 19:11:04 +05:30
|
|
|
for man in $(MAN5); do \
|
|
|
|
$(INSTALL_DATA) ../man/$$man $(ROOT)$(MANDIR)/man5/; \
|
|
|
|
sed -i "1{ $(MANDB); }" $(ROOT)$(MANDIR)/man5/$$man ; \
|
2009-09-10 13:58:49 +05:30
|
|
|
done
|
2011-04-27 19:11:04 +05:30
|
|
|
for man in $(MAN8); do \
|
|
|
|
$(INSTALL_DATA) ../man/$$man $(ROOT)$(MANDIR)/man8/; \
|
|
|
|
sed -i "1{ $(MANDB); }" $(ROOT)$(MANDIR)/man8/$$man ; \
|
2009-09-10 13:58:49 +05:30
|
|
|
done
|
|
|
|
ifeq ($(ROOT),)
|
|
|
|
#
|
|
|
|
# This part is skipped on Debian systems, the
|
|
|
|
# debian.preinst script takes care of it.
|
2018-02-21 04:59:08 +05:30
|
|
|
@if [ ! -p /run/initctl ]; then \
|
|
|
|
echo "Creating /run/initctl"; \
|
|
|
|
rm -f /run/initctl; \
|
|
|
|
mknod -m 600 /run/initctl p; fi
|
2009-09-10 13:58:49 +05:30
|
|
|
endif
|