-
Notifications
You must be signed in to change notification settings - Fork 5
/
Makefile.inc
65 lines (56 loc) · 1.57 KB
/
Makefile.inc
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
PLOOPROOT ?= .
include $(PLOOPROOT)/Makefile.incl
NAME=ploop
VERSION=$(shell cat $(PLOOPROOT)/Makefile.version)
RELEASE=
CC=gcc
INSTALL=install
SBINDIR=/sbin
USRSBINDIR=/usr/sbin
INCDIR=/usr/include/ploop
LIBDIR=/usr/lib
# For DEB-based systems
DEB_HOST_MULTIARCH ?= $(shell dpkg-architecture -qDEB_HOST_MULTIARCH 2>/dev/null)
ifneq "$(DEB_HOST_MULTIARCH)" ""
LIBDIR=/usr/lib/$(DEB_HOST_MULTIARCH)
# For RPM-based systems
else ifeq "$(shell uname -m)" "x86_64"
LIBDIR=/usr/lib64
endif
LOCKDIR=/var/lock/ploop
MANDIR=/usr/share/man
DOCDIR=/usr/share/doc/$(NAME)-$(VERSION)
LDOCDIR=/usr/share/doc/$(NAME)-lib-$(VERSION)
DDOCDIR=/usr/share/doc/$(NAME)-devel-$(VERSION)
MAN8DIR=$(MANDIR)/man8
TMPFILESDIR=/usr/lib/tmpfiles.d
LOGROTATEDIR=/etc/logrotate.d
COMPLETIONDIR=/etc/bash_completion.d
MODULESLOADDIR=/etc/modules-load.d
LIBSCRIPTDIR=/usr/libexec/ploop
TESTDIR=/usr/libexec/ploop-test
DEBUG=yes
CFLAGS := $(if $(DEBUG),-g -O0 -DDEBUG,-O2) $(CFLAGS)
CFLAGS += -I. -I../include -fno-strict-aliasing \
-Wall -Wstrict-prototypes -Werror -Wformat-security -Werror=format-truncation=0 \
-D_GNU_SOURCE -D_LARGEFILE64_SOURCE -D_FILE_OFFSET_BITS=64 \
-DPRODUCT_NAME_SHORT=\"$(PRODUCT_NAME_SHORT)\"
CFLAGS += $(RPM_OPT_FLAGS) $(CPPFLAGS)
CFLAGS += $(if $(PLOOP_LOG_FILE), -DPLOOP_LOG_FILE=\"$(PLOOP_LOG_FILE)\")
#CFLAGS += -DDEBUG_TIMES
LDFLAGS += $(if $(DEBUG),-g -rdynamic,)
export CFLAGS CC
ifeq ($(strip $(V)),)
E = @echo
Q = @
else
E = @\#
Q =
endif
export E Q
%.o: %.c
$(E) " CC " $@
$(Q) $(CC) $(CFLAGS) -c $< -o $@
.depend:
$(E) " DEP " $@
$(Q) $(CC) $(CFLAGS) -M $^ > $@