Hi all,
I have 4 '.cpp' files and 1 header files:
Tools.cpp
Code1.cpp
Code2.cpp
Code3.cpp
and Tools.hh
Now all
Code1.cpp, Code2.cpp, Code3.cpp
use functions stored in
Tools.cpp
.
Currently, what I do to compile all of them is using
this simple shell script:
#!/bin/bash
echo "compiling Code1.cpp";
g++ Code1.cpp Tools.cpp -o Code1
echo "compiling Code2.cpp";
g++ Code2.cpp Tools.cpp -o Code2
echo "compiling Code3.cpp";
g++ Code3.cpp Tools.cpp -o Code3
It all works fine.
Now I want to do that using a standard makefile.
But why this doesnt' work:
XX = g++
TOOLSRC = Tools.cpp Code1.cpp Code2.cpp \
Code3.cpp
TOOLSINC = Tools.hh
all: Code1 Code2 Code3
Code1: $(TOOLSRC) $(TOOLSINC) makefile
$(CXX)
Code2: $(TOOLSRC) $(TOOLSINC) makefile
$(CXX)
Code3: $(TOOLSRC) $(TOOLSINC) makefile
$(CXX)
The error I got is this:
g++
i686-apple-darwin9-g++-4.0.1: no input files
make: *** [Code1] Error 1