Generating prerequisites automatically - for C++20 modules

2022-08-16 Thread ljh
Hello list, Can make provide an option to support C++20 modules, similar to the -MMD -MP option for generating .d files for header files inclusion. So we don't have to list the dependencies manually   main.o: x.o y.o z.o   x.o: y.o z.o    Thanks

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: ?????? ?????? Implicit rule for linking multiple object files

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

?????? ?????? 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 (sorry,

?????? 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

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

2022-08-10 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  

Implicit rule for linking multiple object files

2022-08-10 Thread ljh
Hello list, GNU Make Manual / 10.2 / Linking a single object file, mentions this:     x: y.o z.o  I have three c source files: x.c, y.c, z.c and I name x as the target on left. Can I put x.o in the prerequisites on the right too? Are they the same, with or without x.o in the prerequisites on

Re: The order of compiling multiple c++ source files

2022-08-10 Thread ljh
Thanks Paul, I have another quetion. Please help me. On section 10.2 of the manual:     ` x: y.o z.o ` Can I put x.o on the prerequisites on the right part?      ` x: y.o z.o x.o`  # with x.o Are they the same? --- The section 10.2 inspired me to write my little minimal general Make

The order of compiling multiple c++ source files

2022-08-09 Thread ljh
make manual / 10.2 Catalogue of Built-In Rules / Linking a single object file x: y.o z.o when x.c, y.c and z.c all exist will execute: cc -c x.c -o x.o  # x.c compiles first cc -c y.c -o y.o cc -c z.c -o z.o cc x.o y.o z.o -o x rm -f x.o rm -f y.o rm -f z.o ---  Q1:  The