Live data from Hacker News

One line you should add to every makefile

blog.jgc.org

61–70 of 99 posts

Re: One line you should add to every makefile

#61
post #5
post #3

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.

To 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.

Based of our ANT file that seems to be a common feature of build systems, moreso than an issue with Make.

Re: One line you should add to every makefile

#62
post #3

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.

I said much the same thing when Google released Sawzall 4 years ago: 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.

Re: One line you should add to every makefile

#63
post #19

Earlier quoted context omitted.

If you use autoconf, why not use also automake?

If you've already shot yourself in the foot, why not also shoot yourself in the face?

Because if you write your own Makefile instead of using automake, you'll get shot in the face by a distro package maintainer when you forget to obey DESTDIR, CC, CFLAGS, etc. like every packaging tool expects to use.

Re: One line you should add to every makefile

#64
post #3

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.

You're wrong. I wrote at least 4 Makefiles from scratch in the last 10 years. :)

Re: One line you should add to every makefile

#65
post #3

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.

i couldn't agree more, that's why i started collecting snippets in https://github.com/andreineculau/util.mk

Re: One line you should add to every makefile

#66
post #3

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.

Someone should combine Make with SQL so we can get the best of both worlds.

Re: One line you should add to every makefile

#67
post #5

Earlier quoted context omitted.

To 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.

> 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).

Most of the time I've blown on wrestling with other people's makefiles has been on ostensibly supported platforms.

Re: One line you should add to every makefile

#68
post #52

I prefer to use memoize.py whenever possible instead of Make. I think it is much simpler to let it manage the dependencies rather than having to code them explicitly. Almost every other make system I have ever used eventually devolves to the point where 'make clean; make' is the only reliable way to use it. https://github.com/kgaughan/memoize.py

Neat. Any reason it doesn't appear to be on pypi? I didn't see it at first glance.

Re: One line you should add to every makefile

#69
post #42
post #30

Earlier quoted context omitted.

How do they track the dependencies automatically?

With gcc/clang it's a set of flags starting with -M, and with MSVC it's /showIncludes. They're discussed a bit here: http://martine.github.io/ninja/manual.html#ref_headers

What if we're using a different compiler, then?

The comment that I was replying to sounds like CMake or something has more magic thus power for a future unknown compiler.

Post reply on HN