Skip to content

Commit

Permalink
MycroftOS: BNuilding now uses a proper Makefile.
Browse files Browse the repository at this point in the history
- Big thx once again to the HassOS guys.
  • Loading branch information
j1nx committed Dec 10, 2019
1 parent f45287d commit 8b826c7
Show file tree
Hide file tree
Showing 4 changed files with 52 additions and 20 deletions.
43 changes: 43 additions & 0 deletions Makefile
@@ -0,0 +1,43 @@
RELEASE_DIR = release

BUILDROOT=buildroot
BUILDROOT_EXTERNAL=buildroot-external
DEFCONFIG_DIR = $(BUILDROOT_EXTERNAL)/configs

TARGETS := $(notdir $(patsubst %_defconfig,%,$(wildcard $(DEFCONFIG_DIR)/*_defconfig)))
TARGETS_CONFIG := $(notdir $(patsubst %_defconfig,%-config,$(wildcard $(DEFCONFIG_DIR)/*_defconfig)))

.NOTPARALLEL: $(TARGETS) $(TARGETS_CONFIG) all

.PHONY: $(TARGETS) $(TARGETS_CONFIG) all clean help

all: $(TARGETS)

$(RELEASE_DIR):
mkdir -p $(RELEASE_DIR)

$(TARGETS_CONFIG): %-config:
@echo "config $*"
$(MAKE) -C $(BUILDROOT) BR2_EXTERNAL=../$(BUILDROOT_EXTERNAL) "$*_defconfig"

$(TARGETS): %: $(RELEASE_DIR) %-config
@echo "build $@"
$(MAKE) -C $(BUILDROOT) BR2_EXTERNAL=../$(BUILDROOT_EXTERNAL) 2>&1 | tee logs/buildroot_output.txt
cp -f $(BUILDROOT)/output/images/sdcard.img $(RELEASE_DIR)/MycroftOS_$@.img

# Do not clean when building for one target
ifneq ($(words $(filter $(TARGETS),$(MAKECMDGOALS))), 1)
@echo "clean $@"
$(MAKE) -C $(BUILDROOT) BR2_EXTERNAL=../$(BUILDROOT_EXTERNAL) clean
endif
@echo "finished $@"

clean:
$(MAKE) -C $(BUILDROOT) BR2_EXTERNAL=../$(BUILDROOT_EXTERNAL) clean

help:
@echo "Supported targets: $(TARGETS)"
@echo "Run 'make <target>' to build a target image."
@echo "Run 'make all' to build all target images."
@echo "Run 'make clean' to clean the build output."
@echo "Run 'make <target>-config' to configure buildroot for a target."
File renamed without changes.
12 changes: 9 additions & 3 deletions documentation/building.md
Expand Up @@ -17,9 +17,15 @@ If this is the very first time you are going to build an image, you need to exec
This will patch the Buildroot packages.

## Building the image.
We can build the image(s) by running the following command;
Building the image(s) can be done by utilizing a proper Makefile;
<br>
- ./scripts/build.sh
To see the available commands, just run: 'make help'
<br>
At this moment only one image get's build. Namely the one for RPi3. Later on in time this section will get expanded with other possible supported hardware.
As example to build the rpi3 version;<br>
make clean<br>
make rpi3-config<br>
make rpi3<br>
<br>
To build all available buids, run;<br>
make all

17 changes: 0 additions & 17 deletions scripts/build.sh

This file was deleted.

0 comments on commit 8b826c7

Please sign in to comment.