Commit 121a2c1f authored by Alessandro Rubini's avatar Alessandro Rubini

Makefiles: some contortions to be friends of submodules

This patch adds a script "check-fmc-bus" that returns the pathname of
the fmc-bus kernel driver, either under this directory or under
../fmc-bus .  The former applies when fmc-bus is a submodule of this
package, the latter applies when we both are submodules of another

The final aim is helping the naive user, who just wants to build it
all in a single step -- both if building this package or another
package that depends on both fmc-bus and this one.
Signed-off-by: Alessandro Rubini's avatarAlessandro Rubini <>
parent 37dff380
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
cd $(dirname $0)
# If this project _and_ fmc-bus are submodules of ../, pick ../fmc-bus
THIS=$(basename $(/bin/pwd))
if ! test -f ../.gitmodules; then
exit 0
if ! grep "submodule \"$THIS\"" ../.gitmodules > /dev/null; then
exit 0
if ! grep "submodule \"fmc-bus\"" ../.gitmodules > /dev/null; then
exit 0
\ No newline at end of file
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
ccflags-y += -I$M/include -I$(FMC_DRV)/include
ccflags-y += $(WR_NIC_CFLAGS)
obj-m += spec.o
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment