forked from agraef/ShuttlePRO
-
Notifications
You must be signed in to change notification settings - Fork 1
/
Makefile
81 lines (59 loc) · 2.28 KB
/
Makefile
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
# Copyright 2013 Eric Messick (FixedImagePhoto.com/Contact)
# Copyright 2018 Albert Graef (aggraef@gmail.com)
# Copyright 2019 Ben Blain (servc.eu/contact)
#CFLAGS=-g -W -Wall
CFLAGS=-O3 -W -Wall
prefix=/usr/local
bindir=$(DESTDIR)$(prefix)/bin
mandir=$(DESTDIR)$(prefix)/share/man/man1
datadir=$(DESTDIR)/etc
udevdir=$(DESTDIR)/etc/udev/rules.d
OBJ = shuttlepro.o
# Only try to install the manual page if it's actually there, to prevent
# errors if pandoc isn't installed.
INSTALL_TARGETS = shuttlepro $(wildcard shuttlepro.1)
.PHONY: all install uninstall man pdf clean realclean
all: shuttlepro
install: all
install -d $(bindir) $(datadir) $(mandir)
install shuttlepro $(bindir)
# If present, the manual page will be installed along with the program.
ifneq ($(findstring shuttlepro.1, $(INSTALL_TARGETS)),)
install -m 0644 shuttlepro.1 $(mandir)
else
@echo "Manual page not found, create it with 'make man'."
endif
uninstall:
rm -f $(bindir)/shuttlepro $(mandir)/shuttlepro.1 $(datadir)/shuttlerc
shuttlepro: $(OBJ)
gcc $(CFLAGS) $(OBJ) -o shuttlepro -L /usr/X11R6/lib -lX11 -lXtst
# This creates the manual page from the README. Requires pandoc
# (http://pandoc.org/).
man: shuttlepro.1
# Manual page in pdf format. This also needs groff.
pdf: shuttlepro.pdf
shuttlepro.1: README.md
pandoc -s -tman $< > $@
shuttlepro.pdf: shuttlepro.1
# This assumes that man does the right thing when given a file instead of a
# program name, and that it understands groff's -T option.
man -Tpdf ./shuttlepro.1 > $@
# Shamanon's udev hotplugging. *Only* install these if you're know what you're
# doing! (See the Hotplugging section in the manual for details.)
udev-rules = $(patsubst %.rules.in, %.rules, $(wildcard udev/*.rules.in))
%.rules: %.rules.in
sed -e 's:@prefix@:$(prefix):g' < $< > $@
udev/shuttle-hotplug: udev/shuttle-hotplug.in
sed -e 's:@prefix@:$(prefix):g' < $< > $@
install-udev: $(udev-rules) udev/shuttle-hotplug
install -d $(bindir) $(udevdir)
install udev/shuttle-hotplug $(bindir)
install -m 0644 $(udev-rules) $(udevdir)
rm -f $(udev-rules) udev/shuttle-hotplug
uninstall-udev:
rm -f $(bindir)/shuttle-hotplug $(addprefix $(udevdir)/, $(notdir $(udev-rules)))
clean:
rm -f shuttlepro $(OBJ)
realclean:
rm -f shuttlepro shuttlepro.1 shuttlepro.pdf $(OBJ)
shuttlepro.o: shuttle.h