]>
git.wh0rd.org - sysvinit.git/blob - src/Makefile
c815d0981e99e7e43540d4dd9f51f6d2ba1b5e1c
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@
17 # For some known distributions we do not build all programs, otherwise we do.
19 SBIN = init halt shutdown runlevel killall5 fstab-decode
22 MAN1 = last.1 lastb.1 mesg.1
23 MAN5 = initscript.5 inittab.5
24 MAN8 = halt.8 init.8 killall5.8 pidof.8 poweroff.8 reboot.8 runlevel.8
25 MAN8 += shutdown.8 telinit.8 fstab-decode.8
29 SBIN += sulogin bootlogd
30 USRBIN += utmpdump wall
31 MAN1 += utmpdump.1 mountpoint.1 wall.1
32 MAN8 += sulogin.8 bootlogd.8
35 ifeq ($(DISTRO),Debian)
36 CPPFLAGS+= -DACCTON_OFF
38 SBIN += sulogin bootlogd
40 MAN8 += sulogin.8 bootlogd.8
51 CPPFLAGS+= -DUSE_SYSFS -DSANE_TIO -DSIGINT_ONLYONCE -DUSE_ONELINE
55 MAN1 += utmpdump.1 mountpoint.1
63 BIN_COMBO = $(BIN_OWNER):$(BIN_GROUP)
65 INSTALL_EXEC = install -o $(BIN_OWNER) -g $(BIN_GROUP) -m 755
66 INSTALL_DATA = install -o $(BIN_OWNER) -g $(BIN_GROUP) -m 644
68 INSTALL_EXEC = install -m 755
69 INSTALL_DATA = install -m 644
71 INSTALL_DIR = install -m 755 -d
72 MANDIR = /usr/share/man
74 ifeq ($(WITH_SELINUX),yes)
75 SELINUX_DEF = -DWITH_SELINUX
76 INITLIBS += -lsepol -lselinux
77 SULOGINLIBS = -lselinux
84 # Additional libs for GNU libc.
85 ifneq ($(wildcard /usr/lib*/libcrypt.a),)
86 SULOGINLIBS += -lcrypt
89 all: $(BIN) $(SBIN) $(USRBIN)
92 # $(CC) $(CFLAGS) $(LDFLAGS) -o $@ $^ $(LDLIBS)
94 # $(CC) $(CFLAGS) $(CPPFLAGS) -c $^ -o $@
96 init: LDLIBS += $(INITLIBS) $(STATIC)
97 init: init.o init_utmp.o
99 halt: halt.o ifdown.o hddown.o utmp.o
105 mountpoint: mountpoint.o
111 sulogin: LDLIBS += $(SULOGINLIBS) $(STATIC)
112 sulogin: sulogin.o consoles.o
114 wall: dowall.o wall.o
116 shutdown: dowall.o shutdown.o utmp.o
118 bootlogd: LDLIBS += -lutil
121 sulogin.o: CPPFLAGS += $(SELINUX_DEF)
124 init.o: CPPFLAGS += $(SELINUX_DEF)
125 init.o: init.c init.h initreq.h paths.h reboot.h set.h
129 init_utmp.o: CPPFLAGS += -DINIT_MAIN
130 init_utmp.o: utmp.c init.h initreq.h paths.h
131 $(CC) $(CFLAGS) $(CPPFLAGS) -c -o $@ $<
133 utmpdump.o: utmpdump.c oldutmp.h
135 shutdown.o: shutdown.c paths.h reboot.h initreq.h init.h
137 halt.o: halt.c reboot.h
139 last.o: last.c oldutmp.h
141 consoles.o: consoles.c consoles.h
147 @echo Type \"make clobber\" to really clean up.
150 rm -f $(BIN) $(SBIN) $(USRBIN)
155 $(INSTALL_DIR) $(ROOT)/bin/ $(ROOT)/sbin/
156 $(INSTALL_DIR) $(ROOT)/usr/bin/
157 for i in $(BIN); do \
158 $(INSTALL_EXEC) $$i $(ROOT)/bin/ ; \
160 for i in $(SBIN); do \
161 $(INSTALL_EXEC) $$i $(ROOT)/sbin/ ; \
163 for i in $(USRBIN); do \
164 $(INSTALL_EXEC) $$i $(ROOT)/usr/bin/ ; \
166 # $(INSTALL_DIR) $(ROOT)/etc/
167 # $(INSTALL_EXEC) initscript.sample $(ROOT)/etc/
168 ln -sf halt $(ROOT)/sbin/reboot
169 ln -sf halt $(ROOT)/sbin/poweroff
170 ln -sf init $(ROOT)/sbin/telinit
171 ln -sf /sbin/killall5 $(ROOT)/bin/pidof
172 if [ ! -f $(ROOT)/usr/bin/lastb ]; then \
173 ln -sf last $(ROOT)/usr/bin/lastb; \
175 $(INSTALL_DIR) $(ROOT)/usr/include/
176 $(INSTALL_DATA) initreq.h $(ROOT)/usr/include/
177 $(INSTALL_DIR) $(ROOT)$(MANDIR)/man1/
178 $(INSTALL_DIR) $(ROOT)$(MANDIR)/man5/
179 $(INSTALL_DIR) $(ROOT)$(MANDIR)/man8/
180 for man in $(MAN1); do \
181 $(INSTALL_DATA) ../man/$$man $(ROOT)$(MANDIR)/man1/; \
182 sed -i "1{ $(MANDB); }" $(ROOT)$(MANDIR)/man1/$$man ; \
184 for man in $(MAN5); do \
185 $(INSTALL_DATA) ../man/$$man $(ROOT)$(MANDIR)/man5/; \
186 sed -i "1{ $(MANDB); }" $(ROOT)$(MANDIR)/man5/$$man ; \
188 for man in $(MAN8); do \
189 $(INSTALL_DATA) ../man/$$man $(ROOT)$(MANDIR)/man8/; \
190 sed -i "1{ $(MANDB); }" $(ROOT)$(MANDIR)/man8/$$man ; \
194 # This part is skipped on Debian systems, the
195 # debian.preinst script takes care of it.
196 @if [ ! -p /dev/initctl ]; then \
197 echo "Creating /dev/initctl"; \
198 rm -f /dev/initctl; \
199 mknod -m 600 /dev/initctl p; fi