File: Makefile

package info (click to toggle)
mrtgutils 0.8.3
  • links: PTS, VCS
  • area: main
  • in suites: bullseye, buster, sid, stretch
  • size: 124 kB
  • ctags: 42
  • sloc: ansic: 497; makefile: 32
file content (39 lines) | stat: -rw-r--r-- 1,086 bytes parent folder | download
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
CC = gcc
VERSION = 0.1

CPPFLAGS:=$(shell dpkg-buildflags --get CPPFLAGS)
CFLAGS:=$(shell dpkg-buildflags --get CFLAGS)
CXXFLAGS:=$(shell dpkg-buildflags --get CXXFLAGS)
LDFLAGS:=$(shell dpkg-buildflags --get LDFLAGS)

ARCH:= $(shell dpkg-architecture -qDEB_BUILD_ARCH)
WITH_SENSORS:=1

COBJS = uptime.o util.o
TARGETS = mrtg-load mrtg-ip-acct mrtg-apache mrtg-uptime
MANPAGES = mrtg-load.1 mrtg-ip-acct.1 mrtg-apache.1 mrtg-uptime.1
ifeq ($(WITH_SENSORS),1)
TARGETS += mrtg-sensors
MANPAGES += mrtg-sensors.1
endif

%.o: %.c
	$(CC) $(CPPFLAGS) $(CFLAGS) $(LDFLAGS) -c $<

%.1: %.pod
	pod2man --center "MRTG helper utilities" --release "mrtgutils $(VERSION)" $^ > $@

all: $(TARGETS) $(MANPAGES)

mrtg-sensors: LIBS=-lsensors

mrtg-%: $(COBJS) mrtg-%.o
	$(CC) $(CPPFLAGS) $(CFLAGS) $(LDFLAGS) -o $@ $^ $(LIBS)

install: $(TARGET) 
	for i in $(TARGETS); do install -m 755 $$i $(DESTDIR)/usr/bin/$$i; done
	for i in $(MANPAGES); do install -m 644 $$i $(DESTDIR)/usr/share/man/man1/$$i; gzip -9 $(DESTDIR)/usr/share/man/man1/$$i; done

clean:
	-rm -f *.o $(TARGETS) $(MANPAGES)
	-rm -f *~