1 | ############################################################################# |
---|
2 | # HAL Makefile for Tsar-MIPS32 # |
---|
3 | ############################################################################# |
---|
4 | |
---|
5 | -include ../../params-soft.mk |
---|
6 | ifeq ($(ARCH_NAME),) |
---|
7 | $(error Please define in ARCH_NAME parameter in params-soft.mk!) |
---|
8 | endif |
---|
9 | |
---|
10 | LIBGCC = -L$(shell $(CC) -print-libgcc-file-name | sed 's/libgcc.a//') #todo ? |
---|
11 | |
---|
12 | # Rules that don't build target files |
---|
13 | # always out-of-date, need to be regenerated everytime they are called |
---|
14 | .PHONY: compile \ |
---|
15 | dirs \ |
---|
16 | clean \ |
---|
17 | |
---|
18 | DRIVERS_OBJS = $(HAL_ARCH)/build/drivers/soclib_tty.o \ |
---|
19 | $(HAL_ARCH)/build/drivers/soclib_mtty.o \ |
---|
20 | $(HAL_ARCH)/build/drivers/soclib_bdv.o \ |
---|
21 | $(HAL_ARCH)/build/drivers/soclib_hba.o \ |
---|
22 | $(HAL_ARCH)/build/drivers/soclib_sdc.o \ |
---|
23 | $(HAL_ARCH)/build/drivers/soclib_spi.o \ |
---|
24 | $(HAL_ARCH)/build/drivers/soclib_mmc.o \ |
---|
25 | $(HAL_ARCH)/build/drivers/soclib_pic.o \ |
---|
26 | $(HAL_ARCH)/build/drivers/soclib_nic.o \ |
---|
27 | $(HAL_ARCH)/build/drivers/soclib_dma.o \ |
---|
28 | $(HAL_ARCH)/build/drivers/soclib_iob.o |
---|
29 | |
---|
30 | CORE_OBJS = $(HAL_ARCH)/build/core/hal_special.o \ |
---|
31 | $(HAL_ARCH)/build/core/hal_context.o \ |
---|
32 | $(HAL_ARCH)/build/core/hal_atomic.o \ |
---|
33 | $(HAL_ARCH)/build/core/hal_remote.o \ |
---|
34 | $(HAL_ARCH)/build/core/hal_uspace.o \ |
---|
35 | $(HAL_ARCH)/build/core/hal_irqmask.o \ |
---|
36 | $(HAL_ARCH)/build/core/hal_gpt.o \ |
---|
37 | $(HAL_ARCH)/build/core/hal_ppm.o \ |
---|
38 | $(HAL_ARCH)/build/core/hal_vmm.o \ |
---|
39 | $(HAL_ARCH)/build/core/hal_exception.o \ |
---|
40 | $(HAL_ARCH)/build/core/hal_interrupt.o \ |
---|
41 | $(HAL_ARCH)/build/core/hal_syscall.o \ |
---|
42 | $(HAL_ARCH)/build/core/hal_drivers.o \ |
---|
43 | $(HAL_ARCH)/build/core/hal_kentry.o \ |
---|
44 | $(HAL_ARCH)/build/core/hal_switch.o \ |
---|
45 | $(HAL_ARCH)/build/core/hal_user.o |
---|
46 | |
---|
47 | HAL_INCLUDE = -I$(KERNEL) \ |
---|
48 | -I$(HAL_ARCH)/drivers \ |
---|
49 | -I$(HAL)/generic \ |
---|
50 | -I$(HAL_ARCH)/core \ |
---|
51 | -I../../tools/arch_info \ |
---|
52 | -I$(KERNEL)/kern \ |
---|
53 | -I$(KERNEL)/mm \ |
---|
54 | -I$(KERNEL)/fs \ |
---|
55 | -I$(KERNEL)/syscalls \ |
---|
56 | -I$(SHARED_INCLUDE) \ |
---|
57 | -I$(KERNEL)/devices \ |
---|
58 | -I$(KERNEL)/libk \ |
---|
59 | -I../../ # for hard_config.h (needed by soclib_sdc_driver for SYS_CLK) |
---|
60 | |
---|
61 | ############################## |
---|
62 | # Rule to generate .o for HAL. |
---|
63 | compile: dirs $(CORE_OBJS) $(DRIVERS_OBJS) |
---|
64 | |
---|
65 | ######################################## |
---|
66 | # Rule to create the build directories. |
---|
67 | dirs: |
---|
68 | @mkdir -p $(HAL_ARCH)/build |
---|
69 | @mkdir -p $(HAL_ARCH)/build/drivers |
---|
70 | @mkdir -p $(HAL_ARCH)/build/core |
---|
71 | |
---|
72 | |
---|
73 | ############################## |
---|
74 | # rules to compile the drivers |
---|
75 | $(HAL_ARCH)/build/drivers/%.o: $(HAL_ARCH)/drivers/%.c \ |
---|
76 | $(HAL_ARCH)/drivers/%.h \ |
---|
77 | $(KERNEL)/kernel_config.h \ |
---|
78 | $(HAL_ARCH)/core/hal_kernel_types.h |
---|
79 | $(CC) $(HAL_INCLUDE) $(CFLAGS) -c -o $@ $< |
---|
80 | |
---|
81 | ###################################### |
---|
82 | # Rules to generate kernel/hal objects |
---|
83 | $(HAL_ARCH)/build/core/%.o: $(HAL_ARCH)/core/%.c \ |
---|
84 | $(HAL)/generic/%.h \ |
---|
85 | $(KERNEL)/kernel_config.h \ |
---|
86 | $(HAL_ARCH)/core/hal_kernel_types.h |
---|
87 | $(CC) $(HAL_INCLUDE) $(CFLAGS) -c -o $@ $< |
---|
88 | |
---|
89 | $(HAL_ARCH)/build/core/hal_kentry.o: $(HAL_ARCH)/core/hal_kentry.S \ |
---|
90 | $(HAL_ARCH)/core/hal_kentry.h \ |
---|
91 | $(KERNEL)/kernel_config.h \ |
---|
92 | $(HAL_ARCH)/core/hal_kernel_types.h |
---|
93 | $(CC) $(HAL_INCLUDE) $(CFLAGS) -c -o $@ $< |
---|
94 | |
---|
95 | $(HAL_ARCH)/build/core/hal_switch.o: $(HAL_ARCH)/core/hal_switch.S \ |
---|
96 | $(HAL)/generic/hal_switch.h |
---|
97 | $(CC) $(HAL_INCLUDE) $(CFLAGS) -c -o $@ $< |
---|
98 | $(DU) -D $@ > $@.txt |
---|
99 | |
---|
100 | clean: |
---|
101 | rm -rf $(HAL_ARCH)/build/* |
---|