Skip to content

Commit 6565f16

Browse files
committed
src/Makefile: Clean up codal patching after use.
In order to get a non-dirty git hash in the micro:bit version string. Signed-off-by: Damien George <[email protected]>
1 parent 9efa1fe commit 6565f16

File tree

1 file changed

+14
-2
lines changed

1 file changed

+14
-2
lines changed

src/Makefile

Lines changed: 14 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,23 +10,35 @@ SRC_HEX = $(BUILD)/MICROBIT.hex
1010
SRC_MAP = $(CODAL_BUILD)/MICROBIT.map
1111
DEST_HEX = ./MICROBIT.hex
1212

13+
define CODAL_CLEAN
14+
git -C $(CODAL_DIR) checkout CMakeLists.txt
15+
endef
16+
17+
define CODAL_PATCH
18+
$(call CODAL_CLEAN)
19+
cat codal.patch | git -C $(CODAL_DIR) apply -
20+
endef
21+
1322
.PHONY: all codal_build libmicropython clean
1423

1524
all: codal_build
1625

1726
codal_build: libmicropython
27+
$(call CODAL_PATCH)
1828
make -C $(BUILD)
29+
$(call CODAL_CLEAN)
1930
arm-none-eabi-size $(CODAL_BUILD)/MICROBIT
2031
$(PYTHON3) addlayouttable.py $(SRC_HEX) $(SRC_MAP) -o $(DEST_HEX)
2132

2233
libmicropython: $(CODAL_DIR)/libraries
34+
$(call CODAL_CLEAN)
2335
$(MAKE) -C codal_port
2436

2537
$(CODAL_LIBRARIES):
2638
$(MKDIR) -p $(BUILD)
27-
git -C $(CODAL_DIR) checkout CMakeLists.txt
28-
cat codal.patch | git -C $(CODAL_DIR) apply -
39+
$(call CODAL_PATCH)
2940
(cd $(BUILD) && cmake ../$(CODAL_DIR) -DCMAKE_BUILD_TYPE=RelWithDebInfo)
41+
$(call CODAL_CLEAN)
3042

3143
clean:
3244
$(MAKE) -C codal_port clean

0 commit comments

Comments
 (0)