|
root / tools / sysv-wrapper / Makefile
Makefile Makefile 36 lines 922 B
 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
# sysv-wrapper Makefile.
#
# Build:    make
# Install:  make install DESTDIR=<root>      (defaults to /)
# Clean:    make clean
#
# Installs the wrapper at /sbin/sysv-wrapper and symlinks the legacy
# tool names to it. /sbin/init is NOT symlinked here — that path is
# the zyginit daemon binary. If you want sysv-wrapper to handle
# `init <N>` too, move zyginit aside (e.g. to /sbin/zyginit) and
# symlink /sbin/init -> sysv-wrapper instead.

CC      ?= gcc
CFLAGS  ?= -O2 -Wall
DESTDIR ?=
SBIN     = $(DESTDIR)/sbin
WRAPPER  = $(SBIN)/sysv-wrapper

all: sysv-wrapper

sysv-wrapper: wrapper.c version.h
	$(CC) $(CFLAGS) -o $@ wrapper.c

install: sysv-wrapper
	install -d $(SBIN)
	install -m 0755 sysv-wrapper $(WRAPPER)
	ln -sf sysv-wrapper $(SBIN)/halt
	ln -sf sysv-wrapper $(SBIN)/reboot
	ln -sf sysv-wrapper $(SBIN)/poweroff
	ln -sf sysv-wrapper $(SBIN)/telinit

clean:
	rm -f sysv-wrapper

.PHONY: all install clean