~j-harbott/cirros/dev

6 by Scott Moser
add initial makefile
1
ARCH = i386
2
TOP_D = $(shell pwd)
3
BR_D = $(TOP_D)/buildroot
4
OUT_D = $(TOP_D)/output/$(ARCH)
5
BR_OUT_D = $(OUT_D)/buildroot
6
CONF_D = $(TOP_D)/conf
7
DL_D = $(TOP_D)/download
8 by Scott Moser
use BR2_ROOTFS_SKELETON_CUSTOM_PATH to specify a skeleton dir
8
SKEL_D = $(OUT_D)/skeleton
6 by Scott Moser
add initial makefile
9
282 by Scott Moser
Makefile: fix variable assignment quoting.
10
TMPDIR ?= $(OUT_D)/tmp
277 by Scott Moser
Makefile: set TMPDIR and BR2_CCACHE_DIR
11
export TMPDIR
12
6 by Scott Moser
add initial makefile
13
DISK_IMG = $(OUT_D)/disk.img
14
PART_IMG = $(OUT_D)/part.img
15
TAR_IMG = $(OUT_D)/rootfs.tar
16
BR_TAR_IMG = $(BR_OUT_D)/images/rootfs.tar
282 by Scott Moser
Makefile: fix variable assignment quoting.
17
BR2_CCACHE_DIR = $(OUT_D)/ccache
6 by Scott Moser
add initial makefile
18
277 by Scott Moser
Makefile: set TMPDIR and BR2_CCACHE_DIR
19
BR_MAKE = cd $(BR_D) && mkdir -p "$(TMPDIR)" && \
20
   make O=$(BR_OUT_D) BR2_DL_DIR=$(DL_D) \
328 by Scott Moser
fix make br-menuconfig
21
   BR2_CONFIG=$(BR_OUT_D)/.config \
277 by Scott Moser
Makefile: set TMPDIR and BR2_CCACHE_DIR
22
   BUSYBOX_CONFIG_FILE=$(BR_OUT_D)/busybox.config \
23
   BR2_CCACHE_DIR=$(BR2_CCACHE_DIR)
8 by Scott Moser
use BR2_ROOTFS_SKELETON_CUSTOM_PATH to specify a skeleton dir
24
25
BR_DEPS = $(BR_D) $(BR_OUT_D)/busybox.config $(BR_OUT_D)/.config $(SKEL_D)/.dir
6 by Scott Moser
add initial makefile
26
177.1.22 by Scott Moser
Makefile: add BUSYBOX_CONFIG variable
27
BR_CONFIG = $(CONF_D)/buildroot-$(ARCH).config
28
322.2.2 by Scott Moser
update to buildroot 2014.08
29
BUSYBOX_VERSION := $(shell sed -n \
30
   "s,^BUSYBOX_VERSION\s*=\s*\([^\s]*\).*,\1,p" \
31
   $(BR_D)/package/busybox/busybox.mk)
177.1.22 by Scott Moser
Makefile: add BUSYBOX_CONFIG variable
32
BUSYBOX_BUILD_DIR = $(BR_OUT_D)/build/busybox-$(BUSYBOX_VERSION)
33
BUSYBOX_BUILD_CONFIG = $(BUSYBOX_BUILD_DIR)/.config
34
175 by Scott Moser
unset SED in Makefile, now builds on Ubuntu 11.10.
35
unexport SED # causes random issues (LP: #920620)
36
6 by Scott Moser
add initial makefile
37
all: $(TAR_IMG)
38
8 by Scott Moser
use BR2_ROOTFS_SKELETON_CUSTOM_PATH to specify a skeleton dir
39
debug:
40
	@echo "BR_DEPS: $(BR_DEPS)"
41
	@echo "BR_MAKE: $(BR_MAKE)"
42
	@echo "BR_OUT_D: $(BR_OUT_D)"
177.1.22 by Scott Moser
Makefile: add BUSYBOX_CONFIG variable
43
	@echo "BUSYBOX_BUILD_CONFIG: $(BUSYBOX_BUILD_CONFIG)"
