Dear Mark,
On 07.03.11 15:18, Mark Galeck (CW) wrote:
MAKEFILE := $(lastword $(MAKEFILE_LIST))
sorry, maybe my explanation was not very well, here a very short example
that shows the problem. I kicked out all the subdirectory stuff and
tried to simplify it as far as possible.
I attached two small c files, a header file and the Makefile.
Copy it to a directory and execute:
make
then execute:
make debug
You see, it does not remake the hello.o, but it should because the code
changes.
How can I teach make to rebuild the hello.o in this case?
Thanks,
Matthias
--
"Programming today is a race between software engineers striving to
build bigger and better idiot-proof programs, and the universe trying to
produce bigger and better idiots. So far, the universe is winning." --
Rich Cook
#include <stdio.h>
#include <hello.h>
int main(void)
{
printf("Hello\n");
printHello();
}
#include <stdio.h>
#include <hello.h>
void printHello()
{
printf("Hello from function\n");
#ifdef TEST
printf("Additional test line\n");
#endif
}
void printHello(void);
PRJSRC=a.c hello.c
OPTLEVEL=s
CC=gcc
REMOVE=rm -f
PROJECTNAME=test
TRG=$(PROJECTNAME).out
CFLAGS=$(CUSTOM_CFLAGS) -I. $(INC) -O$(OPTLEVEL)
CFILES=$(filter %.c, $(PRJSRC))
OBJDEPS=$(CFILES:.c=.o)
.SUFFIXES : .c .h
all: $(TRG)
debug: CUSTOM_CFLAGS:=-DTEST
debug: $(TRG)
clean:
$(REMOVE) $(TRG)
$(REMOVE) $(OBJDEPS)
$(TRG): $(OBJDEPS)
$(CC) $(OBJDEPS) $(LDFLAGS) -o $(TRG)
%.o: %.c
$(CC) $(CFLAGS) -c $< -o $@
_______________________________________________
Help-make mailing list
[email protected]
http://lists.gnu.org/mailman/listinfo/help-make