Skip to content

Commit

Permalink
split makefile into multiple scripts
Browse files Browse the repository at this point in the history
  • Loading branch information
aler9 committed Aug 23, 2022
1 parent 2683689 commit 6d861c6
Show file tree
Hide file tree
Showing 4 changed files with 52 additions and 53 deletions.
54 changes: 1 addition & 53 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -11,56 +11,4 @@ help:
@echo " test run tests"
@echo ""

define DOCKERFILE_FORMAT
FROM ubuntu:20.04

RUN apt update && apt install -y --no-install-recommends \
clang-format

ENTRYPOINT [ "sh", "-c", "clang-format \
-i \
--style=\"{BasedOnStyle: llvm, IndentWidth: 4}\"\
*.c \
*.h \
orientation/*.c \
orientation/*.h \
test/*.c" ]

endef
export DOCKERFILE_FORMAT

format:
echo "$$DOCKERFILE_FORMAT" | docker build - -t temp
docker run --rm \
-v $(PWD):/s \
-w /s \
temp

define DOCKERFILE_LINT
FROM ubuntu:20.04

RUN apt update && apt install -y --no-install-recommends \
clang-format

ENTRYPOINT [ "sh", "-c", "clang-format \
--dry-run \
--Werror \
--style=\"{BasedOnStyle: llvm, IndentWidth: 4}\"\
*.c \
*.h \
orientation/*.c \
orientation/*.h \
test/*.c" ]

endef
export DOCKERFILE_LINT

lint:
echo "$$DOCKERFILE_LINT" | docker build - -t temp
docker run --rm \
-v $(PWD):/s \
-w /s \
temp

test:
cd test && make build-cross
include scripts/*.mk
24 changes: 24 additions & 0 deletions scripts/format.mk
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
define DOCKERFILE_FORMAT
FROM ubuntu:20.04

RUN apt update && apt install -y --no-install-recommends \
clang-format

ENTRYPOINT [ "sh", "-c", "clang-format \
-i \
--style=\"{BasedOnStyle: llvm, IndentWidth: 4}\"\
*.c \
*.h \
orientation/*.c \
orientation/*.h \
test/*.c" ]

endef
export DOCKERFILE_FORMAT

format:
echo "$$DOCKERFILE_FORMAT" | docker build - -t temp
docker run --rm \
-v $(PWD):/s \
-w /s \
temp
25 changes: 25 additions & 0 deletions scripts/lint.mk
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
define DOCKERFILE_LINT
FROM ubuntu:20.04

RUN apt update && apt install -y --no-install-recommends \
clang-format

ENTRYPOINT [ "sh", "-c", "clang-format \
--dry-run \
--Werror \
--style=\"{BasedOnStyle: llvm, IndentWidth: 4}\"\
*.c \
*.h \
orientation/*.c \
orientation/*.h \
test/*.c" ]

endef
export DOCKERFILE_LINT

lint:
echo "$$DOCKERFILE_LINT" | docker build - -t temp
docker run --rm \
-v $(PWD):/s \
-w /s \
temp
2 changes: 2 additions & 0 deletions scripts/test.mk
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
test:
cd test && make build-cross

0 comments on commit 6d861c6

Please sign in to comment.