-
Notifications
You must be signed in to change notification settings - Fork 36
/
Makefile
75 lines (58 loc) · 3.01 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
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
RELEASE_DIR = release
BUILDDATE := $(shell date -u +'%Y%m%d_%H%M')
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
#rsync -ah --progress $(BUILDROOT)/output/images/disk.img $(RELEASE_DIR)/OpenVoiceOS_$@_$(BUILDDATE).img
#rsync -ah --progress $(BUILDROOT)/output/images/rootfs.swu $(RELEASE_DIR)/OpenVoiceOS_$@_$(BUILDDATE).swu
#xz -3 -T0 -v -f $(RELEASE_DIR)/OpenVoiceOS_$@_$(BUILDDATE).img
#xz -3 -T0 -v -f $(RELEASE_DIR)/OpenVoiceOS_$@_$(BUILDDATE).swu
xz -2 -v -f -T0 -c $(BUILDROOT)/output/images/disk.img > $(RELEASE_DIR)/OpenVoiceOS_$@_$(BUILDDATE).img.xz
rsync -ah --progress $(BUILDROOT)/output/images/rootfs.swu $(RELEASE_DIR)/OpenVoiceOS_$@_$(BUILDDATE).swu
@if [ $@ = "ova_64" ]; then\
qemu-img convert -O vdi $(RELEASE_DIR)/OpenVoiceOS_$@_$(BUILDDATE).img $(RELEASE_DIR)/OpenVoiceOS_$@_$(BUILDDATE).vdi;\
xz -3 -T0 -v -f -k $(RELEASE_DIR)/OpenVoiceOS_$@_$(BUILDDATE).vdi;\
fi
# 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
menuconfig:
$(MAKE) -C $(BUILDROOT) BR2_EXTERNAL=../$(BUILDROOT_EXTERNAL) menuconfig
linux-check-dotconfig:
$(MAKE) -C $(BUILDROOT) BR2_EXTERNAL=../$(BUILDROOT_EXTERNAL) BR2_CHECK_DOTCONFIG_OPTS="--github-format" linux-check-dotconfig
linux-menuconfig:
$(MAKE) -C $(BUILDROOT) BR2_EXTERNAL=../$(BUILDROOT_EXTERNAL) linux-menuconfig
busybox-menuconfig:
$(MAKE) -C $(BUILDROOT) BR2_EXTERNAL=../$(BUILDROOT_EXTERNAL) busybox-menuconfig
swupdate-menuconfig:
$(MAKE) -C $(BUILDROOT) BR2_EXTERNAL=../$(BUILDROOT_EXTERNAL) swupdate-menuconfig
uclibc-menuconfig:
$(MAKE) -C $(BUILDROOT) BR2_EXTERNAL=../$(BUILDROOT_EXTERNAL) uclibc-menuconfig
savedefconfig:
$(MAKE) -C $(BUILDROOT) BR2_EXTERNAL=../$(BUILDROOT_EXTERNAL) savedefconfig
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 OpenVoiceOS for a target."
@echo "Run 'make menuconfig' to update current config utilising a menu based program."
@echo "Run 'make savedefconfig' to save current config back to config directory."