1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150
|
# BubbleFishyMon with gkrellm support
# Type 'make' or 'make bubblefishymon' to build bubblefishymon
# Type 'make bubblefishymon1' to build bubblefishymon for gtk1
# Type 'make gkrellm' to build gkrellm-bfm.so for gkrellm2
# Type 'make gkrellm1' to build gkrellm-bfm.so for gkrellm
# where to install this program
PREFIX ?= /usr/local
# bubblemon configuration
EXTRA = -DENABLE_DUCK
EXTRA = -DENABLE_CPU
EXTRA = -DENABLE_MEMSCREEN
EXTRA = -DENABLE_FISH
EXTRA = -DENABLE_TIME
EXTRA = -DUPSIDE_DOWN_DUCK
EXTRA = -DKDE_DOCKAPP
# If building for Linux define the network device to monitor.
NET_DEVICE = eth0
###############################################################################
# no user serviceable parts below #
###############################################################################
EXTRA = $(WMAN)
# gtk cflags and gtk lib flags
GTK_CFLAGS = $(shell gtk-config --cflags)
GTK_LIBS = -lX11 $(shell gtk-config --libs)
GTK2_CFLAGS = $(shell pkg-config gtk -2.0 --cflags)
GTK2_LIBS = -lX11 $(shell pkg-config gtk -2.0 --libs)
LIBS = -lm
# optimization cflags
#CFLAGS = -O3 -Wall ${EXTRA}
CFLAGS = ${EXTRA}
# profiling cflags
# CFLAGS = -ansi -Wall -pg -O3 ${EXTRA} -DPRO
# test coverage cflags
# CFLAGS = -fprofile-arcs -ftest-coverage -Wall -ansi -g ${EXTRA} -DPRO
SHELL = sh
OS = $(shell uname -s)
SRCS = fishmon.c bubblemon.c
OBJS = fishmon.o bubblemon.o
BUBBLEFISHYMON = bubblefishymon
# Some stuffs for building gkrellm-bfm
GKRELLM_SRCS = gkrellm-bfm.c
GKRELLM_OBJS = gkrellm-bfm.o
GKRELLM_BFM = gkrellm-bfm.so
LDFLAGS = -shared
STRIP = strip
CC = gcc
INSTALLMAN = -m 644
# special things for Linux
ifeq ($(OS), Linux)
ifeq "$(NET_DEVICE)" ""
CFLAGS =-DNET_DEVICE=\"eth0\"
else
CFLAGS =-DNET_DEVICE=\"$(NET_DEVICE)\"
endif
SRCS = sys_linux.c
OBJS = sys_linux.o
INSTALL = -m 755
INSTALLMAN = -m 644
endif
# special things for FreeBSD
ifeq ($(OS), FreeBSD)
SRCS = sys_freebsd.c
OBJS = sys_freebsd.o
LIBS = -lkvm
INSTALL = -c -g kmem -m 2755 -o root
endif
# special things for OpenBSD
ifeq ($(OS), OpenBSD)
OBJS = sys_openbsd.o
LIBS = `gtk-config --libs | sed "s/-lgtk//g"`
endif
#special things for SunOS
ifeq ($(OS), SunOS)
# try to detect if gcc is available (also works if you call gmake CC=cc to
# select the sun compilers on a system with both)
COMPILER=$(shell \
if [ `$(CC) -v 2>&1 | egrep -c '(gcc|egcs|g\ \ )'` = 0 ]; then \
echo suncc; else echo gcc; fi)
# if not, fix up CC and the CFLAGS for the Sun compiler
ifeq ($(COMPILER), suncc)
CC=cc
CFLAGS=-v -xO3
endif
ifeq ($(COMPILER), gcc)
CFLAGS=-O3 -Wall
endif
CFLAGS = ${EXTRA}
SRCS = sys_sunos.c
OBJS = sys_sunos.o
LIBS = -lkstat
INSTALL = -m 755
endif
all: $(BUBBLEFISHYMON)
gkrellm: clean_obj
$(CC) -DGKRELLM2 -DGKRELLM_BFM -fPIC $(GTK2_CFLAGS) $(CFLAGS) -c $(SRCS) \
$(GKRELLM_SRCS)
$(CC) $(GTK2_LIBS) $(LDFLAGS) -o $(GKRELLM_BFM) $(OBJS) $(GKRELLM_OBJS)
$(STRIP) $(GKRELLM_BFM)
gkrellm1: clean_obj
$(CC) -DGKRELLM_BFM -fPIC $(GTK_CFLAGS) $(CFLAGS) -c $(SRCS) \
$(GKRELLM_SRCS)
$(CC) $(GTK_LIBS) $(LDFLAGS) -o $(GKRELLM_BFM) $(OBJS) $(GKRELLM_OBJS)
$(STRIP) $(GKRELLM_BFM)
bubblefishymon: clean_obj
$(CC) $(GTK2_CFLAGS) $(CFLAGS) -o $(BUBBLEFISHYMON) \
$(SRCS) $(LIBS) $(GTK2_LIBS)
$(STRIP) $(BUBBLEFISHYMON)
bubblefishymon1: clean_obj
$(CC) $(GTK_CFLAGS) $(CFLAGS) -o $(BUBBLEFISHYMON) \
$(SRCS) $(LIBS) $(GTK_LIBS)
$(STRIP) $(BUBBLEFISHYMON)
clean_obj:
rm -rf *.o
clean:
rm -f bubblefishymon *.o *.bb* *.gcov gmon.* *.da *~ *.so
install:
install -d $(DESTDIR)/$(PREFIX)/bin $(DESTDIR)/$(PREFIX)/share/man/man1
install $(INSTALL) $(BUBBLEFISHYMON) $(DESTDIR)/$(PREFIX)/bin
install $(INSTALL_MAN) doc/bubblefishymon.1 $(DESTDIR)/$(PREFIX)/share/man/man1
|