makefile basics (beginner - intermediate) anthony explains

Поділитися
Вставка
  • Опубліковано 18 жов 2024
  • 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/aso...
    stream github: github.com/ant...
    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 2 роки тому +10

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

  • @unikkkkkkk
    @unikkkkkkk Рік тому +1

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

  • @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 Рік тому +2

    Best video about makefile, thank you

  • @Karlux92
    @Karlux92 Рік тому +4

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

  • @trido3815
    @trido3815 10 місяців тому +2

    Thanks Anthony. You make it so easy to follow.

  • @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!

  • @serge8175
    @serge8175 Рік тому +1

    Amazing breakdown of the Makefile! Thanks Anthony!

  • @a_maxed_out_handle_of_30_chars
    @a_maxed_out_handle_of_30_chars 9 місяців тому +1

    this was awesome, thank you :)

  • @yugandhar2007
    @yugandhar2007 Рік тому

    Thanks a lot!! That really helps to understand PHONY

  • @AbishaiSingh
    @AbishaiSingh Рік тому

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

  • @jiminma50
    @jiminma50 2 роки тому

    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!

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

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

  • @thesun___
    @thesun___ Рік тому +1

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

    • @anthonywritescode
      @anthonywritescode  Рік тому +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___ Рік тому

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

  • @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 2 роки тому

      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 2 роки тому

    con tanta pluma no entendí nada

  • @fabtjar
    @fabtjar Рік тому +1

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