1
0
mirror of https://github.com/RIOT-OS/RIOT.git synced 2024-12-29 04:50:03 +01:00
RIOT/boards/native/Makefile.include

91 lines
2.2 KiB
Makefile
Raw Normal View History

include $(RIOTBOARD)/$(BOARD)/Makefile.dep
export NATIVEINCLUDES = -I$(RIOTBOARD)/$(BOARD)/include/
export NATIVEINCLUDES += -I$(RIOTBASE)/core/include/
export NATIVEINCLUDES += -I$(RIOTBASE)/drivers/include/
2013-03-19 22:02:22 +01:00
export CPU = native
2014-02-01 13:16:58 +01:00
export ELF = $(BINDIR)$(PROJECT).elf
2013-03-19 22:02:22 +01:00
2014-02-01 13:16:58 +01:00
# toolchain:
export PREFIX =
export CC ?= $(PREFIX)gcc
export AR = $(PREFIX)ar
2013-03-19 22:02:22 +01:00
export AS = $(PREFIX)as
export LINK = $(PREFIX)gcc
export SIZE = $(PREFIX)size
export OBJCOPY = true
2013-03-19 22:02:22 +01:00
2014-02-01 13:16:58 +01:00
export DEBUGGER = gdb
export TERMPROG = $(ELF)
export FLASHER = true
2013-12-02 11:00:43 +01:00
export VALGRIND ?= valgrind
2014-03-14 12:56:44 +01:00
export CGANNOTATE ?= cg_annotate
export GPROF ?= gprof
2013-03-19 22:02:22 +01:00
2014-02-01 13:16:58 +01:00
# flags:
export CFLAGS += -Wall -Wextra -pedantic -m32
2014-02-01 13:16:58 +01:00
export LINKFLAGS += -m32 -gc -ldl
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
2014-02-14 14:30:16 +01:00
ifneq (,$(filter nativenet,$(USEMODULE)))
2014-02-01 13:16:58 +01:00
export PORT ?= tap0
else
2014-02-01 13:16:58 +01:00
export PORT =
2013-03-19 22:02:22 +01:00
endif
2013-12-02 11:00:43 +01:00
all: # do not override first target
all-gprof: all
2013-12-02 11:00:43 +01:00
all-valgrind: all
all-cachegrind: all
term-valgrind:
2013-12-02 11:00:43 +01:00
# 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:
2014-03-14 12:56:44 +01:00
$(GPROF) $(ELF) $(shell ls -rt gmon.out* | tail -1)
eval-cachegrind:
2014-03-14 12:56:44 +01:00
$(CGANNOTATE) $(shell ls -rt cachegrind.out* | tail -1)