6 ms·
I always see others complain about Makefile syntax, especially the whitespace, but that is, to me, one of the smallest problems with make. For myself, the top p
by oftenwrong 3y ago
I always see others complain about Makefile syntax, especially the whitespace, but that is, to me, one of the smallest problems with make. For myself, the top problems are:
- No tracking of changes to build rules. The build rule of a target should be one of its dependencies.
- No protection from dirty builds. Your sources root is also your output root, and make does not help you keep it clean.
- No options for extending the build to use alternate up-to-date checks (e.g. not mtimes), caches, execution mechanisms, etc.
These all have workarounds, but they require the developer to manually include the workarounds in every build rule.
- pif 3y ago> Your sources root is also your output root Only if you learnt to program by reading Microsoft examples. Unix developers do not mix compiled files with source files.
- WesolyKubeczek 3y agoLaughs in openssl Seriously, it’s very project-dependent, but you’re lucky if your thing of choice that you need to build often supports a separate build directory, let alone enforces it.
- oftenwrong 3y agoYes, it is one of those things that many experienced makefile writers know to avoid, but the tool does not guide new users to this wiser approach. Contrast with Bazel, which does not pollute the workspace with outputs.
- nerdponx 3y agoBut Make isn't really a build tool, even if it was/is intended as such. This kind of thing is exactly what more sophisticated build tools are good for.
- duped 3y agoOne of the foundational concepts in an autotools builds is mixing generated files with source files.
- yrro 3y agoHuh? Generated files are written to the build directory which is only the source directory if you choose to make it so... $ cd /tmp/build $ ../bash-5.2.15/configure checking build system type... x86_64-pc-linux-gnu checking host system type... x86_64-pc-linux-gnu Beginning configuration for bash-5.2-release for x86_64-pc-linux-gnu checking for gcc... gcc ... etc ... $ tree . ├── builtins │ └── Makefile ├── config.h ├── config.log ├── config.status ├── doc │ └── Makefile ├── examples │ └── loadables │ ├── Makefile │ ├── Makefile.inc │ ├── Makefile.sample │ └── perl │ └── Makefile ├── lib │ ├── glob │ │ └── Makefile │ ├── intl │ │ └── Makefile │ ├── malloc │ │ └── Makefile │ ├── readline │ │ └── Makefile │ ├── sh │ │ └── Makefile │ ├── termcap │ │ └── Makefile │ └── tilde │ └── Makefile ├── Makefile ├── po │ ├── Makefile │ ├── Makefile.in │ └── POTFILES ├── stamp-h ├── support │ ├── bashbug.sh │ ├── bash.pc │ └── Makefile └── tests 17 directories, 24 files The makefiles and any files they generate are in /tmp/build, the source directory remains unmodified. (Recursive make, eww!) ;)