tests/vlock-test.c: make output verbose
[vlock.git] / Makefile
blob8f87cc5abaf42934c1bea0cf0ce7eca0841df5d2
1 # vlock makefile
3 include config.mk
5 VPATH = src
7 VLOCK_VERSION = 2.2 rc2
9 PROGRAMS = vlock vlock-main
11 .PHONY: all
12 all: $(PROGRAMS)
14 .PHONY: debug
15 debug:
16 @$(MAKE) DEBUG=y
18 ifeq ($(ENABLE_PLUGINS),yes)
19 all: plugins
20 endif
22 .PHONY: plugins
23 plugins: modules scripts
25 .PHONY: modules
26 modules:
27 @$(MAKE) -C modules
29 .PHONY: scripts
30 scripts:
31 @$(MAKE) -C scripts
33 .PHONY: tests
34 tests:
35 @$(MAKE) -C tests
37 ### configuration ###
39 config.mk:
40 $(info )
41 $(info ###################################################)
42 $(info # Creating default configuration. #)
43 $(info # Run ./configure or edit config.mk to customize. #)
44 $(info ###################################################)
45 $(info )
46 @./configure --quiet
48 ### installation rules ###
50 .PHONY: install
51 install: install-programs install-man
53 ifeq ($(ENABLE_PLUGINS),yes)
54 install: install-plugins
55 endif
57 .PHONY: install-programs
58 install-programs: $(PROGRAMS)
59 $(MKDIR_P) -m 755 $(DESTDIR)$(PREFIX)/bin
60 $(INSTALL) -m 755 -o root -g $(ROOT_GROUP) vlock $(DESTDIR)$(BINDIR)/vlock
61 $(MKDIR_P) -m 755 $(DESTDIR)$(PREFIX)/sbin
62 $(INSTALL) -m 4711 -o root -g $(ROOT_GROUP) vlock-main $(DESTDIR)$(SBINDIR)/vlock-main
64 .PHONY: install-plugins
65 install-plugins: install-modules install-scripts
67 .PHONY: install-modules
68 install-modules:
69 @$(MAKE) -C modules install
71 .PHONY: install-scripts
72 install-scripts:
73 @$(MAKE) -C scripts install
75 .PHONY: install-man
76 install-man:
77 $(MKDIR_P) -m 755 $(DESTDIR)$(MANDIR)/man1
78 $(INSTALL) -m 644 -o root -g $(ROOT_GROUP) man/vlock.1 $(DESTDIR)$(MANDIR)/man1/vlock.1
79 $(MKDIR_P) -m 755 $(DESTDIR)$(MANDIR)/man8
80 $(INSTALL) -m 644 -o root -g $(ROOT_GROUP) man/vlock-main.8 $(DESTDIR)$(MANDIR)/man8/vlock-main.8
81 $(MKDIR_P) -m 755 $(DESTDIR)$(MANDIR)/man5
82 $(INSTALL) -m 644 -o root -g $(ROOT_GROUP) man/vlock-plugins.5 $(DESTDIR)$(MANDIR)/man5/vlock-plugins.5
85 ### build rules ###
87 vlock: vlock.sh config.mk Makefile
88 $(BOURNE_SHELL) -n $<
89 sed \
90 -e 's,%BOURNE_SHELL%,$(BOURNE_SHELL),' \
91 -e 's,%PREFIX%,$(PREFIX),' \
92 -e 's,%VLOCK_VERSION%,$(VLOCK_VERSION),' \
93 -e 's,%VLOCK_ENABLE_PLUGINS%,$(ENABLE_PLUGINS),' \
94 $< > $@.tmp
95 mv -f $@.tmp $@
97 override CFLAGS += -Isrc
99 vlock-main: vlock-main.o prompt.o auth-$(AUTH_METHOD).o console_switch.o util.o
101 auth-pam.o: auth-pam.c prompt.h auth.h
102 auth-shadow.o: auth-shadow.c prompt.h auth.h
103 prompt.o: prompt.c prompt.h
104 vlock-main.o: vlock-main.c auth.h prompt.h util.h
105 plugins.o: plugins.c tsort.h plugin.h plugins.h list.h util.h
106 module.o : override CFLAGS += -DVLOCK_MODULE_DIR="\"$(MODULEDIR)\""
107 module.o: module.c plugin.h list.h util.h
108 script.o : override CFLAGS += -DVLOCK_SCRIPT_DIR="\"$(SCRIPTDIR)\""
109 script.o: script.c plugin.h process.h list.h util.h
110 plugin.o: plugin.c plugin.h list.h util.h
111 tsort.o: tsort.c tsort.h list.h
112 list.o: list.c list.h util.h
113 console_switch.o: console_switch.c console_switch.h
114 process.o: process.c process.h
115 util.o: util.c util.h
117 ifneq ($(ENABLE_ROOT_PASSWORD),yes)
118 vlock-main.o : override CFLAGS += -DNO_ROOT_PASS
119 endif
121 ifeq ($(AUTH_METHOD),pam)
122 vlock-main : override LDFLAGS += $(PAM_LIBS)
123 endif
125 ifeq ($(AUTH_METHOD),shadow)
126 vlock-main : override LDFLAGS += $(CRYPT_LIB)
127 endif
129 ifeq ($(ENABLE_PLUGINS),yes)
130 vlock-main: plugins.o plugin.o module.o process.o script.o tsort.o list.o
131 # -rdynamic is needed so that the all plugin can access the symbols from console_switch.o
132 vlock-main : override LDFLAGS += $(DL_LIB) -rdynamic
133 vlock-main.o : override CFLAGS += -DUSE_PLUGINS
134 vlock-main.o: plugins.h
135 endif
137 .PHONY: realclean
138 realclean: clean
139 $(RM) config.mk
141 .PHONY: clean
142 clean:
143 $(RM) $(PROGRAMS) $(wildcard *.o)
144 @$(MAKE) -C modules clean
145 @$(MAKE) -C scripts clean
146 @$(MAKE) -C tests clean