summaryrefslogtreecommitdiff
path: root/modules/pam_pwdb/Makefile
blob: fcb7aec43a67a99aa77a93befea0c186383c110a (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
# $Id$
#
# This Makefile controls a build process of the pam_unix module
# for Linux-PAM. You should not modify this Makefile.
#
# rewritten to compile new module Andrew Morgan
# <morgan@parc.power.net> 1996/11/6
#

#
# Note, the STATIC module is commented out because it doesn't work.
# please fix!
#

ifndef FULL_LINUX_PAM_SOURCE_TREE
export DYNAMIC=-DPAM_DYNAMIC
export CC=gcc
export CFLAGS=-O2 -Dlinux -DLINUX_PAM \
       -ansi -D_POSIX_SOURCE -Wall -Wwrite-strings \
       -Wpointer-arith -Wcast-qual -Wcast-align -Wtraditional \
       -Wstrict-prototypes -Wmissing-prototypes -Wnested-externs -Winline \
       -Wshadow -pedantic -fPIC
export MKDIR=mkdir -p
export LD_D=gcc -shared -Xlinker -x
export HAVE_PWDBLIB=yes
endif

ifeq ($(shell if [ -f /lib/libcrypt.so.* ]; then echo yes ; else echo no ; fi),yes)
EXTRALS += -lcrypt
endif

ifeq ($(HAVE_PWDBLIB),yes)

TITLE=pam_pwdb
CHKPWD=pwdb_chkpwd

# compilation flags
EXTRAS=
# extra object files
PLUS=
# extra files that may be needed to be created
CREATE=

# NOTE: this module links dynamically to the libpwdb library.
EXTRALS += -lpwdb 
EXTRAS += -DCHKPWD_HELPER=\"$(SUPLEMENTED)/$(CHKPWD)\"

########################### don't edit below ##########################

LIBSRC = $(TITLE).c
LIBOBJ = $(TITLE).o
LIBOBJD = $(addprefix dynamic/,$(LIBOBJ))
#LIBOBJS = $(addprefix static/,$(LIBOBJ))
LIBDEPS = pam_unix_acct.-c pam_unix_auth.-c pam_unix_passwd.-c \
	pam_unix_sess.-c pam_unix_pwupd.-c support.-c bigcrypt.-c

PLUS += md5_good.o md5_broken.o md5_crypt_good.o md5_crypt_broken.o
CFLAGS += $(EXTRAS)

ifdef DYNAMIC
LIBSHARED = $(TITLE).so
endif
#ifdef STATIC
#LIBSTATIC = lib$(TITLE).o
#endif

all: info dirs $(PLUS) $(LIBSHARED) $(LIBSTATIC) register $(CHKPWD)

dynamic/$(LIBOBJ) : $(LIBSRC) $(LIBDEPS)
	$(CC) $(CFLAGS) $(DYNAMIC) $(CPPFLAGS) $(TARGET_ARCH) -c $< -o $@

#static/$(LIBOBJ) : $(LIBSRC) $(LIBDEPS)
#	$(CC) $(CFLAGS) $(STATIC) $(CPPFLAGS) $(TARGET_ARCH) -c $< -o $@

info:
	@echo
	@echo "*** Building PAM_pwdb module..."
	@echo

$(CHKPWD): pwdb_chkpwd.o md5_good.o md5_broken.o \
           md5_crypt_good.o md5_crypt_broken.o
	$(CC) -o $(CHKPWD) $^ -lpwdb

pwdb_chkpwd.o: pwdb_chkpwd.c pam_unix_md.-c bigcrypt.-c

md5_good.o: md5.c
	$(CC) $(CFLAGS) $(CPPFLAGS) -DHIGHFIRST -D'MD5Name(x)=Good##x' \
            $(TARGET_ARCH) -c $< -o $@

md5_broken.o: md5.c
	$(CC) $(CFLAGS) $(CPPFLAGS) -D'MD5Name(x)=Broken##x' \
            $(TARGET_ARCH) -c $< -o $@

md5_crypt_good.o: md5_crypt.c
	$(CC) $(CFLAGS) $(CPPFLAGS) -D'MD5Name(x)=Good##x' \
            $(TARGET_ARCH) -c $< -o $@

md5_crypt_broken.o: md5_crypt.c
	$(CC) $(CFLAGS) $(CPPFLAGS) -D'MD5Name(x)=Broken##x' \
            $(TARGET_ARCH) -c $< -o $@

dirs:
ifdef DYNAMIC
	@$(MKDIR) ./dynamic
endif
#ifdef STATIC
#	@$(MKDIR) ./static
#endif

register:
#ifdef STATIC
#	( cd .. ; ./register_static $(TITLE) $(TITLE)/$(LIBSTATIC) )
#endif

ifdef DYNAMIC
$(LIBOBJD): $(LIBSRC)

$(LIBSHARED):	$(LIBOBJD)
	$(LD_D) -o $@ $(LIBOBJD) $(PLUS) $(EXTRALS)
endif

#ifdef STATIC
#$(LIBOBJS): $(LIBSRC)
#
#$(LIBSTATIC): $(LIBOBJS)
#	$(LD) -r -o $@ $(LIBOBJS) $(PLUS) $(EXTRALS)
#endif

install: all
	$(MKDIR) $(FAKEROOT)$(SECUREDIR)
ifdef DYNAMIC
	$(INSTALL) -m $(SHLIBMODE) $(LIBSHARED) $(FAKEROOT)$(SECUREDIR)
endif
	$(MKDIR) $(FAKEROOT)$(SUPLEMENTED)
	$(INSTALL) -m 4555 -o root -g root $(CHKPWD) $(FAKEROOT)$(SUPLEMENTED)

remove:
	rm -f $(FAKEROOT)$(SECUREDIR)/$(TITLE).so
	rm -f $(FAKEROOT)$(SUPLEMENTED)/$(CHKPWD)

clean:
	rm -f $(CHKPWD) $(LIBOBJD) $(LIBOBJS) $(MOREDELS) core *~ *.o *.so

extraclean: clean
	rm -f *.a *.o *.so *.bak

else

include ../dont_makefile

endif

#####################################################################
# $Log$
# Revision 1.1  2000/06/20 22:11:47  agmorgan
# Initial revision
#
# Revision 1.4  1999/08/01 16:18:27  morgan
# added a conditional for libcrypt
#
# Revision 1.3  1999/07/08 05:02:02  morgan
# glibc fixes (Thorsten Kukuk, Adam J. Richter)
#
# Revision 1.2  1999/07/04 23:22:38  morgan
# Andrey's MD5 (bigendian) work around + cleanup to address problems with
# applications that let an (ab)user kill them off without giving PAM the
# opportunity to end. [Problem report from Tani Hosokawa on bugtraq.]
#
# Revision 1.1.1.1  1998/07/12 05:17:16  morgan
# Linux PAM sources pre-0.66
#
# Revision 1.7  1997/04/05 06:28:50  morgan
# fakeroot
#
# Revision 1.6  1997/02/15 17:25:32  morgan
# update for .56 . extra commands for new helper binary
#
# Revision 1.5  1997/01/04 20:39:08  morgan
# conditional on having libpwdb
#
# Revision 1.4  1996/12/01 03:02:03  morgan
# changed banner, removed linking libraries
#
# Revision 1.3  1996/11/10 20:14:42  morgan
# cross platform support
#
# Revision 1.2  1996/09/05 06:36:49  morgan
# options added and use of LD altered
#
# Revision 1.1  1996/08/29 13:23:29  morgan
# Initial revision
#
#