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 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107
|
#
# Makefile Makefile for the systemV init suite.
# Targets: all compiles everything
# install installs the binaries (not the scripts)
# clean cleans up
#
# Version: @(#)Makefile 2.72 06-Jul-1997 MvS
#
CC = cc
CFLAGS = -Wall -O2 -D_GNU_SOURCE
LDFLAGS = -s
#CFLAGS = -Wall -g -pg -D_GNU_SOURCE
#LDFLAGS = -pg
STATIC =
# Use the first 2 lines to build all of the programs (some are non-debian).
# PROGS = init halt shutdown killall5 runlevel sulogin utmpdump \
# last mesg wall
PROGS = init halt shutdown killall5 runlevel sulogin last mesg
BIN_OWNER = root
BIN_GROUP = root
BIN_COMBO = $(BIN_OWNER).$(BIN_GROUP)
INSTALL = install -o $(BIN_OWNER) -g $(BIN_GROUP)
# Additional libs for Gnu Libc
ifneq ($(wildcard /usr/lib/libcrypt.a),)
LCRYPT = -lcrypt
endif
#ifneq ($(wildcard /usr/lib/libutil.a),)
#LUTIL = -lutil
#endif
all: $(PROGS)
init: init.o init_utmp.o
$(CC) $(LDFLAGS) $(STATIC) -o $@ init.o init_utmp.o $(LUTIL)
halt: halt.o ifdown.o utmp.o reboot.h
$(CC) $(LDFLAGS) -o $@ halt.o ifdown.o utmp.o $(LUTIL)
last: last.o oldutmp.h
$(CC) $(LDFLAGS) -o $@ last.o
mesg: mesg.o
$(CC) $(LDFLAGS) -o $@ mesg.o
utmpdump: utmpdump.o
$(CC) $(LDFLAGS) -o $@ utmpdump.o
runlevel: runlevel.o
$(CC) $(LDFLAGS) -o $@ runlevel.o
sulogin: sulogin.o
$(CC) $(LDFLAGS) $(STATIC) -o $@ sulogin.o $(LCRYPT)
wall: dowall.o wall.o
$(CC) $(LDFLAGS) -o $@ dowall.o wall.o
shutdown: dowall.o shutdown.o utmp.o reboot.h
$(CC) $(LDFLAGS) -o $@ dowall.o shutdown.o utmp.o $(LUTIL)
init.o: init.c init.h set.h reboot.h
$(CC) -c $(CFLAGS) init.c
utmp.o: utmp.c init.h
$(CC) -c $(CFLAGS) utmp.c
init_utmp.o: utmp.c init.h
$(CC) -c $(CFLAGS) -DINIT_MAIN utmp.c -o init_utmp.o
cleanobjs:
rm -f *.o *.bak
clean: cleanobjs
@echo Type \"make clobber\" to really clean up.
clobber: cleanobjs
rm -f $(PROGS)
install:
$(INSTALL) -m 755 halt init killall5 sulogin \
runlevel shutdown $(ROOT)/sbin
# These are not installed by default
# $(INSTALL) -m 555 utmpdump wall $(ROOT)/usr/bin
# $(INSTALL) -m 755 etc/initscript.sample $(ROOT)/etc
$(INSTALL) -m 755 mesg last $(ROOT)/usr/bin
cd $(ROOT)/usr/bin; ln -sf last lastb; chown $(BIN_COMBO) lastb
cd $(ROOT)/sbin; ln -sf halt reboot; chown $(BIN_COMBO) reboot
cd $(ROOT)/sbin; ln -sf halt poweroff; chown $(BIN_COMBO) poweroff
cd $(ROOT)/sbin; ln -sf killall5 pidof; chown $(BIN_COMBO) pidof
cd $(ROOT)/sbin; ln -sf init telinit; chown $(BIN_COMBO) telinit
$(INSTALL) -m 644 initreq.h $(ROOT)/usr/include
$(INSTALL) -m 644 ../man/*.8 $(ROOT)/usr/man/man8
$(INSTALL) -m 644 ../man/*.5 $(ROOT)/usr/man/man5
# Some manpages not installed by default.
# $(INSTALL) -m 644 ../man/wall.1 $(ROOT)/usr/man/man1
$(INSTALL) -m 644 ../man/last.1 ../man/lastb.1 ../man/mesg.1 \
$(ROOT)/usr/man/man1
#
# 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
|