makefile basics (beginner - intermediate) anthony explains
HTML-код
- Опубликовано: 11 ноя 2021
- today I go over the basics of makefiles, how to use them as a build system, and what `.PHONY` is.
playlist: • anthony explains
==========
twitch: / anthonywritescode
dicsord: / discord
twitter: / codewithanthony
github: github.com/asottile
stream github: github.com/anthonywritescode
I won't ask for subscriptions / likes / comments in videos but it really helps the channel. If you have any suggestions or things you'd like to see please comment below! - Наука
...that explanation of PHONY was better than the docs and stackoverflow explanations combined
Thanks for the talk!
Thank you Anthony! This video really helped me with understanding makefiles much better.
It's a great addition for anyone just getting into Makefiles, a good addition in video format to the myriad of tutorials out there. A big thank you!
One of the best Makefile tutorials out there, thank you very much Anthony!
Amazing breakdown of the Makefile! Thanks Anthony!
very short but precise & among most helpful Makefile tutorials. Thanks
Thanks Anthony. You make it so easy to follow.
To be honest, I didn't have the chance till now to learn C programming, and this video sent me to learn what are .h and .o files. So I learnt so much more then just about the 'make' command :) thank you! Hope to join you and the rest of the cool guys in the C programming very soon.
C is my favourite footgun
Nice Hybrid Theory pfp
Best video about makefile, thank you
Thanks a lot!! That really helps to understand PHONY
Thanks for this concise tutorial. I just wanted a simple Makefile whilst I played with C++. You made all the black magic understandable. =)
Thank you Anthony!
This is a great tutorial l, especially using advanced symbols in make.
this was awesome, thank you :)
I'd love to see a makefile that is designed for django/docker projects.
I wouldn't use a makefile for that -- I would write specific scripts / build tools do what I need. as I show here a makefile can be (ab)used as a script runner but that's not the point of make
Why didn't you mention the wildcard function for automatic detection of source files?
because that's a bit beyond "basics" -- you have to get into addprefix and substitution and notdir and the rest of the functions
@@anthonywritescode It is a little bit of an intermediate feature, yes. But, for a basic Makefile, it is absolutely necessary for you to be able to automatically detect your source files. Who wants to have to write down every single source file on their creation?
Neat trick to use tail instead of cat to get the file names too - why do you use tail instead of head?
no real reason -- just habit!
Easier to press t than h
These are also great for reproducible data science, great tutorial!
I've seen Makefile being used in Python projects where basically all the targets are phony. I've come to prefer having a scripts directory, and using bash (or python) for tasks that may be repeated (docker build, run dev db, purge dev db etc.). It offers a bit more flexibility on handling inputs.
for sure! this actually came up because of a code review I did on stream where every make target was `PHONY` and I explained "well this isn't really what make is for!"
I think the reason you see this is because Makefiles and make provide a very easy and intuitive way to perform automation. Writing bash scripts or other things make sense and, as Kristoffer said, the scripts are more flexible for handling input, but if you just need to a simple CLI to interface for building, deploying, and testing your application or infrastructure, make comes in clutch imo.
Hi, I wrote a comment and it was deleted. Just wonder if youtube algorithm did that, or you decide to remove it?
youtube is very aggressive with the comment filter and there doesn't seem to be much I can do about it :( -- I've heard if you're subscribed it's more likely to not filter but I'm not sure
@@anthonywritescode Thanks for replay, I wish that was you ;). Now I am start thinking that maybe there is some Makefile conspiracy theory that youtube is trying to hide. I was posting not long ago about makefile in different channels few times and they are all gone 😲.
Anyway, I guess this is not last video about make, but I think you forgot include header file as prerequisite, so after modification it wont trigger a building process.
ah yep totally missed the header file -- the first version I did was just a single .c file and I goofed in this take :P
con tanta pluma no entendí nada
Great video.
Shouldn't main.o also rely on lib.h?
yeah probably