Re: no library dependency in Makefile?

From: 高增琦 <pgf00a(at)gmail(dot)com>
To: pgsql-hackers <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: no library dependency in Makefile?
Date: 2017-11-18 02:28:43
Message-ID: CAFmBtr28NjCVpj7kQt0u2vWzbS_fF9ttw=LTta=J0LSd7LLejA@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

I very much look forward to hearing everyone's views on this issue.

If the solution mentioned before is ok, I will start to complete it.

thanks

高增琦 <pgf00a(at)gmail(dot)com>于2017年11月16日 周四20:51写道:

> LDFLAGS in the example changed to:
>
> '''
> override LDFLAGS := $(call expand_stlibs,$(STLIBS)) $(libpq_pgport)
> $(LDFLAGS)
> '''
>
> 2017-11-16 20:50 GMT+08:00 高增琦 <pgf00a(at)gmail(dot)com>:
>
>> Is this a problem or not?
>>
>>
>> A simple fix:
>> 1. add a STLIBS variable in Makefiles as normal prerequisite
>> <https://www.gnu.org/software/make/manual/make.html#Prerequisite-Types>
>> 2. using GNU make's function to generate '-Lxxx -lxxx' for items in STLIBS
>>
>> For example: libpgfeutils.a in psql's Makefile:
>> '''
>> # function to generate '-Lxxx -lxxx', may put in another file
>> expand_stlibs = $(patsubst %,-L%,$(dir $(1))) $(patsubst
>> lib%.a,-l%,$(notdir $(1)))
>>
>> # static lib
>> STLIBS := $(top_builddir)/src/fe_utils/libpgfeutils.a
>>
>> # add STLIBS as normal prerequisite
>> psql: $(OBJS) $(STLIBS) | submake-libpq submake-libpgport
>> submake-libpgfeutils
>> $(CC) $(CFLAGS) $(OBJS) $(LDFLAGS) $(LDFLAGS_EX) $(LIBS) -o $(at)$(X)
>> '''
>>
>> 2017-11-15 16:10 GMT+08:00 高增琦 <pgf00a(at)gmail(dot)com>:
>>
>>> Hi,
>>>
>>> Recently, I found 'psql' is not rebuilt automatically after
>>> editing 'fe_utils/psqlscan.l'.
>>>
>>> The detail is:
>>> 'psqlscan.l' is part of 'libpgfeutils.a' which will be built
>>> into 'psql' statically. But there is no dependency rule between
>>> them.
>>>
>>> It's OK for 'libpq' since 'libpq' is a dynamic library.
>>> For a static library such as 'libpgfeutils.a', should we
>>> add dependency rule in Makefile?
>>>
>>> --
>>> GaoZengqi
>>> pgf00a(at)gmail(dot)com
>>> zengqigao(at)gmail(dot)com
>>>
>>
>>
>>
>> --
>> GaoZengqi
>> pgf00a(at)gmail(dot)com
>> zengqigao(at)gmail(dot)com
>>
>
>
>
> --
> GaoZengqi
> pgf00a(at)gmail(dot)com
> zengqigao(at)gmail(dot)com
>
--
GaoZengqi
pgf00a(at)gmail(dot)com
zengqigao(at)gmail(dot)com

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message jotpe 2017-11-18 09:13:59 percentile value check can be slow
Previous Message Peter Geoghegan 2017-11-18 02:22:54 Re: Treating work_mem as a shared resource (Was: Parallel Hash take II)