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!
  • НаукаНаука

Комментарии • 34

  • @uuu12343
    @uuu12343 Год назад +7

    ...that explanation of PHONY was better than the docs and stackoverflow explanations combined
    Thanks for the talk!

  • @raoulkent
    @raoulkent 2 года назад +1

    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!

  • @Karlux92
    @Karlux92 Год назад +3

    One of the best Makefile tutorials out there, thank you very much Anthony!

  • @serge8175
    @serge8175 Год назад +1

    Amazing breakdown of the Makefile! Thanks Anthony!

  • @unikkkkkkk
    @unikkkkkkk Год назад

    very short but precise & among most helpful Makefile tutorials. Thanks

  • @trido3815
    @trido3815 6 месяцев назад +1

    Thanks Anthony. You make it so easy to follow.

  • @dorb1337
    @dorb1337 2 года назад +10

    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.

  • @TahaAlars
    @TahaAlars 8 месяцев назад +1

    Best video about makefile, thank you

  • @yugandhar2007
    @yugandhar2007 Год назад

    Thanks a lot!! That really helps to understand PHONY

  • @jiminma50
    @jiminma50 Год назад

    Thanks for this concise tutorial. I just wanted a simple Makefile whilst I played with C++. You made all the black magic understandable. =)

  • @zeljkokojic4831
    @zeljkokojic4831 2 года назад +1

    Thank you Anthony!

  • @AbishaiSingh
    @AbishaiSingh 9 месяцев назад

    This is a great tutorial l, especially using advanced symbols in make.

  • @a_maxed_out_handle_of_30_chars
    @a_maxed_out_handle_of_30_chars 4 месяца назад +1

    this was awesome, thank you :)

  • @morenoh149
    @morenoh149 Год назад +1

    I'd love to see a makefile that is designed for django/docker projects.

    • @anthonywritescode
      @anthonywritescode  Год назад

      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

  • @thesun___
    @thesun___ 7 месяцев назад +1

    Why didn't you mention the wildcard function for automatic detection of source files?

    • @anthonywritescode
      @anthonywritescode  7 месяцев назад +1

      because that's a bit beyond "basics" -- you have to get into addprefix and substitution and notdir and the rest of the functions

    • @thesun___
      @thesun___ 7 месяцев назад

      ​@@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?

  • @guntbert9709
    @guntbert9709 2 года назад +3

    Neat trick to use tail instead of cat to get the file names too - why do you use tail instead of head?

  • @KraziAzian
    @KraziAzian 2 года назад +1

    These are also great for reproducible data science, great tutorial!

  • @kristofferbakkejord165
    @kristofferbakkejord165 2 года назад +2

    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.

    • @anthonywritescode
      @anthonywritescode  2 года назад +1

      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!"

    • @Caarve
      @Caarve Год назад

      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.

  • @voytechj
    @voytechj 2 года назад +1

    Hi, I wrote a comment and it was deleted. Just wonder if youtube algorithm did that, or you decide to remove it?

    • @anthonywritescode
      @anthonywritescode  2 года назад

      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

    • @voytechj
      @voytechj 2 года назад +1

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

    • @anthonywritescode
      @anthonywritescode  2 года назад

      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

  • @Carlos-kd7tu
    @Carlos-kd7tu Год назад

    con tanta pluma no entendí nada

  • @fabtjar
    @fabtjar Год назад +1

    Great video.
    Shouldn't main.o also rely on lib.h?