Path: utzoo!utgpu!news-server.csri.toronto.edu!cs.utexas.edu!swrinde!zaphod.mps.ohio-state.edu!usc!snorkelwacker!bloom-beacon!morgan.COM!jordan From: jordan@morgan.COM (Jordan Hayes) Newsgroups: comp.windows.x Subject: Re: Shared Libraries and Patches Message-ID: <9010032032.AA24339@Morgan.COM> Date: 3 Oct 90 20:32:22 GMT References: <9010021331.AA22861@expire.lcs.mit.edu> Sender: root@athena.mit.edu (Wizard A. Root) Organization: Morgan Stanley, & Co., Inc. / New York City, NY Lines: 145 > I'd like to see the Sun shared library support go into sun.cf, I don't know what this means. I'd like SharedLibraryObjectRule() to be defined in sun.cf, and for Imake.rules to say something like #ifndef SharedLibraryObjectRule #define SharedLibraryObjectRule() #endif Then for the different types of shared libraries out there, you'd need to define a rule for SharedLibraryObjectRule in your .cf file ... Like, how have people hacked in shared library support for SYS V.2 machines, like the Intergraph that was mentioned recently or (more to my neck of the woods), A/UX 2.0? Seems kind of weird for HasSunOSSharedLibraries to appear in a bunch of random files. I thought the achitecture-independent portion of the rules should be in the .cf file? Perhaps you'd like to make such changes locally and try them for a few months (gratuitously installing new versions from time to time) to see if it really works? I have been, actually, for Motif 1.0 (and more recently 1.1), and i've found that the biggest change is to the *LibraryObjectRule() stuff. Are there any other machines (other than AIX -- grrr) where "cc -o" doesn't work? Near as I can tell, that's a v7-ism (where's Henry when you need him?), and it seems like a reasonable thing to expect. Without this support, you need to do that $(CC) ... $(MV) $@ shared/$@ hack. What this really means is that if you have libraries built and you decide to add one of {shared,debugged,profiled} to your Project.tmpl, you have to rebuild everything -- actually, you have to do a "make clean" before you re-make, because there's no target for shared/%.o: anywhere. For instance, here's my ProfiledLibraryObject and ProfiledLibraryTarget ----- cut here #ifndef NewProfiledLibraryObjectRule #define NewProfiledLibraryObjectRule() @@\ all:: @@\ -@if [ ! -d profiled ]; then mkdir profiled; else exit 0; fi @@\ @@\ profiled/%.o: %.c @@\ $(RM) $@ @@\ $(CC) -pg -o $@ -c $(CFLAGS) $< @@\ @@\ clean:: @@\ -@if [ -d profiled ]; then echo " $(RM) profiled/?*.o"; \ @@\ $(RM) profiled/?*.o; else exit 0; fi @@\ #endif /* NewProfiledLibraryObjectRule */ /* * NewProfiledLibraryTarget - generate rules to create a profiled library. */ #ifndef NewProfiledLibraryTarget #define NewProfiledLibraryTarget(libname,objlist) @@\ AllTarget(lib/**/libname/**/_p.a) @@\ @@\ Profiled/**/libname/**/Objs = $(objlist:%=profiled/%) @@\ @@\ lib/**/libname/**/_p.a: $(Profiled/**/libname/**/Objs) @@\ $(RM) $@ @@\ cd profiled; $(AR) ../$@ $(objlist) @@\ $(RANLIB) $@ @@\ @@\ clean:: @@\ $(RM) lib/**/libname/**/_p.a #endif /* NewProfiledLibraryTarget */ ----- cut here Given the following Imakefile, ----- cut here SRCS = foo.c bar.c mumble.c OBJS = $(SRCS:%.c=%.o) NewProfiledLibraryObjectRule() NewProfiledLibraryTarget(libXm,OBJS) ----- cut here gives you (approximately) ----- cut here all:: -@if [ ! -d profiled ]; then mkdir profiled; else exit 0; fi profiled/%.o: %.c $(RM) $@ $(CC) -pg -o $@ -c $(CFLAGS) $< clean:: -@if [ -d profiled ]; then echo " $(RM) profiled/?*.o"; \ $(RM) profiled/?*.o; else exit 0; fi all:: libXm_p.a ProfiledXmObjs = $(OBJS:%=profiled/%) libXm_p.a: $(ProfiledXmObjs) $(RM) $@ cd profiled; $(AR) ../$@ $(OBJS) $(RANLIB) $@ clean:: $(RM) libXm_p.a ----- cut here As for minor version numbers, we have the Motif shared libraries using the following system: libXm.so.${OSFMajor}.${OSFMinor}${OSFMinor2}${LocalLevel} e.g., the first shot from OSF Motif 1.1 becomes libXm.so.1.100 so I have 10 shots at bug-fixes locally before 1.1.1 comes out (which would become libXm.so.110). Since we have production code here running with these shared libraries, you can't just "make install" over the old libraries, so we bump ${LocalLevel} and 3-5 days later remove the ${LocalLevel} - 1 version ... this way new instances of programs get the new library, and old ones just die off eventually. There's more, of course, but I'd better take it off line ... /jordan