]> granicus.if.org Git - linux-pam/blob - modules/pam_unix/Makefile
Relevant BUGIDs: 643357
[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          -I../pammodutil/include
46
47 LDLIBS = $(EXTRALS) -L../pammodutil -lpammodutil
48
49 ifdef USE_CRACKLIB
50 CRACKLIB = -lcrack
51 endif
52
53
54 LIBOBJ = pam_unix_auth.o pam_unix_acct.o pam_unix_sess.o pam_unix_passwd.o \
55                 support.o
56 LIBSRC = pam_unix_auth.c pam_unix_acct.c pam_unix_sess.c pam_unix_passwd.c \
57                 support.c
58 LIBOBJD = $(addprefix dynamic/,$(LIBOBJ))
59 LIBOBJS = $(addprefix static/,$(LIBOBJ))
60
61 PLUS = md5_good.o md5_broken.o md5_crypt_good.o md5_crypt_broken.o \
62                 yppasswd_xdr.o bigcrypt.o
63
64 ifdef DYNAMIC
65 LIBSHARED = pam_unix.so
66 endif
67 ifdef STATIC
68 LIBSTATIC = libpam_unix.o
69 endif
70
71
72 ########################### don't edit below #######################
73
74 all: dirs info $(PLUS) $(LIBSHARED) $(LIBSTATIC) $(CHKPWD) register
75
76 dynamic/%.o : %.c
77         $(CC) $(CFLAGS) $(DYNAMIC) $(CPPFLAGS) $(TARGET_ARCH) -c $< -o $@
78
79 static/%.o: %.c
80         $(CC) $(CFLAGS) $(STATIC) $(CPPFLAGS) $(TARGET_ARCH) -c $< -o $@
81
82 dummy:
83         @echo "**** This is not a top-level Makefile "
84         exit
85
86 info:
87         @echo
88         @echo "*** Building pam-unix module of the framework..."
89         @echo
90
91 dirs:
92 ifdef DYNAMIC
93         mkdir -p ./dynamic
94 endif
95 ifdef STATIC
96         mkdir -p ./static
97 endif
98
99 register:
100 ifdef STATIC
101         ( cd .. ; ./register_static pam_unix_auth pam_unix/$(LIBSTATIC) ; \
102                 ./register_static pam_unix_acct  "" ; \
103                 ./register_static pam_unix_session "" ; \
104                 ./register_static pam_unix_passwd "" ; \
105         )
106 endif
107
108 ifdef DYNAMIC
109 $(LIBOBJD): $(LIBSRC)
110
111 $(LIBSHARED):   $(LIBOBJD)
112         $(LD_D) -o $@ $(LIBOBJD) $(PLUS) $(CRACKLIB) $(LDLIBS) $(LIBNSL) $(LIBCRYPT) $(NEED_LINK_LIB_C) -L../../libpam -lpam
113 endif
114
115 ifdef STATIC
116 $(LIBOBJS): $(LIBSRC)
117
118 $(LIBSTATIC): $(LIBOBJS)
119         $(LD) -r -o $@ $(LIBOBJS) $(PLUS) $(CRACKLIB) $(LDLIBS) $(LIBNSL) $(LIBCRYPT)
120 endif
121
122 $(CHKPWD): unix_chkpwd.o md5_good.o md5_broken.o \
123                 md5_crypt_good.o md5_crypt_broken.o \
124                 bigcrypt.o
125         $(CC) -o $(CHKPWD) $^ $(LDLIBS) $(LIBCRYPT)
126
127 unix_chkpwd.o: unix_chkpwd.c
128         $(CC) $(CFLAGS) $(CPPFLAGS) $(TARGET_ARCH) -c $< -o $@
129
130 md5_good.o: md5.c
131         $(CC) $(CFLAGS) $(CPPFLAGS) -DHIGHFIRST -D'MD5Name(x)=Good##x' \
132                 $(TARGET_ARCH) -c $< -o $@
133
134 md5_broken.o: md5.c
135         $(CC) $(CFLAGS) $(CPPFLAGS) -D'MD5Name(x)=Broken##x' \
136                 $(TARGET_ARCH) -c $< -o $@
137
138 md5_crypt_good.o: md5_crypt.c
139         $(CC) $(CFLAGS) $(CPPFLAGS) -D'MD5Name(x)=Good##x' \
140                 $(TARGET_ARCH) -c $< -o $@
141
142 md5_crypt_broken.o: md5_crypt.c
143         $(CC) $(CFLAGS) $(CPPFLAGS) -D'MD5Name(x)=Broken##x' \
144                 $(TARGET_ARCH) -c $< -o $@
145
146 install: all
147         mkdir -p $(FAKEROOT)$(SECUREDIR)
148 ifdef DYNAMIC
149         install -m $(SHLIBMODE) $(LIBSHARED) $(FAKEROOT)$(SECUREDIR)
150         for x in pam_unix_auth pam_unix_acct pam_unix_passwd pam_unix_session;\
151                 do ln -sf $(LIBSHARED) $(FAKEROOT)$(SECUREDIR)/$$x.so ; done
152 endif
153         $(MKDIR) $(FAKEROOT)$(SUPLEMENTED)
154         install -m 4555 $(CHKPWD) $(FAKEROOT)$(SUPLEMENTED)
155
156 remove:
157         rm -f $(FAKEROOT)$(SECUREDIR)/$(LIBSHARED)
158         for x in pam_unix_auth pam_unix_acct pam_unix_passwd pam_unix_session;\
159                 do rm -f $(FAKEROOT)$(SECUREDIR)/$$x.so ; done
160         rm -f $(FAKEROOT)$(SUPLEMENTED)/$(CHKPWD)
161
162 clean:
163         rm -f $(LIBOBJD) $(LIBOBJS) $(CHKPWD) *.o *.so core
164         rm -f *~ *.a *.out *.bak
165         rm -rf dynamic static
166
167 .c.o:   
168         $(CC) -c $(CFLAGS) $<
169