aboutsummaryrefslogtreecommitdiff
path: root/makefile
blob: 282d7ef1437de268956eaec4179a7811cd2e6872 (plain)
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
CC := cc

ifeq ($(PREFIX),)
	PREFIX := /usr/local
endif

BUILD_FILES_COMMON := \
	src/ss/*.c \
	src/sysfs.c \
	src/zenmonitor-lib.c

BUILD_FILES_GUI := \
	$(BUILD_FILES_COMMON) \
	src/gui.c \
	src/zenmonitor.c

BUILD_FILES_CLI := \
	$(BUILD_FILES_COMMON) \
	src/zenmonitor-cli.c

build:
	$(CC) -Isrc/include `pkg-config --cflags gtk+-3.0` $(BUILD_FILES_GUI) -o zenmonitor `pkg-config --libs gtk+-3.0` -lm -no-pie -Wall $(CFLAGS)

build-cli:
	$(CC) -Isrc/include `pkg-config --cflags glib-2.0` $(BUILD_FILES_CLI) -o zenmonitor-cli `pkg-config --libs glib-2.0` -lm -lncurses -no-pie -Wall $(CFLAGS)

install:
	mkdir -p $(DESTDIR)$(PREFIX)/bin
	install -m 755 zenmonitor $(DESTDIR)$(PREFIX)/bin

	mkdir -p $(DESTDIR)$(PREFIX)/share/applications
	sed -e "s|@APP_EXEC@|${DESTDIR}${PREFIX}/bin/zenmonitor|" \
			data/zenmonitor.desktop.in > \
			$(DESTDIR)$(PREFIX)/share/applications/zenmonitor.desktop

install-cli:
	mkdir -p $(DESTDIR)$(PREFIX)/bin
	install -m 755 zenmonitor-cli $(DESTDIR)$(PREFIX)/bin

install-polkit:
	sed -e "s|@APP_EXEC@|${DESTDIR}${PREFIX}/bin/zenmonitor|" \
			data/zenmonitor-root.desktop.in > \
			$(DESTDIR)$(PREFIX)/share/applications/zenmonitor-root.desktop

	sed -e "s|@APP_EXEC@|${DESTDIR}${PREFIX}/bin/zenmonitor|" \
			data/org.pkexec.zenmonitor.policy.in > \
			$(DESTDIR)/usr/share/polkit-1/actions/org.pkexec.zenmonitor.policy

uninstall:
	rm -f $(DESTDIR)$(PREFIX)/bin/zenmonitor
	rm -f $(DESTDIR)$(PREFIX)/share/applications/zenmonitor.desktop
	rm -f $(DESTDIR)$(PREFIX)/share/applications/zenmonitor-root.desktop
	rm -f $(DESTDIR)/usr/share/polkit-1/actions/org.pkexec.zenmonitor.policy

uninstall-cli:
	rm -f $(DESTDIR)$(PREFIX)/bin/zenmonitor-cli

all: build build-cli

clean:
	rm -f zenmonitor
	rm -f zenmonitor-cli
	rm -f *.o