]>
git.wh0rd.org - sysvinit.git/blob - src/Makefile
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
15 MANDB
:= s@^\
('\\\\\"\)[^\*-]*-\*- coding: [^[:blank:]]\+ -\*-@\1@
18 # Leave empty if the mountpoint(1) command from util-linux 2.20
19 # and above should be used, otherwise set it to yes.
23 # For some known distributions we do not build all programs, otherwise we do.
25 SBIN = init halt shutdown runlevel killall5 fstab-decode
28 MAN1 = last.1 lastb.1 mesg.1
29 MAN5 = initscript.5 inittab.5
30 MAN8 = halt.8 init.8 killall5.8 pidof.8 poweroff.8 reboot.8 runlevel.8
31 MAN8 += shutdown.8 telinit.8 fstab-decode.8
34 SBIN += sulogin bootlogd
35 USRBIN += utmpdump wall
36 MAN1 += utmpdump.1 wall.1
37 MAN8 += sulogin.8 bootlogd.8
40 ifeq ($(DISTRO),Debian)
41 CPPFLAGS+= -DACCTON_OFF
42 SBIN += sulogin bootlogd
43 MAN8 += sulogin.8 bootlogd.8
54 CPPFLAGS+= -DUSE_SYSFS -DSANE_TIO -DSIGINT_ONLYONCE -DUSE_ONELINE
62 ifeq ($(MNTPOINT),yes)
70 BIN_COMBO = $(BIN_OWNER):$(BIN_GROUP)
72 INSTALL_EXEC = install -o $(BIN_OWNER) -g $(BIN_GROUP) -m 755
73 INSTALL_DATA = install -o $(BIN_OWNER) -g $(BIN_GROUP) -m 644
75 INSTALL_EXEC = install -m 755
76 INSTALL_DATA = install -m 644
78 INSTALL_DIR = install -m 755 -d
79 MANDIR = /usr/share/man
81 ifeq ($(WITH_SELINUX),yes)
82 SELINUX_DEF = -DWITH_SELINUX
83 INITLIBS += -lsepol -lselinux
84 SULOGINLIBS = -lselinux
91 # Additional libs for GNU libc.
92 ifneq ($(wildcard /usr/lib*/libcrypt.*),)
93 SULOGINLIBS += -lcrypt
96 # Additional libs for GNU libc / multiarch on Debian based systems.
97 ifneq ($(wildcard /usr/lib/*/libcrypt.*),)
98 SULOGINLIBS += -lcrypt
101 all: $(BIN) $(SBIN) $(USRBIN)
104 # $(CC) $(CFLAGS) $(LDFLAGS) -o $@ $^ $(LDLIBS)
106 # $(CC) $(CFLAGS) $(CPPFLAGS) -c $^ -o $@
108 init: LDLIBS += $(INITLIBS) $(STATIC)
109 init: init.o init_utmp.o
111 halt: halt.o ifdown.o hddown.o utmp.o
117 mountpoint: mountpoint.o
123 sulogin: LDLIBS += $(SULOGINLIBS) $(STATIC)
124 sulogin: sulogin.o consoles.o
126 wall: dowall.o wall.o
128 shutdown: dowall.o shutdown.o utmp.o
130 bootlogd: LDLIBS += -lutil
133 sulogin.o: CPPFLAGS += $(SELINUX_DEF)
136 init.o: CPPFLAGS += $(SELINUX_DEF)
137 init.o: init.c init.h initreq.h paths.h reboot.h set.h
141 init_utmp.o: CPPFLAGS += -DINIT_MAIN
142 init_utmp.o: utmp.c init.h initreq.h paths.h
143 $(CC) $(CFLAGS) $(CPPFLAGS) -c -o $@ $<
145 utmpdump.o: utmpdump.c oldutmp.h
147 shutdown.o: shutdown.c paths.h reboot.h initreq.h init.h
149 halt.o: halt.c reboot.h
151 last.o: last.c oldutmp.h
153 consoles.o: consoles.c consoles.h
159 @echo Type \"make clobber\" to really clean up.
162 rm -f $(BIN) $(SBIN) $(USRBIN)
167 $(INSTALL_DIR) $(ROOT)/bin/ $(ROOT)/sbin/
168 $(INSTALL_DIR) $(ROOT)/usr/bin/
169 for i in $(BIN); do \
170 $(INSTALL_EXEC) $$i $(ROOT)/bin/ ; \
172 for i in $(SBIN); do \
173 $(INSTALL_EXEC) $$i $(ROOT)/sbin/ ; \
175 for i in $(USRBIN); do \
176 $(INSTALL_EXEC) $$i $(ROOT)/usr/bin/ ; \
178 # $(INSTALL_DIR) $(ROOT)/etc/
179 # $(INSTALL_EXEC) initscript.sample $(ROOT)/etc/
180 ln -sf halt $(ROOT)/sbin/reboot
181 ln -sf halt $(ROOT)/sbin/poweroff
182 ln -sf init $(ROOT)/sbin/telinit
183 ln -sf /sbin/killall5 $(ROOT)/bin/pidof
184 if [ ! -f $(ROOT)/usr/bin/lastb ]; then \
185 ln -sf last $(ROOT)/usr/bin/lastb; \
187 $(INSTALL_DIR) $(ROOT)/usr/include/
188 $(INSTALL_DATA) initreq.h $(ROOT)/usr/include/
189 $(INSTALL_DIR) $(ROOT)$(MANDIR)/man1/
190 $(INSTALL_DIR) $(ROOT)$(MANDIR)/man5/
191 $(INSTALL_DIR) $(ROOT)$(MANDIR)/man8/
192 for man in $(MAN1); do \
193 $(INSTALL_DATA) ../man/$$man $(ROOT)$(MANDIR)/man1/; \
194 sed -i "1{ $(MANDB); }" $(ROOT)$(MANDIR)/man1/$$man ; \
196 for man in $(MAN5); do \
197 $(INSTALL_DATA) ../man/$$man $(ROOT)$(MANDIR)/man5/; \
198 sed -i "1{ $(MANDB); }" $(ROOT)$(MANDIR)/man5/$$man ; \
200 for man in $(MAN8); do \
201 $(INSTALL_DATA) ../man/$$man $(ROOT)$(MANDIR)/man8/; \
202 sed -i "1{ $(MANDB); }" $(ROOT)$(MANDIR)/man8/$$man ; \
206 # This part is skipped on Debian systems, the
207 # debian.preinst script takes care of it.
208 @if [ ! -p /dev/initctl ]; then \
209 echo "Creating /dev/initctl"; \
210 rm -f /dev/initctl; \
211 mknod -m 600 /dev/initctl p; fi