]> granicus.if.org Git - linux-pam/blob - modules/pam_unix/Makefile
Relevant BUGIDs: 126431, 126423
[linux-pam] / modules / pam_unix / Makefile
1 # $Id$
2 #
3 # This Makefile controls a build process of the pam_unix modules
4 # for Linux-PAM. You should not modify this Makefile.
5 #
6
7 include ../../Make.Rules
8
9 ########################################################################
10 # some options... uncomment to take effect
11 ########################################################################
12
13 # Unless someone wants to work out how to make this work with the new
14 # autoconf stuff, you should use a separate module for this type of thing
15 # pam_cracklib perhaps..?
16 # do you want cracklib?
17 #ifeq ($(HAVE_CRACKLIB),yes)
18 #USE_CRACKLIB=-D"USE_CRACKLIB"
19 #endif
20
21 # do you want to use lckpwdf?
22 ifeq ($(WITH_LCKPWDF),yes)
23 USE_LCKPWDF=-D"USE_LCKPWDF"
24 # do you need to include the locking functions in the source?
25 ifeq ($(HAVE_LCKPWDF),no)
26   NEED_LCKPWDF=-D"NEED_LCKPWDF"
27 endif
28 endif
29
30 ifeq ($(HAVE_LIBNSL),yes)
31   LIBNSL = -lnsl
32 endif
33
34 ifeq ($(HAVE_LIBCRYPT),yes)
35   LIBCRYPT=-lcrypt
36 endif
37
38 CHKPWD=unix_chkpwd
39
40 EXTRAS += -DCHKPWD_HELPER=\"$(SUPLEMENTED)/$(CHKPWD)\"
41
42 ########################################################################
43
44 CFLAGS += $(USE_CRACKLIB) $(USE_LCKPWDF) $(NEED_LCKPWDF) $(EXTRAS)
45 LDLIBS = $(EXTRALS)
46
47 ifdef USE_CRACKLIB
48 CRACKLIB = -lcrack
49 endif
50
51
52 LIBOBJ = pam_unix_auth.o pam_unix_acct.o pam_unix_sess.o pam_unix_passwd.o \
53                 support.o
54 LIBSRC = pam_unix_auth.c pam_unix_acct.c pam_unix_sess.c pam_unix_passwd.c \
55                 support.c
56 LIBOBJD = $(addprefix dynamic/,$(LIBOBJ))
57 LIBOBJS = $(addprefix static/,$(LIBOBJ))
58
59 PLUS = md5_good.o md5_broken.o md5_crypt_good.o md5_crypt_broken.o \
60                 yppasswd_xdr.o bigcrypt.o
61
62 ifdef DYNAMIC
63 LIBSHARED = pam_unix.so
64 endif
65 ifdef STATIC
66 LIBSTATIC = libpam_unix.o
67 endif
68
69
70 ########################### don't edit below #######################
71
72 all: dirs info $(PLUS) $(LIBSHARED) $(LIBSTATIC) $(CHKPWD) register
73
74 dynamic/%.o : %.c
75         $(CC) $(CFLAGS) $(DYNAMIC) $(CPPFLAGS) $(TARGET_ARCH) -c $< -o $@
76
77 static/%.o: %.c
78         $(CC) $(CFLAGS) $(STATIC) $(CPPFLAGS) $(TARGET_ARCH) -c $< -o $@
79
80 dummy:
81         @echo "**** This is not a top-level Makefile "
82         exit
83
84 info:
85         @echo
86         @echo "*** Building pam-unix module of the framework..."
87         @echo
88
89 dirs:
90 ifdef DYNAMIC
91         mkdir -p ./dynamic
92 endif
93 ifdef STATIC
94         mkdir -p ./static
95 endif
96
97 register:
98 ifdef STATIC
99         ( cd .. ; ./register_static pam_unix_auth pam_unix/$(LIBSTATIC) ; \
100                 ./register_static pam_unix_acct  "" ; \
101                 ./register_static pam_unix_session "" ; \
102                 ./register_static pam_unix_passwd "" ; \
103         )
104 endif
105
106 ifdef DYNAMIC
107 $(LIBOBJD): $(LIBSRC)
108
109 $(LIBSHARED):   $(LIBOBJD)
110         $(LD_D) -o $@ $(LIBOBJD) $(PLUS) $(CRACKLIB) $(LDLIBS) $(LIBNSL) $(LIBCRYPT)
111 endif
112
113 ifdef STATIC
114 $(LIBOBJS): $(LIBSRC)
115
116 $(LIBSTATIC): $(LIBOBJS)
117         $(LD) -r -o $@ $(LIBOBJS) $(PLUS) $(CRACKLIB) $(LDLIBS) $(LIBNSL) $(LIBCRYPT)
118 endif
119
120 $(CHKPWD): unix_chkpwd.o md5_good.o md5_broken.o \
121                 md5_crypt_good.o md5_crypt_broken.o \
122                 bigcrypt.o
123         $(CC) -o $(CHKPWD) $^ $(LDLIBS) $(LIBCRYPT)
124
125 unix_chkpwd.o: unix_chkpwd.c
126         $(CC) $(CFLAGS) $(CPPFLAGS) $(TARGET_ARCH) -c $< -o $@
127
128 md5_good.o: md5.c
129         $(CC) $(CFLAGS) $(CPPFLAGS) -DHIGHFIRST -D'MD5Name(x)=Good##x' \
130                 $(TARGET_ARCH) -c $< -o $@
131
132 md5_broken.o: md5.c
133         $(CC) $(CFLAGS) $(CPPFLAGS) -D'MD5Name(x)=Broken##x' \
134                 $(TARGET_ARCH) -c $< -o $@
135
136 md5_crypt_good.o: md5_crypt.c
137         $(CC) $(CFLAGS) $(CPPFLAGS) -D'MD5Name(x)=Good##x' \
138                 $(TARGET_ARCH) -c $< -o $@
139
140 md5_crypt_broken.o: md5_crypt.c
141         $(CC) $(CFLAGS) $(CPPFLAGS) -D'MD5Name(x)=Broken##x' \
142                 $(TARGET_ARCH) -c $< -o $@
143
144 install: all
145         mkdir -p $(FAKEROOT)$(SECUREDIR)
146 ifdef DYNAMIC
147         install -m $(SHLIBMODE) $(LIBSHARED) $(FAKEROOT)$(SECUREDIR)
148         for x in pam_unix_auth pam_unix_acct pam_unix_passwd pam_unix_session;\
149                 do ln -sf $(LIBSHARED) $(FAKEROOT)$(SECUREDIR)/$$x.so ; done
150 endif
151         install $(CHKPWD) $(FAKEROOT)$(SUPLEMENTED)
152
153 remove:
154         rm -f $(FAKEROOT)$(SECUREDIR)/$(LIBSHARED)
155         for x in pam_unix_auth pam_unix_acct pam_unix_passwd pam_unix_session;\
156                 do rm -f $(FAKEROOT)$(SECUREDIR)/$$x.so ; done
157         rm -f $(FAKEROOT)$(SUPLEMENTED)/$(CHKPWD)
158
159 clean:
160         rm -f $(LIBOBJD) $(LIBOBJS) $(CHKPWD) *.o *.so core
161         rm -f *~ *.a *.out *.bak
162         rm -rf dynamic static
163
164 .c.o:   
165         $(CC) -c $(CFLAGS) $<
166