Blame view

RIOT/boards/x86-multiboot-common/Makefile.include 2.3 KB
a752c7ab   elopes   add first test an...
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
  ifeq (, $(NEWLIB_BASE))
    NEWLIB_BASE := $(RIOTBASE)/toolchain/x86/i586-none-elf
  endif
  
  ifneq (0, $(shell test -e "$(NEWLIB_BASE)/lib/libc.a" && echo $$?))
    NEWLIB_PRECOMPILED_NAME := i586-newlib_2.2.0.20150623_tlsf-3337.tar.bz2
    NEWLIB_PRECOMPILED := http://download.riot-os.org/$(NEWLIB_PRECOMPILED_NAME)
    NEWLIB_PRECOMPILED_MD5 := 8090a768cf0294b259fe7ad904d085c7
  
    $(warning Precompiled newlib is missing in $(NEWLIB_BASE))
    $(warning Downloading from $(NEWLIB_PRECOMPILED))
  
    $(shell cd $(RIOTBASE) && $(DLCACHE) "$(NEWLIB_PRECOMPILED)" 8090a768cf0294b259fe7ad904d085c7 - | tar xj)
  endif
  
  ifeq (,$(BUILD_INCLUDE_BASE))
    GCC_BUILD_TRIPLET ?= $(shell gcc -dumpmachine)
    GCC_BUILD_VERSION ?= $(shell gcc -dumpversion)
    BUILD_INCLUDE_BASE = /usr/lib/gcc/$(GCC_BUILD_TRIPLET)/$(GCC_BUILD_VERSION)
  
    ifeq (,$(shell echo $(GCC_BUILD_TRIPLET) | sed -e 's,-.*,,' | grep -e '\(x\|i[3-7]\)86'))
      $(warning Your build machine is a(n) $(GCC_BUILD_TRIPLET).)
      $(warning Since this is not IA32 compatible, you must set BUILD_INCLUDE_BASE explicitly!)
    endif
  endif
  
  export INCLUDES += -isystem $(BUILD_INCLUDE_BASE)/include \
                     -isystem $(NEWLIB_BASE)/include \
                     -isystem $(NEWLIB_BASE)/sys-include \
                     -isystem $(BUILD_INCLUDE_BASE)/include-fixed \
                     -I$(RIOTBOARD)/x86-multiboot-common/include
  export CPU = x86
  
  # toolchain config
  export CC ?= $(PREFIX)gcc
  ifeq ($(LTO),1)
    export AR = $(PREFIX)gcc-ar
  else
    export AR = $(PREFIX)ar
  endif
  export AS ?= $(PREFIX)as
  export RANLIB ?= $(PREFIX)ranlib
  export LINK ?= $(RIOTBASE)/boards/x86-multiboot-common/dist/link $(PREFIX)gcc
  export SIZE ?= $(PREFIX)size
  export OBJCOPY ?= $(PREFIX)objcopy
  
  export CFLAGS += -m32 -mfpmath=387 -ffreestanding -nostdlib -nostdinc -fno-builtin
  export OFLAGS = -O binary
  
  LINKFLAGS += -m32 -nostdlib -nostdinc -nostartfiles -nodefaultlibs \
               --prefix=$(NEWLIB_BASE) \
               -Wl,-rpath,$(NEWLIB_BASE)/lib \
               -T$(RIOTBASE)/boards/x86-multiboot-common/linker.ld
  
  # clean up unused functions
  export CFLAGS += -ffunction-sections -fdata-sections
  export LINKFLAGS += -Wl,--gc-sections
  
  UNDEF += $(BINDIR)/x86-multiboot-common/startup.o
  
  BASELIBS += $(NEWLIB_BASE)/lib/libc.a \
              $(NEWLIB_BASE)/lib/libm.a
  
  all:
  
  all-debug: export CFLAGS += -ggdb3 -O0
  all-debug: all