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
+= mountpoint
.1 wall
.1
30 MAN8
+= sulogin
.8 bootlogd
.8
33 ifeq ($(DISTRO
),Debian
)
35 SBIN
+= sulogin bootlogd
37 MAN8
+= sulogin
.8 bootlogd
.8
47 BIN_COMBO
= $(BIN_OWNER
):$(BIN_GROUP
)
48 STRIP
= strip -s
-R .comment
49 INSTALL_EXEC
= install -o
$(BIN_OWNER
) -g
$(BIN_GROUP
) -m
755
50 INSTALL_DATA
= install -o
$(BIN_OWNER
) -g
$(BIN_GROUP
) -m
644
51 INSTALL_DIR
= install -m
755 -d
52 MANDIR
= /usr
/share
/man
54 ifeq ($(WITH_SELINUX
),yes
)
55 SELINUX_DEF
=-DWITH_SELINUX
56 INIT_SELIBS
=-lsepol
-lselinux
57 SULOGIN_SELIBS
=-lselinux
66 # Additional libs for GNU libc.
67 ifneq ($(wildcard /usr
/lib
*/libcrypt.a
),)
71 all: $(BIN
) $(SBIN
) $(USRBIN
)
74 # $(CC) $(CFLAGS) $(LDFLAGS) -o $@ $^ $(LDLIBS)
76 # $(CC) $(CFLAGS) $(CPPFLAGS) -c $^ -o $@
78 init
: LDLIBS
+= $(INIT_SELIBS
) $(STATIC
)
79 init
: init.o init_utmp.o
81 halt
: halt.o ifdown.o hddown.o utmp.o reboot.h
83 last
: last.o oldutmp.h
87 mountpoint
: mountpoint.o
93 sulogin
: LDLIBS
+= $(LCRYPT
) $(SULOGIN_SELIBS
) $(STATIC
)
98 shutdown
: dowall.o shutdown.o utmp.o reboot.h
100 bootlogd
: LDLIBS
+= -lutil
103 sulogin.o
: CPPFLAGS
+= $(SELINUX_DEF
)
106 init.o
: CPPFLAGS
+= $(SELINUX_DEF
)
107 init.o
: init.c init.h set.h reboot.h initreq.h
109 utmp.o
: utmp.c init.h
111 init_utmp.o
: CPPFLAGS
+= -DINIT_MAIN
112 init_utmp.o
: utmp.c init.h
113 $(CC
) $(CFLAGS
) $(CPPFLAGS
) -c
-o
$@
$<
119 @echo Type
\"make
clobber\" to really
clean up.
122 rm -f
$(BIN
) $(SBIN
) $(USRBIN
)
127 $(INSTALL_DIR
) $(ROOT
)/bin
/ $(ROOT
)/sbin
/
128 $(INSTALL_DIR
) $(ROOT
)/usr
/bin
/
129 for i in
$(BIN
); do \
131 $(INSTALL_EXEC
) $$i $(ROOT
)/bin
/ ; \
133 for i in
$(SBIN
); do \
135 $(INSTALL_EXEC
) $$i $(ROOT
)/sbin
/ ; \
137 for i in
$(USRBIN
); do \
139 $(INSTALL_EXEC
) $$i $(ROOT
)/usr
/bin
/ ; \
141 # $(INSTALL_EXEC) etc/initscript.sample $(ROOT)/etc/
142 ln
-sf halt
$(ROOT
)/sbin
/reboot
143 ln
-sf halt
$(ROOT
)/sbin
/poweroff
144 ln
-sf init
$(ROOT
)/sbin
/telinit
145 ln
-sf
/sbin
/killall5
$(ROOT
)/bin
/pidof
146 if
[ ! -f
$(ROOT
)/usr
/bin
/lastb
]; then \
147 ln
-sf last
$(ROOT
)/usr
/bin
/lastb
; \
149 $(INSTALL_DIR
) $(ROOT
)/usr
/include/
150 $(INSTALL_DATA
) initreq.h
$(ROOT
)/usr
/include/
151 $(INSTALL_DIR
) $(ROOT
)$(MANDIR
)/man1
/
152 $(INSTALL_DIR
) $(ROOT
)$(MANDIR
)/man5
/
153 $(INSTALL_DIR
) $(ROOT
)$(MANDIR
)/man8
/
154 for i in
$(MAN1
); do \
155 $(INSTALL_DATA
) ..
/man
/$$i $(ROOT
)$(MANDIR
)/man1
/; \
157 for i in
$(MAN5
); do \
158 $(INSTALL_DATA
) ..
/man
/$$i $(ROOT
)$(MANDIR
)/man5
/; \
160 for i in
$(MAN8
); do \
161 $(INSTALL_DATA
) ..
/man
/$$i $(ROOT
)$(MANDIR
)/man8
/; \
165 # This part is skipped on Debian systems, the
166 # debian.preinst script takes care of it.
167 @if
[ ! -p
/dev
/initctl
]; then \
168 echo
"Creating /dev/initctl"; \
169 rm -f
/dev
/initctl
; \
170 mknod
-m
600 /dev
/initctl p
; fi