10 ms·
GNU Make 4.0 Released
- Shish2k 13y ago> New feature: GNU Guile integration Because if there's one thing the GNU software-building toolchain needs, it's more languages! How many are we up to now? Grouping output by target for parallel builds sounds very useful though \o/
- Kototama 13y agoI think it's great. In the future all GNU tools will probably be extensible with Scheme.
- fosap 13y agoCan't wait for EMACS with scheme support.
- dbaupp 13y agohttp://www.emacswiki.org/emacs/GuileEmacs http://www.emacswiki.org/emacs/GuileEmacs
- pdw 13y agoHow's that going anyway? It seems GNUcache, Lilypond and TeXmacs are already using guile (and geda also but that doesn't seem to be part of GNU). So make is the fourth Guile-using GNU project?
- fafner 13y agoThere are more https://en.wikipedia.org/wiki/GNU_Guile#Programs_using_Guile https://en.wikipedia.org/wiki/GNU_Guile#Programs_using_Guile But GNU Make seems to be the first major one.
- davexunit 13y agoGuile is the official GNU extension language, so it makes sense. Guile's goal is to provide practical software freedom by allowing more GNU programs to be extensible in the way that Emacs is.
- the_mitsuhiko 13y agoConsidering that one of the most popular operating systems among developers has an 8 year old version of make, I wonder how many people will start using new features.
- k-mcgrady 13y agoWhat OS are you referring to?
- yuvadam 13y agoOS X
- mxey 13y agogmake 4.0 is GPLv3, it will never be added to OS X.
- aurelius 13y agoAnd I, for one, am glad.
- Touche 13y agoWhy? You like running old software?
- tedunangst 13y agoIs there something broken with make 3.81?
- treerex 13y agoWhat's wrong with old software. If it works, why change? Just because something is "new" and "cool"? C'mon.
- alextingle 13y ago
- philjackson 13y agoI'm being incredibly unimaginative today, but what's a good use-case for extending Make via scheme?
- VMG 13y agoBeing unreasonably optimistic, I hope for the replacement of a bunch of other cruft around the toolchain with Scheme. Being realistic, I look forward to adding Scheme to the cruft.
- emmelaich 13y agoI often think how much better Make would have been with elisp or scheme syntax rather than extending it with shell.
- opk 13y agoGNU make already has a number of functions for things like filtering a list for strings matching a pattern. There were many requests for additional functions. There's some sense to integrating guile rather than going further down the path of extending the macro/function language that GNU make essentially has.
- mturmon 13y agoOne starting place for some of these functions is: http://www.gnu.org/software/make/manual/html_node/Functions.html http://www.gnu.org/software/make/manual/html_node/Functions.... (note "foreach", "call", "eval") and: http://www.gnu.org/software/make/manual/html_node/Multi_002dLine.html http://www.gnu.org/software/make/manual/html_node/Multi_002d... For instance, from the "call" documentation -- "The call function is unique in that it can be used to create new parameterized functions." Sometimes these types of functions are really important, and you have to be creative to use the builtins to set up the dependencies you want. For instance, by combining "foreach" with "call" or "eval", you can dynamically create sets of rules. This can be quite powerful. And you don't have to use make only for software compilation. You can use it to create more general-purpose data transformations. When you get a batch of new images, for example, you type "make", and it just recomputes all the derived data (but only what depends on the new stuff). I have done this, and it was very slick, but it tends to stress the existing function set.
- madmax96 13y agoThere are a few of the features mentioned that I already thought that make had. At least now I might start actually using them.
- Aardwolf 13y agoDoes make have any sort of way to see if a .h file changed, that all C/C++ source files that directly or indirectly include it need to be recompiled, but others don't need to?
- lrm242 13y agoMake does not do this directly. Typically you generate a set of dependencies using gcc. gcc can be told to output a rule suitable for use in make that describes the dependencies of a source file. See the -M option and friends.
- emillon 13y agoMake only understands rules such as "X depends on Y", but gcc can output these dependency rules (-M* switches). So yes, it is possible to do this but make itself is source code agnostic.
- cygx 13y agoNot make by itself, but gcc comes with related preprocessor options[1], in particular -MMD. Add that to your CFLAGS and include the generated dependency files by adding something like -include $(OBJECTS:%.o=%.d) to the Makefile. [1] http://gcc.gnu.org/onlinedocs/gcc/Preprocessor-Options.html http://gcc.gnu.org/onlinedocs/gcc/Preprocessor-Options.html
- deleted 13y ago[deleted]
- deleted 13y ago[deleted]
- itp 13y agoYes, but you have to work a little bit for it. If your rule that builds .o files from .c/.cpp files uses the one of the dependency-generating flags to GCC (options beginning with -M), GCC will create an alternate or additional (depending on the flag) make-compatible file that describes what files were included during the build. If you then include these files in your Makefile with the 'include' directive, then you'll get the behavior you're looking for. Implementing it correctly can be a little tricky, but once you understand how to do it it's not too bad. As I recall there used to be some subtle issues that required some post-processing of the GCC-generated dependency files to avoid a problem when header files were renamed or removed (foo.c included foo.h, so a dependency was generated; later foo.c was modified to not require foo.h, and foo.h was removed, but the build still thinks it's required to build) -- it looks like GCC now has a -MP option to add phony empty rules for all dependencies, allowing make to power through these.
- Siecje 13y agoWhen would you make over a bash script?
- michael_h 13y agoWell, for starters: make does dependency resolution. If you change a single file and recompile, it will figure out what needs to be rebuilt instead of rebuilding everything. It will also figure out what can be built in parallel if you give it the -j option. It also has implicit build rules so you don't have to write a line in a bash script for every single file. EDIT: To answer your question more directly: when you have a large project, or a project that needs to build on many platforms. Probably a whole load of other situations as well, but those are the two that stick out.
- pavanky 13y agoMake makes it possible to compile only the files you have changed in your code base to produce the library / output you want. bash scripts usually end up compiling the entire codebase even if there is only one file that has changed. TL;DR faster turn around times using make.
- JoshTriplett 13y agoMeanwhile, many users are still stuck on 3.81, because 3.82 introduced an intentionally backward-incompatible change to the handling of pattern rules, which breaks real makefiles such as those in the Linux kernel: https://savannah.gnu.org/bugs/index.php?33034 https://savannah.gnu.org/bugs/index.php?33034 This bug is the reason why make 3.82, released in 2011, still sits in Debian experimental and hasn't yet graduated to unstable where it might form part of a release. Make 4.0 seems likely to suffer the same fate.
- tjr 13y agoIntentionally backward-incompatible changes can be gotten away with (e.g., Apple moving from PPC to Intel). What could be done with GNU Make to help encourage a transition forward?
- JoshTriplett 13y ago> Intentionally backward-incompatible changes can be gotten away with (e.g., Apple moving from PPC to Intel). With massive, carefully coordinated transitions, and features provided to help with backward compatibility (e.g. OS X provided PowerPC emulation for ~5 years). > What could be done with GNU Make to help encourage a transition forward? First, documenting exactly why the previous behavior (mixing implicit/pattern rules and normal rules) is problematic to support going forward and is worth the pain of a backward-incompatible transition. Second, adding a backward-compatibility option to enable the old behavior, or ideally allowing it by default, perhaps with a warning if transitioning away from it is that important. And third, keeping that option available for many years as existing software projects making use of that behavior filter out of usefulness (until, for example, all of the enterprise Linux distributions have moved to versions of the Linux kernel that don't depend on the old behavior).
- smackfu 13y agoThe key is that Apple changes the output format that they accept, not the input format that developers work with.
- ajross 13y ago
- beagle3 13y agoCongrats to the GNU Make team. I still use Make occasionally, but redo (https://github.com/apenwarr/redo https://github.com/apenwarr/redo) just fits my mind better - it's simple, consistent, doesn't require keeping another language with its dark corners (it's just shell scripts), and works well. It also solves the bootstrap problem - there's a short script called "do", which always rebuilds everything, all of 177 of non-minified bash script. If you need to distribute anything, you should distribute it with "do" inside - and guarantee that your users can build without relying on an installed package (or a specific version of GNU Make). p.s: OS/X, Linux and BSD supported. Supposedly, windows through cygwin or busybox - but I've never tried.
- mixmastamyk 13y agoInteresting, I've started a similar kind of program, but wouldn't mind abandoning it for something better. Gonna try it out.
- bnegreve 13y ago> "do", which always rebuilds everything, To rebuild everything with Make, you can use the -B switch: -B, --always-make Unconditionally make all targets.
- mprovost 13y agoIt's not doing it as a feature but as a fallback. If you don't install the whole redo program but just include a "do" script it doesn't do dependency tracking so it just rebuilds everything. If you install redo itself it's much smarter and only rebuilds what is needed.
- bnegreve 13y agoI see. Nice feature.
- _ak 13y agoAn attitude "It's just a shell script" can be dangerous when you have software that is supposed to be built on multiple platforms. You can never be 100 % sure what your /bin/sh is, be it bash, ash, dash, ksh, zsh or even an ancient Bourne shell.
- undoware 13y agoFinally! An answer to all the clamour for a Guile-based extension language to an increasingly nonstandard implementation of an increasingly fragmented 'POSIX' 'standard'.
- undoware 13y agoI just can't wait to rewrite the next generation of GNU Makefiles so I can build them from /usr/ports.
- ajross 13y agoI don't see that the sarcasm is warranted. GNU make, really, is the relevant standard. It's what virtually everyone doing serious work (as opposed to e.g. emitting "makefiles" from some other tool) with make uses. GNU Make is simply more featureful and more performant than the other choices. One of the features it doesn't have, though, is a first class language for doing non-trivial extensions. Some systems (the kernel Makefiles and Android's build system are really good examples) have stretched make's built-in environmnent past the limit already and might have benefitted from something like this.
- cjensen 13y agoBack at the dawn of time, Borland C wrote dependency info into its object files, and Borland Make could read the object files to get the info. That's so much simpler than makedepend or gcc -M that it's sad.
- Roboprog 13y agoIt would be nice if gmake had some predefined, portable, macros for working with Java, so XML clutter like Ant and Maven could be shown the door. I so prefer reading makefiles to a sea of XML gibberish. mytarget: source1 source2 do-something -o mytarget source1 source2 so much easier to read than Ant tasks. (and, yes, there are ways to get the file lists into symbols without explicitly enumerating them) Ant, and by extension, Maven, was a huge step backward. Sure, have a way to make portable commands, BUT, was XML really needed??? And, does every task have to be built such that the task checks dependency timestamps, rather than the framework that calls the task???
- lsd5you 13y agoIsn't what you are saying is that if Make was better then it could be better than Ant? Ant and Maven both have plenty of issues, but being dissimilar from make is not one of them. At the end of the day 'file based' tools like Make are not really suitable for Java which is more concerned with source directories - rightly so in my opinion. There is no program that cannot be written because of a consistent source layout. There are ways to enumerate files, but nothing good (in my experience) and by the time you are using them the make files are no longer easy to read (never mind debug). Make also has this Faustian pact thing going on. Access to the shell and all of its power and familiarity, but at the (significant) expense of portability.