public inbox for [email protected]  
help / color / mirror / Atom feed
From: Noah Misch <[email protected]>
To: 高增琦 <[email protected]>
Cc: Tom Lane <[email protected]>
Cc: pgsql-hackers <[email protected]>
Subject: Re: no library dependency in Makefile?
Date: Wed, 13 Nov 2024 10:10:05 -0800
Message-ID: <[email protected]> (raw)
In-Reply-To: <CAFmBtr3Drr2Kw+_+eXjMVPv0n=yJH22mNy4H=4fnxfSTm0dXPg@mail.gmail.com>
References: <CAFmBtr1GDF+Cpw+7SZF8jWGeazOd==ivRAg3rWhLaRXYCv83Vg@mail.gmail.com>
	<CAFmBtr1nSvn3QAy30etCbNmUD+2hDDF=3nCpBAzuDBJ9n8HO4g@mail.gmail.com>
	<CAFmBtr3qUKuLHi+apw7ZVU7mG6mLsZwT9WR8pj62-=xAZ9r_5A@mail.gmail.com>
	<CAFmBtr28NjCVpj7kQt0u2vWzbS_fF9ttw=LTta=J0LSd7LLejA@mail.gmail.com>
	<[email protected]>
	<CAFmBtr1Mbm_PM15xx7qTbXzMMOmReM2=1G0EQmanqo9M5NijZw@mail.gmail.com>
	<CAFmBtr13kmMjdAReZW58_TG6zyZnRYz7RNyv-yT=HnY11kvuuQ@mail.gmail.com>
	<CAFmBtr3Drr2Kw+_+eXjMVPv0n=yJH22mNy4H=4fnxfSTm0dXPg@mail.gmail.com>

This burned me recently.

On Sun, Nov 26, 2017 at 02:18:16PM +0800, 高增琦 wrote:
> Update version:
> 1. Re-base with head of master
> 2. Add some basic support for PGXS
> 
> After replacing submake-libpgport/submake-libpgfeutils with
> $(stlib_pgport)/$(stlib_pgfeutils) in
> Makefiles of client programs, I think, may be we should add static lib
> dependency for PGXS.

Maybe.  Naming an installed file as a Make prerequisite can break if installed
to a directory containing a space.  If that works now, we shouldn't break it
for this.  Otherwise, naming the installed prerequisites sounds fine.

> I can think two ways to do that: first, add  a new PG_STLIBS variable, user
> need to
> add static libs to it; second, we generate static lib dependency
> automatically
> from PG_LIBS variable. Which one is better?

I prefer the second one.  With the first one, it's easy to miss omissions.  I
think that concept is useful beyond PG_LIBS and beyond PGXS.  For example:

> -initdb: $(OBJS) | submake-libpq submake-libpgport submake-libpgfeutils
> +initdb: $(OBJS) $(stlib_pgport) $(stlib_pgfeutils) | submake-libpq
>  	$(CC) $(CFLAGS) $(OBJS) $(LDFLAGS) $(LDFLAGS_EX) $(LIBS) -o $@$(X)

This could look like

  initdb: $(OBJS) $(call lib_prereq,$(LDFLAGS) $(LDFLAGS_EX) $(LIBS))

where lib_prereq is a GNU make function that translates -lpgcommon to
SOMEDIR/libpgcommon.a, translates unrecognized arguments to nothing, etc.
This avoids the need to edit the "initdb" rule every time you edit LIBS.  It's
easy to miss doing that, due to distance between the places that edit LIBS and
the places that read it.  For example, Makefile.global is one of the editors
of LIBS.  How do you see it?

Thanks,
nm






view thread (2+ messages)

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients using the --to and --cc options:
  reply via email

  To: [email protected]
  Cc: [email protected], [email protected], [email protected]
  Subject: Re: no library dependency in Makefile?
  In-Reply-To: <[email protected]>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by agora; see mirroring instructions
for how to clone and mirror all data and code used for this inbox