- May 8, 2005
- 415
- 0
- 76
This isn't really an urgent issue but I'm trying to learn to make better Makefiles and I've run into an issue and I have no idea why it's happening. I have the following makefile:
Now the 'problem' is that every time I run make, it remakes the tests even if nothing changed. I'm trying to understand why this is happening since the dependencies clearly don't change. any ideas?
Code:
CC = gcc
CFLAGS = -Wall -g -std=gnu99 -lpthread
.PHONY: all clean
all: tests
tests: timerQueue.o test1.c test2.c
$(CC) $(CFLAGS) -o test1 test1.c timerQueue.o
$(CC) $(CFLAGS) -o test2 test2.c timerQueue.o
test1: tests
echo "Running test 1...\nEnd with ctrl-c"
./test1
timerQueue.o: timerQueue.c timerQueue.h
$(CC) $(CFLAGS) -c -o timerQueue.o timerQueue.c
clean:
@rm -f *.o test1 test2 *~