-
Notifications
You must be signed in to change notification settings - Fork 0
/
Makefile
73 lines (57 loc) · 2.21 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
CROSS_COMPILE?=
ARCH?=x86
KDIR=kernel
KTARGET=kbuild
KGIT=git://github.com/torvalds/linux.git
KDEFCONFIG=allyesconfig
KARCH=$(ARCH)
UDIR=uboot
UTARGET=ubuild
UGIT=git://git.denx.de/u-boot.git
UDEFCONFIG=sandbox_defconfig
UARCH=sandbox
KMOD_DIR=kmod
.DEFAULT: help
.PHONY: help all clean purge $(KTARGET) $(UTARGET) $(KMOD_DIR)
help:
@echo "Supported targets:"
@echo " all\t- builds everything"
@echo " clean\t- cleans everything"
@echo " purge\t- cleans everything (completly)"
@echo " remove\t- deletes $(UDIR) and $(KDIR)"
@echo " $(KDIR)\t- gets kernel source"
@echo " $(UDIR)\t- gets u-boot source"
@echo " $(KTARGET)\t- builds kernel"
@echo " $(UTARGET)\t- builds U-Boot"
@echo " $(KMOD_DIR)\t- builds kernel module template"
all: $(KTARGET) $(UTARGET)
@$(MAKE) $(KMOD_DIR)
$(KTARGET): $(KDIR)/.config
@$(MAKE) -C $(KDIR) ARCH=$(KARCH) CROSS_COMPILE=$(CROSS_COMPILE) all
$(KDIR)/.config: $(KDIR)
@$(MAKE) -C $(KDIR) ARCH=$(KARCH) CROSS_COMPILE=$(CROSS_COMPILE) $(KDEFCONFIG)
@$(MAKE) -C $(KDIR) ARCH=$(KARCH) CROSS_COMPILE=$(CROSS_COMPILE) silentoldconfig
$(KDIR):
@git clone $(KGIT) -b master $(KDIR)
$(UTARGET): $(UDIR)/.config
@$(MAKE) -C $(UDIR) ARCH=$(UARCH) CROSS_COMPILE=$(CROSS_COMPILE)
$(UDIR)/.config: $(UDIR)
@$(MAKE) -C $(UDIR) ARCH=$(UARCH) CROSS_COMPILE=$(CROSS_COMPILE) $(UDEFCONFIG)
@$(MAKE) -C $(UDIR) ARCH=$(UARCH) CROSS_COMPILE=$(CROSS_COMPILE) silentoldconfig
$(UDIR):
@git clone $(UGIT) -b master $(UDIR)
$(KMOD_DIR): $(KTARGET)
@$(MAKE) -C $(KMOD_DIR) ARCH=$(KARCH) CROSS_COMPILE=$(CROSS_COMPILE) KDIR=$(CURDIR)/$(KDIR) all
clean: $(KDIR) $(UDIR)
@$(MAKE) -C $(KMOD_DIR) ARCH=$(KARCH) CROSS_COMPILE=$(CROSS_COMPILE) KDIR=$(CURDIR)/$(KDIR) clean
@$(MAKE) -C $(KDIR) ARCH=$(KARCH) CROSS_COMPILE=$(CROSS_COMPILE) clean
@$(MAKE) -C $(UDIR) ARCH=$(UARCH) CROSS_COMPILE=$(CROSS_COMPILE) clean
purge: $(KDIR) $(UDIR)
@$(MAKE) -C $(KMOD_DIR) ARCH=$(KARCH) CROSS_COMPILE=$(CROSS_COMPILE) KDIR=$(CURDIR)/$(KDIR) clean
@$(MAKE) -C $(KDIR) ARCH=$(KARCH) CROSS_COMPILE=$(CROSS_COMPILE) mrproper
@$(MAKE) -C $(UDIR) ARCH=$(UARCH) CROSS_COMPILE=$(CROSS_COMPILE) distclean
remove:
@echo " [RM] Removing $(KDIR)..."
@rm -rf $(CURDIR)/$(KDIR)
@echo " [RM] Removing $(UDIR)..."
@rm -rf $(CURDIR)/$(UDIR)