File: Makefile

package info (click to toggle)
disorderfs 0.6.2-1
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 224 kB
  • sloc: cpp: 478; sh: 156; makefile: 64
file content (108 lines) | stat: -rw-r--r-- 2,552 bytes parent folder | download
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
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
#
# Copyright 2015 Andrew Ayer <agwa@andrewayer.name>
# Copyright 2016, 2017 Chris Lamb <lamby@debian.org>
# 
# This file is part of disorderfs.
# 
# disorderfs is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
# 
# disorderfs is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
# GNU General Public License for more details.
# 
# You should have received a copy of the GNU General Public License
# along with disorderfs.  If not, see <http://www.gnu.org/licenses/>.
#

# Note: uses GNU Make features

PREFIX ?= /usr/local
BINDIR ?= $(PREFIX)/bin
MANDIR ?= $(PREFIX)/share/man
ENABLE_MAN ?= $(HAS_A2X)

# a2x
HAS_A2X ?= $(shell command -v a2x >/dev/null && echo yes || echo no)

# FUSE
PKG_CONFIG ?= pkg-config
FUSE_CFLAGS ?= $(shell $(PKG_CONFIG) --cflags fuse3) -DFUSE_USE_VERSION=31
FUSE_LIBS ?= $(shell $(PKG_CONFIG) --libs fuse3)

# CXXFLAGS
CXXFLAGS += -Wall -Wextra -pedantic -O2 -g
CXXFLAGS += -std=c++20 -Wno-unused-parameter
CXXFLAGS += $(FUSE_CFLAGS)
ifeq ($(shell getconf LONG_BIT),32)
    CXXFLAGS += -D_FILE_OFFSET_BITS=64
endif

# Files
OBJFILES = disorderfs.o

all: build

#
# Build
#
BUILD_MAN_TARGETS-yes = build-man
BUILD_MAN_TARGETS-no =
BUILD_TARGETS := build-bin $(BUILD_MAN_TARGETS-$(ENABLE_MAN))

build: $(BUILD_TARGETS)

build-bin: disorderfs

disorderfs: $(OBJFILES)
	$(CXX) $(CXXFLAGS) -o $@ $(OBJFILES) $(LDFLAGS) $(FUSE_LIBS)

build-man: disorderfs.1

disorderfs.1: disorderfs.1.txt
	a2x --doctype manpage --format manpage disorderfs.1.txt

#
# Clean
#
CLEAN_MAN_TARGETS-yes = clean-man
CLEAN_MAN_TARGETS-no =
CLEAN_TARGETS := clean-bin $(CLEAN_MAN_TARGETS-$(ENABLE_MAN))

clean: $(CLEAN_TARGETS)

clean-bin:
	rm -f $(OBJFILES) disorderfs

clean-man:
	rm -f disorderfs.1


#
# Install
#
INSTALL_MAN_TARGETS-yes = install-man
INSTALL_MAN_TARGETS-no =
INSTALL_TARGETS := install-bin $(INSTALL_MAN_TARGETS-$(ENABLE_MAN))

install: $(INSTALL_TARGETS)

install-bin: build-bin
	install -d $(DESTDIR)$(BINDIR)
	install -m 755 disorderfs $(DESTDIR)$(BINDIR)/

install-man: build-man
	install -d $(DESTDIR)$(MANDIR)/man1
	install -m 644 disorderfs.1 $(DESTDIR)$(MANDIR)/man1/

test: build
	$(MAKE) -C tests

.PHONY: all \
	build build-bin build-man \
	clean clean-bin clean-man \
	install install-bin install-man \
	test