A former student recently emailed me asking for a good reference about makefiles. To be honest, I teach a lot about makefiles but I am not sure I have a go-to source. I could have googled something but instead I just tapped out this quick description. I thought it makes for a fairly quick introduction to Makefiles. Feel free to leave your favorite resource in the comments.
Makefiles are fairly simple in concept but are an entire programming language so can get very advanced. Basically a makefile consists of rules in the following format:
target : prerequisite_file1 prerequisite_file2 prequiste_file3 ... Recipe step 1 Recipe step 2 ...
When you type “make Target” on the command line you active the rule. Then the Make program recursively activates rules to make each of the prerequisites. If there is no rule to make a prerequisite it looks to see if the prerequisite file exists. If there is no rule and there is no file you will get an error. However, assuming you have all the prerequisite files you need for a rule, the Make program then runs the Recipe commands (things like gcc or whatever you want). It is assumed that the commands will take the prerequisites as inputs and generate the target file (this is not always the case). That is basically it. Some more things to note: If you just type “make” (with no target) the Make command assumes you are trying to make the first rule in the file. Often the first rule target is called “all” with a bunch of prerequisites and no recipe steps. This is just a high level rule that tells make to build all of your main target files. There is nothing special about the keyword “all” it is just used as a convention. Often there is a rule at the end of a makefile called “clean” with no prerequisites. You typically have to explicitly activate this target by writing “make clean” (i.e. you normally do not make “clean” a prerequisite to a rule). Typically the Recipe steps are remove (rm) commands that delete all intermediate files you may have generated (ex exe and *.o files). Basically giving you a clean slate. Makefiles can have variables and wildcards. In these cases they can get fairly advanced. * Make is fairly smart, it will rebuild a target if the targets modification date is older than the modification date of it’s prerequisites. This means that if you repeat the make command it will not automatically regenerate a file it thinks will not change.
That was fun for me. I hope you find this description a useful first step.
Above is a toy example of a makefile and a visual re
Quick Graphviz Tutorial
This quick tutorial shows provides basic instructions for generating the above graph using Graphviz.
If you already have Anaconda installed on your system, you can quickly install graphviz using the following command:
conda install graphviz
Once graphviz is installed you need to create a text file with the connections. This …read more
Three and Four way switch status lights
There are two light switches in our mudroom that control the garage lights and the lights on the front of the house. Unfortunately I can not see these lights when standing next to the switches and sense there are multiple switches for each light you can not know if the …read more
Using an X11 Virtual Frame Buffer to run GUI jobs in batch mode on the HPC.
How do we know what we don't know we don't know?
Faculty at MSU conducted a workshop to brainstorm and discuss ways we can try and foresee how education will be changed by technology in an effort to get ahead of the changes and make sure our teaching goals and values stay intact.
My presentation was about the difficulty in predicting …read more
Alexa Dot Holder
My brother got me an Alexa Dot for Christmas a few years ago. It turns out to be a lot of fun. We put it in the kitchen and the kids play music. My wife and I also use it to add things to our shopping list (very convenient!) Anyway …read more
3D printed Switch Guard
We recently moved into a new house and the kids are having fun running around turning on and off all the lights. Unfortunately, some of the light switches are not for lights. One goes to our garbage disposal, another goes to the gas fireplace and another turns off the furnace …read more
Emerging Technologies (FPGAs) @ 2018 ACI-REF VR
Today is the last day of the 2018 ACI-REF Virtual residency workshop here in Norman Ok. It was a great week with a lot of great people. I highly recommend the workshop for anyone in the area of Advanced Computing Instruction especially those do some Research and Education Facilitation in …read more
Deciding Which Technologies to Adopt, and When @ 2018 ACI-REF VR
I had fun leading a discussion on Deciding Which Technologies to Adopt, and When at the 2018 ACI-REF Virtual residency event in Norman Oklahoma. Since many of the participants were virtual I experimented with doing a Brainstorming exercise over zoom. We had local volunteers on typing in comments from our …read more
Teams of CI Professionals: Recruitment & Retention, Management, Team-building, and Motivation Panel @ 2018 ACI-REF VR
Thank you Aaron Bergstrom (U North Dakota) for facilitating the panel discussion on Teams of CI Professionals: Recruitment & Retention, Management, Team-building, and Motivation at the 2018 ACI-REF Virtual residency. My fellow panel members included:
- Jerry Perez, U Texas Dallas
- Derek Leydig, Pennsylvania State U
- Claire Mizumoto, U California San Diego …