What are Makefile.am and Makefile.in?

Makefile.am is a programmer-defined file and is used by automake to generate the Makefile.in file (the .am stands for automake). The configure script typically seen in source tarballs will use the Makefile.in to generate a Makefile. The configure script itself is generated from a programmer-defined file named either configure.ac or configure.in (deprecated). I prefer .ac (for autoconf) since it differentiates it from the generated Makefile.in files and that way I can have rules such as make dist-clean which runs rm -f *.in. Since … Read more

(.text+0x20): undefined reference to `main’ and undefined reference to function

This rule is wrong. It says to create a file named producer.o (with -o producer.o), but you want to create a file named main. Please excuse the shouting, but ALWAYS USE $@ TO REFERENCE THE TARGET: As Shahbaz rightly points out, the gmake professionals would also use $^ which expands to all the prerequisites in … Read more

make: Nothing to be done for `all’

Sometimes “Nothing to be done for all” error can be caused by spaces before command in makefile rule instead of tab. Please ensure that you use tabs instead of spaces inside of your rules. instead of Please see the GNU make manual for the rule syntax description: https://www.gnu.org/software/make/manual/make.html#Rule-Syntax

Make error: missing separator

As indicated in the online manual, the most common cause for that error is that lines are indented with spaces when make expects tab characters. Correct where \t is TAB (U+0009) Wrong where each . represents a SPACE (U+0020).

Makefile:2: *** missing separator. Stop

You need a real tab instead of space in front of g++ and rm commands. If still fails then your editor is inserting spaces instead, even if you’re hitting the tab key on your keyboard. You need to configure your editor to insert hard tabs (09 in ASCII) instead. Like Instead ***** replace TAB. You can check your side by command … Read more

Making a Java Makefile

For a simple project without many files or dependencies, I simply use scripts. To build: To run: Replace . with whatever path(s) you need for your source. The * will use any jar on the default path or use a different path like lib/*.

Cygwin – Makefile-error: recipe for target `main.o’ failed

You see the two empty -D entries in the g++ command line? They’re causing the problem. You must have values in the -D items e.g. -DWIN32 if you’re insistent on using something like -D$(SYSTEM) -D$(ENVIRONMENT) then you can use something like: in the makefile which gives them default values. Your output looks to be missing the all important output: just to clarify, what actually … Read more

How to run a makefile in Windows?

If you have Visual Studio, run the Visual Studio Command prompt from the Start menu, change to the directory containing Makefile.win and type this: You can also use the normal command prompt and run vsvars32.bat (c:\Program Files (x86)\Microsoft Visual Studio 9.0\Common7\Tools for VS2008). This will set up the environment to run nmake and find the compiler tools.