Commit cfc523f2 authored by Federico Vaga's avatar Federico Vaga Committed by Federico Vaga

Makefile: fix environment variable

In order to allow people to select their own external dependencies
(fmc-bus, spec-sw, zio) and keep the Makefile simple, the following
policy is implemented:
* project Makefile defines and exports the default source directories,
  but it allows to overwrite the default
* kernel Makefile relies on the environment variable

kbuild only work with relative path, so in order to avoid this problem
we create a temporary symbolic link to the fmc-bus project
Signed-off-by: Federico Vaga's avatarFederico Vaga <federico.vaga@cern.ch>
parent 0cc06a63
......@@ -23,9 +23,15 @@ gitmodules:
@git submodule update
# The user can override, using environment variables, all these three:
FMC_BUS ?= fmc-bus
ZIO ?= zio
SPEC_SW ?= spec-sw
FMC_BUS ?= $(shell /bin/pwd)/fmc-bus
export FMC_BUS
ZIO ?= $(shell /bin/pwd)/zio
export ZIO
SPEC_SW ?= $(shell /bin/pwd)/spec-sw
export SPEC_SW
SUBMOD = $(FMC_BUS) $(ZIO) $(SPEC_SW)
prereq:
......
LINUX ?= /lib/modules/$(shell uname -r)/build
ZIO ?= $(src)/../zio
FMC_BUS ?= $(src)/../fmc-bus
SPEC ?= $(src)/../spec-sw
# FMC_BUS, ZIO, SPEC_SW comes from the upper level
KBUILD_EXTRA_SYMBOLS := \
$(ZIO)/Module.symvers \
$(SPEC)/kernel/Module.symvers \
$(SPEC_SW)/kernel/Module.symvers \
$(FMC_BUS)/kernel/Module.symvers
GIT_VERSION = $(shell cd $(src); git describe --always --dirty --long --tags)
......@@ -23,7 +21,7 @@ ccflags-y = -DGIT_VERSION=\"$(GIT_VERSION)\" \
-I$(FMC_BUS)/kernel/include \
-I$(FMC_BUS)/kernel/include/linux \
-I$(FMC_BUS)/sdb-lib \
-I$(SPEC)/kernel
-I$(SPEC_SW)/kernel
ccflags-$(CONFIG_FMC_TDC_DEBUG) += -DDEBUG
subdirs-ccflags-y = $(ccflags-y)
......@@ -31,9 +29,15 @@ subdirs-ccflags-y = $(ccflags-y)
obj-m := fmc-tdc.o
fmc-tdc-objs = acam.o calibration.o fmc-util.o ft-spec.o \
ft-svec.o ft-core.o onewire.o ft-time.o ft-irq.o ft-zio.o\
../fmc-bus/sdb-lib/access.o ../fmc-bus/sdb-lib/glue.o
fmc-bus-link/sdb-lib/access.o fmc-bus-link/sdb-lib/glue.o
all: modules
modules_install clean modules:
modules_install modules:
rm -f fmc-bus-link
ln -s $(FMC_BUS) fmc-bus-link
$(MAKE) -C $(LINUX) M=$(shell /bin/pwd) $@
rm -f fmc-bus-link
clean:
$(MAKE) -C $(LINUX) M=$(shell /bin/pwd) $@
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