mirror of
https://github.com/RIOT-OS/RIOT.git
synced 2025-01-18 12:52:44 +01:00
248a8531a5
Sometimes boards/*/Makefile.include (e. g. in case of the msba2) gets included twice somehow, leading the TERMFLAG to be set twice and faulty. This fixes that.
119 lines
2.8 KiB
Makefile
119 lines
2.8 KiB
Makefile
include $(RIOTBOARD)/$(BOARD)/Makefile.dep
|
|
|
|
export NATIVEINCLUDES = -I$(RIOTBOARD)/$(BOARD)/include/
|
|
export NATIVEINCLUDES += -I$(RIOTBASE)/core/include/
|
|
export NATIVEINCLUDES += -I$(RIOTBASE)/drivers/include/
|
|
|
|
export CPU = native
|
|
export ELF = $(BINDIR)$(APPLICATION).elf
|
|
|
|
# toolchain:
|
|
export PREFIX =
|
|
export CC ?= $(PREFIX)gcc
|
|
export CXX ?= $(PREFIX)g++
|
|
export AR ?= $(PREFIX)ar
|
|
export AS ?= $(PREFIX)as
|
|
export LINK ?= $(PREFIX)gcc
|
|
export SIZE ?= $(PREFIX)size
|
|
export OBJCOPY = true
|
|
|
|
export DEBUGGER = gdb
|
|
export TERMPROG = $(ELF)
|
|
export FLASHER = true
|
|
export VALGRIND ?= valgrind
|
|
export CGANNOTATE ?= cg_annotate
|
|
export GPROF ?= gprof
|
|
|
|
# flags:
|
|
export CFLAGS += -Wall -Wextra -pedantic -m32
|
|
ifeq ($(shell uname -s),FreeBSD)
|
|
ifeq ($(shell uname -m),amd64)
|
|
export CFLAGS += -DCOMPAT_32BIT -L/usr/lib32 -B/usr/lib32
|
|
endif
|
|
endif
|
|
|
|
# unwanted (CXXUWFLAGS) and extra (CXXEXFLAGS) flags for c++
|
|
export CXXUWFLAGS +=
|
|
export CXXEXFLAGS +=
|
|
|
|
export LINKFLAGS += -m32
|
|
ifeq ($(shell uname -s),FreeBSD)
|
|
ifeq ($(shell uname -m),amd64)
|
|
export LINKFLAGS += -DCOMPAT_32BIT -L/usr/lib32 -B/usr/lib32
|
|
endif
|
|
export LINKFLAGS += -L $(BINDIR)
|
|
else
|
|
export LINKFLAGS += -ldl
|
|
endif
|
|
|
|
export ASFLAGS =
|
|
export DEBUGGER_FLAGS = $(ELF)
|
|
term-memcheck: export VALGRIND_FLAGS ?= --track-origins=yes
|
|
term-cachegrind: export CACHEGRIND_FLAGS += --tool=cachegrind
|
|
term-gprof: export TERMPROG = GMON_OUT_PREFIX=gmon.out $(ELF)
|
|
all-valgrind: export CFLAGS += -DHAVE_VALGRIND_H -g
|
|
all-valgrind: export NATIVEINCLUDES += $(shell pkg-config valgrind --cflags)
|
|
all-debug: export CFLAGS += -g
|
|
all-cachegrind: export CFLAGS += -g
|
|
all-gprof: export CFLAGS += -pg
|
|
all-gprof: export LINKFLAGS += -pg
|
|
|
|
export INCLUDES += $(NATIVEINCLUDES)
|
|
|
|
# backward compatability with glibc <= 2.17 for native
|
|
ifeq ($(CPU),native)
|
|
ifeq ($(shell uname -s),Linux)
|
|
ifeq ($(shell ldd --version | awk '/^ldd/{if ($$NF < 2.17) {print "yes"} else {print "no"} }'),yes)
|
|
LINKFLAGS += -lrt
|
|
endif
|
|
endif
|
|
endif
|
|
|
|
# clumsy way to enable building native on osx:
|
|
BUILDOSXNATIVE = 0
|
|
ifeq ($(CPU),native)
|
|
ifeq ($(shell uname -s),Darwin)
|
|
BUILDOSXNATIVE = 1
|
|
endif
|
|
endif
|
|
|
|
# set the tap interface for term/valgrind
|
|
ifneq (,$(filter nativenet,$(USEMODULE)))
|
|
export PORT ?= tap0
|
|
else
|
|
export PORT =
|
|
endif
|
|
|
|
ifeq (,$(filter $(PORT),$(TERMFLAGS)))
|
|
export TERMFLAGS += $(PORT)
|
|
endif
|
|
|
|
all: # do not override first target
|
|
|
|
all-debug: all
|
|
|
|
all-gprof: all
|
|
|
|
all-valgrind: all
|
|
|
|
all-cachegrind: all
|
|
|
|
term-valgrind:
|
|
# use this if you want to attach gdb from valgrind:
|
|
# echo 0 > /proc/sys/kernel/yama/ptrace_scope
|
|
# VALGRIND_FLAGS += --db-attach=yes
|
|
$(VALGRIND) $(VALGRIND_FLAGS) $(ELF) $(PORT)
|
|
|
|
term-cachegrind:
|
|
$(VALGRIND) $(CACHEGRIND_FLAGS) $(ELF) $(PORT)
|
|
|
|
term-gprof: term
|
|
|
|
eval-gprof:
|
|
$(GPROF) $(ELF) $(shell ls -rt gmon.out* | tail -1)
|
|
|
|
eval-cachegrind:
|
|
$(CGANNOTATE) $(shell ls -rt cachegrind.out* | tail -1)
|
|
|
|
export UNDEF += $(BINDIR)cpu/startup.o
|