88 lines
2.6 KiB
Makefile
88 lines
2.6 KiB
Makefile
############################################################################
|
|
# arch/arm/src/Makefile
|
|
#
|
|
# SPDX-License-Identifier: Apache-2.0
|
|
#
|
|
# Licensed to the Apache Software Foundation (ASF) under one or more
|
|
# contributor license agreements. See the NOTICE file distributed with
|
|
# this work for additional information regarding copyright ownership. The
|
|
# ASF licenses this file to you under the Apache License, Version 2.0 (the
|
|
# "License"); you may not use this file except in compliance with the
|
|
# License. You may obtain a copy of the License at
|
|
#
|
|
# http://www.apache.org/licenses/LICENSE-2.0
|
|
#
|
|
# Unless required by applicable law or agreed to in writing, software
|
|
# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
|
|
# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
|
|
# License for the specific language governing permissions and limitations
|
|
# under the License.
|
|
#
|
|
############################################################################
|
|
|
|
TOOLCHAIN_NAME := $(notdir ${TOOLCHAIN})
|
|
TOOLCHAIN_NAME := $(basename ${TOOLCHAIN_NAME})
|
|
|
|
VPATH += ${ARCH_DIR}/common
|
|
include ${ARCH_DIR}/common/Make.defs
|
|
|
|
VPATH += ${ARCH_DIR}/${ARCH_FAMILY}
|
|
include ${ARCH_DIR}/${ARCH_FAMILY}/Make.defs
|
|
|
|
VPATH += ${ARCH_DIR}/${TOOLCHAIN_NAME}
|
|
|
|
$(info TOOLCHAIN: ${TOOLCHAIN})
|
|
INCLUDES := ${INCDIR_PREFIX}${NXBASE}/include
|
|
INCLUDES += ${INCDIR_PREFIX}${NXBASE}/include/chip
|
|
INCLUDES += ${INCDIR_PREFIX}${NXBASE}/sched
|
|
INCLUDES += ${INCDIR_PREFIX}${ARCH_DIR}/common
|
|
|
|
DEFINES = -D__KERNEL__
|
|
|
|
CFLAGS += ${INCLUDES}
|
|
CFLAGS += ${DEFINES}
|
|
|
|
AFLAGS += ${INCLUDES}
|
|
CFLAGS += ${DEFINES}
|
|
AFLAGS += -D__ASSEMBLY__
|
|
|
|
BIN = libarch.a
|
|
|
|
STARTUP_OBJS = $(STARTUP_CSRC:.c=.o)
|
|
STARTUP_OBJS := $(addprefix ${NXOUT}/, ${STARTUP_OBJS})
|
|
|
|
HEAD_OBJS = $(HEAD_ASRC:.S=.o)
|
|
HEAD_OBJS := $(addprefix ${NXOUT}/, ${HEAD_OBJS})
|
|
|
|
COBJS = $(CSRCS:.c=.o)
|
|
COBJS := $(addprefix ${NXOUT}/, ${COBJS})
|
|
|
|
AOBJS = $(ASRCS:.S=.o)
|
|
AOBJS := $(addprefix ${NXOUT}/, ${AOBJS})
|
|
|
|
OBJS = ${STARTUP_OBJS} ${HEAD_OBJ} ${COBJS} ${AOBJS}
|
|
|
|
${STARTUP_OBJS} ${COBJS}: ${NXOUT}/%.o: %.c
|
|
$(call COMPILE, $<, $@, -MMD)
|
|
|
|
${HEAD_OBJS} ${AOBJS}: ${NXOUT}/%.o: %.S
|
|
$(call ASSEMBLE, $<, $@, -MMD)
|
|
|
|
symlink:
|
|
$(call LINK, ${ARCH_DIR}/include, ${NXBASE}/include/arch)
|
|
$(call LINK, ${NXBASE}/soc/arm/include/${ARCH_CHIP}, ${NXBASE}/include/chip)
|
|
$(call LINK, ${NXOUT}/config.h, ${NXBASE}/include/nuttx/config.h)
|
|
|
|
unlink:
|
|
$(call UNLINK, ${NXBASE}/include/arch)
|
|
$(call UNLINK, ${NXBASE}/include/chip)
|
|
$(call UNLINK, ${NXBASE}/include/nuttx/config.h)
|
|
|
|
${BIN}: ${OBJS}
|
|
$(call ARCHIVE, ${NXOUT}/$@, $^)
|
|
|
|
.PHONY: symlink unlink all
|
|
.IGNORE: ${BIN}
|
|
|
|
all: symlink ${BIN} unlink
|
|
|