$NetBSD: patch-ah,v 1.7 2006/05/14 19:58:04 minskim Exp $ --- modules/Simple.Rules.orig 2001-12-09 22:15:11.000000000 +0000 +++ modules/Simple.Rules @@ -18,8 +18,13 @@ LIBSRC = $(addsuffix .c,$(LIBFILES)) LIBOBJ = $(addsuffix .o,$(LIBFILES)) LIBOBJD = $(addprefix dynamic/,$(LIBOBJ)) LIBOBJS = $(addprefix static/,$(LIBOBJ)) +LIBOBJLA = $(LIBOBJ:.o=.lo) +ifdef LIBTOOL +LINK_PAMMODUTILS = ../pammodutil/libpammodutil.la +else LINK_PAMMODUTILS = -L../pammodutil -lpammodutil +endif INCLUDE_PAMMODUTILS = -I../pammodutil/include ifdef DYNAMIC @@ -30,9 +35,23 @@ ifdef STATIC LIBSTATIC = lib$(TITLE).o endif +ifdef LIBTOOL +LIBLIBTOOL = $(TITLE).la +endif + ####################### don't edit below ####################### -all: dirs $(LIBSHARED) $(LIBSTATIC) register +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 dynamic/%.o : %.c $(CC) $(CFLAGS) $(INCLUDE_PAMMODUTILS) $(DYNAMIC) $(TARGET_ARCH) -c $< -o $@ @@ -40,6 +59,9 @@ dynamic/%.o : %.c static/%.o : %.c $(CC) $(CFLAGS) $(INCLUDE_PAMMODUTILS) $(STATIC) $(TARGET_ARCH) -c $< -o $@ +%.lo : %.c + $(SHLIBTOOL) --mode=compile $(CC) $(CFLAGS) $(INCLUDE_PAMMODUTILS) $(LTCFLAGS) $(CPPFLAGS) $(TARGET_ARCH) -c $< + dirs: ifdef DYNAMIC $(MKDIR) ./dynamic @@ -72,22 +94,37 @@ $(LIBSTATIC): $(LIBOBJS) $(LD) -r -o $@ $(LIBOBJS) $(MODULE_SIMPLE_EXTRALIBS) $(LINK_PAMMODUTILS) endif +ifdef LIBTOOL +$(LIBOBJLA): $(LIBSRC) +endif + +ifdef LIBTOOL +$(LIBLIBTOOL): $(LIBOBJLA) + $(SHLIBTOOL) --mode=link $(CC) $(LDFLAGS) $(LIBOBJLA) -o $@ $(MODULE_SIMPLE_EXTRALIBS) $(NEED_LINK_LIB_C) $(LINK_PAMMODUTILS) -module -avoid-version -rpath $(FAKEROOT)$(SECUREDIR) +endif + install: all $(MKDIR) $(FAKEROOT)$(SECUREDIR) ifdef DYNAMIC $(INSTALL) -m $(SHLIBMODE) $(LIBSHARED) $(FAKEROOT)$(SECUREDIR) endif +ifdef LIBTOOL + $(SHLIBTOOL) --mode=install $(INSTALL) -c $(LIBLIBTOOL) $(FAKEROOT)$(SECUREDIR) +endif $(MODULE_SIMPLE_INSTALL) remove: rm -f $(FAKEROOT)$(SECUREDIR)/$(TITLE).so +ifdef LIBTOOL + $(SHLIBTOOL) --mode=uninstall rm $(FAKEROOT)$(SECUREDIR)/$(TITLE).la +endif $(MODULE_SIMPLE_REMOVE) clean: - rm -f $(LIBOBJD) $(LIBOBJS) core *~ + rm -f $(LIBOBJD) $(LIBOBJS) $(LIBOBJLA) core *~ $(MODULE_SIMPLE_CLEAN) - rm -f *.a *.o *.so *.bak - rm -rf dynamic static + rm -f *.a *.la *.lo *.o *.so *.bak + rm -rf dynamic static .libs $(MODULE_SIMPLE_EXTRACLEAN) .c.o: