forked from kevinboone/epub2txt2
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Makefile
39 lines (31 loc) · 988 Bytes
/
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
VERSION := 2.10
CC := gcc
EXTRA_CFLAGS ?=
EXTRA_LDLAGS ?=
CFLAGS := -Wall -Wno-unused-result -O3 $(EXTRA_CFLAGS)
#LDFLAGS := -pie -s # Android
LDFLAGS := -s $(EXTRA_LDFLAGS)
DESTDIR :=
PREFIX := /usr
BINDIR := /bin
MANDIR := /share/man
APPNAME := epub2txt
TARGET := epub2txt
SOURCES := $(sort $(shell find src/ -type f -name *.c))
OBJECTS := $(patsubst src/%,build/%,$(SOURCES:.c=.o))
DEPS := $(OBJECTS:.o=.deps)
$(TARGET): $(OBJECTS)
$(CC) -o $(TARGET) $(LDFLAGS) $(OBJECTS)
build/%.o: src/%.c
@mkdir -p build/
$(CC) $(CFLAGS) -DVERSION=\"$(VERSION)\" -DAPPNAME=\"$(APPNAME)\" -MD -MF $(@:.o=.deps) -c -o $@ $<
clean:
$(RM) -r build/ $(TARGET)
install:
install -D -m 755 $(APPNAME) $(DESTDIR)/$(PREFIX)/$(BINDIR)/$(APPNAME)
install -D -m 644 man1/epub2txt.1 $(DESTDIR)/$(PREFIX)/$(MANDIR)/man1/epub2txt.1
uninstall:
rm -f $(DESTDIR)/$(PREFIX)/$(BINDIR)/$(APPNAME)
rm -f $(DESTDIR)/$(PREFIX)/$(MANDIR)/man1/epub2txt.1
-include $(DEPS)
.PHONY: clean install