Skip to content
Snippets Groups Projects
Commit 61c9f19d authored by Alex Apostolescu's avatar Alex Apostolescu Committed by Razvan Deaconescu
Browse files

Simplify Makefile rules


Export SRC_PATH to run the checker with an extern solution.
Export UTILS_PATH to build libosmem.so is built using utils from checker.
Breakdown 'check' rule into multiple smaller rules.

Signed-off-by: default avatarAlex Apostolescu <alexx.apostolescu@gmail.com>
parent 6c34bc36
No related branches found
No related tags found
No related merge requests found
Pipeline #25245 passed
SRC_PATH ?= ../src
export SRC_PATH ?= $(realpath ../src)
export UTILS_PATH ?= $(realpath ../utils)
CC = gcc
CPPFLAGS = -I../utils
CPPFLAGS = -I$(UTILS_PATH)
CFLAGS = -fPIC -Wall -Wextra -g
LDFLAGS = -L$(SRC_PATH)
LDLIBS = -losmem
......@@ -10,24 +12,26 @@ BUILDDIR = bin
SRCS = $(sort $(wildcard $(SOURCEDIR)/*.c))
BINS = $(patsubst $(SOURCEDIR)/%.c, $(BUILDDIR)/%, $(SRCS))
.PHONY: all clean src check lint
all: src $(BUILDDIR) $(BINS)
.PHONY: all src clean_src bins clean_bins check lint
$(BUILDDIR):
mkdir -p $(BUILDDIR)
$(BUILDDIR)/%: $(SOURCEDIR)/%.c
$(CC) $(CPPFLAGS) $(CFLAGS) -o $@ $^ $(LDFLAGS) $(LDLIBS)
all: src bins
src:
make -C $(SRC_PATH)
check:
clean_src:
make -C $(SRC_PATH) clean
make clean
make -i SRC_PATH=$(SRC_PATH)
SRC_PATH=$(SRC_PATH) python run-tests.py -m
bins: $(BUILDDIR) $(BINS)
clean_bins:
-rm -f *~
-rm -f $(BINS)
check:
make clean_src src
make clean_bins bins
python checker.py
lint:
-cd .. && checkpatch.pl -f src/*.c tests/src/*.c
......@@ -36,6 +40,8 @@ lint:
-cd .. && shellcheck checker/*.sh
-cd .. && pylint tests/*.py
clean:
-rm -f *~
-rm -f $(BINS)
$(BUILDDIR):
mkdir -p $(BUILDDIR)
$(BUILDDIR)/%: $(SOURCEDIR)/%.c
$(CC) $(CPPFLAGS) $(CFLAGS) -o $@ $^ $(LDFLAGS) $(LDLIBS)
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment