Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Make the Makefile more robust, readable and safe
The Makefile has been modified to make use of the features of Make with the general objective of increasing robustness, readability and safety of the code through a reduction in redundancy and an increase in automatic work. The dependencies have been grouped to express clearly that they can be of one of 2 kinds: hardware-dependant assembly or higher-level source. Thanks to this, the dependency tree that the Makefile defines becomes clearer (main depends on source and source depends on asm). The use of Pattern Rules (Static or not) and variables (Automatic or not) make the code more readable and robuster by expressing redundancy in a non-literal way. Extending the tool to support a new hardware (i.e. adding to the project a new .S file and some code in asm-opt) now only requires to add the name of the extension in ${ASM} and this will cascade down the tree. This is more robust than the previous solution which required multiple modifications. This new approach fixes a mistake on line 13 where the rule 'asm-opt.o : aarch64-asm.h' was NOT defined while being required from line 335 in asm-opt.c! all and clean are declared as phony variables to increase robustness. '-O2' was removed from the call to the compiler as it is a compiler flag and we believe that it should be in ${CFLAGS}. Thanks to the previous change, the `rm -f *.o` command in the clean rule was made safer so it is now unable to delete .o files that it couldn't have created. A ${NAME} variable is used to further reduce redundancy.
- Loading branch information