aboutsummaryrefslogtreecommitdiffstats
path: root/Makefile
blob: 78ad1db67b50c91eff5a54d8d293d530eb8e03c8 (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
PREFIX = /usr/local/bin
CC = gcc
CFLAGS = -Wall -g #-DDEBUG
LIBS = $(shell gpgme-config --cflags --libs)
MAN_PATH = /usr/share/man/man1
COMPLETION_PATH = /usr/share/bash-completion/completions/lpass
SOURCES = \
	src/lpass.c \
	src/exec-cmd.c \
	src/routines.c \
	src/easydir.c \
	src/r-gpgme.c \
	src/tree.c \
	src/xstd.c
ifdef DISPLAY
	LIBS += -lX11
	CFLAGS += -DDISPLAY
	SOURCES += src/r-x11.c
endif
OBJECTS = ${SOURCES:.c=.o}
MAN_SOURCES = man/lpass.1
MAN_OBJECTS = lpass.1.gz
EXECUTABLE = lpass

.PHONY: all clean install uninstall

all: $(EXECUTABLE)

clean:
	rm -rf $(EXECUTABLE) $(OBJECTS) $(MAN_OBJECTS)

$(EXECUTABLE): $(OBJECTS)
	$(CC) $(CFLAGS) $(LIBS) -o $(EXECUTABLE) $(OBJECTS)

%.o: %.c
	$(CC) $(CFLAGS) $(LIBS) -c $< -o $@

install: all
	install -m 755 -v $(EXECUTABLE) $(PREFIX)
	install -m 0644 -v contrib/completion/lpass-completion.sh $(COMPLETION_PATH)
	cat $(MAN_SOURCES) | gzip > $(MAN_OBJECTS)
	install $(MAN_OBJECTS) $(MAN_PATH)

uninstall:
	rm -rf \
		$(PREFIX)/$(EXECUTABLE) \
		$(MAN_PATH)/$(MAN_OBJECTS) \
		$(COMPLETION_PATH)