1 | |
---|
2 | # define absolute path to almos-mkh directory |
---|
3 | ALMOSMKH_DIR = /Users/alain/soc/almos-mkh |
---|
4 | |
---|
5 | # Select the libc |
---|
6 | LIBC_NAME = mini-libc |
---|
7 | #LIBC_NAME = newlib |
---|
8 | |
---|
9 | # Select the target architecture |
---|
10 | ARCH_NAME = tsar_mips32 |
---|
11 | #ARCH_NAME = x86_64 |
---|
12 | |
---|
13 | # check |
---|
14 | ifeq ($(ALMOSMKH_DIR),) |
---|
15 | $(error Please define ALMOSMKH_DIR parameter in params-soft.mk!) |
---|
16 | endif |
---|
17 | |
---|
18 | ifeq ($(ARCH_NAME),) |
---|
19 | $(error Please define ARCH_NAME parameter in params-soft.mk!) |
---|
20 | endif |
---|
21 | |
---|
22 | ifeq ($(LIBC_NAME),) |
---|
23 | $(error Please define LIBC_NAME parameter in params-soft.mk!) |
---|
24 | endif |
---|
25 | |
---|
26 | # define path for LIBC |
---|
27 | ifeq ($(LIBC_NAME), mini-libc) |
---|
28 | LIBC_PATH = $(ALMOSMKH_DIR)/libs/mini-libc/ |
---|
29 | LIBC = $(LIBC_PATH)/build/lib/ |
---|
30 | LIBC_INCLUDE = $(LIBC_PATH)/build/include/ |
---|
31 | endif |
---|
32 | ifeq ($(LIBC_NAME), newlib) |
---|
33 | ifeq ($(ARCH_NAME), tsar_mips32) |
---|
34 | ARCH_NEWLIB=mipsel |
---|
35 | endif |
---|
36 | #TODO for x86 |
---|
37 | LIBC_PATH = $(ALMOSMKH_DIR)/libs/newlib/ |
---|
38 | LIBC = $(LIBC_PATH)/build/$(ARCH_NEWLIB)-almosmkh/lib/ |
---|
39 | LIBC_INCLUDE = $(LIBC_PATH)/build/$(ARCH_NEWLIB)-almosmkh/include/ |
---|
40 | endif |
---|
41 | |
---|
42 | # define paths for LIBPTHREAD |
---|
43 | LIBPTHREAD_PATH = $(ALMOSMKH_DIR)/libs/libpthread/ |
---|
44 | LIBPTHREAD = $(LIBPTHREAD_PATH)/build/lib/ |
---|
45 | LIBPTHREAD_INCLUDE = $(LIBPTHREAD_PATH)/build/include/ |
---|
46 | |
---|
47 | # define paths for LIBSEMAPHORE |
---|
48 | LIBSEMAPHORE_PATH = $(ALMOSMKH_DIR)/libs/libsemaphore |
---|
49 | LIBSEMAPHORE = $(LIBSEMAPHORE_PATH)/build/lib/ |
---|
50 | LIBSEMAPHORE_INCLUDE = $(LIBSEMAPHORE_PATH)/build/include/ |
---|
51 | |
---|
52 | # define paths for LIBMATH |
---|
53 | LIBMATH_PATH = $(ALMOSMKH_DIR)/libs/libmath |
---|
54 | LIBMATH = $(LIBMATH_PATH)/build/lib/ |
---|
55 | LIBMATH_INCLUDE = $(LIBMATH_PATH)/build/include/ |
---|
56 | |
---|
57 | # define paths for LIBALMOSMKH |
---|
58 | LIBALMOSMKH_PATH = $(ALMOSMKH_DIR)/libs/libalmosmkh |
---|
59 | LIBALMOSMKH = $(LIBALMOSMKH_PATH)/build/lib/ |
---|
60 | LIBALMOSMKH_INCLUDE = $(LIBALMOSMKH_PATH)/build/include/ |
---|
61 | |
---|
62 | # define paths for HAL |
---|
63 | HAL = $(ALMOSMKH_DIR)/hal |
---|
64 | HAL_ARCH = $(HAL)/$(ARCH_NAME) |
---|
65 | HAL_INCLUDE = $(HAL_ARCH)/core |
---|
66 | |
---|
67 | # define paths for KERNEL |
---|
68 | KERNEL = $(ALMOSMKH_DIR)/kernel |
---|
69 | SHARED_INCLUDE = $(KERNEL)/syscalls/shared_include/ |
---|
70 | |
---|
71 | |
---|
72 | ifeq ($(ARCH_NAME), tsar_mips32) |
---|
73 | $(info ARCH_NAME is tsar_mips32) |
---|
74 | export CFLAGS = -Wall -Wextra -ffreestanding -mno-gpopt -mips32 -g -ggdb -O2 \ |
---|
75 | -fno-delete-null-pointer-checks -std=gnu89 |
---|
76 | export CC = mipsel-unknown-elf-gcc |
---|
77 | export AS = mipsel-unknown-elf-as |
---|
78 | export LD = mipsel-unknown-elf-ld |
---|
79 | export DU = mipsel-unknown-elf-objdump |
---|
80 | export AR = mipsel-unknown-elf-ar |
---|
81 | export RANLIB = mipsel-unknown-elf-ranlib |
---|
82 | endif |
---|
83 | |
---|
84 | ifeq ($(ARCH_NAME), x86_64) |
---|
85 | $(info ARCH_NAME is x86_64) |
---|
86 | export CFLAGS = -Wall -ffreestanding -mno-red-zone -mno-mmx -mno-sse -mno-avx -g \ |
---|
87 | -fno-delete-null-pointer-checks -mcmodel=large -std=gnu89 |
---|
88 | export CC = gcc |
---|
89 | export AS = as |
---|
90 | export LD = ld |
---|
91 | export DU = objdump |
---|
92 | export AR = ar |
---|
93 | export RANLIB = ranlib |
---|
94 | endif |
---|
95 | |
---|
96 | BOOTLOADER_PATH = boot/$(ARCH_NAME) |
---|
97 | |
---|
98 | |
---|
99 | |
---|