################################################################################
#
# WangXun 10GbE PCI Express Linux Network Driver
# Copyright(c) 2015 - 2017 Beijing WangXun Technology Co., Ltd.
#
# This program is free software; you can redistribute it and/or modify it
# under the terms and conditions of the GNU General Public License,
# version 2, as published by the Free Software Foundation.
#
# This program is distributed in the hope 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.
#
# The full GNU General Public License is included in this distribution in
# the file called "COPYING".
#
################################################################################
#
# Makefile for the WangXun(R) 10GbE PCI Express Linux Network Driver
#

obj-$(CONFIG_TXGBE) += txgbe.o
txgbe-objs := txgbe_main.o txgbe_dcb.o txgbe_ethtool.o txgbe_lib.o \
	      txgbe_mbx.o txgbe_sriov.o txgbe_param.o txgbe_phy.o \
	      txgbe_procfs.o txgbe_hw.o txgbe_mtd.o txgbe_pcierr.o \
	      txgbe_bp.o txgbe_xsk.o

txgbe-${CONFIG_DCB} += txgbe_dcb_nl.o

txgbe-${CONFIG_DEBUG_FS} += txgbe_debugfs.o

txgbe-${CONFIG_FCOE:m=y} += txgbe_fcoe.o

txgbe-$(CONFIG_PTP_1588_CLOCK:m=y) += txgbe_ptp.o

txgbe-${CONFIG_SYSFS} += txgbe_sysfs.o

txgbe-y += kcompat.o

# Generate kcompat_generated_defs.h from kernel headers
# Use filechk: always regenerate to a temp file and only update if content
# changed. This avoids stale/empty headers from interrupted builds.
always-y += kcompat_generated_defs.h

filechk_kcompat_gen = KSRC=$(srctree) CONFFILE=$(srctree)/include/generated/autoconf.h bash $(src)/kcompat-generator.sh

$(obj)/kcompat_generated_defs.h: $(src)/kcompat-generator.sh $(src)/kcompat-lib.sh FORCE
	$(call filechk,kcompat_gen)

# Make every txgbe object depend on the generated header so that single-target
# builds (make ...txgbe.ko) also regenerate it.
_txgbe-objs := $(sort $(txgbe-objs) $(txgbe-y) $(txgbe-m))
$(foreach o,$(_txgbe-objs),$(eval $(obj)/$(o): $(obj)/kcompat_generated_defs.h))
