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
|
$NetBSD: patch-aw,v 1.4 2004/11/16 07:46:58 jlam Exp $
--- modules/pam_unix/Makefile.orig 2001-02-11 01:33:53.000000000 -0500
+++ modules/pam_unix/Makefile
@@ -55,6 +55,7 @@ LIBSRC = pam_unix_auth.c pam_unix_acct.c
support.c
LIBOBJD = $(addprefix dynamic/,$(LIBOBJ))
LIBOBJS = $(addprefix static/,$(LIBOBJ))
+LIBOBJLA = $(LIBOBJ:.o=.lo)
PLUS = md5_good.o md5_broken.o md5_crypt_good.o md5_crypt_broken.o \
yppasswd_xdr.o bigcrypt.o
@@ -65,11 +66,24 @@ endif
ifdef STATIC
LIBSTATIC = libpam_unix.o
endif
+ifdef LIBTOOL
+LIBLIBTOOL = pam_unix.la
+endif
########################### don't edit below #######################
-all: dirs info $(PLUS) $(LIBSHARED) $(LIBSTATIC) $(CHKPWD) register
+ifdef DYNAMIC
+MODULES_TO_BUILD+= $(LIBSHARED)
+endif
+ifdef STATIC
+MODULES_TO_BUILD+= $(LIBSTATIC)
+endif
+ifdef LIBTOOL
+MODULES_TO_BUILD+= $(LIBLIBTOOL)
+endif
+
+all: dirs info $(MODULES_TO_BUILD) $(CHKPWD) register
dynamic/%.o : %.c
$(CC) $(CFLAGS) $(DYNAMIC) $(CPPFLAGS) $(TARGET_ARCH) -c $< -o $@
@@ -77,6 +91,9 @@ dynamic/%.o : %.c
static/%.o: %.c
$(CC) $(CFLAGS) $(STATIC) $(CPPFLAGS) $(TARGET_ARCH) -c $< -o $@
+%.lo : %.c
+ $(SHLIBTOOL) --mode=compile $(CC) $(CFLAGS) $(CPPFLAGS) -DPAM_DYNAMIC $(TARGET_ARCH) -c $<
+
dummy:
@echo "**** This is not a top-level Makefile "
exit
@@ -117,10 +134,17 @@ $(LIBSTATIC): $(LIBOBJS)
$(LD) -r -o $@ $(LIBOBJS) $(PLUS) $(CRACKLIB) $(LDLIBS) $(LIBNSL) $(LIBCRYPT)
endif
+ifdef LIBTOOL
+$(LIBOBJLA): $(LIBSRC)
+
+$(LIBLIBTOOL): $(LIBOBJLA) $(PLUS:.o=.lo)
+ $(SHLIBTOOL) --mode=link $(CC) $(LDFLAGS) $(LIBOBJLA) -o $@ $(PLUS:.o=.lo) $(CRACKLIB) $(LDLIBS) $(LIBNSL) $(LIBCRYPT) -module -avoid-version -rpath $(FAKEROOT)$(SECUREDIR)
+endif
+
$(CHKPWD): unix_chkpwd.o md5_good.o md5_broken.o \
md5_crypt_good.o md5_crypt_broken.o \
bigcrypt.o
- $(CC) -o $(CHKPWD) $^ $(LDLIBS) $(LIBCRYPT)
+ $(CC) $(LDFLAGS) -o $(CHKPWD) $^ $(LDLIBS) $(LIBCRYPT)
unix_chkpwd.o: unix_chkpwd.c
$(CC) $(CFLAGS) $(CPPFLAGS) $(TARGET_ARCH) -c $< -o $@
@@ -129,18 +153,38 @@ md5_good.o: md5.c
$(CC) $(CFLAGS) $(CPPFLAGS) -DHIGHFIRST -D'MD5Name(x)=Good##x' \
$(TARGET_ARCH) -c $< -o $@
+md5_good.lo: md5.c
+ $(LIBTOOL) --mode=compile $(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_broken.lo: md5.c
+ $(LIBTOOL) --mode=compile $(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_good.lo: md5_crypt.c
+ $(LIBTOOL) --mode=compile $(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 $@
+md5_crypt_broken.lo: md5_crypt.c
+ $(LIBTOOL) --mode=compile $(CC) $(CFLAGS) $(CPPFLAGS) \
+ -D'MD5Name(x)=Broken##x' \
+ $(TARGET_ARCH) -c $< -o $@
+
install: all
mkdir -p $(FAKEROOT)$(SECUREDIR)
ifdef DYNAMIC
@@ -148,19 +192,28 @@ ifdef DYNAMIC
for x in pam_unix_auth pam_unix_acct pam_unix_passwd pam_unix_session;\
do ln -sf $(LIBSHARED) $(FAKEROOT)$(SECUREDIR)/$$x.so ; done
endif
+ifdef LIBTOOL
+ $(SHLIBTOOL) --mode=install install $(LIBLIBTOOL) $(FAKEROOT)$(SECUREDIR)
+ . $(FAKEROOT)$(SECUREDIR)/$(LIBLIBTOOL); \
+ for x in pam_unix_auth pam_unix_acct pam_unix_passwd pam_unix_session;\
+ do ln -sf $$dlname $(FAKEROOT)$(SECUREDIR)/$$x.so ; done
+endif
$(MKDIR) $(FAKEROOT)$(SUPLEMENTED)
install -m 4555 $(CHKPWD) $(FAKEROOT)$(SUPLEMENTED)
remove:
rm -f $(FAKEROOT)$(SECUREDIR)/$(LIBSHARED)
+ifdef LIBTOOL
+ $(SHLIBTOOL) --mode=uninstall rm $(FAKEROOT)$(SECUREDIR)/$(LIBLIBTOOL)
+endif
for x in pam_unix_auth pam_unix_acct pam_unix_passwd pam_unix_session;\
do rm -f $(FAKEROOT)$(SECUREDIR)/$$x.so ; done
rm -f $(FAKEROOT)$(SUPLEMENTED)/$(CHKPWD)
clean:
- rm -f $(LIBOBJD) $(LIBOBJS) $(CHKPWD) *.o *.so core
+ rm -f $(LIBOBJD) $(LIBOBJS) $(LIBOBJLA) $(CHKPWD) *.la *.lo *.o *.so core
rm -f *~ *.a *.out *.bak
- rm -rf dynamic static
+ rm -rf dynamic static .libs
.c.o:
$(CC) -c $(CFLAGS) $<
|