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
12 CFLAGS ?
= -ansi
-O2
-fomit-frame-pointer
13 override CFLAGS
+= -W
-Wall
-D_GNU_SOURCE
16 # For some known distributions we do not build all programs, otherwise we do.
18 SBIN
= init halt shutdown runlevel killall5 fstab-decode
21 MAN1
= last
.1 lastb
.1 mesg
.1
22 MAN5
= initscript
.5 inittab
.5
23 MAN8
= halt
.8 init
.8 killall5.8 pidof
.8 poweroff
.8 reboot
.8 runlevel
.8
24 MAN8
+= shutdown
.8 telinit
.8 fstab-decode
.8
28 SBIN
+= sulogin bootlogd
29 USRBIN
+= utmpdump wall
30 MAN1
+= utmpdump
.1 mountpoint
.1 wall
.1
31 MAN8
+= sulogin
.8 bootlogd
.8
34 ifeq ($(DISTRO
),Debian
)
35 CPPFLAGS
+= -DACCTON_OFF
37 SBIN
+= sulogin bootlogd
39 MAN8
+= sulogin
.8 bootlogd
.8
48 CPPFLAGS
+= -DUSE_SYSFS
-DSANE_TIO
-DSIGINT_ONLYONCE
-DUSE_ONELINE
52 MAN1
+= utmpdump
.1 mountpoint
.1
59 BIN_COMBO
= $(BIN_OWNER
):$(BIN_GROUP
)
60 STRIP
= strip -s
-R .comment
62 INSTALL_EXEC
= install -o
$(BIN_OWNER
) -g
$(BIN_GROUP
) -m
755
63 INSTALL_DATA
= install -o
$(BIN_OWNER
) -g
$(BIN_GROUP
) -m
644
65 INSTALL_EXEC
= install -m
755
66 INSTALL_DATA
= install -m
644
68 INSTALL_DIR
= install -m
755 -d
69 MANDIR
= /usr
/share
/man
71 ifeq ($(WITH_SELINUX
),yes
)
72 SELINUX_DEF
= -DWITH_SELINUX
73 INITLIBS
+= -lsepol
-lselinux
74 SULOGINLIBS
= -lselinux
81 # Additional libs for GNU libc.
82 ifneq ($(wildcard /usr
/lib
*/libcrypt.a
),)
83 SULOGINLIBS
+= -lcrypt
86 all: $(BIN
) $(SBIN
) $(USRBIN
)
89 # $(CC) $(CFLAGS) $(LDFLAGS) -o $@ $^ $(LDLIBS)
91 # $(CC) $(CFLAGS) $(CPPFLAGS) -c $^ -o $@
93 init
: LDLIBS
+= $(INITLIBS
) $(STATIC
)
94 init
: init.o init_utmp.o
96 halt
: halt.o ifdown.o hddown.o utmp.o reboot.h
98 last
: last.o oldutmp.h
102 mountpoint
: mountpoint.o
108 sulogin
: LDLIBS
+= $(SULOGINLIBS
) $(STATIC
)
111 wall
: dowall.o wall.o
113 shutdown
: dowall.o shutdown.o utmp.o reboot.h
115 bootlogd
: LDLIBS
+= -lutil
118 sulogin.o
: CPPFLAGS
+= $(SELINUX_DEF
)
121 init.o
: CPPFLAGS
+= $(SELINUX_DEF
)
122 init.o
: init.c init.h set.h reboot.h initreq.h
124 utmp.o
: utmp.c init.h
126 init_utmp.o
: CPPFLAGS
+= -DINIT_MAIN
127 init_utmp.o
: utmp.c init.h
128 $(CC
) $(CFLAGS
) $(CPPFLAGS
) -c
-o
$@
$<
134 @echo Type
\"make
clobber\" to really
clean up.
137 rm -f
$(BIN
) $(SBIN
) $(USRBIN
)
142 $(INSTALL_DIR
) $(ROOT
)/bin
/ $(ROOT
)/sbin
/
143 $(INSTALL_DIR
) $(ROOT
)/usr
/bin
/
144 for i in
$(BIN
); do \
146 $(INSTALL_EXEC
) $$i $(ROOT
)/bin
/ ; \
148 for i in
$(SBIN
); do \
150 $(INSTALL_EXEC
) $$i $(ROOT
)/sbin
/ ; \
152 for i in
$(USRBIN
); do \
154 $(INSTALL_EXEC
) $$i $(ROOT
)/usr
/bin
/ ; \
156 # $(INSTALL_DIR) $(ROOT)/etc/
157 # $(INSTALL_EXEC) initscript.sample $(ROOT)/etc/
158 ln
-sf halt
$(ROOT
)/sbin
/reboot
159 ln
-sf halt
$(ROOT
)/sbin
/poweroff
160 ln
-sf init
$(ROOT
)/sbin
/telinit
161 ln
-sf
/sbin
/killall5
$(ROOT
)/bin
/pidof
162 if
[ ! -f
$(ROOT
)/usr
/bin
/lastb
]; then \
163 ln
-sf last
$(ROOT
)/usr
/bin
/lastb
; \
165 $(INSTALL_DIR
) $(ROOT
)/usr
/include/
166 $(INSTALL_DATA
) initreq.h
$(ROOT
)/usr
/include/
167 $(INSTALL_DIR
) $(ROOT
)$(MANDIR
)/man1
/
168 $(INSTALL_DIR
) $(ROOT
)$(MANDIR
)/man5
/
169 $(INSTALL_DIR
) $(ROOT
)$(MANDIR
)/man8
/
170 for i in
$(MAN1
); do \
171 $(INSTALL_DATA
) ..
/man
/$$i $(ROOT
)$(MANDIR
)/man1
/; \
173 for i in
$(MAN5
); do \
174 $(INSTALL_DATA
) ..
/man
/$$i $(ROOT
)$(MANDIR
)/man5
/; \
176 for i in
$(MAN8
); do \
177 $(INSTALL_DATA
) ..
/man
/$$i $(ROOT
)$(MANDIR
)/man8
/; \
181 # This part is skipped on Debian systems, the
182 # debian.preinst script takes care of it.
183 @if
[ ! -p
/dev
/initctl
]; then \
184 echo
"Creating /dev/initctl"; \
185 rm -f
/dev
/initctl
; \
186 mknod
-m
600 /dev
/initctl p
; fi