-
Notifications
You must be signed in to change notification settings - Fork 1
/
Makefile
38 lines (30 loc) · 813 Bytes
/
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
CC=gcc
CFLAGS=-std=c99
LDFLAGS=-lX11 -lXtst
OBJS=mousemode.o
OUT=mousemode
DESTDIR=
PREFIX=/usr/local
MANPREFIX=$(PREFIX)/share/man
VERSION=1.0
all: main
main: $(OBJS)
$(CC) $(CFLAGS) $(LDFLAGS) $(OBJS) -o $(OUT)
%.o: %.c
$(CC) -c $(CFLAGS) $^ -o $@
clean:
rm -f *.o
debug: CFLAGS += -g -Og
debug: clean $(OBJS)
$(CC) $(CFLAGS) $(LDFLAGS) $(OBJS) -o a.out
install: CFLAGS += -O3
install: clean all
@mkdir -p -- $(DESTDIR)$(PREFIX)
cp -- $(OUT) $(DESTDIR)$(PREFIX)/bin
@chmod 755 -- $(DESTDIR)$(PREFIX)/bin/$(OUT)
@mkdir -p -- $(DESTDIR)$(MANPREFIX)/man1
sed "s/VERSION/$(VERSION)/g" < mousemode.1 > $(DESTDIR)$(MANPREFIX)/man1/mousemode.1
@chmod 644 -- $(DESTDIR)$(MANPREFIX)/man1/mousemode.1
uninstall:
rm -f -- $(DESTDIR)$(PREFIX)/bin/$(OUT)
rm -f -- $(DESTDIR)$(MANPREFIX)/man1/mousemode.1