I just finished a major bout of makefile hacking.  We have seven or
so different makefiles that try to produce shared libraries, and only
two of them (libpq and libpgtcl) have been really properly maintained
over the last couple of months.  I fixed the recently introduced 
overwrite-library-with-symlink bug in those two, and then tried to
propagate what they know about shlibs into the other makefiles.

What I have now builds and installs, so I went ahead and checked it in
(what we had yesterday did not install correctly, so this can't be any
worse...).  But I'm thinking that this is still pretty messy and
unmaintainable.  In particular there is way too much replication of
stuff between the different makefiles.

I am thinking that we could improve matters by moving the common
material into a new file, say src/Makefile.shlib, that would be
included by each existing makefile that wants to build a shared lib.
The common file could contain all of the platform-specific variable
settings as well as some of the common rules (AFAIC the rules for
building and installing the shlib could be in the common file...).

Does anyone have an objection to this?


While we're on the subject of build procedures: a lot of the makefiles
contain cruft for building ordinary unshared libraries like this:

libpq.a: $(OBJS)
ifdef MK_NO_LORDER
	$(AR) $(AROPT) libpq.a $(OBJS) 
else
	$(AR) $(AROPT) libpq.a `lorder $(OBJS) | tsort`
endif
	$(RANLIB) libpq.a

I don't believe there are any Unix platforms left that still need the
lorder|tsort dance --- that's been superseded by ranlib on every
platform that has a linker that needs sorted modules within a library.
(libjpeg, which I believe to be considerably more widely-spread than
Postgres, has never done anything but a plain ranlib call --- and I
have never yet heard a complaint.)

The lorder stuff is evidently giving someone a hard time, since the
MK_NO_LORDER cruft has recently been introduced to allow it to be turned
off.

I propose just ripping out the lorder|tsort calls.  Can anyone point
to a platform on which they are still needed?

			regards, tom lane

Sun, 18 Oct 1998 15:59:56 -0400
Tom Lane <tgl@sss.pgh.pa.us>
shared library makefile changes checked in