3 # all all main tools and the shared library
4 # static build static bnaries, requires static version of the libraries
5 # test run the full testsuite
6 # install install to default location (/usr/local)
7 # clean clean built binaries (not the documentation)
8 # clean-all clean as above, clean docs and generated files
10 # Tuning by variables (environment or make arguments):
11 # V=1 verbose, print command lines (default: quiet)
12 # C=1 run checker before compilation (default checker: sparse)
13 # D=1 debugging build, turn off optimizations
14 # D=dflags dtto, turn on additional debugging features:
15 # verbose - print file:line along with error/warning messages
16 # trace - print trace before the error/warning messages
17 # abort - call abort() on first error (dumps core)
18 # all - shortcut for all of the above
19 # asan - enable address sanitizer compiler feature
20 # tsan - enable thread sanitizer compiler feature
21 # ubsan - undefined behaviour sanitizer compiler feature
22 # bcheck - extended build checks
23 # W=123 build with warnings (default: off)
24 # DEBUG_CFLAGS additional compiler flags for debugging build
25 # EXTRA_CFLAGS additional compiler flags
26 # EXTRA_LDFLAGS additional linker flags
28 # Testing-specific options (see also tests/README.md):
29 # TEST=GLOB run test(s) from directories matching GLOB
30 # TEST_LOG=tty print name of a command run via the execution helpers
31 # TEST_LOG=dump dump testing log file when a test fails
34 # CHECKER static checker binary to be called (default: sparse)
35 # CHECKER_FLAGS flags to pass to CHECKER, can override CFLAGS
38 # Export all variables to sub-makes by default
42 ifneq ($(MAKEFILE_INC_INCLUDED),yes)
43 $(error Makefile.inc not generated, please configure first)
47 CSCOPE_CMD := cscope -u -b -c -q
49 include Makefile.extrawarn
54 DEBUG_CFLAGS_DEFAULT = -O0 -U_FORTIFY_SOURCE -ggdb3
55 DEBUG_CFLAGS_INTERNAL =
58 DEBUG_LDFLAGS_DEFAULT =
59 DEBUG_LDFLAGS_INTERNAL =
62 ABSTOPDIR = $(shell pwd)
67 CFLAGS = $(SUBST_CFLAGS) \
70 -DBTRFS_FLAT_INCLUDES \
72 -fno-strict-aliasing \
75 -I$(TOPDIR)/kernel-lib \
77 $(DEBUG_CFLAGS_INTERNAL) \
80 LDFLAGS = $(SUBST_LDFLAGS) \
81 -rdynamic -L$(TOPDIR) \
82 $(DEBUG_LDFLAGS_INTERNAL) \
86 LIBBTRFS_LIBS = $(LIBS_BASE)
88 # Static compilation flags
89 STATIC_CFLAGS = $(CFLAGS) -ffunction-sections -fdata-sections
90 STATIC_LDFLAGS = -static -Wl,--gc-sections
91 STATIC_LIBS = $(STATIC_LIBS_BASE)
93 # don't use FORTIFY with sparse because glibc with FORTIFY can
94 # generate so many sparse errors that sparse stops parsing,
95 # which masks real errors that we want to see.
96 # Note: additional flags might get added per-target later
98 check_defs := .cc-defines.h
99 CHECKER_FLAGS := -include $(check_defs) -D__CHECKER__ \
100 -D__CHECK_ENDIAN__ -Wbitwise -Wuninitialized -Wshadow -Wundef \
101 -U_FORTIFY_SOURCE -Wdeclaration-after-statement -Wdefault-bitfield-sign
103 objects = ctree.o disk-io.o kernel-lib/radix-tree.o extent-tree.o print-tree.o \
104 root-tree.o dir-item.o file-item.o inode-item.o inode-map.o \
105 extent-cache.o extent_io.o volumes.o utils.o repair.o \
106 qgroup.o free-space-cache.o kernel-lib/list_sort.o props.o \
107 kernel-shared/ulist.o qgroup-verify.o backref.o string-table.o task-utils.o \
108 inode.o file.o find-root.o free-space-tree.o help.o send-dump.o \
109 fsfeatures.o kernel-lib/tables.o kernel-lib/raid56.o transaction.o
110 cmds_objects = cmds-subvolume.o cmds-filesystem.o cmds-device.o cmds-scrub.o \
111 cmds-inspect.o cmds-balance.o cmds-send.o cmds-receive.o \
112 cmds-quota.o cmds-qgroup.o cmds-replace.o check/main.o \
113 cmds-restore.o cmds-rescue.o chunk-recover.o super-recover.o \
114 cmds-property.o cmds-fi-usage.o cmds-inspect-dump-tree.o \
115 cmds-inspect-dump-super.o cmds-inspect-tree-stats.o cmds-fi-du.o \
116 mkfs/common.o check/mode-common.o check/mode-lowmem.o
117 libbtrfs_objects = send-stream.o send-utils.o kernel-lib/rbtree.o btrfs-list.o \
118 kernel-lib/crc32c.o messages.o \
119 uuid-tree.o utils-lib.o rbtree-utils.o
120 libbtrfs_headers = send-stream.h send-utils.h send.h kernel-lib/rbtree.h btrfs-list.h \
121 kernel-lib/crc32c.h kernel-lib/list.h kerncompat.h \
122 kernel-lib/radix-tree.h kernel-lib/sizes.h kernel-lib/raid56.h \
123 extent-cache.h extent_io.h ioctl.h ctree.h btrfsck.h version.h
124 convert_objects = convert/main.o convert/common.o convert/source-fs.o \
125 convert/source-ext2.o convert/source-reiserfs.o
126 mkfs_objects = mkfs/main.o mkfs/common.o mkfs/rootdir.o
127 image_objects = image/main.o image/sanitize.o
128 all_objects = $(objects) $(cmds_objects) $(libbtrfs_objects) $(convert_objects) \
129 $(mkfs_objects) $(image_objects)
131 udev_rules = 64-btrfs-dm.rules
133 ifeq ("$(origin V)", "command line")
140 ifeq ($(BUILD_VERBOSE),1)
146 ifeq ("$(origin D)", "command line")
147 DEBUG_CFLAGS_INTERNAL = $(DEBUG_CFLAGS_DEFAULT) $(DEBUG_CFLAGS)
148 DEBUG_LDFLAGS_INTERNAL = $(DEBUG_LDFLAGS_DEFAULT) $(DEBUG_LDFLAGS)
151 ifneq (,$(findstring verbose,$(D)))
152 DEBUG_CFLAGS_INTERNAL += -DDEBUG_VERBOSE_ERROR=1
155 ifneq (,$(findstring trace,$(D)))
156 DEBUG_CFLAGS_INTERNAL += -DDEBUG_TRACE_ON_ERROR=1
159 ifneq (,$(findstring abort,$(D)))
160 DEBUG_CFLAGS_INTERNAL += -DDEBUG_ABORT_ON_ERROR=1
163 ifneq (,$(findstring all,$(D)))
164 DEBUG_CFLAGS_INTERNAL += -DDEBUG_VERBOSE_ERROR=1
165 DEBUG_CFLAGS_INTERNAL += -DDEBUG_TRACE_ON_ERROR=1
166 DEBUG_CFLAGS_INTERNAL += -DDEBUG_ABORT_ON_ERROR=1
169 ifneq (,$(findstring asan,$(D)))
170 DEBUG_CFLAGS_INTERNAL += -fsanitize=address
171 DEBUG_LDFLAGS_INTERNAL += -fsanitize=address -lasan
174 ifneq (,$(findstring tsan,$(D)))
175 DEBUG_CFLAGS_INTERNAL += -fsanitize=thread -fPIC
176 DEBUG_LDFLAGS_INTERNAL += -fsanitize=thread -ltsan -pie
179 ifneq (,$(findstring ubsan,$(D)))
180 DEBUG_CFLAGS_INTERNAL += -fsanitize=undefined
181 DEBUG_LDFLAGS_INTERNAL += -fsanitize=undefined -lubsan
184 ifneq (,$(findstring bcheck,$(D)))
185 DEBUG_CFLAGS_INTERNAL += -DDEBUG_BUILD_CHECKS
188 MAKEOPTS = --no-print-directory Q=$(Q)
190 # build all by default
191 progs = $(progs_install) btrfsck btrfs-corrupt-block
193 # install only selected
194 progs_install = btrfs mkfs.btrfs btrfs-debug-tree \
195 btrfs-map-logical btrfs-image btrfs-zero-log \
196 btrfs-find-root btrfstune \
199 # other tools, not built by default
200 progs_extra = btrfs-fragments btrfs-calc-size btrfs-show-super
202 progs_static = $(foreach p,$(progs),$(p).static)
204 ifneq ($(DISABLE_BTRFSCONVERT),1)
205 progs_install += btrfs-convert
208 # external libs required by various binaries; for btrfs-foo,
209 # specify btrfs_foo_libs = <list of libs>; see $($(subst...)) rules below
210 btrfs_convert_cflags = -DBTRFSCONVERT_EXT2=$(BTRFSCONVERT_EXT2)
211 btrfs_convert_cflags += -DBTRFSCONVERT_REISERFS=$(BTRFSCONVERT_REISERFS)
212 btrfs_fragments_libs = -lgd -lpng -ljpeg -lfreetype
213 btrfs_debug_tree_objects = cmds-inspect-dump-tree.o
214 btrfs_show_super_objects = cmds-inspect-dump-super.o
215 btrfs_calc_size_objects = cmds-inspect-tree-stats.o
216 cmds_restore_cflags = -DBTRFSRESTORE_ZSTD=$(BTRFSRESTORE_ZSTD)
218 CHECKER_FLAGS += $(btrfs_convert_cflags)
220 # collect values of the variables above
221 standalone_deps = $(foreach dep,$(patsubst %,%_objects,$(subst -,_,$(filter btrfs-%, $(progs) $(progs_extra)))),$($(dep)))
224 BUILDDIRS = $(patsubst %,build-%,$(SUBDIRS))
225 INSTALLDIRS = $(patsubst %,install-%,$(SUBDIRS))
226 CLEANDIRS = $(patsubst %,clean-%,$(SUBDIRS))
228 ifneq ($(DISABLE_DOCUMENTATION),1)
229 BUILDDIRS += build-Documentation
230 INSTALLDIRS += install-Documentation
235 .PHONY: $(INSTALLDIRS)
238 .PHONY: all install clean
241 # Create all the static targets
242 static_objects = $(patsubst %.o, %.static.o, $(objects))
243 static_cmds_objects = $(patsubst %.o, %.static.o, $(cmds_objects))
244 static_libbtrfs_objects = $(patsubst %.o, %.static.o, $(libbtrfs_objects))
245 static_convert_objects = $(patsubst %.o, %.static.o, $(convert_objects))
246 static_mkfs_objects = $(patsubst %.o, %.static.o, $(mkfs_objects))
247 static_image_objects = $(patsubst %.o, %.static.o, $(image_objects))
249 libs_shared = libbtrfs.so.0.1
250 libs_static = libbtrfs.a
251 libs = $(libs_shared) $(libs_static)
252 lib_links = libbtrfs.so.0 libbtrfs.so
253 headers = $(libbtrfs_headers)
255 # make C=1 to enable sparse
257 # We're trying to use sparse against glibc headers which go wild
258 # trying to use internal compiler macros to test features. We
259 # copy gcc's and give them to sparse. But not __SIZE_TYPE__
260 # 'cause sparse defines that one.
262 dummy := $(shell $(CC) -dM -E -x c - < /dev/null | \
263 grep -v __SIZE_TYPE__ > $(check_defs))
273 $(Q)$(CC) -MM -MG -MF $@ -MT $(@:.o.d=.o) -MT $(@:.o.d=.static.o) -MT $@ $(CFLAGS) $<
276 # Pick from per-file variables, btrfs_*_cflags
279 @$(check_echo) " [SP] $<"
280 $(Q)$(check) $(CFLAGS) $(CHECKER_FLAGS) $<
282 $(Q)$(CC) $(CFLAGS) -c $< -o $@ $($(subst -,_,$(@:%.o=%)-cflags)) \
283 $($(subst -,_,btrfs-$(@:%/$(notdir $@)=%)-cflags))
287 $(Q)$(CC) $(STATIC_CFLAGS) -c $< -o $@ $($(subst -,_,$(@:%.static.o=%)-cflags)) \
288 $($(subst -,_,btrfs-$(@:%/$(notdir $@)=%)-cflags))
290 all: $(progs) libbtrfs $(BUILDDIRS)
291 $(SUBDIRS): $(BUILDDIRS)
293 @echo "Making all in $(patsubst build-%,%,$@)"
294 $(Q)$(MAKE) $(MAKEOPTS) -C $(patsubst build-%,%,$@)
296 test-convert: btrfs btrfs-convert
297 @echo " [TEST] convert-tests.sh"
298 $(Q)bash tests/convert-tests.sh
300 test-check: test-fsck
301 test-fsck: btrfs btrfs-image btrfs-corrupt-block mkfs.btrfs btrfstune
302 @echo " [TEST] fsck-tests.sh"
303 $(Q)bash tests/fsck-tests.sh
305 test-misc: btrfs btrfs-image btrfs-corrupt-block mkfs.btrfs btrfstune fssum \
306 btrfs-zero-log btrfs-find-root btrfs-select-super btrfs-convert
307 @echo " [TEST] misc-tests.sh"
308 $(Q)bash tests/misc-tests.sh
310 test-mkfs: btrfs mkfs.btrfs
311 @echo " [TEST] mkfs-tests.sh"
312 $(Q)bash tests/mkfs-tests.sh
314 test-fuzz: btrfs btrfs-image
315 @echo " [TEST] fuzz-tests.sh"
316 $(Q)bash tests/fuzz-tests.sh
318 test-cli: btrfs mkfs.btrfs
319 @echo " [TEST] cli-tests.sh"
320 $(Q)bash tests/cli-tests.sh
323 @echo "Cleaning tests"
324 $(Q)bash tests/clean-tests.sh
327 @tmpdest=`mktemp --tmpdir -d btrfs-inst.XXXXXX` && \
328 echo "Test installation to $$tmpdest" && \
329 $(MAKE) $(MAKEOPTS) DESTDIR=$$tmpdest install && \
330 $(RM) -rf -- $$tmpdest
332 test: test-fsck test-mkfs test-misc test-cli test-convert test-fuzz
334 testsuite: btrfs-corrupt-block fssum
335 @echo "Export tests as a package"
336 $(Q)cd tests && ./export-testsuite.sh
339 # NOTE: For static compiles, you need to have all the required libs
340 # static equivalent available
342 static: $(progs_static)
344 version.h: version.h.in configure.ac
346 $(Q)bash ./config.status --silent $@
348 mktables: kernel-lib/mktables.c
350 $(Q)$(CC) $(CFLAGS) $< -o $@
352 # the target can be regenerated manually using mktables, but a local copy is
353 # kept so the build process is simpler
356 $(Q)./mktables > $@ || ($(RM) -f $@ && exit 1)
358 libbtrfs: $(libs_shared) $(lib_links)
360 $(libs_shared): $(libbtrfs_objects) $(lib_links) send.h
362 $(Q)$(CC) $(CFLAGS) $(libbtrfs_objects) $(LDFLAGS) $(LIBBTRFS_LIBS) \
363 -shared -Wl,-soname,libbtrfs.so.0 -o libbtrfs.so.0.1
365 $(libs_static): $(libbtrfs_objects)
367 $(Q)$(AR) cr libbtrfs.a $(libbtrfs_objects)
371 $(Q)$(LN_S) -f libbtrfs.so.0.1 $@
373 # keep intermediate files from the below implicit rules around
374 .PRECIOUS: $(addsuffix .o,$(progs))
376 # Make any btrfs-foo out of btrfs-foo.o, with appropriate libs.
377 # The $($(subst...)) bits below takes the btrfs_*_libs definitions above and
378 # turns them into a list of libraries to link against if they exist
380 # For static variants, use an extra $(subst) to get rid of the ".static"
381 # from the target name before translating to list of libs
383 btrfs-%.static: btrfs-%.static.o $(static_objects) $(patsubst %.o,%.static.o,$(standalone_deps)) $(static_libbtrfs_objects)
385 $(Q)$(CC) -o $@ $@.o $(static_objects) \
386 $(patsubst %.o, %.static.o, $($(subst -,_,$(subst .static,,$@)-objects))) \
387 $(static_libbtrfs_objects) $(STATIC_LDFLAGS) \
388 $($(subst -,_,$(subst .static,,$@)-libs)) $(STATIC_LIBS)
390 btrfs-%: btrfs-%.o $(objects) $(standalone_deps) $(libs_static)
392 $(Q)$(CC) -o $@ $(objects) $@.o \
393 $($(subst -,_,$@-objects)) \
395 $(LDFLAGS) $(LIBS) $($(subst -,_,$@-libs))
397 btrfs: btrfs.o $(objects) $(cmds_objects) $(libs_static)
399 $(Q)$(CC) -o $@ $^ $(LDFLAGS) $(LIBS) $(LIBS_COMP)
401 btrfs.static: btrfs.static.o $(static_objects) $(static_cmds_objects) $(static_libbtrfs_objects)
403 $(Q)$(CC) -o $@ $^ $(STATIC_LDFLAGS) $(STATIC_LIBS) $(STATIC_LIBS_COMP)
405 # For backward compatibility, 'btrfs' changes behaviour to fsck if it's named 'btrfsck'
408 $(Q)$(LN_S) -f btrfs btrfsck
410 btrfsck.static: btrfs.static
414 mkfs.btrfs: $(mkfs_objects) $(objects) $(libs_static)
416 $(Q)$(CC) -o $@ $^ $(LDFLAGS) $(LIBS)
418 mkfs.btrfs.static: $(static_mkfs_objects) $(static_objects) $(static_libbtrfs_objects)
420 $(Q)$(CC) -o $@ $^ $(STATIC_LDFLAGS) $(STATIC_LIBS)
422 btrfstune: btrfstune.o $(objects) $(libs_static)
424 $(Q)$(CC) -o $@ $^ $(LDFLAGS) $(LIBS)
426 btrfstune.static: btrfstune.static.o $(static_objects) $(static_libbtrfs_objects)
428 $(Q)$(CC) -o $@ $^ $(STATIC_LDFLAGS) $(STATIC_LIBS)
430 btrfs-image: $(image_objects) $(objects) $(libs_static)
432 $(Q)$(CC) -o $@ $^ $(LDFLAGS) $(LIBS) $(LIBS_COMP)
434 btrfs-image.static: $(static_image_objects) $(static_objects) $(static_libbtrfs_objects)
436 $(Q)$(CC) -o $@ $^ $(STATIC_LDFLAGS) $(STATIC_LIBS) $(STATIC_LIBS_COMP)
438 btrfs-convert: $(convert_objects) $(objects) $(libs_static)
440 $(Q)$(CC) -o $@ $^ $(LDFLAGS) $(btrfs_convert_libs) $(LIBS)
442 btrfs-convert.static: $(static_convert_objects) $(static_objects) $(static_libbtrfs_objects)
444 $(Q)$(CC) -o $@ $^ $(STATIC_LDFLAGS) $(btrfs_convert_libs) $(STATIC_LIBS)
446 dir-test: dir-test.o $(objects) $(libs)
448 $(Q)$(CC) -o $@ $^ $(LDFLAGS) $(LIBS)
450 quick-test: quick-test.o $(objects) $(libs)
452 $(Q)$(CC) -o $@ $^ $(LDFLAGS) $(LIBS)
454 ioctl-test.o: ioctl-test.c ioctl.h kerncompat.h ctree.h
456 $(Q)$(CC) $(CFLAGS) -c $< -o $@
458 ioctl-test-32.o: ioctl-test.c ioctl.h kerncompat.h ctree.h
460 $(Q)$(CC) $(CFLAGS) -m32 -c $< -o $@
462 ioctl-test-64.o: ioctl-test.c ioctl.h kerncompat.h ctree.h
464 $(Q)$(CC) $(CFLAGS) -m64 -c $< -o $@
466 ioctl-test: ioctl-test.o
468 $(Q)$(CC) $(CFLAGS) -o $@ $< $(LDFLAGS)
469 @echo " ?[PAHOLE] $@.pahole"
470 -$(Q)pahole $@ > $@.pahole
472 ioctl-test-32: ioctl-test-32.o
474 $(Q)$(CC) -m32 -o $@ $< $(LDFLAGS)
475 @echo " ?[PAHOLE] $@.pahole"
476 -$(Q)pahole $@ > $@.pahole
478 ioctl-test-64: ioctl-test-64.o
480 $(Q)$(CC) -m64 -o $@ $< $(LDFLAGS)
481 @echo " ?[PAHOLE] $@.pahole"
482 -$(Q)pahole $@ > $@.pahole
484 test-ioctl: ioctl-test ioctl-test-32 ioctl-test-64
485 @echo " [TEST/ioctl]"
486 $(Q)./ioctl-test > ioctl-test.log
487 $(Q)./ioctl-test-32 > ioctl-test-32.log
488 $(Q)./ioctl-test-64 > ioctl-test-64.log
490 library-test: library-test.c $(libs_shared)
491 @echo " [TEST PREP] $@"$(eval TMPD=$(shell mktemp -d))
492 $(Q)mkdir -p $(TMPD)/include/btrfs && \
493 cp $(libbtrfs_headers) $(TMPD)/include/btrfs && \
494 cd $(TMPD) && $(CC) -I$(TMPD)/include -o $@ $(addprefix $(ABSTOPDIR)/,$^) -Wl,-rpath=$(ABSTOPDIR) -lbtrfs
495 @echo " [TEST RUN] $@"
496 $(Q)cd $(TMPD) && ./$@
497 @echo " [TEST CLEAN] $@"
498 $(Q)$(RM) -rf -- $(TMPD)
500 library-test.static: library-test.c $(libs_static)
501 @echo " [TEST PREP] $@"$(eval TMPD=$(shell mktemp -d))
502 $(Q)mkdir -p $(TMPD)/include/btrfs && \
503 cp $(libbtrfs_headers) $(TMPD)/include/btrfs && \
504 cd $(TMPD) && $(CC) -I$(TMPD)/include -o $@ $(addprefix $(ABSTOPDIR)/,$^) $(STATIC_LDFLAGS) $(STATIC_LIBS)
505 @echo " [TEST RUN] $@"
506 $(Q)cd $(TMPD) && ./$@
507 @echo " [TEST CLEAN] $@"
508 $(Q)$(RM) -rf -- $(TMPD)
510 fssum: tests/fssum.c tests/sha224-256.c
512 $(Q)$(CC) $(CFLAGS) -o $@ $^ $(LDFLAGS)
514 test-build: test-build-pre test-build-real
517 $(MAKE) $(MAKEOPTS) clean-all
522 $(MAKE) $(MAKEOPTS) library-test
523 -$(MAKE) $(MAKEOPTS) library-test.static
524 $(MAKE) $(MAKEOPTS) -j 8 all
525 -$(MAKE) $(MAKEOPTS) -j 8 static
526 $(MAKE) $(MAKEOPTS) -j 8 $(progs_extra)
529 $(Q)$(MAKE) $(MAKEOPTS) -C Documentation
532 @echo " [TAGS] $(TAGS_CMD)"
533 $(Q)$(TAGS_CMD) *.[ch] image/*.[ch] convert/*.[ch] mkfs/*.[ch]
536 @echo " [CSCOPE] $(CSCOPE_CMD)"
537 $(Q)ls -1 *.[ch] image/*.[ch] convert/*.[ch] mkfs/*.[ch] > cscope.files
540 clean-all: clean clean-doc clean-gen
544 $(Q)$(RM) -f -- $(progs) *.o *.o.d \
545 kernel-lib/*.o kernel-lib/*.o.d \
546 kernel-shared/*.o kernel-shared/*.o.d \
547 image/*.o image/*.o.d \
548 convert/*.o convert/*.o.d \
549 mkfs/*.o mkfs/*.o.d check/*.o check/*.o.d \
550 dir-test ioctl-test quick-test library-test library-test-static \
551 mktables btrfs.static mkfs.btrfs.static fssum \
553 $(libs) $(lib_links) \
554 $(progs_static) $(progs_extra)
557 @echo "Cleaning Documentation"
558 $(Q)$(MAKE) $(MAKEOPTS) -C Documentation clean
561 @echo "Cleaning Generated Files"
562 $(Q)$(RM) -rf -- version.h config.status config.cache connfig.log \
563 configure.lineno config.status.lineno Makefile.inc \
564 Documentation/Makefile tags \
565 cscope.files cscope.out cscope.in.out cscope.po.out \
566 config.log config.h config.h.in~ aclocal.m4 \
567 configure autom4te.cache/ config/
570 @echo "Cleaning $(patsubst clean-%,%,$@)"
571 $(Q)$(MAKE) $(MAKEOPTS) -C $(patsubst clean-%,%,$@) clean
573 install: $(libs) $(progs_install) $(INSTALLDIRS)
574 $(INSTALL) -m755 -d $(DESTDIR)$(bindir)
575 $(INSTALL) $(progs_install) $(DESTDIR)$(bindir)
576 $(INSTALL) fsck.btrfs $(DESTDIR)$(bindir)
577 # btrfsck is a link to btrfs in the src tree, make it so for installed file as well
578 $(LN_S) -f btrfs $(DESTDIR)$(bindir)/btrfsck
579 $(INSTALL) -m755 -d $(DESTDIR)$(libdir)
580 $(INSTALL) $(libs) $(DESTDIR)$(libdir)
581 cp -a $(lib_links) $(DESTDIR)$(libdir)
582 $(INSTALL) -m755 -d $(DESTDIR)$(incdir)
583 $(INSTALL) -m644 $(headers) $(DESTDIR)$(incdir)
585 $(INSTALL) -m755 -d $(DESTDIR)$(udevruledir)
586 $(INSTALL) -m644 $(udev_rules) $(DESTDIR)$(udevruledir)
589 install-static: $(progs_static) $(INSTALLDIRS)
590 $(INSTALL) -m755 -d $(DESTDIR)$(bindir)
591 $(INSTALL) $(progs_static) $(DESTDIR)$(bindir)
592 # btrfsck is a link to btrfs in the src tree, make it so for installed file as well
593 $(LN_S) -f btrfs.static $(DESTDIR)$(bindir)/btrfsck.static
596 @echo "Making install in $(patsubst install-%,%,$@)"
597 $(Q)$(MAKE) $(MAKEOPTS) -C $(patsubst install-%,%,$@) install
600 $(Q)$(MAKE) $(MAKEOPTS) -C Documentation uninstall
601 cd $(DESTDIR)$(incdir); $(RM) -f -- $(headers)
602 $(RMDIR) -p --ignore-fail-on-non-empty -- $(DESTDIR)$(incdir)
603 cd $(DESTDIR)$(libdir); $(RM) -f -- $(lib_links) $(libs)
604 cd $(DESTDIR)$(bindir); $(RM) -f -- btrfsck fsck.btrfs $(progs_install)
606 ifneq ($(MAKECMDGOALS),clean)
607 -include $(all_objects:.o=.o.d) $(subst .btrfs,, $(filter-out btrfsck.o.d, $(progs:=.o.d)))