I have the following makefile:
CCC = g++
CCFLAGS = -ansi
driver: driver.o graph.o
$(CCC) -o driver driver.o graph.o
graph.o: graph.h
driver.o: graph.h
adjl:
rm -f graph.h graph.cc
ln -s adjl/graph.cc .
ln -s adjl/graph.h .
touch graph.cc graph.h
adjm:
rm -f graph.h graph.cc
ln -s adjm/graph.cc .
ln -s adjm/graph.h .
touch graph.cc graph.h
clean:
rm -f *.o
real_clean: clean
rm -f graph.cc graph.h
rm -f driver
The idea is that I am trying to link two different .cc/.h files depending on which implementation I want to use. If I make real_clean, none of the .cc/.h files exist, I merely have a driver.cc file and the makefile in the folder. If I call make, it says they are up to date. This happens even if I edit the files in adjl/adjm to make them “newer” versions.
[95]% ls adjl/ adjm/ driver.cc makefile [96]% make adjl make: `adjl' is up to date. [97]% make adjm make: `adjm' is up to date.
I took the template makefile from another project I had done, and they are written the same way but I can repeatedly make the same commands with no “up to date” issues.
I have googled but have not found a problem similar to mine (they generally seem to involve users who aren’t cleaning before making).
Thanks to anyone for reading.
The problem is that you have directory named the same as your targets in Makefile.
When you issue
make adjlmake checks for fileadjlwhich it finds and does nothing.Rename targets to something else and try again.