src/vlock.sh: move variable declarations around
[vlock.git] / Makefile
blob86999c5e08c07031033f7048a542dd662a98c097
1 # vlock makefile
3 include config.mk
5 override CFLAGS += -Isrc -DPREFIX="\"$(PREFIX)"\"
7 VPATH = src
9 VLOCK_VERSION = "2.1 alpha1"
11 PROGRAMS = \
12 vlock \
13 vlock-current \
14 vlock-new \
15 vlock-all \
16 vlock-nosysrq
18 .PHONY: all
19 all: $(PROGRAMS)
21 vlock: vlock.sh config.mk Makefile
22 $(BOURNE_SHELL) -n $<
23 sed \
24 -e 's,%BOURNE_SHELL%,$(BOURNE_SHELL),' \
25 -e 's,%PREFIX%,$(PREFIX),' \
26 -e 's,%VLOCK_VERSION%,$(VLOCK_VERSION),' \
27 $< > $@.tmp
28 mv -f $@.tmp $@
30 ifneq ($(USE_ROOT_PASS),y)
31 vlock-current : override CFLAGS += -DNO_ROOT_PASS
32 endif
34 ifeq ($(AUTH_METHOD),pam)
35 vlock-current : override LDFLAGS += $(PAM_LIBS)
36 endif
38 ifeq ($(AUTH_METHOD),shadow)
39 vlock-current : override LDFLAGS += -lcrypt
40 endif
42 vlock-current: vlock-current.c prompt.c auth-$(AUTH_METHOD).c
44 ifeq ($(USE_PAM),y)
45 vlock-nosysrq vlock-all : override LDFLAGS += $(PAM_LIBS)
46 vlock-nosysrq vlock-all : override CFLAGS += -DUSE_PAM
47 endif
49 ifndef VLOCK_GROUP
50 VLOCK_GROUP = root
51 ifndef VLOCK_MODE
52 VLOCK_MODE = 4711
53 endif
54 else # VLOCK_GROUP is defined
55 ifndef VLOCK_MODE
56 VLOCK_MODE = 4710
57 endif
58 endif
60 .PHONY: install
61 install: install-programs install-man
63 .PHONY: install-programs
64 install-programs: $(PROGRAMS)
65 $(INSTALL) -D -m 755 -o root -g $(ROOT_GROUP) vlock $(DESTDIR)$(PREFIX)/bin/vlock
66 $(INSTALL) -D -m 4711 -o root -g $(ROOT_GROUP) vlock-current $(DESTDIR)$(PREFIX)/sbin/vlock-current
67 $(INSTALL) -D -m 755 -o root -g $(ROOT_GROUP) vlock-all $(DESTDIR)$(PREFIX)/sbin/vlock-all
68 $(INSTALL) -D -m $(VLOCK_MODE) -o root -g $(VLOCK_GROUP) vlock-nosysrq $(DESTDIR)$(PREFIX)/sbin/vlock-nosysrq
69 $(INSTALL) -D -m $(VLOCK_MODE) -o root -g $(VLOCK_GROUP) vlock-new $(DESTDIR)$(PREFIX)/sbin/vlock-new
71 .PHONY: install-man
72 install-man:
73 $(INSTALL) -D -m 644 -o root -g $(ROOT_GROUP) man/vlock.1 $(DESTDIR)$(PREFIX)/share/man/man1/vlock.1
74 $(INSTALL) -D -m 644 -o root -g $(ROOT_GROUP) man/vlock-current.8 $(DESTDIR)$(PREFIX)/share/man/man8/vlock-current.8
75 $(INSTALL) -D -m 644 -o root -g $(ROOT_GROUP) man/vlock-all.8 $(DESTDIR)$(PREFIX)/share/man/man8/vlock-all.8
76 $(INSTALL) -D -m 644 -o root -g $(ROOT_GROUP) man/vlock-new.8 $(DESTDIR)$(PREFIX)/share/man/man8/vlock-new.8
77 $(INSTALL) -D -m 644 -o root -g $(ROOT_GROUP) man/vlock-nosysrq.8 $(DESTDIR)$(PREFIX)/share/man/man8/vlock-nosysrq.8
79 .PHONY: clean
80 clean:
81 rm -f $(PROGRAMS)