Upload Tizen:Base source
[framework/base/util-linux-ng.git] / login-utils / Makefile.am
1 include $(top_srcdir)/config/include-Makefile.am
2
3 bin_PROGRAMS =
4 usrbin_exec_PROGRAMS =
5 sbin_PROGRAMS =
6 usrsbin_exec_PROGRAMS =
7 dist_man_MANS =
8
9 EXTRA_DIST = README.getty  README.modems-with-agetty  README.poeigl
10
11 if BUILD_AGETTY
12 sbin_PROGRAMS += agetty
13 dist_man_MANS += agetty.8
14 endif
15
16 if BUILD_INIT
17
18 sbin_PROGRAMS += simpleinit shutdown initctl
19 dist_man_MANS += fastboot.8 fasthalt.8 halt.8 reboot.8 simpleinit.8 shutdown.8 \
20         initctl.8
21
22 simpleinit_SOURCES = simpleinit.c my_crypt.h simpleinit.h
23 initctl_SOURCES = initctl.c simpleinit.h
24
25 if NEED_LIBCRYPT
26 simpleinit_LDADD = -lcrypt
27 endif
28
29 endif
30
31 if BUILD_LAST
32 usrbin_exec_PROGRAMS += last
33 dist_man_MANS += last.1
34 endif
35
36 if BUILD_LOGIN_UTILS
37
38 bin_PROGRAMS += login
39 usrbin_exec_PROGRAMS += chfn chsh newgrp
40 usrsbin_exec_PROGRAMS += vipw
41 dist_man_MANS += chfn.1 chsh.1 login.1 newgrp.1 vipw.8 vigr.8
42
43 chfn_SOURCES = chfn.c $(chfn_chsh_common)
44 chsh_SOURCES = chsh.c $(chfn_chsh_common)
45 chfn_chsh_common = islocal.c setpwnam.c islocal.h my_crypt.h setpwnam.h \
46         ../lib/env.c
47 login_SOURCES = login.c login.h my_crypt.h ../lib/setproctitle.c
48 newgrp_SOURCES = newgrp.c my_crypt.h
49 vipw_SOURCES = vipw.c setpwnam.h
50
51 chfn_LDADD =
52 chsh_LDADD =
53 login_LDADD =
54 newgrp_LDADD =
55 vipw_LDADD =
56
57 chfn_CFLAGS = $(SUID_CFLAGS) $(AM_CFLAGS)
58 chsh_CFLAGS = $(SUID_CFLAGS) $(AM_CFLAGS)
59 newgrp_CFLAGS = $(SUID_CFLAGS) $(AM_CFLAGS)
60
61 chfn_LDFLAGS = $(SUID_LDFLAGS) $(AM_LDFLAGS)
62 chsh_LDFLAGS = $(SUID_LDFLAGS) $(AM_LDFLAGS)
63 newgrp_LDFLAGS = $(SUID_LDFLAGS) $(AM_LDFLAGS)
64
65 if NEED_LIBCRYPT
66 chfn_LDADD += -lcrypt
67 chsh_LDADD += -lcrypt
68 login_LDADD += -lcrypt
69 newgrp_LDADD += -lcrypt
70 endif
71
72 if HAVE_PAM
73 chfn_LDADD += -lpam -lpam_misc
74 chsh_LDADD += -lpam -lpam_misc
75 login_LDADD += -lpam -lpam_misc
76 else
77 login_SOURCES += checktty.c
78 endif
79
80 if HAVE_AUDIT
81 login_LDADD += -laudit
82 endif
83
84 if HAVE_SELINUX
85 chfn_SOURCES += selinux_utils.c selinux_utils.h
86 chfn_LDADD += -lselinux
87 chsh_SOURCES += selinux_utils.c selinux_utils.h
88 chsh_LDADD += -lselinux
89 vipw_LDADD += -lselinux
90 endif
91
92
93 install-exec-hook::
94         cd $(DESTDIR)$(usrsbin_execdir) && ln -sf vipw vigr
95
96 endif
97
98 if BUILD_MESG
99 usrbin_exec_PROGRAMS += mesg
100 dist_man_MANS += mesg.1
101 endif
102
103 if BUILD_WALL
104 usrbin_exec_PROGRAMS += wall
105 wall_SOURCES = wall.c ttymsg.c ttymsg.h
106 dist_man_MANS += wall.1
107
108 if USE_TTY_GROUP
109 if MAKEINSTALL_DO_CHOWN
110 install-exec-hook::
111         chgrp tty $(DESTDIR)$(usrbin_execdir)/wall
112         chmod g+s $(DESTDIR)$(usrbin_execdir)/wall
113 endif
114 endif
115 endif
116
117 if BUILD_INIT
118
119 install-exec-hook::
120         cd $(DESTDIR)$(sbindir) && ln -sf shutdown reboot
121         cd $(DESTDIR)$(sbindir) && ln -sf shutdown fastboot
122         cd $(DESTDIR)$(sbindir) && ln -sf shutdown halt
123         cd $(DESTDIR)$(sbindir) && ln -sf shutdown fasthalt
124         cd $(DESTDIR)$(sbindir) && ln -sf initctl need
125         cd $(DESTDIR)$(sbindir) && ln -sf initctl display-services
126         cd $(DESTDIR)$(sbindir) && ln -sf initctl provide
127
128 install-data-hook:
129         cd $(DESTDIR)$(mandir)/man8 && ln -sf initctl.8 need.8
130         cd $(DESTDIR)$(mandir)/man8 && ln -sf initctl.8 display-services.8
131         cd $(DESTDIR)$(mandir)/man8 && ln -sf initctl.8 provide.8
132
133 endif
134
135 noinst_PROGRAMS = checktty_test islocal_test
136 checktty_test_SOURCES = checktty.c login.h
137 checktty_test_CPPFLAGS = -DMAIN_TEST_CHECKTTY $(AM_CPPFLAGS)
138 islocal_test_SOURCES = islocal.c
139 islocal_test_CPPFLAGS = -DMAIN_TEST_ISLOCAL $(AM_CPPFLAGS)
140