-
Notifications
You must be signed in to change notification settings - Fork 13
/
Copy pathMakefile
63 lines (51 loc) · 1.67 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
PROGRAM = xob
MANPAGE = doc/xob.1
SYSCONF = styles.cfg
LIBS = x11 libconfig
SOURCES = src/conf.c src/display.c src/main.c
# Feature: alpha channel (transparency)
enable_alpha ?= yes
ifeq ($(enable_alpha),yes)
LIBS += xrender
SOURCES += src/display_xrender.c
else
SOURCES += src/display_xlib.c
endif
OBJECTS = $(SOURCES:.c=.o)
CFLAGS += $(shell pkg-config --cflags $(LIBS)) -std=c99 -Wall -Wextra -pedantic
LDFLAGS += $(shell pkg-config --libs $(LIBS))
INSTALL ?= install
INSTALL_PROGRAM ?= $(INSTALL)
INSTALL_DATA ?= $(INSTALL) -m 644
prefix ?= /usr/local
bindir ?= $(prefix)/bin
sysconfdir ?= $(prefix)/etc
datarootdir ?= $(prefix)/share
mandir ?= $(datarootdir)/man
man1dir ?= $(mandir)/man1
all: $(PROGRAM)
$(PROGRAM): $(OBJECTS)
$(CC) -o $@ $(OBJECTS) $(LDFLAGS)
%.o: %.c
$(CC) $(CFLAGS) -DSYSCONFDIR='"$(sysconfdir)"' -c -o $@ $<
install: $(PROGRAM) $(MANPAGE) $(SYSCONF)
mkdir --parents "$(DESTDIR)$(bindir)"
$(INSTALL_PROGRAM) "$(PROGRAM)" -t "$(DESTDIR)$(bindir)"
mkdir --parents "$(DESTDIR)$(man1dir)"
$(INSTALL_DATA) "$(MANPAGE)" -t "$(DESTDIR)$(man1dir)"
mkdir --parents "$(DESTDIR)$(sysconfdir)/$(PROGRAM)"
$(INSTALL_DATA) "$(SYSCONF)" -t "$(DESTDIR)$(sysconfdir)/$(PROGRAM)"
uninstall:
rm -f "$(DESTDIR)$(bindir)/$(PROGRAM)"
rm -f "$(DESTDIR)$(man1dir)/$(MANPAGE)"
rm -f "$(DESTDIR)$(sysconfdir)/$(PROGRAM)/$(SYSCONF)"
rmdir "$(DESTDIR)$(sysconfdir)/$(PROGRAM)"
clean:
rm -f src/*.o
rm -f $(PROGRAM)
src/conf.o: src/conf.h
src/display.o: src/display.h src/conf.h
src/main.o: src/main.h src/display.h src/conf.h
src/xlib.o: src/display.h
src/xrender.o: src/display.h
.PHONY: all install uninstall clean