5c76aa93db5c0bc003519b80d183a9abfbaefd3b
[xfstests-dev.git] / src / Makefile
1 # SPDX-License-Identifier: GPL-2.0
2 #
3 # Copyright (c) 2000-2005 Silicon Graphics, Inc.  All Rights Reserved.
4 #
5
6 TOPDIR = ..
7 include $(TOPDIR)/include/builddefs
8
9 TARGETS = dirstress fill fill2 getpagesize holes lstat64 \
10         nametest permname randholes runas truncfile usemem \
11         mmapcat append_reader append_writer dirperf metaperf \
12         devzero feature alloc fault fstest t_access_root \
13         godown resvtest writemod writev_on_pagefault makeextents itrash rename \
14         multi_open_unlink unwritten_sync genhashnames t_holes \
15         t_mmap_writev t_truncate_cmtime dirhash_collide t_rename_overwrite \
16         holetest t_truncate_self af_unix t_mmap_stale_pmd \
17         t_mmap_cow_race t_mmap_fallocate fsync-err t_mmap_write_ro \
18         t_ext4_dax_journal_corruption t_ext4_dax_inline_corruption \
19         t_ofd_locks t_mmap_collision mmap-write-concurrent \
20         t_get_file_time t_create_short_dirs t_create_long_dirs t_enospc \
21         t_mmap_writev_overlap checkpoint_journal
22
23 LINUX_TARGETS = xfsctl bstat t_mtab getdevicesize preallo_rw_pattern_reader \
24         preallo_rw_pattern_writer ftrunc trunc fs_perms testx looptest \
25         locktest unwritten_mmap bulkstat_unlink_test deduperace \
26         bulkstat_unlink_test_modified t_dir_offset t_futimens t_immutable \
27         stale_handle pwrite_mmap_blocked t_dir_offset2 seek_sanity_test \
28         seek_copy_test t_readdir_1 t_readdir_2 fsync-tester nsexec cloner \
29         renameat2 t_getcwd e4compact test-nextquota punch-alternating \
30         attr-list-by-handle-cursor-test listxattr dio-interleaved t_dir_type \
31         dio-invalidate-cache stat_test t_encrypted_d_revalidate \
32         attr_replace_test swapon mkswap t_attr_corruption t_open_tmpfiles \
33         fscrypt-crypt-util bulkstat_null_ocount splice-test chprojid_fail \
34         detached_mounts_propagation
35
36 SUBDIRS = log-writes perf
37
38 LLDLIBS = $(LIBHANDLE) $(LIBACL) -lpthread -lrt
39
40 ifeq ($(HAVE_XLOG_ASSIGN_LSN), true)
41 LINUX_TARGETS += loggen
42 endif
43
44 ifeq ($(HAVE_FIEMAP), true)
45 LINUX_TARGETS += fiemap-tester t_stripealign
46 endif
47
48 ifeq ($(HAVE_OPEN_BY_HANDLE_AT), true)
49 LINUX_TARGETS += open_by_handle
50 endif
51
52 ifeq ($(HAVE_FALLOCATE), true)
53 LCFLAGS += -DHAVE_FALLOCATE
54 endif
55
56 ifeq ($(PKG_PLATFORM),linux)
57 TARGETS += $(LINUX_TARGETS)
58 endif
59
60 ifeq ($(HAVE_DB), true)
61 TARGETS += dbtest
62 LLDLIBS += $(LIBGDBM)
63 endif
64
65 ifeq ($(HAVE_AIO), true)
66 TARGETS += t_mmap_dio
67 SUBDIRS += aio-dio-regress
68 LLDLIBS += -laio
69 endif
70
71 ifeq ($(HAVE_URING), true)
72 LLDLIBS += -luring
73 endif
74
75 SUBDIRS += idmapped-mounts
76 ifeq ($(HAVE_LIBCAP), true)
77 LLDLIBS += -lcap
78 endif
79
80 CFILES = $(TARGETS:=.c)
81 LDIRT = $(TARGETS) fssum
82
83
84 default: depend $(LDIRT) $(SUBDIRS)
85
86 depend: .dep
87
88 include $(BUILDRULES)
89
90 fssum: fssum.c md5.c
91         @echo "    [CC]    $@"
92         $(Q)$(LTLINK) fssum.c md5.c -o $@ $(CFLAGS) $(LDFLAGS) $(LDLIBS)
93
94 $(TARGETS): $(LIBTEST)
95         @echo "    [CC]    $@"
96         $(Q)$(LTLINK) $@.c -o $@ $(CFLAGS) $(LDFLAGS) $(LDLIBS) $(LIBTEST)
97
98 LINKTEST = $(LTLINK) $@.c -o $@ $(CFLAGS) $(LDFLAGS)
99
100 install: default $(addsuffix -install,$(SUBDIRS))
101         $(INSTALL) -m 755 -d $(PKG_LIB_DIR)/src
102         $(LTINSTALL) -m 755 $(LDIRT) $(PKG_LIB_DIR)/src
103         $(LTINSTALL) -m 755 dmerror fill2attr fill2fs fill2fs_check scaleread.sh $(PKG_LIB_DIR)/src
104         $(LTINSTALL) -m 644 dumpfile $(PKG_LIB_DIR)/src
105
106 %-install:
107         $(MAKE) -C $* install
108
109 -include .dep