diff --git a/Makefile b/Makefile index 43772dbcfcd9dae40e549479b9728c4fa032bea8..7978d04ee3e42ddc03eedabd64703326936d0d93 100644 --- a/Makefile +++ b/Makefile @@ -1,5 +1,10 @@ -DIRS = fmc-bus/kernel kernel tools doc +# We have a problem here: this package may be a submodule of something +# else (for example: fine-delay). If this is the case, fmc-bus is on ../ +# This external script returns the pathname of the "kernel" subdir of fmc-bus +FMC_DRV = $(./check-fmc-bus) + +DIRS = $(FMC_DRV) kernel tools all clean modules install modules_install: for d in $(DIRS); do $(MAKE) -C $$d $@ || exit 1; done diff --git a/check-fmc-bus b/check-fmc-bus new file mode 100755 index 0000000000000000000000000000000000000000..69e21f322c0a623596208c8e635f989382394aec --- /dev/null +++ b/check-fmc-bus @@ -0,0 +1,27 @@ +#!/bin/sh + +cd $(dirname $0) + +# If this project _and_ fmc-bus are submodules of ../, pick ../fmc-bus + +FMC_SUBDIR=$(/bin/pwd)/fmc-bus/kernel +FMC_DOTDOT=$(/bin/pwd)/../fmc-bus/kernel + +THIS=$(basename $(/bin/pwd)) + +if ! test -f ../.gitmodules; then + echo $FMC_SUBDIR + exit 0 +fi + +if ! grep "submodule \"$THIS\"" ../.gitmodules > /dev/null; then + echo $FMC_SUBDIR + exit 0 +fi + +if ! grep "submodule \"fmc-bus\"" ../.gitmodules > /dev/null; then + echo $FMC_SUBDIR + exit 0 +fi + +echo $FMC_DOTDOT \ No newline at end of file diff --git a/kernel/Makefile b/kernel/Makefile index f55f22124c206dac4591237b8bd7eef5a2fd56b3..4108af4e05aa2fccaffd37474b8403f5329dc531 100644 --- a/kernel/Makefile +++ b/kernel/Makefile @@ -1,9 +1,11 @@ LINUX ?= /lib/modules/$(shell uname -r)/build -KBUILD_EXTRA_SYMBOLS := $M/../fmc-bus/kernel/Module.symvers +FMC_DRV ?= $(shell $M/../check-fmc-bus) -ccflags-y += -I$M/include -I$M/../fmc-bus/kernel/include +KBUILD_EXTRA_SYMBOLS := $(FMC_DRV)/Module.symvers + +ccflags-y += -I$M/include -I$(FMC_DRV)/include ccflags-y += $(WR_NIC_CFLAGS) obj-m += spec.o