322.2.2 by Scott Moser
update to buildroot 2014.08
44
	@echo "BUSYBOX_VERSION: $(BUSYBOX_VERSION)"
8 by Scott Moser
use BR2_ROOTFS_SKELETON_CUSTOM_PATH to specify a skeleton dir
45
6 by Scott Moser
add initial makefile
46
source: br_source minicloud_source
47
48
br_source: $(BR_DEPS) $(OUT_D)/.source.$(ARCH)
49
minicloud_source: $(DL_D)/.dir
50
	@echo hi world
51
	# here we would download the Ubuntu kernel
52
53
$(BR_D):
54
	@[ -d "$(BR_D)" ] || { echo "You Must download BUILDROOT, extract it, and symlink to $(BR_D)"; exit 1; }
55
56
$(OUT_D)/.source.$(ARCH): 
57
	$(BR_MAKE) source
58
59
$(BR_OUT_D)/busybox.config: $(CONF_D)/busybox.config $(BR_OUT_D)/.dir
60
	cp $(CONF_D)/busybox.config $@
326.1.11 by Scott Moser
fix up makefile duplication
61
	for s in configured built target_installed; do rm -f $(BR_OUT_D)/build/busybox-*/.stamp_$$s; done
6 by Scott Moser
add initial makefile
62
177.1.22 by Scott Moser
Makefile: add BUSYBOX_CONFIG variable
63
$(BR_OUT_D)/.config: $(BR_CONFIG) $(BR_OUT_D)/.dir
64
	cp $(BR_CONFIG) $@
6 by Scott Moser
add initial makefile
65
66
$(TAR_IMG): $(BR_TAR_IMG)
67
	cp $(BR_TAR_IMG) $(TAR_IMG)
68
69
$(BR_TAR_IMG): $(BR_DEPS)
70
	$(BR_MAKE)
71
8 by Scott Moser
use BR2_ROOTFS_SKELETON_CUSTOM_PATH to specify a skeleton dir
72
$(SKEL_D)/.dir:
73
	# copy BR_D/fs/skeleton, then sync src/ over the
74
	# top of that.
75
	# depends on $(BR_D)/fs/skeleton (somehow)
12 by Scott Moser
add a 'br-%' rule for 'br-menuconfig' or the like
76
	[ -d $(SKEL_D) ] || mkdir -p $(SKEL_D)
322.2.2 by Scott Moser
update to buildroot 2014.08
77
	rsync -a $(BR_D)/system/skeleton/ $(SKEL_D)/ --delete
12 by Scott Moser
add a 'br-%' rule for 'br-menuconfig' or the like
78
	rsync -a $(TOP_D)/src/ $(SKEL_D)/
79
	touch $(SKEL_D)/.dir
80
107 by Scott Moser
Makefile: add better 'br-menuconfig' rule that copies config back
81
br-menuconfig: $(BR_OUT_D)/.config
82
	$(BR_MAKE) $* menuconfig
83
	cp $(BR_OUT_D)/.config $(CONF_D)/buildroot-$(ARCH).config
138 by Scott Moser
add a br-busybox-menuconfig command
84
326.1.6 by Scott Moser
Makefile update br-busybox-menuconfig target
85
br-busybox-menuconfig: $(BR_OUT_D)/busybox.config
138 by Scott Moser
add a br-busybox-menuconfig command
86
	$(BR_MAKE) $* busybox-menuconfig
177.1.22 by Scott Moser
Makefile: add BUSYBOX_CONFIG variable
87
	cp $(BUSYBOX_BUILD_CONFIG) $(CONF_D)/busybox.config
138 by Scott Moser
add a br-busybox-menuconfig command
88
172 by Scott Moser
support make br-source for downloading sources
89
br-%: $(BR_OUT_D)/.config $(BR_OUT_D)/busybox.config
12 by Scott Moser
add a 'br-%' rule for 'br-menuconfig' or the like
90
	$(BR_MAKE) $*
8 by Scott Moser
use BR2_ROOTFS_SKELETON_CUSTOM_PATH to specify a skeleton dir
91
6 by Scott Moser
add initial makefile
92
%/.dir:
93
	mkdir -p $* && touch $@