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-03-23 20:07:01 +05:30
|
|
|
CPPFLAGS = -DUSE_PAM
|
2009-11-21 04:25:47 +05:30
|
|
|
CFLAGS ?= -ansi -O2 -fomit-frame-pointer
|
2010-03-23 20:07:01 +05:30
|
|
|
override CFLAGS += -W -Wall -D_GNU_SOURCE
|
2009-09-10 13:58:49 +05:30
|
|
|
STATIC =
|
|
|
|
|
|
|
|
# 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
|
|
|
|
MAN5 = initscript.5 inittab.5
|
|
|
|
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),)
|
|
|
|
BIN += mountpoint
|
|
|
|
SBIN += sulogin bootlogd
|
|
|
|
USRBIN += utmpdump wall
|
2010-02-19 21:21:36 +05:30
|
|
|
MAN1 += utmpdump.1 mountpoint.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
|
|
|
BIN += mountpoint
|
|
|
|
SBIN += sulogin bootlogd
|
|
|
|
MAN1 += mountpoint.1
|
|
|
|
MAN8 += sulogin.8 bootlogd.8
|
|
|
|
endif
|
|
|
|
|
|
|
|
ifeq ($(DISTRO),Owl)
|
|
|
|
USRBIN += wall
|
|
|
|
MAN1 += wall.1
|
|
|
|
endif
|
|
|
|
|
2010-02-19 21:21:36 +05:30
|
|
|
ifeq ($(DISTRO),SuSE)
|
2010-03-23 20:07:01 +05:30
|
|
|
CPPFLAGS+= -DUSE_SYSFS -DSANE_TIO -DSIGINT_ONLYONCE
|
2010-02-19 21:21:36 +05:30
|
|
|
BIN += mountpoint
|
|
|
|
SBIN += sulogin
|
|
|
|
USRBIN += utmpdump
|
|
|
|
MAN1 += utmpdump.1 mountpoint.1
|
|
|
|
MAN8 += sulogin.8
|
|
|
|
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)
|
|
|
|
STRIP = strip -s -R .comment
|
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
|
|
|
|
|
|
|
|
# Additional libs for GNU libc.
|
|
|
|
ifneq ($(findstring -DUSE_PAM,$(CPPFLAGS)),)
|
|
|
|
INITLIBS += -lpam -lpam_misc
|
2009-09-10 13:58:49 +05:30
|
|
|
endif
|
|
|
|
|
|
|
|
# Additional libs for GNU libc.
|
2009-11-24 15:33:19 +05:30
|
|
|
ifneq ($(wildcard /usr/lib*/libcrypt.a),)
|
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)
|
2009-09-10 13:58:49 +05:30
|
|
|
init: init.o init_utmp.o
|
|
|
|
|
|
|
|
halt: halt.o ifdown.o hddown.o utmp.o reboot.h
|
|
|
|
|
|
|
|
last: last.o oldutmp.h
|
|
|
|
|
|
|
|
mesg: mesg.o
|
|
|
|
|
|
|
|
mountpoint: mountpoint.o
|
|
|
|
|
|
|
|
utmpdump: utmpdump.o
|
|
|
|
|
|
|
|
runlevel: runlevel.o
|
|
|
|
|
2010-03-23 20:07:01 +05:30
|
|
|
sulogin: LDLIBS += $(SULOGINLIBS) $(STATIC)
|
2009-09-10 13:58:49 +05:30
|
|
|
sulogin: sulogin.o
|
|
|
|
|
|
|
|
wall: dowall.o wall.o
|
|
|
|
|
|
|
|
shutdown: dowall.o shutdown.o utmp.o reboot.h
|
|
|
|
|
2009-11-21 04:25:47 +05:30
|
|
|
bootlogd: LDLIBS += -lutil
|
2009-09-10 13:58:49 +05:30
|
|
|
bootlogd: bootlogd.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
|
|
|
|
|
2009-11-21 04:25:47 +05:30
|
|
|
init.o: CPPFLAGS += $(SELINUX_DEF)
|
2009-09-10 13:58:49 +05:30
|
|
|
init.o: init.c init.h set.h reboot.h initreq.h
|
|
|
|
|
|
|
|
utmp.o: utmp.c init.h
|
|
|
|
|
2009-11-21 04:25:47 +05:30
|
|
|
init_utmp.o: CPPFLAGS += -DINIT_MAIN
|
2009-09-10 13:58:49 +05:30
|
|
|
init_utmp.o: utmp.c init.h
|
2009-11-21 04:25:47 +05:30
|
|
|
$(CC) $(CFLAGS) $(CPPFLAGS) -c -o $@ $<
|
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 \
|
|
|
|
$(STRIP) $$i ; \
|
|
|
|
$(INSTALL_EXEC) $$i $(ROOT)/bin/ ; \
|
|
|
|
done
|
|
|
|
for i in $(SBIN); do \
|
|
|
|
$(STRIP) $$i ; \
|
|
|
|
$(INSTALL_EXEC) $$i $(ROOT)/sbin/ ; \
|
|
|
|
done
|
|
|
|
for i in $(USRBIN); do \
|
|
|
|
$(STRIP) $$i ; \
|
|
|
|
$(INSTALL_EXEC) $$i $(ROOT)/usr/bin/ ; \
|
|
|
|
done
|
|
|
|
# $(INSTALL_EXEC) etc/initscript.sample $(ROOT)/etc/
|
|
|
|
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/
|
2009-09-10 13:58:49 +05:30
|
|
|
for i in $(MAN1); do \
|
|
|
|
$(INSTALL_DATA) ../man/$$i $(ROOT)$(MANDIR)/man1/; \
|
|
|
|
done
|
|
|
|
for i in $(MAN5); do \
|
|
|
|
$(INSTALL_DATA) ../man/$$i $(ROOT)$(MANDIR)/man5/; \
|
|
|
|
done
|
|
|
|
for i in $(MAN8); do \
|
|
|
|
$(INSTALL_DATA) ../man/$$i $(ROOT)$(MANDIR)/man8/; \
|
|
|
|
done
|
|
|
|
ifeq ($(ROOT),)
|
|
|
|
#
|
|
|
|
# This part is skipped on Debian systems, the
|
|
|
|
# debian.preinst script takes care of it.
|
|
|
|
@if [ ! -p /dev/initctl ]; then \
|
|
|
|
echo "Creating /dev/initctl"; \
|
|
|
|
rm -f /dev/initctl; \
|
|
|
|
mknod -m 600 /dev/initctl p; fi
|
|
|
|
endif
|