6 ms·
I firmly believe that there is only one production-quality makefile that has ever been written from scratch. Every other makefile has been copied from an earlie
by nathanb 12y ago
I firmly believe that there is only one production-quality makefile that has ever been written from scratch. Every other makefile has been copied from an earlier makefile, dating back to the one Ur-makefile, and modified to suit the author's purpose.
- mmastrac 12y agoautoconf yes, but Makefiles, no. I'll write a new Makefile from scratch maybe once a year or so.
- lukaslalinsky 12y agoIf you use autoconf, why not use also automake?
- antocv 12y agoWe wrote several Makefiles from scratch at work. And a dependency-graph-of-thing-we-work-with to Makefile generator, like the output of gcc -M does. In fact its a whole build system using gnu make, written from scratch.
- arcatek 12y agoTo be honest, a simple Makefile is very simple to write and efficient once you know the syntax fairly well. Then you add more and more things as the time pass, and it starts to morph into a giant huge monster that eat puppies.
- perdunov 12y ago> a giant huge monster that eat puppies Not puppies, but brains of the poor programmer who is confronted with a problem of building your bloatware on a non-supported platform (typically Windows).
- tomjen3 12y agoBased of our ANT file that seems to be a common feature of build systems, moreso than an issue with Make.
- mellavora 12y agoIf I had more time, it would be interesting to run a phylogenetic analysis of makefiles. Could we find the most recent common ancestor? Can we add spatial information to track their geographic dispersal?
- PeterWhittaker 12y agoWhen I started with make, I copied working files to a safe place, copied from the safe place to a scratch place, tweaked the scratch, got it working, etc., etc. Managing the make file was itself part of managing the project. Then I read and thoroughly grokked the O'Reilly book on make (which some douche stole from my desk; twenty plus years on, I am still bitter about that one... ...don't miss the Tannenbaum OS book or the Stevens networking books, but the make book, it burns, it burns....) After that all I wrote all of my make files from scratch. Doing so made sure I understood my project, its dependencies, etc., and made sure I wasn't going to accidentally corrupt a build with some edge case from another one. make is super straightforward once you get how it works. Sort of like git rebase, I suppose (still working on that one... :->).
- DannoHung 12y agogit rebase I pretty much understand. Make will forever be a mystery to me. Mostly just how after the third or fourth version of it they didn't take a step back and think, "Hey, wait, maybe we should just make a language that spits out a shell file and ditch having it sort of kind of look like a shell file itself."
- GauntletWizard 12y agoBecause a shell file would be an inefficient and imprecise way of describing the state and logic that Make uses.
- DannoHung 12y agoReally? I mean, it pretty much just runs commands in sequence and/or parallel, right? Sorry, like I said, I don't think I really understand make. I mean, I can understand that it's doing some checks to determine what commands to emit, but doesn't it all end up falling out as pretty much a straight "Yes? Do this. No? Do that. Do this and then this and then this. Do all these at the same time." That's my mental model at the moment anyway.
- 12y ago
- vhost- 12y agoNot exactly true. I tend to start with a new makefile for a good amount of projects. Know your tools, know your code.
- wspeirs 12y agoI wrote a god-awful Perl script to gen (and update) Makefiles for me: https://github.com/wspeirs/makemake https://github.com/wspeirs/makemake
- deleted 12y ago[deleted]
- AceJohnny2 12y agoIt seems every competent programmer makes that mistake at least once in their carreer :)
- blueblob 12y agoThe mistake of writing your own makefile generator or using perl? My first experience with perl read in all of the files in its directory and output to another file also in the directory, it managed to read in both itself and the output. I accidentally implemented `rm *`.
- AceJohnny2 11y agoHeh, I'm currently in the positive phase of my oscillating love-hate relationship with Perl, and acknowledge its right to exist. No, I was referring to implementing a replacement/frontend to Make.
- jacalata 11y agoIn my case it wasn't a mistake, it was a university assignment. That was the assignment where I learned (by omission) how important it is to have source control...
- david-given 11y ago
- beagle3 12y ago:) In my EE/Physics department, lab reports from previous years were known as "newtons" (as in: "do you have a newton for the preservation-of-momentum experiment?"), the explanation being that Isaac Newton wrote a lab report from scratch, and everyone else has used an older lab report as reference to make sure they got the right result - the transitive closure of which having Newton as a boundary. I guess the equivalent Makefile term would be a Feldman[0], as in: "Do you have a feldman that can combine ghc and dmd output? I need that for a project" [0] http://en.wikipedia.org/wiki/Stuart_Feldman http://en.wikipedia.org/wiki/Stuart_Feldman
- DrJosiah 12y agoI said much the same thing when Google released Sawzall 4 years ago: https://news.ycombinator.com/item?id=1866364 https://news.ycombinator.com/item?id=1866364 That said, I have written 2-5 Makefiles from scratch (move companies, need to create a new product, don't have access to old Makefiles). The rest are definitely copy/paste/modify.
- babuskov 12y agoYou're wrong. I wrote at least 4 Makefiles from scratch in the last 10 years. :)
- andreineculau 12y agoi couldn't agree more, that's why i started collecting snippets in https://github.com/andreineculau/util.mk https://github.com/andreineculau/util.mk
- sitkack 12y agoSomeone should combine Make with SQL so we can get the best of both worlds.
- emmelaich 11y agoThe simplest Makefile is ... no Makefile at all! e.g. if you create C program your-program.c with a main(), all you have to do is invoke make your-program and it is done. Not exactly production quality (no clean target) but can't beat it for simplicity :-)
- Tomte 11y agoNo, make files are quite often written from scratch. But the linker script for ARM Cortex and the GNU linker is usually copied verbatim. You can find it everywhere. Open source projects, commercial development. Everywhere. Because STM ships it with their standard peripheral library. Nobody cares that this linker script is (c) Atollic and only licensed for use with their IDE: http://hackaday.com/2012/06/19/stm32-demo-code-carries-extra-hidden-copyrights/ http://hackaday.com/2012/06/19/stm32-demo-code-carries-extra...