Re: ?????? ?????? Implicit rule for linking multiple object files

2022-08-11 Thread ljh
Hi Paul, I use some example code which uses C++20 modules. There are five .cpp files, e.g: main.c depends on a.c b.c c.c d.c b.c d.c depends on c.c a.c depends on b.c d.c depends on a.c I update my Makefile like the following. Is it correct and guaranteed to work under parallel make?

Re: Making makefiles with primarily phony targets more friendly

2022-08-11 Thread Paul Smith
On Wed, 2022-08-10 at 19:08 +, Katherine Pata wrote: > I often find myself using makefiles to handle things like project > linting, container images, various scripts, initiating tests, and > other misc tasks. Sometimes these include tasks that have real > dependencies that make should keep

Re: ?????? ?????? Implicit rule for linking multiple object files

2022-08-11 Thread ljh
Thanks Paul, I've learnt a lot from your mail.

Re: 回复: 回复: Implicit rule for linking multiple object files

2022-08-11 Thread Paul Smith
On Fri, 2022-08-12 at 02:37 +0800, ljh wrote: > Aren't the order of compiling object files of first two rules > certain? The POSIX standard for make mandates that prerequisites are tried by make in the order they are listed in the prerequisite list, with the exception that implicit rules will

Re: 回复: 回复: Implicit rule for linking multiple object files

2022-08-11 Thread Martin Dorey
> Aren't the order of compiling object files of first two rules certain? No, it's unspecified. Earlier in this thread, you wrote: >> The manual states that the x.c compiles first. The example you're looking at just teaches that compiling x.c first is allowed. It doesn't teach that x.c will

?????? ?????? Implicit rule for linking multiple object files

2022-08-11 Thread ljh
Thanks Martin, Your Makefile is too advanced for me to understand by now. I tested out the below five rules. Aren't the order of compiling object files of first two rules certain? Will GNU Make keep their ordering behavior or are they just some random ordering caused by some random bugs

Re: 回复: Implicit rule for linking multiple object files

2022-08-11 Thread Martin Dorey
> I want to compile objects in order of the writting Just because, today, make happens to pick nearly what you want it to do without being told about your ordering constraint, doesn't mean that you should rely on it continuing to do so. You should teach make about that order. You could

?????? Implicit rule for linking multiple object files

2022-08-11 Thread ljh
Thanks Philip, I want to compile objects in order of the writting: y.o z.o x.o . The order of compiling x.o are different in below three cases. I don't understand the difference. x : y.o z.o x.o # compiles x.o last $(CC) $^ -o $@ # with recipe x : y.o z.o # compiles x.o last x : y.o

Re: Making makefiles with primarily phony targets more friendly

2022-08-11 Thread Edward Welbourne
Jean-Baptiste Poittevin (10 August 2022 22:19) wrote: > By using a lot of PHONY targets, I think you're closing a door to one > make greatest feature : not redoing those things that are already up > to date. While that's entirely true of make's "design-basis" use-case, I am familiar with the

Re: Implicit rule for linking multiple object files

2022-08-11 Thread Philip Guenther
The first place to consult in understanding how to build your code is the documentation of your compiler. C++20 *module* support is very new in at least gcc and they have not provided direct guidance on how to use modules with 'make', at least I don't see any such guidance here:

Re: »Ø¸´£º Implicit rule for linking multiple object files

2022-08-11 Thread Henrik Carlqvist
On Thu, 11 Aug 2022 14:18:29 +0800 "ljh" wrote: > main : c.o b.o a.o d.o main.o > A: note: imports must be built before being imported > A: fatal error: returning to the gate for a mechanical issue > compilation terminated. > make: *** [ 3. ok: with target.o and recipe > > $ rm -fr *.o

?????? Implicit rule for linking multiple object files

2022-08-11 Thread ljh
Hi Paul, I don't know if this is related to gcc support of c++20. But mentioning target.o ("x.o") and recipe or not in my Makefile, does have different result.My test follows. Thanks --- 1. error: with target.o ("x.o"), without recipe $ ls a.cpp b.cpp c.cpp d.cpp main.cpp