Commit 5f98dab4 authored by Adam Wujek's avatar Adam Wujek 💬

Merge branch 'adam-coht'

Changes in the buildsystem.
Signed-off-by: Adam Wujek's avatarAdam Wujek <adam.wujek@cern.ch>
parents b0dcb942 014962ae
# include parent_common.mk for buildsystem's defines
#use absolute path for REPO_PARENT
REPO_PARENT=$(shell /bin/pwd)/..
-include $(REPO_PARENT)/parent_common.mk
.PHONY: all clean modules install modules_install
.PHONY: gitmodules prereq prereq_install prereq_install_warn
DIRS = kernel lib tools
all clean modules install modules_install: gitmodules
for d in $(DIRS); do $(MAKE) -C $$d $@ || exit 1; done
@if echo $@ | grep -q install; then $(MAKE) prereq_install_warn; fi
all modules: prereq
clean_all: clean prereq_clean
all: kernel lib tools
# a hack, to prevent compiling wr-nic.ko, which won't work on older kernels
CONFIG_WR_NIC=n
export CONFIG_WR_NIC
#### The following targets are used to manage prerequisite repositories
gitmodules:
@test -d fmc-bus/doc || echo "Checking out submodules"
@test -d fmc-bus/doc || git submodule update --init
@git submodule update
# The user can override, using environment variables, all these three:
FMC_BUS ?= $(shell /bin/pwd)/fmc-bus
export FMC_BUS
FMC_BUS ?= $(shell pwd)/fmc-bus
ZIO ?= $(shell pwd)/zio
SPEC_SW ?= $(shell pwd)/spec-sw
ZIO ?= $(shell /bin/pwd)/zio
export ZIO
ZIO_VERSION = $(shell cd $(ZIO); git describe --always --dirty --long --tags)
# FMC_BUS_ABS, ZIO_ABS and SPEC_SW_ABS has to be absolut path, due to beeing
# passed to the Kbuild
FMC_BUS_ABS ?= $(abspath $(FMC_BUS) )
ZIO_ABS ?= $(abspath $(ZIO) )
SPEC_SW_ABS ?= $(abspath $(SPEC_SW) )
export FMC_BUS_ABS
export ZIO_ABS
export SPEC_SW_ABS
ZIO_VERSION = $(shell cd $(ZIO_ABS); git describe --always --dirty --long --tags)
export ZIO_VERSION
SPEC_SW ?= $(shell /bin/pwd)/spec-sw
export SPEC_SW
SUBMOD = $(FMC_BUS) $(ZIO) $(SPEC_SW)
DIRS = $(FMC_BUS_ABS) $(ZIO_ABS) $(SPEC_SW_ABS) kernel lib tools
$(SPEC_SW_ABS): $(FMC_BUS_ABS)
kernel: $(FMC_BUS_ABS) $(ZIO_ABS) $(SPEC_SW_ABS)
lib: $(ZIO_ABS)
tools: lib
.PHONY: all clean modules install modules_install $(DIRS)
.PHONY: gitmodules prereq_install prereq_install_warn
prereq:
for d in $(SUBMOD); do $(MAKE) -C $$d || exit 1; done
install modules_install: prereq_install_warn
all clean modules install modules_install: $(DIRS)
clean: TARGET = clean
modules: TARGET = modules
install: TARGET = install
modules_install: TARGET = modules_install
$(DIRS):
$(MAKE) -C $@ $(TARGET)
SUBMOD = $(FMC_BUS_ABS) $(ZIO_ABS) $(SPEC_SW_ABS)
prereq_install_warn:
@test -f .prereq_installed || \
......@@ -47,5 +62,18 @@ prereq_install:
for d in $(SUBMOD); do $(MAKE) -C $$d modules_install || exit 1; done
touch .prereq_installed
prereq_clean:
for d in $(SUBMOD); do $(MAKE) -C $$d clean || exit 1; done
$(FMC_BUS_ABS): fmc-bus-init_repo
$(ZIO_ABS): zio-init_repo
$(SPEC_SW_ABS): spec-sw-init_repo
# init submodule if missing
fmc-bus-init_repo:
@test -d $(FMC_BUS_ABS)/doc || ( echo "Checking out submodule $(FMC_BUS_ABS)"; git submodule update --init $(FMC_BUS_ABS) )
# init submodule if missing
zio-init_repo:
@test -d $(ZIO_ABS)/doc || ( echo "Checking out submodule $(ZIO_ABS)" && git submodule update --init $(ZIO_ABS) )
# init submodule if missing
spec-sw-init_repo:
@test -d $(SPEC_SW_ABS)/doc || ( echo "Checking out submodule $(SPEC_SW_ABS)" && git submodule update --init $(SPEC_SW_ABS) )
# FMC_BUS, ZIO, SPEC_SW comes from the Makefile
KBUILD_EXTRA_SYMBOLS := \
$(ZIO_ABS)/Module.symvers \
$(SPEC_SW_ABS)/kernel/Module.symvers \
$(FMC_BUS_ABS)/kernel/Module.symvers
# The library includes <sdb.h>, so point -I directtly there
# include our header before to avoid conflicts with the kernel
LINUXINCLUDE := -I$(FMC_BUS_ABS)/kernel/include -I$(FMC_BUS_ABS)/kernel/include/linux $(LINUXINCLUDE)
ccflags-y = -DGIT_VERSION=\"$(GIT_VERSION)\" \
-I$(src) \
-I$(ZIO_ABS)/include \
-I$(FMC_BUS_ABS)/sdb-lib/ \
-I$(SPEC_SW_ABS)/kernel
ccflags-$(CONFIG_FMC_TDC_DEBUG) += -DDEBUG
ccflags-$(CONFIG_FMC_TDC_VERBOSE_DEBUG) += -DVERBOSE_DEBUG
# Extract minimum com major, minor and patch number
ccflags-y += -D__ZIO_MIN_MAJOR_VERSION=$(shell echo $(ZIO_VERSION) | cut -d '-' -f 2 | cut -d '.' -f 1; )
ccflags-y += -D__ZIO_MIN_MINOR_VERSION=$(shell echo $(ZIO_VERSION) | cut -d '-' -f 2 | cut -d '.' -f 2; )
# add versions of supermodule. It is useful when fine-delay-sw is included as sub-module
# of a bigger project that we want to track
ifdef CONFIG_SUPER_REPO
ifdef CONFIG_SUPER_REPO_VERSION
SUBMODULE_VERSIONS += MODULE_INFO(version_$(CONFIG_SUPER_REPO),\"$(CONFIG_SUPER_REPO_VERSION)\");
endif
endif
# add versions of used submodules
SUBMODULE_VERSIONS += MODULE_INFO(version_fmc_bus,\"$(FMC_BUS_VERSION)\");
SUBMODULE_VERSIONS += MODULE_INFO(version_zio,\"$(ZIO_VERSION)\");
SUBMODULE_VERSIONS += MODULE_INFO(version_spec_sw,\"$(SPEC_SW_VERSION)\");
ccflags-y += -DADDITIONAL_VERSIONS="$(SUBMODULE_VERSIONS)"
subdirs-ccflags-y = $(ccflags-y)
obj-m := fmc-tdc.o
fmc-tdc-objs = acam.o calibration.o fmc-util.o \
ft-core.o onewire.o ft-time.o ft-irq.o ft-zio.o\
fmc-bus-link/sdb-lib/access.o fmc-bus-link/sdb-lib/glue.o
LINUX ?= /lib/modules/$(shell uname -r)/build
# FMC_BUS, ZIO, SPEC_SW comes from the upper level
KBUILD_EXTRA_SYMBOLS := \
$(ZIO)/Module.symvers \
$(SPEC_SW)/kernel/Module.symvers \
$(FMC_BUS)/kernel/Module.symvers
GIT_VERSION = $(shell cd $(src); git describe --always --dirty --long --tags)
# include parent_common.mk for buildsystem's defines
#use absolute path for REPO_PARENT
REPO_PARENT=$(shell /bin/pwd)/../..
-include $(REPO_PARENT)/parent_common.mk
# The library includes <sdb.h>, so point -I directtly there
# include our header before to avoid conflicts with the kernel
LINUXINCLUDE := -I$(FMC_BUS)/kernel/include -I$(FMC_BUS)/kernel/include/linux $(LINUXINCLUDE)
ccflags-y = -DGIT_VERSION=\"$(GIT_VERSION)\" \
-I$(src) \
-I$(ZIO)/include \
-I$(FMC_BUS)/sdb-lib/ \
-I$(SPEC_SW)/kernel
LINUX ?= /lib/modules/$(shell uname -r)/build
ccflags-$(CONFIG_FMC_TDC_DEBUG) += -DDEBUG
ccflags-$(CONFIG_FMC_TDC_VERBOSE_DEBUG) += -DVERBOSE_DEBUG
FMC_BUS ?= ../fmc-bus
ZIO ?= ../zio
SPEC_SW ?= ../spec-sw
# Extract minimum com major, minor and patch number
ccflags-y += -D__ZIO_MIN_MAJOR_VERSION=$(shell echo $(ZIO_VERSION) | cut -d '-' -f 2 | cut -d '.' -f 1; )
ccflags-y += -D__ZIO_MIN_MINOR_VERSION=$(shell echo $(ZIO_VERSION) | cut -d '-' -f 2 | cut -d '.' -f 2; )
# FMC_BUS_ABS, ZIO_ABS and SPEC_SW_ABS has to be absolut path, due to beeing
# passed to the Kbuild
FMC_BUS_ABS ?= $(abspath $(FMC_BUS) )
ZIO_ABS ?= $(abspath $(ZIO) )
SPEC_SW_ABS ?= $(abspath $(SPEC_SW) )
# For this CSM_VERSION, please see ohwr.org/csm documentation
ifdef CONFIG_CSM_VERSION
ccflags-y += -D"CERN_SUPER_MODULE=MODULE_VERSION(\"$(CONFIG_CSM_VERSION)\")"
else
ccflags-y += -DCERN_SUPER_MODULE=""
endif
GIT_VERSION = $(shell git describe --always --dirty --long --tags)
export GIT_VERSION
subdirs-ccflags-y = $(ccflags-y)
FMC_BUS_VERSION ?= $(shell cd $(FMC_BUS_ABS); git describe --always --dirty --long --tags)
ZIO_VERSION ?= $(shell cd $(ZIO_ABS); git describe --always --dirty --long --tags)
SPEC_SW_VERSION ?= $(shell cd $(SPEC_SW_ABS); git describe --always --dirty --long --tags)
obj-m := fmc-tdc.o
fmc-tdc-objs = acam.o calibration.o fmc-util.o \
ft-core.o onewire.o ft-time.o ft-irq.o ft-zio.o\
fmc-bus-link/sdb-lib/access.o fmc-bus-link/sdb-lib/glue.o
export FMC_BUS_VERSION
export ZIO_VERSION
export SPEC_SW_VERSION
all: modules
modules_install modules:
rm -f fmc-bus-link
ln -s $(FMC_BUS) fmc-bus-link
$(MAKE) -C $(LINUX) M=$(shell /bin/pwd) $@
ln -s $(FMC_BUS_ABS) fmc-bus-link
$(MAKE) -C $(LINUX) M=$(shell /bin/pwd) FMC_BUS_ABS=$(FMC_BUS_ABS) ZIO_ABS=$(ZIO_ABS) SPEC_SW_ABS=$(SPEC_SW_ABS) $@
rm -f fmc-bus-link
clean:
......
......@@ -365,4 +365,4 @@ module_exit(ft_exit);
MODULE_VERSION(GIT_VERSION);
MODULE_LICENSE("GPL and additional rights"); /* LGPL */
CERN_SUPER_MODULE;
ADDITIONAL_VERSIONS;
......@@ -5,15 +5,18 @@
# build a particular environment.
-include Makefile.specific
# include parent_common.mk for buildsystem's defines
REPO_PARENT=../..
-include $(REPO_PARENT)/parent_common.mk
#ZIO := $(shell ../scripts/check-submodule zio $(ZIO))
ZIO ?= ../zio
ZIO_ABS ?= $(abspath $(ZIO) )
LIB = libfmctdc.a
LOBJ := fmctdc-lib.o
LOBJ += fmctdc-lib-math.o
CFLAGS = -Wall -ggdb -O2 -I../kernel -I$(ZIO)/include $(EXTRACFLAGS)
CFLAGS = -Wall -ggdb -O2 -I../kernel -I$(ZIO_ABS)/include $(EXTRACFLAGS)
DESTDIR ?= /usr/local
......@@ -25,7 +28,7 @@ lib: $(LIB)
$(CC) $(CFLAGS) $*.c $(LDFLAGS) -o $@
$(LIB): $(LOBJ)
ar r $@ $^
$(AR) r $@ $^
clean:
rm -f $(LIB) .depend *.o *~
......
......@@ -3,6 +3,9 @@
# build a particular environment.
-include Makefile.specific
# include parent_common.mk for buildsystem's defines
REPO_PARENT=../..
-include $(REPO_PARENT)/parent_common.mk
DESTDIR ?= /usr/local/
LIBTDC = ../lib/
......@@ -16,13 +19,12 @@ TESTS = fmc-tdc-list \
CFLAGS = -I. -I$(LIBTDC) -I../kernel -Wall $(EXTRACFLAGS)
COMMON_SRCS = test-common.c
LDFLAGS = -L$(LIBTDC) -lfmctdc
LDFLAGS = -L$(LIBTDC)
LDLIBS = -lfmctdc
all: $(TESTS)
%: %.c $(COMMON_SRCS)
$(CC) $(CFLAGS) $*.c $(COMMON_SRCS) $(LDFLAGS) -o $@
$(TESTS): $(COMMON_SRCS:.c=.o)
clean:
rm -f $(TESTS) test-common.o
......
......@@ -123,7 +123,7 @@ int main(int argc, char **argv)
int nblock = 0, buflen = 16;
enum fmctdc_buffer_mode bufmode = FMCTDC_BUFFER_FIFO;
int n_samples = -1;
int fmt_wr = 0, flush = 0, read = 0, last = 0;
int flush = 0, read = 0, last = 0;
char opt;
struct sigaction new_action, old_action;
int ch_valid[FMCTDC_NUM_CHANNELS] = {0, 1, 2, 3, 4};
......
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