hi,
i have the following structure in the "simple application":
application_folder
|
|--makefile
|
+-headers
| |
| +----func.h
|
|
+src
| |
| +------ func.c
| +------ main.c
|
|
and here are the contents of the files:
*func.h
float hey(float a, float b);
*func.c
#include "func.h"
float hey(float a, float b)
{
return a+b;
}
*main.c
#include "func.h"
#include <stdio.h>
int main()
{
printf("%f\n", hey(4.4,4.4) );
return 0;
}
and here is the makefile, where i try to use builtin rules to
reduce the size of it
vpath %.c src
vpath %.h headers
CPPFLAGS = -I headers
simple: main.o func.o
main.o: func.h
func.o: func.h
the problem is that when i run gnu-make i only get:
cc -I headers -c -o main.o src/main.c
cc -I headers -c -o func.o src/func.c
so basically the built in rule for simple is never run.
To verify that there is a default rule for such cases,
i type gmake --print-data-base > gmake.database.txt
and when i read gmake.database.txt i find
# Implicit Rules
%.out:
%.a:
%.ln:
%.o:
%: %.o
# commands to execute (built-in):
$(LINK.o) $^ $(LOADLIBES) $(LDLIBS) -o $@
so this should work but it doesn't.....:(
any ideas will be appreciated
-nicolas