Skip to content

Commit 130a254

Browse files
committed
src/Makefile: Fix build dependencies so make can run in parallel.
Signed-off-by: Damien George <damien@micropython.org>
1 parent 0735d3b commit 130a254

File tree

1 file changed

+11
-6
lines changed

1 file changed

+11
-6
lines changed

src/Makefile

Lines changed: 11 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -19,26 +19,31 @@ define CODAL_PATCH
1919
cat codal.patch | git -C $(CODAL_DIR) apply -
2020
endef
2121

22-
.PHONY: all codal_build libmicropython clean
22+
.PHONY: all codal_cmake codal_build libmicropython clean
2323

2424
all: codal_build
2525

26+
# Create output directory, run cmake, and make sure codal libraries exist (via cmake)
27+
codal_cmake:
28+
$(MKDIR) -p $(BUILD)
29+
$(call CODAL_PATCH)
30+
(cd $(BUILD) && cmake ../$(CODAL_DIR) -DCMAKE_BUILD_TYPE=RelWithDebInfo)
31+
$(call CODAL_CLEAN)
32+
33+
# Build the codal app and make the final HEX file
2634
codal_build: libmicropython
2735
$(call CODAL_PATCH)
2836
make -C $(BUILD)
2937
$(call CODAL_CLEAN)
3038
arm-none-eabi-size $(CODAL_BUILD)/MICROBIT
3139
$(PYTHON3) addlayouttable.py $(SRC_HEX) $(SRC_MAP) -o $(DEST_HEX)
3240

41+
# Build the MicroPython component
3342
libmicropython: $(CODAL_LIBRARIES) $(BUILD)
3443
$(call CODAL_CLEAN)
3544
$(MAKE) -C codal_port
3645

37-
$(CODAL_LIBRARIES) $(BUILD):
38-
$(MKDIR) -p $(BUILD)
39-
$(call CODAL_PATCH)
40-
(cd $(BUILD) && cmake ../$(CODAL_DIR) -DCMAKE_BUILD_TYPE=RelWithDebInfo)
41-
$(call CODAL_CLEAN)
46+
$(CODAL_LIBRARIES) $(BUILD): codal_cmake
4247

4348
clean:
4449
$(MAKE) -C codal_port clean

0 commit comments

Comments
 (0)