Commit ac799b8e authored by Federico Vaga's avatar Federico Vaga

bld: bring build system to a more standard state

Signed-off-by: Federico Vaga's avatarFederico Vaga <federico.vaga@cern.ch>
parent a65393e9
...@@ -3,13 +3,8 @@ ...@@ -3,13 +3,8 @@
# SPDX-License-Identifier: CC0-1.0 # SPDX-License-Identifier: CC0-1.0
-include Makefile.specific -include Makefile.specific
# include parent_common.mk for buildsystem's defines
# It allows you to inherit an environment configuration from larger project
REPO_PARENT ?= $(shell pwd)/..
-include $(REPO_PARENT)/parent_common.mk -include $(REPO_PARENT)/parent_common.mk
C_DIRS = drivers/zio \ C_DIRS = drivers/zio \
tools tools
...@@ -17,16 +12,14 @@ DIRS = $(C_DIRS) \ ...@@ -17,16 +12,14 @@ DIRS = $(C_DIRS) \
Documentation/core-api/zio \ Documentation/core-api/zio \
Documentation/core-api/zio/img/Makefile Documentation/core-api/zio/img/Makefile
all clean: $(DIRS) all clean install: $(C_DIRS)
clean: TARGET = clean clean: TARGET = clean
install: TARGET = install
$(DIRS): $(DIRS):
$(MAKE) -C $@ $(TARGET) $(MAKE) -C $@ $(TARGET)
modules modules_install:
$(MAKE) -C drivers/zio $@
flawfinder cppcheck: flawfinder cppcheck:
for d in $(C_DIRS); do $(MAKE) -C $$d $@ || exit 1; done for d in $(C_DIRS); do $(MAKE) -C $$d $@ || exit 1; done
.PHONY: all clean modules modules_install cppcheck flawfinder .PHONY: all clean modules modules_install install cppcheck flawfinder $(DIRS)
...@@ -34,6 +34,7 @@ all: modules ...@@ -34,6 +34,7 @@ all: modules
modules coccicheck modules_install clean: modules coccicheck modules_install clean:
$(MAKE) -C $(KERNELSRC) M=$(shell /bin/pwd) $@ $(MAKE) -C $(KERNELSRC) M=$(shell /bin/pwd) $@
install: modules_install
cppcheck: cppcheck:
$(CPPCHECK) -q -I. --suppress=missingIncludeSystem --enable=all *.c *.h $(CPPCHECK) -q -I. --suppress=missingIncludeSystem --enable=all *.c *.h
......
...@@ -14,7 +14,7 @@ ZIO_VERSION += -D__ZIO_MINOR_VERSION=$(shell echo $(GIT_VERSION) | cut -d '-' -f ...@@ -14,7 +14,7 @@ ZIO_VERSION += -D__ZIO_MINOR_VERSION=$(shell echo $(GIT_VERSION) | cut -d '-' -f
ZIO_VERSION += -D__ZIO_PATCH_VERSION=$(shell echo $(GIT_VERSION) | cut -d '-' -f 1 | cut -d '.' -f 3; ) ZIO_VERSION += -D__ZIO_PATCH_VERSION=$(shell echo $(GIT_VERSION) | cut -d '-' -f 1 | cut -d '.' -f 3; )
INCLUDE = -I$(M)/include/ INCLUDE = -I$(M)/include/
CFLAGS = $(INCLUDE) -Wall -Werror $(ZIO_VERSION) $(EXTRACFLAGS) CFLAGS += $(INCLUDE) -Wall -Werror $(ZIO_VERSION) $(EXTRACFLAGS)
CFLAGS += -DGIT_VERSION=\"$(GIT_VERSION)\" CFLAGS += -DGIT_VERSION=\"$(GIT_VERSION)\"
CC ?= $(CROSS_COMPILE)gcc CC ?= $(CROSS_COMPILE)gcc
...@@ -26,7 +26,7 @@ progs += zio-cat-file ...@@ -26,7 +26,7 @@ progs += zio-cat-file
progs += test-dtc progs += test-dtc
# The following is ugly, please forgive me by now # The following is ugly, please forgive me by now
user: $(progs) all: $(progs)
clean: clean:
rm -f $(progs) *~ *.o rm -f $(progs) *~ *.o
...@@ -34,10 +34,22 @@ clean: ...@@ -34,10 +34,22 @@ clean:
%: %.c %: %.c
$(CC) $(CFLAGS) $^ -o $@ $(CC) $(CFLAGS) $^ -o $@
# make nothing for modules_install, but avoid errors
modules_install:
DESTDIR ?=
prefix ?= /usr/local
exec_prefix ?= $(prefix)
bindir ?= $(exec_prefix)/bin
install: $(progs)
mkdir -m 0775 -p $(DESTDIR)$(bindir)
install -D -t $(DESTDIR)$(bindir) -m 0755 $^
cppcheck: cppcheck:
$(CPPCHECK) -q $(INCLUDE) --suppress=missingIncludeSystem --enable=all *.c *.h $(CPPCHECK) -q $(INCLUDE) --suppress=missingIncludeSystem --enable=all *.c *.h
flawfinder: flawfinder:
$(FLAWFINDER) -SQDC --error-level=4 . $(FLAWFINDER) -SQDC --error-level=4 .
.PHONY: flawfinder cppcheck .PHONY: all clean install modules_install flawfinder cppcheck
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