Viewing: autoMakefile.am

# SPDX-License-Identifier: GPL-2.0

#
# This file is part of Lustre, http://www.lustre.org/
#

if LDISKFS_ENABLED
SUBDIRS := ldiskfs
else
SUBDIRS :=
endif
SUBDIRS += . \
	@LUSTREIOKIT_SUBDIR@ \
	Documentation \
	lib \
	lnet/utils \
	lustre/utils \
	lustre/tests \
	lustre/scripts \
	lustre/conf

DIST_SUBDIRS := ldiskfs \
	lustre-iokit \
	Documentation \
	lib \
	lnet/utils \
	lustre/utils \
	lustre/tests \
	lustre/scripts \
	lustre/conf \
	config

AUTOMAKE_OPTIONS = foreign

UAPI_LUSTRE_EXCLUDE =
if !SERVER
UAPI_LUSTRE_EXCLUDE += lustre_access_log.h lustre_barrier_user.h \
	lustre_disk.h lustre_lfsck_user.h lustre_log_user.h
endif

install-data-local:
	for fname in $$(find include/lustre -type f -name '*.h'); do \
		target=$$(echo $${fname} | sed 's:^include/::g'); \
		$(INSTALL) -D -m 0644 $${fname} $(DESTDIR)$(includedir)/$${target}; \
	done
	for fname in $$(find include/uapi/linux/lnet -type f -name '*.h'); do \
		target=$$(echo $${fname} | sed 's:^include/uapi/::g'); \
		$(INSTALL) -D -m 0644 $${fname} $(DESTDIR)$(includedir)/$${target}; \
	done
	for fname in $$(find include/uapi/linux/lustre -type f -name '*.h'); do \
		base=$$(basename $${fname}); \
		skip=false; \
		for s in $(UAPI_LUSTRE_EXCLUDE); do \
			if test "$$base" = "$$s"; then skip=true; break; fi; \
		done; \
		if ! $$skip; then \
			target=$$(echo $${fname} | sed 's:^include/uapi/::g'); \
			$(INSTALL) -D -m 0644 $${fname} $(DESTDIR)$(includedir)/$${target}; \
		fi; \
	done
if MODULES
	mkdir -p $(DESTDIR)$(modulefsdir)
	for ko in $$(find lustre/ ldiskfs/ -name '*.ko' 2>/dev/null); do \
		$(INSTALL) -m 0644 $${ko} $(DESTDIR)$(modulefsdir)/; \
	done
	mkdir -p $(DESTDIR)$(modulenetdir)
	for ko in $$(find lnet/ -name '*.ko' 2>/dev/null); do \
		$(INSTALL) -m 0644 $${ko} $(DESTDIR)$(modulenetdir)/; \
	done
endif

if MODULES
if BUILT_IN_KO2IBLND
if !EXTERNAL_KO2IBLND
install-data-hook:
	(cd "$(DESTDIR)$(modulenetdir)"; \
	 $(LN_S) -f in-kernel-ko2iblnd.ko ko2iblnd.ko)

uninstall-hook:
	(cd "$(DESTDIR)$(modulenetdir)"; rm -f ko2iblnd.ko)
endif # !EXTERNAL_KO2IBLND
endif # BUILT_IN_KO2IBLND
endif # MODULES

dist-hook:
	rm -f $(distdir)/contrib/contrib-kernel-coverage.spec
	find include/ -type f \( -name "*.h" \) \
		-exec cp --parents {} $(distdir) \;
	find lustre/include/ -type f \( -name "*.h" \) \
		-exec cp --parents {} $(distdir) \;
	find lustre_compat/ -type f \( -name "*.c" -o -name "*.h" -o -iname "Makefile" \) \
		-exec cp --parents {} $(distdir) \;
	find lustre/ -type f \( -name "*.c" -o -name "*.h" -o -iname "Makefile" \) \
		-exec cp --parents {} $(distdir) \;
	find lnet/ -type f \( -name "*.c" -o -name "*.h" -o -iname "Makefile" \) \
		-exec cp --parents {} $(distdir) \;
	find $(distdir) -name .deps -o \
			-name CVS -o \
			-name .svn -o \
			-name .git -o \
			-name .#* -exec rm -rf {} \;

EXTRA_DIST = @PACKAGE_TARNAME@.spec	\
	Makefile			\
	Kbuild				\
	config.h.in			\
	lustre-dkms_pre-build.sh	\
	lustre-dkms_post-build.sh	\
	lustre-dkms_post-remove.sh	\
	LUSTRE-VERSION-GEN		\
	LUSTRE-VERSION-FILE		\
	autogen.sh			\
	modules.order			\
	config/lustre-version.m4 \
	contrib \
	lustre/kernel_patches \
	lustre/ChangeLog \
	lnet/ChangeLog \
	debian \
	rpm