I am trying to understand whats wrong with this make file outlined
below
#-Wall "turns on all warnings"
#-c "donot run the linker"
#-o "output file"
#$@ "the target"
#$^ "list of all prerequisites"
these 2 lines put all the .cpp and .o files in the current directory
in the variables SRC and OBJ respectively.
SRC := $(wildcard *.cpp)
OBJ := $(wildcard *.o)
this line is the compiler section which uses g++ to compile all the
.cpp and .h (assuming #include directives are correct) into .o files
proj: $(SRC)
$(CXX) -Wall -I/usr/include -c $^
this line links all those .o files that were generated from the
compilation command above
#### linker section ####
proj: $(OBJ)
$(CXX) -L/usr/local/lib $^ -lgsl -lgslcblas -lm
when then I am getting the 2 warning below and no .o files being
compiled?
thanks
[EMAIL PROTECTED]:~/myPrograms/common$ make
makefile:14: warning: overriding commands for target `proj'
makefile:11: warning: ignoring old commands for target `proj'
g++ -L/usr/local/lib read_data.cpp read_data_test.cpp -lgsl -lgslcblas -lm
[EMAIL PROTECTED]:~/myPrograms/common$ ls
a.out makefile read_data.cpp read_data.h read_data_test.cpp semantic.cache
[EMAIL PROTECTED]:~/myPrograms/common$
Groups are talking. We´re listening. Check out the handy changes to Yahoo! Groups.