forked from phoenix-rtos/phoenix-rtos-kernel
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathMakefile
More file actions
75 lines (56 loc) · 1.94 KB
/
Makefile
File metadata and controls
75 lines (56 loc) · 1.94 KB
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
#
# Makefile for phoenix-rtos-kernel
#
# Copyright 2018, 2019 Phoenix Systems
#
# %LICENSE%
#
VERSION="2.97 rev: $(shell git rev-parse --short HEAD)"
CONSOLE?=vga
KERNEL=1
SIL ?= @
MAKEFLAGS += --no-print-directory
include ../phoenix-rtos-build/Makefile.common
include ../phoenix-rtos-build/Makefile.$(TARGET_SUFF)
# TODO: replace BOARD_CONFIG usage with board_config.h
CFLAGS += $(BOARD_CONFIG)
CFLAGS += -I. -I$(PROJECT_PATH)/
CFLAGS += -DVERSION=\"$(VERSION)\"
# uncomment to enable stack canary checking
# CFLAGS += -DSTACK_CANARY
EXTERNAL_HEADERS_DIR := ./include
EXTERNAL_HEADERS := $(shell find $(EXTERNAL_HEADERS_DIR) -name \*.h)
SYSROOT := $(shell $(CC) $(CFLAGS) -print-sysroot)
HEADERS_INSTALL_DIR := $(SYSROOT)/usr/include/phoenix
ifeq (/,$(SYSROOT))
$(error Sysroot is not supported by toolchain. Use Phoenix-RTOS cross-toolchain to compile)
endif
OBJS = $(addprefix $(PREFIX_O), main.o syscalls.o syspage.o usrv.o)
all: $(PREFIX_PROG_STRIPPED)phoenix-$(TARGET_FAMILY)-$(TARGET_SUBFAMILY).elf
include hal/$(TARGET_SUFF)/Makefile
include vm/Makefile
include proc/Makefile
include posix/Makefile
include lib/Makefile
include test/Makefile
include log/Makefile
$(PREFIX_PROG)phoenix-$(TARGET_FAMILY)-$(TARGET_SUBFAMILY).elf: $(OBJS)
@mkdir -p $(@D)
@(printf "LD %-24s\n" "$(@F)");
$(SIL)$(LD) $(LDFLAGS) -e _start --section-start .init=$(VADDR_KERNEL_INIT) -o $@ $(OBJS) $(GCCLIB)
install-headers: $(EXTERNAL_HEADERS)
@printf "Installing kernel headers\n"
@mkdir -p "$(HEADERS_INSTALL_DIR)"; \
for file in $(EXTERNAL_HEADERS); do\
mkdir -p "$(HEADERS_INSTALL_DIR)/`dirname $${file#$(EXTERNAL_HEADERS_DIR)}`"; \
install -p -m 644 $${file} "$(HEADERS_INSTALL_DIR)/$${file#$(EXTERNAL_HEADERS_DIR)}";\
done
uninstall-headers:
rm -rf "$(HEADERS_INSTALL_DIR)"/*
.PHONY: clean install-headers uninstall-headers
clean:
@echo "rm -rf $(BUILD_DIR)"
ifneq ($(filter clean,$(MAKECMDGOALS)),)
$(shell rm -rf $(BUILD_DIR))
$(shell rm -f string/*.inc)
endif