$NetBSD: patch-au,v 1.5 2004/11/19 14:54:55 jlam Exp $ --- modules/pam_filter/Makefile.orig 2001-11-11 02:43:54.000000000 -0500 +++ modules/pam_filter/Makefile @@ -27,6 +27,7 @@ LIBSRC = $(TITLE).c LIBOBJ = $(TITLE).o LIBOBJD = $(addprefix dynamic/,$(LIBOBJ)) LIBOBJS = $(addprefix static/,$(LIBOBJ)) +LIBOBJLA = $(LIBOBJ:.o=.lo) dynamic/%.o : %.c $(CC) $(CFLAGS) $(DYNAMIC) $(CPPFLAGS) $(TARGET_ARCH) -c $< -o $@ @@ -34,6 +35,9 @@ dynamic/%.o : %.c static/%.o : %.c $(CC) $(CFLAGS) $(STATIC) $(CPPFLAGS) $(TARGET_ARCH) -c $< -o $@ +%.lo : %.c + $(SHLIBTOOL) --mode=compile $(CC) $(CFLAGS) $(INCLUDE_PAMMODUTILS) $(LTCFLAGS) $(TARGET_ARCH) -c $< + ifdef DYNAMIC LIBSHARED = $(TITLE).so endif @@ -42,13 +46,27 @@ ifdef STATIC LIBSTATIC = lib$(TITLE).o endif +ifdef LIBTOOL +LIBLIBTOOL = $(TITLE).la +endif + ####################### don't edit below ####################### # # this is where we compile this module # -all: dirs $(LIBSHARED) $(LIBSTATIC) register filters +ifdef DYNAMIC +MODULES_TO_BUILD+= $(LIBSHARED) +endif +ifdef STATIC +MODULES_TO_BUILD+= $(LIBSTATIC) +endif +ifdef LIBTOOL +MODULES_TO_BUILD+= $(LIBLIBTOOL) +endif + +all: dirs $(MODULES_TO_BUILD) register filters dirs: if [ ! -r include/security ]; then ln -sf . include/security ; fi @@ -90,8 +108,20 @@ $(LIBSTATIC): $(LIBOBJS) $(LD) -r -o $@ $(LIBOBJS) endif +ifdef LIBTOOL +$(LIBOBJLA): $(LIBSRC) +endif + +ifdef LIBTOOL +$(LIBLIBTOOL): $(LIBOBJLA) + $(SHLIBTOOL) --mode=link $(CC) $(LDFLAGS) $(LIBOBJLA) -o $@ -module -avoid-version -rpath $(FAKEROOT)$(SECUREDIR) +endif + remove: rm -f $(FAKEROOT)$(SECUREDIR)/$(TITLE).so +ifdef LIBTOOL + $(LIBTOOL) --mode-uninstall rm $(FAKEROOT)$(SECUREDIR)/$(TITLE).la +endif rm -f $(FAKEROOT)$(INCLUDED)/pam_filter.h @for i in $(FILTERS) ; do \ if [ -d $$i ]; then \ @@ -109,6 +139,9 @@ install: all ifdef DYNAMIC $(INSTALL) -m $(SHLIBMODE) $(LIBSHARED) $(FAKEROOT)$(SECUREDIR) endif +ifdef LIBTOOL + $(LIBTOOL) --mode=install $(INSTALL) $(LIBLIBTOOL) $(FAKEROOT)$(SECUREDIR) +endif $(MKDIR) $(FAKEROOT)$(INCLUDED) $(INSTALL) -m 644 include/pam_filter.h $(FAKEROOT)$(INCLUDED) @@ -118,9 +151,9 @@ clean: $(MAKE) -C $$i clean ; \ fi ; \ done - rm -f $(LIBSHARED) $(LIBOBJD) $(LIBOBJS) core *~ + rm -f $(LIBSHARED) $(LIBLIBTOOL) $(LIBOBJD) $(LIBOBJS) $(LIBOBJSLA) core *~ rm -f include/security - rm -fr dynamic static - rm -f *.a *.o *.so *.bak + rm -fr dynamic static .libs + rm -f *.a *.la *.lo *.o *.so *.bak endif