#
# Linux Makefile template
#
#
# $Id$
#
include ../Makefile.config

##  Autodepend rule defaults to disabled.
#-include ../Makefile.GNU.autodep

CXXFLAGS += -I..

OBJS = \
cpumeter.o \
memmeter.o \
swapmeter.o \
pagemeter.o \
netmeter.o \
nfsmeter.o \
intmeter.o \
loadmeter.o \
btrymeter.o \
diskmeter.o \
raidmeter.o \
lmstemp.o \
MeterMaker.o

FAIL_ARCHS = arm m68k powerpc s390 sparc 3D s390x powerpc64

# Test for arm specifically, because arm can show up as a number of
# things prefixed by "arm"
# This means that no return value for host_cpu that contains a
# substring of "arm" will ever have a serialmeter.  Oh well.
#
# With the ioperm checks in serialmeter.cc, this should no longer be
# necessary.  In fact, it may no longer be necessary to perform this
# check at all, but it is left here just in case until this can be
# tested.
#
# ifneq (,$(findstring arm, i686))
# ARCH = arm
# else
# ARCH = i686
# endif

ARCH = i686

ifneq (,$(findstring $(ARCH), $(FAIL_ARCHS)))
# Don't include serialmeter for above architectures
else
OBJS += serialmeter.o
endif

CFILES := $(OBJS:.o=.cc)
DEPFILES := $(OBJS:%=.%.d)

vpath %.h $(TOP)
vpath %.cc $(TOP)

#-----------------------------------------------------------------------

all : libmeter.a 

MemStat:
	$(MAKE) -C memstat

clean :
	rm -f $(OBJS) $(DEPFILES) libmeter.a *~
	if test "" = "MemStat"; then $(MAKE) -C memstat clean; fi

libmeter.a : $(OBJS)
	ar cvr libmeter.a $(OBJS)
	ranlib $@


