Skip to content

Latest commit

 

History

History

makefile

Folders and files

NameName
Last commit message
Last commit date

parent directory

..
 
 
 
 
 
 
 
 

makefile

Problem I: makefile separator (easy)

Suppose you are new to make. You just write an small helloworld program and try to compile it using make.

However, when you run make, the following error pops up.

makefile:2: *** missing separator.  Stop.
Click to Solution
  1. Googling the error message gives you this
  2. Click into one entry
  3. Read it and you know it is due to tab/space
  4. Fix it by type tab instead of space in the makefile

Some editor may automatically expand tab to space this can be found by Google tab space expand <your editor name>

Problem II: This shouldn't work! (medium)

After fixing the above error, you decide to study the concept of target in the make. Suddenly, you notice there are something odd with your target he1lo. It is wrong as there is a 1 instead of a l.

However, when you try to run it with

make hello

It still works. How is that possible? Does it means make doesn't distinguish 1 and l?

Click to Solution
  1. As there are no information available, you decide to Google "make debug"
  2. Clicking into one entry, you learn that make -d will gives you more information
  3. After trying executing make hello -d, make prints out a bunch of information
  4. Inside make_debug_info, you notice there is a thing called implicit rules
  5. Gooling "implicit rules make", gives you a list of them
  6. You learn that these rules can be disabled through make -r, after executing that, make gives the expected error
$ make -r hello
make: *** No rule to make target 'hello'.  Stop.