Improve message printed when signaling processes to stop. Patch from Matias A. Fonzo...
[sysvinit.git] / src / Makefile
CommitLineData
a74aeac6
PR
1#
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
7#
8# Version: @(#)Makefile 2.85-13 23-Mar-2004 miquels@cistron.nl
9#
10
2a2f7033 11CPPFLAGS =
bcbe7f89 12CFLAGS ?= -ansi -O2 -fomit-frame-pointer
55f242bf 13override CFLAGS += -W -Wall -D_GNU_SOURCE
a74aeac6 14STATIC =
040ccc09 15MANDB := s@^\('\\\\\"\)[^\*-]*-\*- coding: [^[:blank:]]\+ -\*-@\1@
a74aeac6 16
b9eebd6e
DWF
17#
18# Leave empty if the mountpoint(1) command from util-linux 2.20
19# and above should be used, otherwise set it to yes.
20#
21MNTPOINT=
22
a74aeac6
PR
23# For some known distributions we do not build all programs, otherwise we do.
24BIN =
55f242bf 25SBIN = init halt shutdown runlevel killall5 fstab-decode
a74aeac6
PR
26USRBIN = last mesg
27
28MAN1 = last.1 lastb.1 mesg.1
29MAN5 = initscript.5 inittab.5
30MAN8 = halt.8 init.8 killall5.8 pidof.8 poweroff.8 reboot.8 runlevel.8
55f242bf 31MAN8 += shutdown.8 telinit.8 fstab-decode.8
a74aeac6
PR
32
33ifeq ($(DISTRO),)
a74aeac6
PR
34SBIN += sulogin bootlogd
35USRBIN += utmpdump wall
b9eebd6e 36MAN1 += utmpdump.1 wall.1
a74aeac6
PR
37MAN8 += sulogin.8 bootlogd.8
38endif
39
40ifeq ($(DISTRO),Debian)
55f242bf 41CPPFLAGS+= -DACCTON_OFF
a74aeac6 42SBIN += sulogin bootlogd
a74aeac6 43MAN8 += sulogin.8 bootlogd.8
040ccc09 44MANDB :=
a74aeac6
PR
45endif
46
47ifeq ($(DISTRO),Owl)
48USRBIN += wall
49MAN1 += wall.1
040ccc09 50MANDB :=
a74aeac6
PR
51endif
52
1414572e 53ifeq ($(DISTRO),SuSE)
0f9a1165 54CPPFLAGS+= -DUSE_SYSFS -DSANE_TIO -DSIGINT_ONLYONCE -DUSE_ONELINE
1414572e
DWF
55SBIN += sulogin
56USRBIN += utmpdump
b9eebd6e 57MAN1 += utmpdump.1
1414572e 58MAN8 += sulogin.8
040ccc09 59MANDB :=
1414572e
DWF
60endif
61
b9eebd6e
DWF
62ifeq ($(MNTPOINT),yes)
63BIN += mountpoint
64MAN1 += mountpoint.1
65endif
66
55f242bf 67ID = $(shell id -u)
a74aeac6
PR
68BIN_OWNER = root
69BIN_GROUP = root
70BIN_COMBO = $(BIN_OWNER):$(BIN_GROUP)
55f242bf
DWF
71ifeq ($(ID),0)
72 INSTALL_EXEC = install -o $(BIN_OWNER) -g $(BIN_GROUP) -m 755
73 INSTALL_DATA = install -o $(BIN_OWNER) -g $(BIN_GROUP) -m 644
74else
75 INSTALL_EXEC = install -m 755
76 INSTALL_DATA = install -m 644
77endif
bcbe7f89 78INSTALL_DIR = install -m 755 -d
a74aeac6
PR
79MANDIR = /usr/share/man
80
81ifeq ($(WITH_SELINUX),yes)
55f242bf
DWF
82 SELINUX_DEF = -DWITH_SELINUX
83 INITLIBS += -lsepol -lselinux
84 SULOGINLIBS = -lselinux
a74aeac6 85else
55f242bf
DWF
86 SELINUX_DEF =
87 INITLIBS =
88 SULOGINLIBS =
89endif
90
a74aeac6 91# Additional libs for GNU libc.
63a2c981 92ifneq ($(wildcard /usr/lib*/libcrypt.a),)
55f242bf 93 SULOGINLIBS += -lcrypt
a74aeac6
PR
94endif
95
96all: $(BIN) $(SBIN) $(USRBIN)
97
bcbe7f89
PR
98#%: %.o
99# $(CC) $(CFLAGS) $(LDFLAGS) -o $@ $^ $(LDLIBS)
100#%.o: %.c
101# $(CC) $(CFLAGS) $(CPPFLAGS) -c $^ -o $@
102
55f242bf 103init: LDLIBS += $(INITLIBS) $(STATIC)
a74aeac6 104init: init.o init_utmp.o
a74aeac6 105
8ec857d9 106halt: halt.o ifdown.o hddown.o utmp.o
a74aeac6 107
8ec857d9 108last: last.o
a74aeac6
PR
109
110mesg: mesg.o
a74aeac6
PR
111
112mountpoint: mountpoint.o
a74aeac6
PR
113
114utmpdump: utmpdump.o
a74aeac6
PR
115
116runlevel: runlevel.o
a74aeac6 117
55f242bf 118sulogin: LDLIBS += $(SULOGINLIBS) $(STATIC)
35ec6446 119sulogin: sulogin.o consoles.o
a74aeac6
PR
120
121wall: dowall.o wall.o
a74aeac6 122
8ec857d9 123shutdown: dowall.o shutdown.o utmp.o
a74aeac6 124
bcbe7f89 125bootlogd: LDLIBS += -lutil
a74aeac6 126bootlogd: bootlogd.o
a74aeac6 127
bcbe7f89 128sulogin.o: CPPFLAGS += $(SELINUX_DEF)
a74aeac6 129sulogin.o: sulogin.c
a74aeac6 130
bcbe7f89 131init.o: CPPFLAGS += $(SELINUX_DEF)
8ec857d9 132init.o: init.c init.h initreq.h paths.h reboot.h set.h
a74aeac6 133
8ec857d9 134utmp.o:
a74aeac6 135
bcbe7f89 136init_utmp.o: CPPFLAGS += -DINIT_MAIN
8ec857d9 137init_utmp.o: utmp.c init.h initreq.h paths.h
bcbe7f89 138 $(CC) $(CFLAGS) $(CPPFLAGS) -c -o $@ $<
a74aeac6 139
8ec857d9
DWF
140utmpdump.o: utmpdump.c oldutmp.h
141
142shutdown.o: shutdown.c paths.h reboot.h initreq.h init.h
143
144halt.o: halt.c reboot.h
145
146last.o: last.c oldutmp.h
147
32c9fc6d
DWF
148consoles.o: consoles.c consoles.h
149
a74aeac6
PR
150cleanobjs:
151 rm -f *.o *.bak
152
153clean: cleanobjs
154 @echo Type \"make clobber\" to really clean up.
155
156clobber: cleanobjs
157 rm -f $(BIN) $(SBIN) $(USRBIN)
158
159distclean: clobber
160
161install:
bcbe7f89
PR
162 $(INSTALL_DIR) $(ROOT)/bin/ $(ROOT)/sbin/
163 $(INSTALL_DIR) $(ROOT)/usr/bin/
a74aeac6 164 for i in $(BIN); do \
a74aeac6
PR
165 $(INSTALL_EXEC) $$i $(ROOT)/bin/ ; \
166 done
167 for i in $(SBIN); do \
a74aeac6
PR
168 $(INSTALL_EXEC) $$i $(ROOT)/sbin/ ; \
169 done
170 for i in $(USRBIN); do \
a74aeac6
PR
171 $(INSTALL_EXEC) $$i $(ROOT)/usr/bin/ ; \
172 done
23d97522
DWF
173 # $(INSTALL_DIR) $(ROOT)/etc/
174 # $(INSTALL_EXEC) initscript.sample $(ROOT)/etc/
a74aeac6
PR
175 ln -sf halt $(ROOT)/sbin/reboot
176 ln -sf halt $(ROOT)/sbin/poweroff
177 ln -sf init $(ROOT)/sbin/telinit
178 ln -sf /sbin/killall5 $(ROOT)/bin/pidof
179 if [ ! -f $(ROOT)/usr/bin/lastb ]; then \
180 ln -sf last $(ROOT)/usr/bin/lastb; \
181 fi
bcbe7f89 182 $(INSTALL_DIR) $(ROOT)/usr/include/
a74aeac6 183 $(INSTALL_DATA) initreq.h $(ROOT)/usr/include/
bcbe7f89
PR
184 $(INSTALL_DIR) $(ROOT)$(MANDIR)/man1/
185 $(INSTALL_DIR) $(ROOT)$(MANDIR)/man5/
186 $(INSTALL_DIR) $(ROOT)$(MANDIR)/man8/
040ccc09
DWF
187 for man in $(MAN1); do \
188 $(INSTALL_DATA) ../man/$$man $(ROOT)$(MANDIR)/man1/; \
189 sed -i "1{ $(MANDB); }" $(ROOT)$(MANDIR)/man1/$$man ; \
a74aeac6 190 done
040ccc09
DWF
191 for man in $(MAN5); do \
192 $(INSTALL_DATA) ../man/$$man $(ROOT)$(MANDIR)/man5/; \
193 sed -i "1{ $(MANDB); }" $(ROOT)$(MANDIR)/man5/$$man ; \
a74aeac6 194 done
040ccc09
DWF
195 for man in $(MAN8); do \
196 $(INSTALL_DATA) ../man/$$man $(ROOT)$(MANDIR)/man8/; \
197 sed -i "1{ $(MANDB); }" $(ROOT)$(MANDIR)/man8/$$man ; \
a74aeac6
PR
198 done
199ifeq ($(ROOT),)
200 #
201 # This part is skipped on Debian systems, the
202 # debian.preinst script takes care of it.
203 @if [ ! -p /dev/initctl ]; then \
204 echo "Creating /dev/initctl"; \
205 rm -f /dev/initctl; \
206 mknod -m 600 /dev/initctl p; fi
207endif