blob: f9850e0125d1b3237e749a538db07c0ba957f26b (
plain) (
blame)
| 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
 | .POSIX:
CONFIGFILE = config.mk
include $(CONFIGFILE)
CPPFLAGS_CONFS =\
	-D'COREUP_THRESHOLD_CPU=$(COREUP_THRESHOLD_CPU)'\
	-D'COREUP_THRESHOLD_TIME=$(COREUP_THRESHOLD_TIME)'\
	-D'COREUP_COOLDOWN=$(COREUP_COOLDOWN)'\
	-D'COREDOWN_THRESHOLD_CPU=$(COREDOWN_THRESHOLD_CPU)'\
	-D'COREDOWN_THRESHOLD_TIME=$(COREDOWN_THRESHOLD_TIME)'\
	-D'COREDOWN_COOLDOWN=$(COREDOWN_COOLDOWN)'\
	-D'DAEMON_INTERVAL_SEC=$(DAEMON_INTERVAL_SEC)'\
	-D'DAEMON_INTERVAL_NSEC=$(DAEMON_INTERVAL_NSEC)'
OBJ =\
	coreupdown.o
HDR =
all: coreupdown
$(OBJ): $(HDR)
.c.o:
	$(CC) -c -o $@ $< $(CFLAGS) $(CPPFLAGS) $(CPPFLAGS_CONFS)
coreupdown: $(OBJ)
	$(CC) -o $@ $(OBJ) $(LDFLAGS)
install: coreupdown
	mkdir -p -- "$(DESTDIR)$(PREFIX)/bin"
	mkdir -p -- "$(DESTDIR)$(MANPREFIX)/man1"
	test -f "$(DESTDIR)$(PREFIX)/bin/coreup" || test ! -e "$(DESTDIR)$(PREFIX)/bin/coreup"
	test -f "$(DESTDIR)$(PREFIX)/bin/coredown" || test ! -e "$(DESTDIR)$(PREFIX)/bin/coredown"
	test -f "$(DESTDIR)$(PREFIX)/bin/coreupdownd" || test ! -e "$(DESTDIR)$(PREFIX)/bin/coreupdownd"
	cp -- coreupdown "$(DESTDIR)$(PREFIX)/bin/coreup"
	ln -sf -- coreup "$(DESTDIR)$(PREFIX)/bin/coredown"
	ln -sf -- coreup "$(DESTDIR)$(PREFIX)/bin/coreupdownd"
	cp -- coreup.1 coredown.1 coreupdownd.1 "$(DESTDIR)$(MANPREFIX)/man1"
postinstall:
	chown '0:0' "$(DESTDIR)$(PREFIX)/bin/coreup"
	chmod '4755' "$(DESTDIR)$(PREFIX)/bin/coreup"
uninstall:
	-rm -f -- "$(DESTDIR)$(PREFIX)/bin/coreup"
	-rm -f -- "$(DESTDIR)$(PREFIX)/bin/coredown"
	-rm -f -- "$(DESTDIR)$(PREFIX)/bin/coreupdownd"
	-rm -f -- "$(DESTDIR)$(MANPREFIX)/man1/coreup.1"
	-rm -f -- "$(DESTDIR)$(MANPREFIX)/man1/coredown.1"
	-rm -f -- "$(DESTDIR)$(MANPREFIX)/man1/coreupdownd.1"
clean:
	-rm -f -- *.o *.a *.lo *.su *.so *.so.* *.gch *.gcov *.gcno *.gcda
	-rm -f -- coreupdown
.SUFFIXES:
.SUFFIXES: .o .c
.PHONY: all install uninstall clean
 |