I have this very simple makefile:
P = hello_world.exe
OBJECTS = main.o
CFLAGS = -g -Wall -O3
LDLIBS =
CC = clang
$(P): $(OBJECTS)
When I run make it will compile main.c but it will not link to hello_world.exe. Shouldn't that be happening automatically?
My environment is cygwin 64bit.
The output of make -p is here: http://pastebin.com/qbr0sRXL
There's no default rule for .exe
files that I'm aware of (or can find in that output).
You'll need to write one yourself.
If your output was hello_world
and you had a hello_world.c
/hello_world.cpp
source file and also a main.c
/main.cpp
file then your makefile as written would work I believe (since the default %: %.o
rule would apply and your added prerequisite would be added to the hello_world
prerequisite list).