# the ADDIDATAINCLUDE variable may hold the path to the addidata-specific include directory
ifeq ($(ADDIDATAINC),)
# include directory has not been specified. suppose we are located inside the Linux kernel source tree
ADDI_CFLAGS:=-I$(TOPDIR)/include/linux/addidata/ -I$(TOPDIR)/drivers/addidata/apci_eeprom/ -D_ADDI_NO_WIN32_COMPAT
else
# use specified location (full path needed !)
ADDI_CFLAGS:=-I$(ADDIDATAINC) -D_ADDI_NO_WIN32_COMPAT -I$(ADDIDATAINC)/../../../drivers/addidata/apci_eeprom/
endif

#ADDI_CFLAGS+=-DCONFIG_XPCI3XXX_DEBUG

# Each configuration option enables a list of files.
obj-$(CONFIG_XPCI3XXX_IOCTL) += xpci3xxx.o

# list of objects that make the module
xpci3xxx-objs := main.o fs.o procfs.o ioctl.o interrupt.o vtable.o timer.o\
		counter.o watchdog.o k_timer.o k_counter.o k_watchdog.o\
		primary_tcw.o digital_input.o digital_output.o ttl.o\
		analog_input.o analog_output.o primary_di.o primary_do.o\
		primary_ttl.o primary_ai.o primary_ao.o shared_memory.o\
		primary_dma.o board_information_kapi.o board_information.o\
		knowndev.o ../apci_eeprom/93c76.o ../apci_eeprom/s5933.o


# Kernel build flags: ccflags-y and ldflags-y were introduced in 2008 as the
# recommended approach. Some kernel 5.x versions already enforce these flags.
# For compatibility: kernels < 5 use EXTRA_CFLAGS, kernels >= 5 use ccflags-y/ldflags-y
ifeq ($(shell test $(VERSION) -lt 5; echo $$?),0)
EXTRA_CFLAGS+=$(ADDI_CFLAGS)
else
ccflags-y :=$(ADDI_CFLAGS)
endif

# KERNEL 2.4 ------------------------------------------
ifeq ($(VERSION),2)
ifeq ($(PATCHLEVEL),4)

# The target object and module list name.
O_TARGET	:= driver.o

# Objects that export symbols.
export-objs	:= main.o k_timer.o k_counter.o k_watchdog.o primary_di.o\
		primary_do.o primary_ttl.o primary_ai.o primary_ao.o\
		shared_memory.o primary_dma.o fs.o interrupt.o knowndev.o\
		board_information_kapi.o

# The global Rules.make.
include $(TOPDIR)/Rules.make

# Link rules
xpci3xxx.o: $(xpci3xxx-objs)
	$(LD) -r -o $@ $(xpci3xxx-objs)
	
endif
endif
