blob: e7272212115da279df979a0961309d3aef4a5d8a (
plain)
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
|
CFLAGS = $(shell ncurses5-config --cflags) -Wall -Wundef -Wshadow -D_GNU_SOURCE=1 -fPIC -fomit-frame-pointer -fno-inline -fstrength-reduce -frerun-cse-after-loop -frerun-loop-opt -fexpensive-optimizations -fstrict-aliasing -Os -MD -MP -g
LDFLAGS = $(shell ncurses5-config --libs) -pthread -lrt
CC = gcc
INSTALL = install
STRIP = strip
BIN_NASKP = naskpass
BIN_CHECK = $(BIN_NASKP)_check
BINS = $(BIN_NASKP) $(BIN_CHECK)
SOURCES = $(wildcard src/*.c)
OBJECTS = $(patsubst %.c,%.o,$(SOURCES))
DEPS = $(patsubst %.c,%.d,$(SOURCES))
all: $(OBJECTS) $(BINS)
%.o: %.c
$(CC) $(CFLAGS) -c $< -o $@
$(BIN_NASKP): $(SOURCES)
$(CC) $(LDFLAGS) $(OBJECTS) -o $(BIN_NASKP)
$(MAKE) -C tests CC='$(CC)' CFLAGS='$(CFLAGS)' all
$(BIN_CHECK): src/check/check.c
$(CC) $(CFLAGS) $(LDFLAGS) src/check/check.c -o $(BIN_CHECK)
strip: $(OBJECTS) $(BINS)
$(STRIP) $(BIN_NASKP)
$(STRIP) $(BIN_CHECK)
release: all strip
debug:
@$(MAKE) CFLAGS='$(CFLAGS)
@$(MAKE) -C tests CFLAGS='$(CFLAGS)
install:
$(INSTALL) -D -m 0755 $(BIN_NASKP) $(DESTDIR)/lib/cryptsetup/naskpass
$(INSTALL) -D -m 0755 $(BIN_CHECK) $(DESTDIR)/lib/cryptsetup/naskpass_check
$(INSTALL) -D -m 0755 scripts/naskpass.inithook $(DESTDIR)/usr/share/naskpass/naskpass.hook.initramfs
$(INSTALL) -D -m 0755 scripts/naskpass.initscript $(DESTDIR)/usr/share/naskpass/naskpass.script.initramfs
$(INSTALL) -D -m 0755 scripts/naskconf $(DESTDIR)/usr/share/naskpass/naskconf
uninstall:
rm -f $(DESTDIR)/lib/cryptsetup/naskpass
rm -f $(DESTDIR)/usr/share/initramfs-tools/hooks/naskpass
rm -f $(DESTDIR)/usr/share/naskpass/naskpass.script.initramfs
rm -f $(DESTDIR)/usr/share/naskpass/naskconf
rmdir --ignore-fail-on-non-empty $(DESTDIR)/usr/share/naskpass
clean:
rm -f $(DEPS)
rm -f $(OBJECTS)
rm -f $(BINS)
$(MAKE) -C tests clean
test:
$(MAKE) -C tests run
.PHONY: all debug release strip install uninstall clean test
|