$NetBSD: patch-aw,v 1.5 2004/11/19 14:54:55 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) $(LTCFLAGS) $(CPPFLAGS) $(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) $<