Skip to content

Commit 5ae28a2

Browse files
committed
makefile: added uncrustify target for code format
1 parent 2883171 commit 5ae28a2

File tree

2 files changed

+18
-6
lines changed

2 files changed

+18
-6
lines changed

.Makefile.mk

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,8 @@ TEMPLATEPATH=../.Makefile.template
3838
### default target ###
3939
DEFAULT += help
4040

41+
UNCRUSTIFY_CFG = ./.uncrustify.cfg
42+
4143
### menuconfig targets ###
4244

4345
.PHONY: menuconfig
@@ -121,15 +123,15 @@ TARGET += uncrustify
121123
HELP_uncrustify = formats code with uncrustify
122124
uncrustify: | check-docker
123125
@make --no-print-directory -C $(DOCKERDIR) uncrustify \
124-
EXEC="git ls-files -ico $(forach PATTERN,$(FORMAT),-x $(PATTERN))
126+
EXEC="git ls-files -ico $(foreach PATTERN,$(FORMAT),-x $(PATTERN)) \
125127
| xargs -I % uncrustify -c $(UNCRUSTIFY_CFG) -f % -o %"
126128

127129
.PHONY: check-uncrustify
128130
TARGET += check-uncrustify
129131
HELP_check-uncrustify = check if formatting code with uncrustify is necessary
130132
check-uncrustify: | check-docker
131133
@make --no-print-directory -C $(DOCKERDIR) uncrustify \
132-
EXEC="git ls-files -ico $(forach PATTERN,$(FORMAT),-x $(PATTERN)) \
134+
EXEC="git ls-files -ico $(foreach PATTERN,$(FORMAT),-x $(PATTERN)) \
133135
| xargs -I % sh -c 'uncrustify -c $(UNCRUSTIFY_CFG) -f % \
134136
| git -c color.diff.new='normal 22' \
135137
-c color.diff.old='normal 88' \

docker/uncrustify/Dockerfile

Lines changed: 14 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,26 @@
11
FROM ubuntu:18.04
22
RUN apt-get update && apt-get -y install \
33
git \
4-
uncrustify \
4+
cmake \
5+
g++ \
6+
python3 \
7+
sudo \
58
;
69

710
ARG UID=1000
811
ARG GID=1000
9-
RUN groupadd -g $GID -o developer
10-
RUN useradd -m -u $UID -g $GID -s /bin/bash developer
11-
RUN echo "developer ALL=(ALL) NOPASSWD:ALL" >> /etc/sudoers
12+
RUN groupadd -g $GID -o developer \
13+
&& useradd -m -u $UID -g $GID -s /bin/bash developer \
14+
&& echo "developer ALL=(ALL) NOPASSWD:ALL" >> /etc/sudoers
1215

1316
WORKDIR /home/developer
1417
USER developer
1518
ENV LC_ALL=C.UTF-8 LANG=C.UTF-8
1619

20+
RUN export REPO=/tmp/uncrustify \
21+
&& git clone https://github.com/uncrustify/uncrustify.git $REPO \
22+
&& mkdir $REPO/build \
23+
&& cd $REPO/build \
24+
&& cmake .. \
25+
&& sudo make install \
26+
&& sudo rm -rf $REPO

0 commit comments

Comments
 (0)