Toolchain independence - #717
Conversation
|
|
||
| REBUILD_CANDIDATE_OBJECTS := $(shell find . -name '*.o') | ||
| ${REBUILD_CANDIDATE_OBJECTS): .EXTRA_PREREQS = ${CHECK_FLAGS_BOARD_HASH} | ||
| .EXTRA_PREREQS = ${CHECK_FLAGS_BOARD_HASH} |
There was a problem hiding this comment.
FYI Peter: #715. (I suspect this might be the BSD make instead of GNU make thing again? IDK)
There was a problem hiding this comment.
Could be; I will check this.
There was a problem hiding this comment.
We use so many GNUmake idioms I'd be surprised if BSD make builds the system at all.
There was a problem hiding this comment.
Is it possible to make make error if it's not GNUmake? That would solve this as well, I think. (I do recall us decided that we basically need GNUmake: our CI needs it explicitly)
There was a problem hiding this comment.
Correction: macOS default is GNUmake 3.8, from 2006...
There was a problem hiding this comment.
So I don't know what the difference is but @0aids was reporting that $^ was including all the dependencies from this and breaking their build.
I don't know what the difference is between them.
There was a problem hiding this comment.
Do you mean with 'EXTRA_PREREQS' or with Courtney's patch? Either way, we're adding a prerequisite to ensure that stuff is rebuilt; and $^ is the list of all prerequisites except the ones in EXTRA_PREREQS -- Courtney's patch will add the hash file 6to the list; this patch will not.
There was a problem hiding this comment.
Yes, Courtney's patch. But it also included all the .h files listed in the compiler emitted .d files.
What confuses me is I don't see what the difference is because the list of dependencies in the compiler-depfile would contain the headers always but why does it only sometimes appear in $^. And when we tested this with two files one included the dependencies in the other file didn't appear in $^.
There was a problem hiding this comment.
On the first run, the .d files haven't been created, so Make doesn't know about the header files. On subsequent runs it does. A prerequisite in Make terms is any file, that if newer than a target, means the target has to be rebuilt: any header file a C file includes, if changed, means that the .o target needs rebuilding. So the complete prerequisite list for a .o file will always include the C file it is built from, and the transitive closure of header files that that C file includes directly or recursively.
There is almost never a reason to use $^ in a Makefile rule;
There was a problem hiding this comment.
Well, a lot of our Makefile rules do...
In some ways I think we need to redo all our Makefiles to be of better quality. At the moment they have a hodegpoge of styles and techniques, but at the same time I don't know of any golden references.
|
|
||
|
|
||
| IMAGES := blk_driver.elf client.elf blk_virt.elf serial_virt_tx.elf serial_driver.elf | ||
| CFLAGS += -Wall -Wno-unused-function -Werror -Wno-unused-command-line-argument \ |
There was a problem hiding this comment.
I can understand wanting to remove these disabled warnings but it has nothing to do with GCC vs Clang... These should be separate commits not squished in with the rest silently.
There was a problem hiding this comment.
This is GCC-versus clang ... the arguments are not available for gcc, and the warnings they suppress need to be fixed in-line in the code instead.
There was a problem hiding this comment.
GCC doesn't support -Wno-unused-function? but it says it does: https://gcc.gnu.org/onlinedocs/gcc/Warning-Options.html#index-Wunused-function (and I'm pretty sure these pre-date clang-as-default).
There was a problem hiding this comment.
-Wunused-command-line-argument is the one it doesn't seem to accept... and if we can get rid of them, let's go ...
There was a problem hiding this comment.
I don't think we can get rid of -Wunused-command-line-argument unfortunately, there's some issues with the Nix-packaged sysroots, and a few other cases.
55be0f0 to
e017a3e
Compare
Gcc complains about a multi-line // comment. Fix it. Signed-off-by: Peter Chubb <Peter.Chubb@unsw.edu.au>
GCC complained about an unused variable: remove it. Signed-off-by: Peter Chubb <Peter.Chubb@unsw.edu.au>
This means we can get of the -Wno-unused-function compiler arg that is unrecognised by GCC. Signed-off-by: Peter Chubb <Peter.Chubb@unsw.edu.au>
Extend the board-hash to include TOOLCHAIN and make it so *everything* depends on it. Make clang the default toolchain Allow parent Makefiles to add to the flags depended on. Signed-off-by: Peter Chubb <Peter.Chubb@unsw.edu.au>
Extends flags with NVME and PARTITION so changing them forces a rebuild. Passes down Makefile flags to submake. Reformat slightly for clarity Signed-off-by: Peter Chubb <Peter.Chubb@unsw.edu.au>
This allows compilation ... there are some debug print helper
functions in a block.h header file.
-- Mark them inline so they don't get expanded if not used
-- Mark them __attribute__((unused) to make sure the compiler doesn't
complain.
Signed-off-by: Peter Chubb <Peter.Chubb@unsw.edu.au>
to make the style checker happy. Signed-off-by: Peter Chubb <Peter.Chubb@unsw.edu.au>
in mmio.c -- clang complains about unused functions. Signed-off-by: Peter Chubb <Peter.Chubb@unsw.edu.au>
Fix style in timer/apb_timer/timer.c blk/mmc/imx/usdhc.c and Makefiles Signed-off-by: Peter Chubb <Peter.Chubb@unsw.edu.au>
e017a3e to
2bb2ae4
Compare
This is now set in common.mk. Signed-off-by: Peter Chubb <Peter.Chubb@unsw.edu.au>
Make sddf build more independent of toolchain.
-- fix warnings from gcc
-- improve common.mk so switching toolchains actually rebuilds things