Makefile 2.56 KB
Newer Older
Moritz Lipp's avatar
Moritz Lipp committed
1
2
3
# See LICENSE file for license and copyright information

include config.mk
4
include common.mk
Moritz Lipp's avatar
Moritz Lipp committed
5

6
PROJECT  = zathura-djvu
Moritz Lipp's avatar
Moritz Lipp committed
7
PLUGIN   = djvu
Sebastian Ramacher's avatar
Sebastian Ramacher committed
8
9
SOURCE   = $(sort $(wildcard *.c))
HEADER   = $(sort $(wildcard *.h))
Moritz Lipp's avatar
Moritz Lipp committed
10
11
12
OBJECTS  = ${SOURCE:.c=.o}
DOBJECTS = ${SOURCE:.c=.do}

13
14
15
16
CPPFLAGS += "-DVERSION_MAJOR=${VERSION_MAJOR}"
CPPFLAGS += "-DVERSION_MINOR=${VERSION_MINOR}"
CPPFLAGS += "-DVERSION_REV=${VERSION_REV}"

Moritz Lipp's avatar
Moritz Lipp committed
17
all: options ${PLUGIN}.so
Moritz Lipp's avatar
Moritz Lipp committed
18

19
20
21
22
zathura-version-check:
ifneq ($(ZATHURA_VERSION_CHECK), 0)
	$(error "The minimum required version of zathura is ${ZATHURA_MIN_VERSION}")
endif
Sebastian Ramacher's avatar
Sebastian Ramacher committed
23
	$(QUIET)touch zathura-version-check
24

Moritz Lipp's avatar
Moritz Lipp committed
25
options:
26
27
28
29
30
	$(ECHO) ${PLUGIN} build options:
	$(ECHO) "CFLAGS  = ${CFLAGS}"
	$(ECHO) "LDFLAGS = ${LDFLAGS}"
	$(ECHO) "DFLAGS  = ${DFLAGS}"
	$(ECHO) "CC      = ${CC}"
Moritz Lipp's avatar
Moritz Lipp committed
31
32

%.o: %.c
33
	$(ECHO) CC $<
Sebastian Ramacher's avatar
Sebastian Ramacher committed
34
	@mkdir -p .depend
35
	$(QUIET)${CC} -c ${CPPFLAGS} ${CFLAGS} -o $@ $< -MMD -MF .depend/$@.dep
Moritz Lipp's avatar
Moritz Lipp committed
36
37

%.do: %.c
38
	$(ECHO) CC $<
Sebastian Ramacher's avatar
Sebastian Ramacher committed
39
	@mkdir -p .depend
40
	$(QUIET)${CC} -c ${CPPFLAGS} ${CFLAGS} ${DFLAGS} -o $@ $< -MMD -MF .depend/$@.dep
Moritz Lipp's avatar
Moritz Lipp committed
41

42
43
${OBJECTS}:  config.mk zathura-version-check
${DOBJECTS}: config.mk zathura-version-check
Moritz Lipp's avatar
Moritz Lipp committed
44

45
${PLUGIN}.so: ${OBJECTS}
46
	$(ECHO) LD $@
Moritz Lipp's avatar
Moritz Lipp committed
47
	$(QUIET)${CC} -shared ${LDFLAGS} -o $@ $(OBJECTS) ${LIBS}
Moritz Lipp's avatar
Moritz Lipp committed
48

49
${PLUGIN}-debug.so: ${DOBJECTS}
50
	$(ECHO) LD $@
Moritz Lipp's avatar
Moritz Lipp committed
51
	$(QUIET)${CC} -shared ${LDFLAGS} -o $@ $(DOBJECTS) ${LIBS}
Moritz Lipp's avatar
Moritz Lipp committed
52
53

clean:
Moritz Lipp's avatar
Moritz Lipp committed
54
	$(QUIET)rm -rf ${OBJECTS} ${DOBJECTS} $(PLUGIN).so $(PLUGIN)-debug.so \
55
		doc .depend ${PROJECT}-${VERSION}.tar.gz zathura-version-check
Moritz Lipp's avatar
Moritz Lipp committed
56

Moritz Lipp's avatar
Moritz Lipp committed
57
debug: options ${PLUGIN}-debug.so
58

59
60
61
dist: clean
	$(QUIET)mkdir -p ${PROJECT}-${VERSION}
	$(QUIET)cp -R LICENSE Makefile config.mk common.mk Doxyfile \
62
63
		${HEADER} ${SOURCE} AUTHORS ${PROJECT}.desktop \
		${PROJECT}-${VERSION}
64
65
66
67
68
69
70
	$(QUIET)tar -cf ${PROJECT}-${VERSION}.tar ${PROJECT}-${VERSION}
	$(QUIET)gzip ${PROJECT}-${VERSION}.tar
	$(QUIET)rm -rf ${PROJECT}-${VERSION}

doc: clean
	$(QUIET)doxygen Doxyfile

71
install: all
72
	$(ECHO) installing ${PLUGIN} plugin
73
74
	$(QUIET)mkdir -p ${DESTDIR}${PLUGINDIR}
	$(QUIET)cp -f ${PLUGIN}.so ${DESTDIR}${PLUGINDIR}
75
76
77
78
	$(QUIET)mkdir -m 755 -p ${DESTDIR}${DESKTOPPREFIX}
	$(ECHO) installing desktop file
	$(QUIET)install -m 644 ${PROJECT}.desktop ${DESTDIR}${DESKTOPPREFIX}

79
80

uninstall:
81
	$(ECHO) uninstalling ${PLUGIN} plugin
82
	$(QUIET)rm -f ${DESTDIR}${PLUGINDIR}/${PLUGIN}.so
83
84
85
86
	$(QUIET)rmdir --ignore-fail-on-non-empty ${DESTDIR}${PLUGINDIR} 2> /dev/null
	$(ECHO) removing desktop file
	$(QUIET)rm -f ${DESTDIR}${DESKTOPPREFIX}/${PROJECT}.desktop
	$(QUIET)rmdir --ignore-fail-on-non-empty ${DESTDIR}${DESKTOPPREFIX} 2> /dev/null
Sebastian Ramacher's avatar
Sebastian Ramacher committed
87

Sebastian Ramacher's avatar
Sebastian Ramacher committed
88
-include $(wildcard .depend/*.dep)
89

90
.PHONY: all options clean debug doc dist install uninstall