forked from fabo-corp/phabos
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Makefile
73 lines (54 loc) · 1.66 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
# Copyright (C) 2014-2015 Fabien Parent. All rights reserved.
# Author: Fabien Parent <[email protected]>
#
# Provided under the three clause BSD license found in the LICENSE file.
export
KERNEL_NAME ?= phabos
KERNEL_ROOT := $(shell pwd)
SHELL := /bin/bash
MAKEFILES := scripts/Makefile.build
ifeq (${MAKELEVEL}, 0)
all: $(KERNEL_NAME).elf
clean:
$(MAKE) -f scripts/Makefile.common dir=. $@
endif
CONFIG := $(wildcard .config)
ifneq ($(CONFIG),)
include $(CONFIG)
endif
include scripts/Makefile.build
include arch/$(ARCH)/Makefile.build
subdirs-y := arch drivers kernel lib
clean-y := config.h $(KERNEL_NAME).elf objects.lst
linker-y += kernel/kernel.ld
linker_files = $(foreach linker-file,$(linker-y), -T $(linker-file))
.config:
echo "ERROR: No config file loaded."
exit 1
%_defconfig:
cp arch/${ARCH}/configs/$@ .config
echo "Loading $@..."
config.h: .config
$(call generate-config)
distclean: clean
$(MAKE) -C ./scripts/ distclean
libc:
$(MAKE) -C ./scripts/ libc
$(KERNEL_NAME).elf: config.h libc
rm -f objects.lst
$(MAKE) -f scripts/Makefile.common dir=. all
$(call build,LD)
$(LD) $(LDFLAGS) $(linker_files) -o $@ \
`cat objects.lst | tr '\n' ' '` libc/lib/libc.a
menuconfig: scripts/kconfig-frontends/bin/kconfig-mconf
scripts/kconfig-frontends/bin/kconfig-mconf Kconfig
nconfig: scripts/kconfig-frontends/bin/kconfig-mconf
scripts/kconfig-frontends/bin/kconfig-nconf Kconfig
config: scripts/kconfig-frontends/bin/kconfig-mconf
scripts/kconfig-frontends/bin/kconfig-conf Kconfig
scripts/kconfig-frontends/bin/kconfig-%:
$(MAKE) -C ./scripts/ $(subst scripts/kconfig-frontends/bin/,,$@)
.PHONY: $(KERNEL_NAME).elf
ifndef VERBOSE
.SILENT:
endif