-
Notifications
You must be signed in to change notification settings - Fork 12
/
Makefile
59 lines (43 loc) · 1.55 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
#See LICENSE for copyright and license details
TARGET := srandrd
SOURCE := srandrd.c
VERSION := 0.6.1
COPYRIGHT := "(C) 2012-2014 Stefan Bolte, 2016 Jan Christoph Ebersbach"
LICENSE := "MIT/X Consortium"
DISTDIR := $(TARGET)-$(VERSION)
PREFIX ?= /usr
INSTALLDIR := $(DESTDIR)$(PREFIX)
MANPREFIX ?= $(PREFIX)/share/man
MANPREFIX := $(DESTDIR)$(MANPREFIX)
CFLAGS := -Wall -g -Os -pedantic -std=c99 #-Werror -Wextra
CPPFLAGS += -D_DEFAULT_SOURCE
CPPFLAGS += -DNAME=\"$(TARGET)\" -DVERSION=\"$(VERSION)\"
CPPFLAGS += -DCOPYRIGHT=\"$(COPYRIGHT)\" -DLICENSE=\"$(LICENSE)\"
LDFLAGS := -lX11 -lXrandr -lXinerama
all: $(TARGET)
$(TARGET): $(SOURCE)
@echo $(CC) -o $@ $< $(CFLAGS) $(LDFLAGS)
@$(CC) -o $@ $< $(CFLAGS) $(LDFLAGS) $(CPPFLAGS)
reindent: $(SOURCE)
indent -ts4 -i4 --braces-on-if-line -l120 --no-space-after-function-call-names $?
install: $(TARGET) doc
@echo Installing executable to $(INSTALLDIR)/bin
@install -d $(INSTALLDIR)/bin
@install -m 755 $(TARGET) $(INSTALLDIR)/bin/
@echo Installing manpage to $(MANPREFIX)/man1
@install -d $(MANPREFIX)/man1
@install -m 644 $(TARGET).1 $(MANPREFIX)/man1
uninstall:
@echo Removing executable from $(INSTALLDIR)/bin
@rm -f $(INSTALLDIR)/bin/$(TARGET)
@echo Removing manpage from $(INSTALLDIR)/bin
@rm -f $(MANPREFIX)/man1/$(TARGET).1
clean:
$(RM) $(TARGET)
doc: srandrd.1
srandrd.1: srandrd.1.txt
a2x --doctype manpage --format manpage $<
dist:
@echo "Creating tarball."
@git archive --format=tar.gz --prefix $(DISTDIR)/ -o $(DISTDIR).tar.gz HEAD
.PHONY: all options clean install uninstall dist