Drop hurd specific dependency on libc0.3 (>= 2.3.2.ds1-12). It is
[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
11CC = gcc
12CFLAGS = -ansi -W -Wall -O2 -fomit-frame-pointer -D_GNU_SOURCE
13LDFLAGS = -s
14STATIC =
15
16# For some known distributions we do not build all programs, otherwise we do.
17BIN =
18SBIN = init halt shutdown runlevel killall5
19USRBIN = last mesg
20
21MAN1 = last.1 lastb.1 mesg.1
22MAN5 = initscript.5 inittab.5
23MAN8 = halt.8 init.8 killall5.8 pidof.8 poweroff.8 reboot.8 runlevel.8
24MAN8 += shutdown.8 telinit.8
25
26ifeq ($(DISTRO),)
27BIN += mountpoint
28SBIN += sulogin bootlogd
29USRBIN += utmpdump wall
30MAN1 += mountpoint.1 wall.1
31MAN8 += sulogin.8 bootlogd.8
32endif
33
34ifeq ($(DISTRO),Debian)
35BIN += mountpoint
36SBIN += sulogin bootlogd
37MAN1 += mountpoint.1
38MAN8 += sulogin.8 bootlogd.8
39endif
40
41ifeq ($(DISTRO),Owl)
42USRBIN += wall
43MAN1 += wall.1
44endif
45
46BIN_OWNER = root
47BIN_GROUP = root
48BIN_COMBO = $(BIN_OWNER):$(BIN_GROUP)
49STRIP = strip -s -R .comment
50INSTALL_EXEC = install -o $(BIN_OWNER) -g $(BIN_GROUP) -m 755
51INSTALL_DATA = install -o $(BIN_OWNER) -g $(BIN_GROUP) -m 644
52MANDIR = /usr/share/man
53
54ifeq ($(WITH_SELINUX),yes)
55 SELINUX_DEF=-DWITH_SELINUX
56 INIT_SELIBS=-lsepol -lselinux
57 SULOGIN_SELIBS=-lselinux
58else
59 SELINUX_DEF=
60 INIT_SELIBS=
61 SULOGIN_SELIBS=
62endif
63
64
65
66# Additional libs for GNU libc.
67ifneq ($(wildcard /usr/lib/libcrypt.a),)
68LCRYPT = -lcrypt
69endif
70
71all: $(BIN) $(SBIN) $(USRBIN)
72
73init: init.o init_utmp.o
74 $(CC) $(LDFLAGS) $(STATIC) -o $@ init.o init_utmp.o $(INIT_SELIBS)
75
76halt: halt.o ifdown.o hddown.o utmp.o reboot.h
77 $(CC) $(LDFLAGS) -o $@ halt.o ifdown.o hddown.o utmp.o
78
79last: last.o oldutmp.h
80 $(CC) $(LDFLAGS) -o $@ last.o
81
82mesg: mesg.o
83 $(CC) $(LDFLAGS) -o $@ mesg.o
84
85mountpoint: mountpoint.o
86 $(CC) $(LDFLAGS) -o $@ mountpoint.o
87
88utmpdump: utmpdump.o
89 $(CC) $(LDFLAGS) -o $@ utmpdump.o
90
91runlevel: runlevel.o
92 $(CC) $(LDFLAGS) -o $@ runlevel.o
93
94sulogin: sulogin.o
95 $(CC) $(LDFLAGS) $(STATIC) $(SELINUX_DEF) -o $@ $^ $(LCRYPT) $(SULOGIN_SELIBS)
96
97wall: dowall.o wall.o
98 $(CC) $(LDFLAGS) -o $@ dowall.o wall.o
99
100shutdown: dowall.o shutdown.o utmp.o reboot.h
101 $(CC) $(LDFLAGS) -o $@ dowall.o shutdown.o utmp.o
102
103bootlogd: bootlogd.o
104 $(CC) $(LDFLAGS) -o $@ bootlogd.o -lutil
105
106sulogin.o: sulogin.c
107 $(CC) -c $(CFLAGS) $(SELINUX_DEF) sulogin.c
108
109init.o: init.c init.h set.h reboot.h initreq.h
110 $(CC) -c $(CFLAGS) $(SELINUX_DEF) init.c
111
112utmp.o: utmp.c init.h
113 $(CC) -c $(CFLAGS) utmp.c
114
115init_utmp.o: utmp.c init.h
116 $(CC) -c $(CFLAGS) -DINIT_MAIN utmp.c -o init_utmp.o
117
118cleanobjs:
119 rm -f *.o *.bak
120
121clean: cleanobjs
122 @echo Type \"make clobber\" to really clean up.
123
124clobber: cleanobjs
125 rm -f $(BIN) $(SBIN) $(USRBIN)
126
127distclean: clobber
128
129install:
130 for i in $(BIN); do \
131 $(STRIP) $$i ; \
132 $(INSTALL_EXEC) $$i $(ROOT)/bin/ ; \
133 done
134 for i in $(SBIN); do \
135 $(STRIP) $$i ; \
136 $(INSTALL_EXEC) $$i $(ROOT)/sbin/ ; \
137 done
138 for i in $(USRBIN); do \
139 $(STRIP) $$i ; \
140 $(INSTALL_EXEC) $$i $(ROOT)/usr/bin/ ; \
141 done
142 # $(INSTALL_EXEC) etc/initscript.sample $(ROOT)/etc/
143 ln -sf halt $(ROOT)/sbin/reboot
144 ln -sf halt $(ROOT)/sbin/poweroff
145 ln -sf init $(ROOT)/sbin/telinit
146 ln -sf /sbin/killall5 $(ROOT)/bin/pidof
147 if [ ! -f $(ROOT)/usr/bin/lastb ]; then \
148 ln -sf last $(ROOT)/usr/bin/lastb; \
149 fi
150 $(INSTALL_DATA) initreq.h $(ROOT)/usr/include/
151 for i in $(MAN1); do \
152 $(INSTALL_DATA) ../man/$$i $(ROOT)$(MANDIR)/man1/; \
153 done
154 for i in $(MAN5); do \
155 $(INSTALL_DATA) ../man/$$i $(ROOT)$(MANDIR)/man5/; \
156 done
157 for i in $(MAN8); do \
158 $(INSTALL_DATA) ../man/$$i $(ROOT)$(MANDIR)/man8/; \
159 done
160ifeq ($(ROOT),)
161 #
162 # This part is skipped on Debian systems, the
163 # debian.preinst script takes care of it.
164 @if [ ! -p /dev/initctl ]; then \
165 echo "Creating /dev/initctl"; \
166 rm -f /dev/initctl; \
167 mknod -m 600 /dev/initctl p; fi
168endif