L
lovecreatesbeauty
My Makefile doesn't detect the change of header files.
This little makefile follows sec 2.6 of GNU make manual, and I
remember it worked before when header files changed.
Where am i wrong?
Thanks
$ touch b.h
$ make
make: `a.out' is up to date.
$
$ pwd
/home/ljh/temp/src
$ ls
a.c b.c b.h Makefile
$ cat Makefile
CC = gcc
CFLAGS = -ansi -pedantic -Wall -W
LDFLAGS =
OBJS = a.o b.o
OUT = a.out
$(OUT) : $(OBJS)
$(CC) $(LDFLAGS) $^ -o $@
a.c b.c : b.h
..PHONY : clean
clean :
rm $(OUT) $(OBJS)
$ make
gcc -ansi -pedantic -Wall -W -c -o a.o a.c
a.c: In function ¡®main¡¯:
a.c:7: warning: implicit declaration of function ¡®b¡¯
gcc -ansi -pedantic -Wall -W -c -o b.o b.c
gcc a.o b.o -o a.out
$ touch b.c
$ make
gcc -ansi -pedantic -Wall -W -c -o b.o b.c
gcc a.o b.o -o a.out
$ make
make: `a.out' is up to date.
$ touch b.h
$ make
make: `a.out' is up to date.
$
$ make -v
GNU Make 3.81
Copyright (C) 2006 Free Software Foundation, Inc.
This is free software; see the source for copying conditions.
There is NO warranty; not even for MERCHANTABILITY or FITNESS FOR A
PARTICULAR PURPOSE.
This program built for i486-pc-linux-gnu
$ uname -a
Linux debian 2.6.32-5-686 #1 SMP Mon Jan 16 16:04:25 UTC 2012 i686 GNU/
Linux
$ cat /etc/debian_version
6.0.4
$
This little makefile follows sec 2.6 of GNU make manual, and I
remember it worked before when header files changed.
Where am i wrong?
Thanks
$ touch b.h
$ make
make: `a.out' is up to date.
$
$ pwd
/home/ljh/temp/src
$ ls
a.c b.c b.h Makefile
$ cat Makefile
CC = gcc
CFLAGS = -ansi -pedantic -Wall -W
LDFLAGS =
OBJS = a.o b.o
OUT = a.out
$(OUT) : $(OBJS)
$(CC) $(LDFLAGS) $^ -o $@
a.c b.c : b.h
..PHONY : clean
clean :
rm $(OUT) $(OBJS)
$ make
gcc -ansi -pedantic -Wall -W -c -o a.o a.c
a.c: In function ¡®main¡¯:
a.c:7: warning: implicit declaration of function ¡®b¡¯
gcc -ansi -pedantic -Wall -W -c -o b.o b.c
gcc a.o b.o -o a.out
$ touch b.c
$ make
gcc -ansi -pedantic -Wall -W -c -o b.o b.c
gcc a.o b.o -o a.out
$ make
make: `a.out' is up to date.
$ touch b.h
$ make
make: `a.out' is up to date.
$
$ make -v
GNU Make 3.81
Copyright (C) 2006 Free Software Foundation, Inc.
This is free software; see the source for copying conditions.
There is NO warranty; not even for MERCHANTABILITY or FITNESS FOR A
PARTICULAR PURPOSE.
This program built for i486-pc-linux-gnu
$ uname -a
Linux debian 2.6.32-5-686 #1 SMP Mon Jan 16 16:04:25 UTC 2012 i686 GNU/
Linux
$ cat /etc/debian_version
6.0.4
$