Commit 4a28a0da authored by Federico Vaga's avatar Federico Vaga

Merge branch '11-rebuild-for-debian-12-and-install' into 'master'

Resolve "rebuild for debian 12 and install"

Closes #11

See merge request be-cem-edl/fec/hardware-modules/fmc!6
parents cce5f3a5 a0acb37c
Pipeline #4912 failed
......@@ -3,6 +3,8 @@
# SPDX-FileCopyrightText: 2019 CERN
---
variables:
GIT_DEPTH: 0
include:
- project: 'be-cem-edl/evergreen/gitlab-ci'
......@@ -36,10 +38,10 @@ documentation:
paths:
- $EDL_CI_EOS_OUTPUT_DIR
kernel_build_cc7:
extends: .kernel_build_cc7
software_build:
extends: .build_fec_os_sw
variables:
EDL_CI_KBUILD_PATHS: drivers/fmc
EDL_CI_SW_PATHS: .
kernel_build_validation:
extends: .kernel_build_validation
......@@ -3,16 +3,22 @@
# SPDX-FileCopyrightText: 2019 CERN
C_DIRS = \
tools \
tools/lib \
drivers/fmc
DIRS = $(C_DIRS) \
Documentation/fmc
DIRS = $(C_DIRS)
ifeq ($(shell bash -c 'which sphinx-build > /dev/zero; echo $$?'),0)
DIRS += Documentation/fmc
endif
all clean cleanall install: $(DIRS)
clean: TARGET = clean
cleanall: TARGET = cleanall
install: TARGET = install
tools: tools/lib
$(DIRS):
$(MAKE) -C $@ $(TARGET)
......
......@@ -22,6 +22,7 @@ clean modules help modules_install coccicheck:
cleanall: clean
modules_install: modules
install: modules_install
cppcheck:
......
......@@ -8,18 +8,16 @@
-include Makefile.specific
DESTDIR ?= /usr/local/
LIB = ./lib/
LIB = ./lib
TOOLS = lsfmc \
fmc-slot-eeprom
CFLAGS = -ggdb -I. -I$(LIB) -I../include/uapi/ -I../kernel -Wall -Werror $(EXTRACFLAGS)
CFLAGS += -ggdb -I. -I$(LIB) -I../include/uapi/ -I../kernel -Wall -Werror $(EXTRACFLAGS)
GIT_VERSION := $(shell git describe --dirty --long --tags)
CFLAGS += -DGIT_VERSION="\"$(GIT_VERSION)\""
LDFLAGS = -L$(LIB)
LDLIBS = -lfmc
LDLIBS += $(LIB)/libfmc.a
CPPCHECK ?= cppcheck
FLAWFINDER ?= flawfinder
......@@ -27,7 +25,7 @@ FLAWFINDER ?= flawfinder
all: $(TOOLS)
$(TOOLS): $(COMMON_SRCS:.c=.o) $(LIB)/libfmc.a
$(TOOLS): $(LIB)/libfmc.a
$(LIB)/libfmc.a:
@$(MAKE) -C $(shell dirname $@)
......@@ -36,9 +34,14 @@ clean cleanall:
@$(MAKE) -C $(LIB) $@
rm -f $(TOOLS)
install:
install -d $(DESTDIR)/bin
install -D $(TOOLS) $(DESTDIR)/bin
DESTDIR ?=
prefix ?= /usr/local
exec_prefix ?= $(prefix)
bindir ?= $(exec_prefix)/bin
install: all
mkdir -m 0775 -p $(DESTDIR)$(bindir)
install -D -t $(DESTDIR)$(bindir) -m 0755 $(TOOLS)
cppcheck:
@$(MAKE) -C $(LIB) $@
......
......@@ -17,19 +17,17 @@ LIBS = libfmc.so
LIBS_XYZ = $(LIBS).$(SO_VERSION_XYZ)
LOBJ := libfmc.o ipmifru.o
CFLAGS = -Wall -Werror -ggdb -O2 -I. -I../../include/uapi
CFLAGS += -Wall -Werror -ggdb -O2 -I. -I../../include/uapi
CFLAGS += -fPIC
CFLAGS += -DGIT_VERSION="\"$(GIT_VERSION)\""
CFLAGS += $(EXTRACFLAGS)
DESTDIR ?= /usr/local
CPPCHECK ?= cppcheck
FLAWFINDER ?= flawfinder
all: lib
lib: $(LIB) $(LIBS_XYZ)
lib: $(LIB) $(LIBS_XYZ) $(LIBS)
%: %.c $(LIB)
$(CC) $(CFLAGS) $*.c $(LDFLAGS) -o $@
......@@ -38,23 +36,30 @@ $(LIB): $(LOBJ)
$(AR) r $@ $^
$(LIBS_XYZ): $(LIB)
$(CC) -shared -o $@ -Wl,--whole-archive,-soname,$@ $^ -Wl,--no-whole-archive
$(CC) -shared -o $@ -Wl,--whole-archive,-soname,$(LIBS).$(SO_VERSION_X) $^ -Wl,--no-whole-archive
$(LIBS): $(LIBS_XYZ)
ln -sf $< $@
clean cleanall:
rm -f $(LIB) $(LIBS_XYZ) .depend *.o *~
rm -f $(LIB) $(LIBS_XYZ) $(LIBS) .depend *.o *~
.depend: Makefile $(wildcard *.c *.h ../*.h)
$(CC) $(CFLAGS) -M $(LOBJ:.o=.c) -o $@
install:
install -d $(DESTDIR)/lib
install -d $(DESTDIR)/include/fmc
install -m 644 -D $(LIB) $(DESTDIR)/lib
install -m 0755 $(LIBS_XYZ) $(DESTDIR)/lib
install -m 644 -D libfmc.h $(DESTDIR)/include/fmc
ln -sf $(LIBS_XYZ) $(DESTDIR)/lib/$(LIBS).$(SO_VERSION_X)
ln -sf $(LIBS).$(SO_VERSION_X) $(DESTDIR)/lib/$(LIBS)
DESTDIR ?=
prefix ?= /usr/local
libdir ?= $(prefix)/lib
includedir ?= $(prefix)/include
install: $(LIB) $(LIBS) $(LIBS_XYZ)
mkdir -m 0775 -p $(DESTDIR)$(libdir) $(DESTDIR)$(includedir)/fmc/linux/ipmi $(DESTDIR)$(includedir)/fmc/fmc
install -D -t $(DESTDIR)$(libdir) -m 0644 $(LIB)
install -D -t $(DESTDIR)$(libdir) -m 0755 $(LIBS_XYZ)
install -D -t $(DESTDIR)$(includedir)/fmc/fmc -m 0644 fmc/core.h
install -D -t $(DESTDIR)$(includedir)/fmc/linux/ipmi -m 0644 ../../include/uapi/linux/ipmi/fru.h
cp -d $(LIBS) $(DESTDIR)$(libdir)
modules_install:
......
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