2 # Makefile Makefile for the systemV init suite.
3 # Targets: all compiles everything
4 # install installs the binaries (not the scripts)
5 # clean cleans up object files
6 # clobber really cleans up
8 # Version: @(#)Makefile 2.85-13 23-Mar-2004 miquels@cistron.nl
11 CFLAGS ?
= -ansi
-O2
-fomit-frame-pointer
12 CFLAGS
+= -W
-Wall
-D_GNU_SOURCE
15 # For some known distributions we do not build all programs, otherwise we do.
17 SBIN
= init halt shutdown runlevel killall5
20 MAN1
= last
.1 lastb
.1 mesg
.1
21 MAN5
= initscript
.5 inittab
.5
22 MAN8
= halt
.8 init
.8 killall5.8 pidof
.8 poweroff
.8 reboot
.8 runlevel
.8
23 MAN8
+= shutdown
.8 telinit
.8
27 SBIN
+= sulogin bootlogd
28 USRBIN
+= utmpdump wall
29 MAN1
+= utmpdump
.1 mountpoint
.1 wall
.1
30 MAN8
+= sulogin
.8 bootlogd
.8
33 ifeq ($(DISTRO
),Debian
)
35 SBIN
+= sulogin bootlogd
37 MAN8
+= sulogin
.8 bootlogd
.8
49 MAN1
+= utmpdump
.1 mountpoint
.1
55 BIN_COMBO
= $(BIN_OWNER
):$(BIN_GROUP
)
56 STRIP
= strip -s
-R .comment
57 INSTALL_EXEC
= install -o
$(BIN_OWNER
) -g
$(BIN_GROUP
) -m
755
58 INSTALL_DATA
= install -o
$(BIN_OWNER
) -g
$(BIN_GROUP
) -m
644
59 INSTALL_DIR
= install -m
755 -d
60 MANDIR
= /usr
/share
/man
62 ifeq ($(WITH_SELINUX
),yes
)
63 SELINUX_DEF
=-DWITH_SELINUX
64 INIT_SELIBS
=-lsepol
-lselinux
65 SULOGIN_SELIBS
=-lselinux
72 # Additional libs for GNU libc.
73 ifneq ($(wildcard /usr
/lib
*/libcrypt.a
),)
77 all: $(BIN
) $(SBIN
) $(USRBIN
)
80 # $(CC) $(CFLAGS) $(LDFLAGS) -o $@ $^ $(LDLIBS)
82 # $(CC) $(CFLAGS) $(CPPFLAGS) -c $^ -o $@
84 init
: LDLIBS
+= $(INIT_SELIBS
) $(STATIC
)
85 init
: init.o init_utmp.o
87 halt
: halt.o ifdown.o hddown.o utmp.o reboot.h
89 last
: last.o oldutmp.h
93 mountpoint
: mountpoint.o
99 sulogin
: LDLIBS
+= $(LCRYPT
) $(SULOGIN_SELIBS
) $(STATIC
)
102 wall
: dowall.o wall.o
104 shutdown
: dowall.o shutdown.o utmp.o reboot.h
106 bootlogd
: LDLIBS
+= -lutil
109 sulogin.o
: CPPFLAGS
+= $(SELINUX_DEF
)
112 init.o
: CPPFLAGS
+= $(SELINUX_DEF
)
113 init.o
: init.c init.h set.h reboot.h initreq.h
115 utmp.o
: utmp.c init.h
117 init_utmp.o
: CPPFLAGS
+= -DINIT_MAIN
118 init_utmp.o
: utmp.c init.h
119 $(CC
) $(CFLAGS
) $(CPPFLAGS
) -c
-o
$@
$<
125 @echo Type
\"make
clobber\" to really
clean up.
128 rm -f
$(BIN
) $(SBIN
) $(USRBIN
)
133 $(INSTALL_DIR
) $(ROOT
)/bin
/ $(ROOT
)/sbin
/
134 $(INSTALL_DIR
) $(ROOT
)/usr
/bin
/
135 for i in
$(BIN
); do \
137 $(INSTALL_EXEC
) $$i $(ROOT
)/bin
/ ; \
139 for i in
$(SBIN
); do \
141 $(INSTALL_EXEC
) $$i $(ROOT
)/sbin
/ ; \
143 for i in
$(USRBIN
); do \
145 $(INSTALL_EXEC
) $$i $(ROOT
)/usr
/bin
/ ; \
147 # $(INSTALL_EXEC) etc/initscript.sample $(ROOT)/etc/
148 ln
-sf halt
$(ROOT
)/sbin
/reboot
149 ln
-sf halt
$(ROOT
)/sbin
/poweroff
150 ln
-sf init
$(ROOT
)/sbin
/telinit
151 ln
-sf
/sbin
/killall5
$(ROOT
)/bin
/pidof
152 if
[ ! -f
$(ROOT
)/usr
/bin
/lastb
]; then \
153 ln
-sf last
$(ROOT
)/usr
/bin
/lastb
; \
155 $(INSTALL_DIR
) $(ROOT
)/usr
/include/
156 $(INSTALL_DATA
) initreq.h
$(ROOT
)/usr
/include/
157 $(INSTALL_DIR
) $(ROOT
)$(MANDIR
)/man1
/
158 $(INSTALL_DIR
) $(ROOT
)$(MANDIR
)/man5
/
159 $(INSTALL_DIR
) $(ROOT
)$(MANDIR
)/man8
/
160 for i in
$(MAN1
); do \
161 $(INSTALL_DATA
) ..
/man
/$$i $(ROOT
)$(MANDIR
)/man1
/; \
163 for i in
$(MAN5
); do \
164 $(INSTALL_DATA
) ..
/man
/$$i $(ROOT
)$(MANDIR
)/man5
/; \
166 for i in
$(MAN8
); do \
167 $(INSTALL_DATA
) ..
/man
/$$i $(ROOT
)$(MANDIR
)/man8
/; \
171 # This part is skipped on Debian systems, the
172 # debian.preinst script takes care of it.
173 @if
[ ! -p
/dev
/initctl
]; then \
174 echo
"Creating /dev/initctl"; \
175 rm -f
/dev
/initctl
; \
176 mknod
-m
600 /dev
/initctl p
; fi