1 |
< |
all: exe |
1 |
> |
# config |
2 |
|
|
3 |
< |
clean: |
4 |
< |
rm -f *.o *.bak |
5 |
< |
rm -f Host core libsocket++.a |
3 |
> |
OBJECTS = Host.o XMLFormatter.o SmallNet.o Config.o\ |
4 |
> |
SysMon.o SubNet.o SubPipe.o |
5 |
|
|
6 |
< |
exe: libsocket++.a |
7 |
< |
g++ -c -Isocket++-1.10 -o Host.o Host.cpp |
9 |
< |
g++ -c -Isocket++-1.10 -o XMLFormatter.o XMLFormatter.cpp |
10 |
< |
g++ -c -Isocket++-1.10 -o SmallNet.o SmallNet.cpp |
11 |
< |
g++ -c -Isocket++-1.10 -o Config.o Config.cpp |
12 |
< |
g++ -c -Isocket++-1.10 -o SysMon.o SysMon.cpp |
13 |
< |
g++ -c -Isocket++-1.10 -o SubNet.o SubNet.cpp |
14 |
< |
g++ -c -Isocket++-1.10 -o SubPipe.o SubPipe.cpp |
15 |
< |
g++ -o Host -L. -lsocket++ -lsocket -lnsl Host.o Config.o XMLFormatter.o SmallNet.o SysMon.o SubNet.o SubPipe.o libsocket++.a |
6 |
> |
SOCKLIBDIR = socket++-1.10 |
7 |
> |
SOCKLIB = libsocket++.a |
8 |
|
|
9 |
< |
run: clean exe |
18 |
< |
Host |
9 |
> |
HOST = Host |
10 |
|
|
11 |
< |
libsocket++.a: |
12 |
< |
cd socket++-1.10 && sh configure && make |
13 |
< |
cp socket++-1.10/libsocket++.a . |
14 |
< |
cd socket++-1.10 && make real-clean |
11 |
> |
# default |
12 |
> |
all: $(HOST) |
13 |
> |
|
14 |
> |
# target to compile the main binary |
15 |
> |
$(HOST): $(OBJECTS) $(SOCKLIB) |
16 |
> |
g++ -o $@ -L. -lsocket++ -lsocket -lnsl $(OBJECTS) $(SOCKLIB) |
17 |
> |
|
18 |
> |
# target to compile any object file |
19 |
> |
%.o : %.cpp |
20 |
> |
g++ -c -I$(SOCKLIBDIR) -o $@ $< |
21 |
> |
|
22 |
> |
# target to compile the socket library |
23 |
> |
$(SOCKLIB): |
24 |
> |
cd $(SOCKLIBDIR) && sh configure && make |
25 |
> |
cp $(SOCKLIBDIR)/$(SOCKLIB) . |
26 |
> |
cd $(SOCKLIBDIR) && make real-clean |
27 |
> |
|
28 |
> |
# cleanup target |
29 |
> |
clean: |
30 |
> |
rm -f $(OBJECTS) $(SOCKLIB) $(HOST) |
31 |
> |
rm -f core |
32 |
> |
|
33 |
> |
# run target |
34 |
> |
run: $(HOST) |
35 |
> |
./$(HOST) |
36 |
> |
|