blob: 19162dad0ff6eb011be363123eeb2c6c29937db9 (
plain) (
blame)
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
82
83
84
85
86
87
|
PREFIX = /usr
LIB = /lib
DATA = /share
INCLUDE = /include
LICENSES = $(DATA)/licenses
PKGNAME = libpassphrase
OPTIONS =
# PASSPHRASE_ECHO: Do not hide the passphrase
# PASSPHRASE_STAR: Use '*' for each character instead of no echo
# PASSPHRASE_REALLOC: Soften security by using `realloc`
# PASSPHRASE_MOVE: Enable move of point
# PASSPHRASE_INSERT: Enable insert mode
# PASSPHRASE_OVERRIDE: Enable override mode
# PASSPHRASE_DELETE: Enable reversed erase command
# PASSPHRASE_CONTROL: Enable use of control key combinations
# PASSPHRASE_DEDICATED: Enable use of dedicated keys
# DEFAULT_INSERT: Use insert mode as default
# PASSPHRASE_INVALID: Prevent duplication of non-initialised memory
OPTIMISE = -Os
CPPFLAGS = $(foreach D, $(OPTIONS), -D'$(D)=1')
CFLAGS = -std=gnu99 -Wall -Wextra -fPIC
LDFLAGS = -shared
CC_FLAGS = $(CPPFLAGS) $(CFLAGS) $(OPTIMISE)
LD_FLAGS = $(LDFLAGS) $(CFLAGS) $(OPTIMISE)
SRC = passphrase
OBJ = $(foreach S, $(SRC), obj/$(S).o)
.PHONY: all
all: libpassphrase doc
.PHONY: libpassphrase
libpassphrase: bin/libpassphrase.so
bin/libpassphrase.so: $(OBJ)
@mkdir -p bin
$(CC) $(LD_FLAGS) -o "$@" $^
obj/%.o: src/%.c src/%.h
@mkdir -p "$(shell dirname "$@")"
$(CC) $(CC_FLAGS) -o "$@" -c "$<"
.PHONY: doc
doc: info
.PHONY: info
info: libpassphrase.info.gz
%.info: info/%.texinfo
makeinfo "$<"
%.gz: %
gzip -9 < "$<" > "$@"
.PHONY: install
install: bin/libpassphrase.so
install -dm755 -- "$(DESTDIR)$(PREFIX)$(LIB)"
install -dm755 -- "$(DESTDIR)$(PREFIX)$(INCLUDE)"
install -m755 -- bin/libpassphrase.so "$(DESTDIR)$(PREFIX)$(LIB)"
install -m755 -- src/passphrase.h "$(DESTDIR)$(PREFIX)$(INCLUDE)"
install -dm755 -- "$(DESTDIR)$(PREFIX)$(LICENSES)/$(PKGNAME)"
install -m644 -- COPYING LICENSE "$(DESTDIR)$(PREFIX)$(LICENSES)/$(PKGNAME)"
install -dm755 -- "$(DESTDIR)$(PREFIX)$(DATA)/info"
install -m644 -- libpassphrase.info.gz "$(DESTDIR)$(PREFIX)$(DATA)/info/$(PKGNAME).info.gz"
.PHONY: uninstall
uninstall:
-rm -- "$(DESTDIR)$(PREFIX)$(LIB)/libpassphrase.so"
-rm -- "$(DESTDIR)$(PREFIX)$(INCLUDE)/passphrase.h"
-rm -- "$(DESTDIR)$(PREFIX)$(LICENSES)/$(PKGNAME)/COPYING"
-rm -- "$(DESTDIR)$(PREFIX)$(LICENSES)/$(PKGNAME)/LICENSE"
-rmdir -- "$(DESTDIR)$(PREFIX)$(LICENSES)/$(PKGNAME)"
-rm -- "$(DESTDIR)$(PREFIX)$(DATA)/info/$(PKGNAME).info.gz"
.PHONY: clean
clean:
-rm -r bin obj libpassphrase.info.gz
|