1 |
< |
# "Senior Level" Makefile :) |
1 |
> |
# Makefile for sysinfo programs |
2 |
|
|
3 |
– |
OBJECTS = load.o |
4 |
– |
|
3 |
|
CXXFLAGS += -g |
4 |
|
|
5 |
< |
%.d : %.cc |
6 |
< |
set -e; $(CXX) -M $(CPPFLAGS) $< \ |
9 |
< |
| sed 's/\($*\)\.o[ :]*/\1.o $@ : /g' > $@; \ |
10 |
< |
[ -s $@ ] || rm -f $@ |
5 |
> |
sysinfo: sysinfo.o hostname.o load.o |
6 |
> |
$(LINK.cc) -o $@ sysinfo.o hostname.o load.o |
7 |
|
|
8 |
< |
load : $(OBJECTS) |
9 |
< |
$(LINK.cc) -o $@ $(OBJECTS) |
8 |
> |
sysinfo.o: sysinfo.cc hostname.hh load.hh |
9 |
> |
hostname.o: hostname.cc hostname.hh |
10 |
> |
load.o: load.cc load.hh |
11 |
|
|
12 |
< |
include $(OBJECTS:%.o=%.d) |
13 |
< |
|
14 |
< |
clean : |
18 |
< |
rm -f $(OBJECTS) |
19 |
< |
rm -f $(OBJECTS:%.o=%.d) |
20 |
< |
rm -f load |
21 |
< |
|
12 |
> |
clean: |
13 |
> |
rm -f *.o |
14 |
> |
rm -f sysinfo |