forked from OpenIPC/firmware
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Makefile
51 lines (38 loc) · 1.33 KB
/
Makefile
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
BR_VER = 2023.02.1
BR_MAKE = $(MAKE) -C buildroot-$(BR_VER) BR2_EXTERNAL=$(PWD)/general O=$(TARGET)
BR_LINK = https://github.com/buildroot/buildroot/archive/refs/tags
BR_FILE = /tmp/buildroot-$(BR_VER).tar.gz
TARGET ?= $(PWD)/output
ifdef BOARD
CONFIG = $(shell find br-ext-chip-*/configs -type f | grep -m1 $(BOARD))
endif
ifeq ($(CONFIG),)
CONFIG = $(error variable BOARD must be defined to initialize build)
endif
.PHONY: all clean defconfig distclean help prepare toolname
help:
@echo -e "BR-OpenIPC usage:\n \
- make clean - remove defconfig and target folder\n \
- make distclean - remove buildroot and output folder\n \
- make list - show available device configurations\n \
- make info BOARD=<config> - show device information\n \
- make all BOARD=<config> - builds the selected device\n"
all: defconfig
@$(BR_MAKE) all
br-%: defconfig
@$(BR_MAKE) $(subst br-,,$@)
defconfig: prepare
@$(BR_MAKE) BR2_DEFCONFIG=$(PWD)/$(CONFIG) defconfig
prepare:
@test -e $(BR_FILE) || wget -c -q $(BR_LINK)/$(BR_VER).tar.gz -O $(BR_FILE)
@test -e buildroot-$(BR_VER) || tar -xf $(BR_FILE) -C $(PWD)
toolname:
@general/scripts/show_toolchains.sh $(CONFIG)
buildroot-version:
@echo $(BR_VER)
clean:
@rm -rf $(TARGET)/target $(TARGET)/.config
distclean:
@rm -rf buildroot-$(BR_VER) $(BR_FILE) $(TARGET)
list:
@ls -1 br-ext-chip-*/configs