0 CC = g++It will be very useful for all our sample codes.
1 CFLAG = -Wall -g -ansi
2
3 %: %.c++
4 $(CC) $(CFLAG) -o $@ $^
5
For example:
hello.c++:
0 #include <iostream>
1
2 using namespace std;
3
4 int main() {
5 cout<<"hello world"<<endl;
6 return 0;
7 }
$ make hello
g++ -Wall -g -ansi -o hello hello.c++
$ ./hello
hello world
$
Won't it be real good if the notations are also explained.
ReplyDeleteI mean,
#1 - what? (e.g, CC, -Wall, -o, -g means)
#2 - Why?(e.g, why we structured it this way)
#3 - How?(e.g, how the same could be achieved by other means).
hope that would help beginners like us to get more info..get different perspective...etc