Why that 'Perfect' Makefile Doesn't Work.

preview_player
Показать описание
---

Why that "Perfect" Makefile Doesn't Work. \\ Makefiles are notorious for giving students headaches, when they look right, but don't act right. The problem is often whitespace. This video explains this issue and shows you how to find and fix these errors quickly so you can get back to developing software.

Related Video:



***

Welcome! I post videos that help you learn to program and become a more confident software developer. I cover beginner-to-advanced systems topics ranging from network programming, threads, processes, operating systems, embedded systems and others. My goal is to help you get under-the-hood and better understand how computers work and how you can use them to become stronger students and more capable professional developers.

About me: I'm a computer scientist, electrical engineer, researcher, and teacher. I specialize in embedded systems, mobile computing, sensor networks, and the Internet of Things. I teach systems and networking courses at Clemson University, where I also lead the PERSIST research lab.

More about me and what I do:

To Support the Channel:
+ like, subscribe, spread the word

Рекомендации по теме
Комментарии
Автор

You're actually touching the tip of a bigger iceberg -- unattended trailing whitespaces in source code. This is something that can raise conflicts in source controls. The best advice would be to configure your editor to remove them on save, because they should *never* stay around toward your commit.

eladi
Автор

2:09 "If it's still giving you errors, think about whitespaces" this helped me fix an issue!

bas
Автор

I think I saw it! Tabs vs spaces. This gave me a headache in the past.

axalius
Автор

"You spend hours pulling your hair out if you have hair" lol

anupkodlekere
Автор

You could enable the trimming of trailing white-spaces when saving the file in the preferences of VS Code.

jenselstner
Автор

I have actually never encountered this, but interesting thank you.

mrcrackerist
Автор

This is a really high production-value to a students question!! I wish all of my professors would answer my emails like this!

BottleOfCoke
Автор

Oh, some of my most memorable experiences programming were when I almost went crazy trying to solve a silly problem :) Like when I split a file with CRLF endings with "\n" and my strings ended with \r. It absolutely messed up my output and I didn't even know that carriage return is a thing.

supernovaw
Автор

Thank you Dr J. for this topic.

Makefile whitespace has transferred to my scalp. I am a Makefile user who has struggled for hours to get one specific one working well and I failed.
I will review my irritant Makefile. The fault: By changing one source file, of a dozen, the Makefile causes all sources to be recompiled. Fortunately, the code is stable.
It is not your problem. But you incentivize me to revisit it again. Hopefully, my buglet will be discovered in a short time-span.

lsatenstein
Автор

Jacob you're the CS teacher I never had! Thanks for being yourself!

prakhargupta
Автор

Tip: highlight the whole file in your editor and look line-by-line for that one bit of whitespace.

enderger
Автор

Thanks for another really good video. When you showed the make files I immediately guessed “I bet the indents aren’t tabbed in, but spaces were used”. I was wrong but it looks like another way whitespace can cause trouble. :)

meiowalot
Автор

Had a problem with a make file yesterday that I copied online to learn about Linux kernel modules. This was the issue. Thank you!

marshalstewart
Автор

Hi Jacob. I really like your videos. It guides me to lots of sections of computer science. This is really helpful please never give up, keep it up.

rishithaminol
Автор

Great work man! Love your channel topics and vibes!

matiascoarasa
Автор

A better way to avoid a problem like this is to simply configure your editor in a way so that it removes all white spaces at the line ending automatically when saving the file.

Theoretically this reduces also the file size. You usually won't notice the latter on a typical file system that is using whole blocks to store data, but when packaging the file with tools like tar or zip and transfering to another machine via network this can save some bytes.

OpenGLever
Автор

Thank you for your videos Jacob, they are really informative! Would you consider making a brief video on the "inline" keyword in C - what it's for, how it works, and how it should be used? Or can you recommend a source for a clear explanation? I've been reading up on it but I can't get a clear understanding myself 😕😕😕

adamtuft
Автор

I would use a utility to build the Makefile versus hand coding it. That way you also get the appropriate .h dependencies into the Makefile. I wrote a utility to create the Makefile back in the 90s and have been dragging it around with me since then.

papasmurf
Автор

Tip: also, many editors have this option of remove trailing whitespaces on saving file or exiting or smth like that. Be sure to look into that too (:

yash
Автор

This really saved me money from a visit to the therapist! Thanks Jacob!

ravishankarnolastname