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
|
# ProcMeter - A system monitoring program for Linux - Version 3.6.
#
# Makefile for the modules.
#
# Written by Andrew M. Bishop
#
# This file Copyright 1994-2012 Andrew M. Bishop
# It may be distributed under the GNU Public License, version 2, or
# any higher version. See section COPYING of the GNU Public license
# for conditions under which this file may be redistributed.
#
# Paths (overridden by main Makefile)
INSTDIR=/usr/local
LIB_PATH=$(INSTDIR)/lib/ProcMeter3
MOD_PATH=$(LIB_PATH)/modules
# Programs
CC=gcc
LD=gcc
# Program options (overridden by main Makefile)
CFLAGS=-g -O2 -Wall
LDFLAGS=-g
# Compilation targets
SRC=$(wildcard *.c)
OBJ=$(foreach f,$(SRC),$(addsuffix .o,$(basename $f)))
LIB=$(foreach f,$(SRC),$(addsuffix .so,$(basename $f)))
########
all : $(OBJ) $(LIB)
########
libsensors-%.o:libsensors-%.c
./check-no-libsensors.sh '$(CC)' '$(CFLAGS)' || $(CC) -c $(CFLAGS) $< -o $@ -I.. -fPIC
libsensors-%.so:libsensors-%.o
[ ! -f $< ] || $(LD) $(LDFLAGS) $< -lsensors -o $@ -shared
%.o:%.c ../procmeter.h
$(CC) -c $(CFLAGS) $< -o $@ -I.. -fPIC
%.so:%.o
$(LD) $(LDFLAGS) $< -o $@ -shared
########
.PHONY : clean distclean
clean :
-rm -f *.o *~ core
distclean : clean
-rm -f *.so
########
.PHONY : install
install :
install -d $(DESTDIR)$(MOD_PATH)
# install -d $(DESTDIR)$(LIB_PATH)/example
for module in *.so ; do \
[ $$module = template.so ] || install $(STRIP) -m 755 $$module $(DESTDIR)$(MOD_PATH) ;\
done
# install -m 644 README $(DESTDIR)$(LIB_PATH)/example
# install -m 644 template.c $(DESTDIR)$(LIB_PATH)/example
|