summaryrefslogtreecommitdiffstats
path: root/arch/sandbox/Makefile
blob: 4ca17ed83928a866b6a3a77aeb9ab672dfea8f96 (plain)
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

CPPFLAGS += -fno-strict-aliasing

machine-y := sandbox

board-y := arch/sandbox/board
BOARD	:= $(board-y)/
lds-y   := $(BOARD)/barebox.lds


TEXT_BASE = $(CONFIG_TEXT_BASE)

CPPFLAGS += -P
CFLAGS += -Dmalloc=barebox_malloc \
		-Dfree=barebox_free -Drealloc=barebox_realloc \
		-Dread=barebox_read -Dwrite=barebox_write \
		-Dopen=barebox_open -Dclose=barebox_close \
		-Dlseek=barebox_lseek -Dperror=barebox_perror \
		-Derrno=barebox_errno -Dgetc=barebox_getc \
		-Dputc=barebox_putc -Dfgetc=barebox_fgetc \
		-Dfputc=barebox_fputc -Dfgets=barebox_fgets \
		-Dfputs=barebox_fputs -Dsetenv=barebox_setenv \
		-Dgetenv=barebox_getenv -Dprintf=barebox_printf \
		-Dglob=barebox_glob -Dglobfree=barebox_globfree \
		-Dioctl=barebox_ioctl

machdirs := $(patsubst %,arch/sandbox/mach-%/,$(machine-y))

ifeq ($(KBUILD_SRC),)
CPPFLAGS += $(patsubst %,-I%include,$(machdirs))
else
CPPFLAGS += $(patsubst %,-I$(srctree)/%include,$(machdirs))
endif

SUBARCH := $(shell uname -m | sed -e s/i.86/i386/ -e s/sun4u/sparc64/ \
				  -e s/arm.*/arm/ -e s/sa110/arm/ \
				  -e s/s390x/s390/ -e s/parisc64/parisc/ \
				  -e s/ppc.*/powerpc/ -e s/mips.*/mips/ )

ifeq ($(SUBARCH),x86_64)
ELF_ARCH   := i386:x86-64
ELF_FORMAT := elf64-x86-64
ELF_CLASS := ELFCLASS64
endif
ifeq ($(SUBARCH),i386)
ELF_ARCH   := $(SUBARCH)
ELF_FORMAT := elf32-$(SUBARCH)
ELF_CLASS  := ELFCLASS32
endif
ifeq ($(SUBARCH),powerpc)
ELF_ARCH   := powerpc
ELF_FORMAT := elf32-powerpc
ELF_CLASS  := ELFCLASS32
endif

CPPFLAGS += -DELF_CLASS="$(ELF_CLASS)"
export ELF_FORMAT ELF_ARCH SUBARCH ELF_CLASS

archprepare: maketools

PHONY += maketools

cmd_barebox__ = $(CC) -o $@ -Wl,-T,$(barebox-lds) \
	-Wl,--start-group $(barebox-common) -Wl,--end-group \
	-lrt -lpthread

common-y += $(BOARD) arch/sandbox/os/

CLEAN_FILES += $(BOARD)/barebox.lds