by xvilka · 8y ago · 0 comments
Maybe fourth - learn how to use it
No, you had as many problems as there are '%' and '$' symbols in this web page : http://www.cs.colby.edu/maxwell/courses/tutorials/maketutor/ multiplied by the number of permutations of tools in the different platforms you want to support, e.g. (gcc-mingw-windows, clang-cl-windows, msvc-windows (this one counts as 10), xcode-macos, gcc-macos). And let's not even get started with cross-compiling.
One of make's great strengths is that it is so generic.
Writing ninja files by hand is tedious and those extra features make provides can make it easier to use, but in principle ninja should be able to handle anything make could.
It also works in windows.
I tried using meson for https://github.com/shlomif/mini-factor , and while it worked fine locally it turned out to require python 3.6 which made it hard to install on Travis-CI. I ended up created a complementary cmake build system.
A modern build system by default should be able to provide utilities to make sure your build is correct and reproducible. Those features need to be coded into your Makefile and aren't available easily or by default.
If you need to code those rules, then you don't have a build system, just a way to run commands and possibly add some (usually poor) logic around them.
A typical example that most handcrafted Makefiles will fail is that changing a build flag should only rebuild the files affected. Most will either require a full clean (aka ignoring the flag change) or rebuild everything.
If you change a build flag, how aren't all the files affected?
Then to build one particular bit of software, there is a dependency upon a particular version of cmake, which you don't have.
Or you have to upgrade Maven. Or install some software you do not have by default on your environment.
I've never had to do that with make.
I've been told that other tools are better because the are simpler ... that is ... until you run into one of those aforementioned compatibility issues with the build tool.
This isn't an infrequent occurrence for me, I see lots of hardwiring for various packages that I don't have installed by default in some projects.
Then you get the gophers/rust folk, and their need to run on the most recently released kit. With all its undiscovered bugs. The gophers want to replace make with mage ... well, to be more correct, they want to replace every non-go based tool with one built in go, because ... go. A modern version of the insufferable pythonistas of years past.
Throughout this, I've been using and building with Make just fine. My make files do the heavy lifting in my projects. And I get a good laugh each time I hear "oh I have to fix my magefile/CMakeFile.txt/yadda yadda yadda".
As the great philosopher Inigo Montoya once opined ... you keep using that word [better]. I do not think it means what you think it means.
okay, please provide a makefile which:
* detects if, say, libpng is available
* compile a library, an executable and a unit test if that's the case
* links the executable to the library and the library to libpng
* does so for mac, windows, linux, creates a .app for mac, an installer for windows, a .deb package for linux
* can be used from IDEs, with IDEs understanding where your code has to be fetched, what the includes are, etc
here's more-or-less the CMake version :
project(myapp)
find_package(PNG REQUIRED)
add_library(mylib lib.c)
add_executable(myapp MACOS_BUNDLE WIN32 app.c)
target_link_libraries(mylib PRIVATE PNG::PNG)
target_link_libraries(myapp PRIVATE mylib)
install(
TARGETS myapp mylib
RUNTIME DESTINATION bin
ARCHIVE DESTINATION lib)
include(CPack)
you can't seriously say that this (which covers an immense part of software project needs) is easier to do in make, right ?[0] http://gittup.org/tup/make_vs_tup.html <edit substitutes the make comparison link instead of the main page>