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_bdv.o \ |
---|
20 | $(HAL_ARCH)/build/drivers/soclib_hba.o \ |
---|
21 | $(HAL_ARCH)/build/drivers/soclib_mmc.o \ |
---|
22 | $(HAL_ARCH)/build/drivers/soclib_pic.o \ |
---|
23 | $(HAL_ARCH)/build/drivers/soclib_nic.o \ |
---|
24 | $(HAL_ARCH)/build/drivers/soclib_dma.o \ |
---|
25 | $(HAL_ARCH)/build/drivers/soclib_iob.o |
---|
26 | |
---|
27 | CORE_OBJS = $(HAL_ARCH)/build/core/hal_special.o \ |
---|
28 | $(HAL_ARCH)/build/core/hal_context.o \ |
---|
29 | $(HAL_ARCH)/build/core/hal_atomic.o \ |
---|
30 | $(HAL_ARCH)/build/core/hal_remote.o \ |
---|
31 | $(HAL_ARCH)/build/core/hal_uspace.o \ |
---|
32 | $(HAL_ARCH)/build/core/hal_irqmask.o \ |
---|
33 | $(HAL_ARCH)/build/core/hal_gpt.o \ |
---|
34 | $(HAL_ARCH)/build/core/hal_ppm.o \ |
---|
35 | $(HAL_ARCH)/build/core/hal_vmm.o \ |
---|
36 | $(HAL_ARCH)/build/core/hal_exception.o \ |
---|
37 | $(HAL_ARCH)/build/core/hal_interrupt.o \ |
---|
38 | $(HAL_ARCH)/build/core/hal_syscall.o \ |
---|
39 | $(HAL_ARCH)/build/core/hal_drivers.o \ |
---|
40 | $(HAL_ARCH)/build/core/hal_kentry.o \ |
---|
41 | $(HAL_ARCH)/build/core/hal_switch.o \ |
---|
42 | $(HAL_ARCH)/build/core/hal_user.o |
---|
43 | |
---|
44 | HAL_INCLUDE = -I$(KERNEL) \ |
---|
45 | -I$(HAL_ARCH)/drivers \ |
---|
46 | -I$(HAL)/generic \ |
---|
47 | -I$(HAL_ARCH)/core \ |
---|
48 | -I../../tools/arch_info \ |
---|
49 | -I$(KERNEL)/kern \ |
---|
50 | -I$(KERNEL)/mm \ |
---|
51 | -I$(KERNEL)/fs \ |
---|
52 | -I$(KERNEL)/syscalls \ |
---|
53 | -I$(SHARED_INCLUDE) \ |
---|
54 | -I$(KERNEL)/devices \ |
---|
55 | -I$(KERNEL)/libk |
---|
56 | |
---|
57 | ############################## |
---|
58 | # Rule to generate .o for HAL. |
---|
59 | compile: dirs $(CORE_OBJS) $(DRIVERS_OBJS) |
---|
60 | |
---|
61 | ######################################## |
---|
62 | # Rule to create the build directories. |
---|
63 | dirs: |
---|
64 | @mkdir -p $(HAL_ARCH)/build |
---|
65 | @mkdir -p $(HAL_ARCH)/build/drivers |
---|
66 | @mkdir -p $(HAL_ARCH)/build/core |
---|
67 | |
---|
68 | |
---|
69 | ############################## |
---|
70 | # rules to compile the drivers |
---|
71 | $(HAL_ARCH)/build/drivers/%.o: $(HAL_ARCH)/drivers/%.c \ |
---|
72 | $(HAL_ARCH)/drivers/%.h \ |
---|
73 | $(KERNEL)/kernel_config.h \ |
---|
74 | $(HAL_ARCH)/core/hal_kernel_types.h |
---|
75 | $(CC) $(HAL_INCLUDE) $(CFLAGS) -c -o $@ $< |
---|
76 | |
---|
77 | ###################################### |
---|
78 | # Rules to generate kernel/hal objects |
---|
79 | $(HAL_ARCH)/build/core/%.o: $(HAL_ARCH)/core/%.c \ |
---|
80 | $(HAL)/generic/%.h \ |
---|
81 | $(KERNEL)/kernel_config.h \ |
---|
82 | $(HAL_ARCH)/core/hal_kernel_types.h |
---|
83 | $(CC) $(HAL_INCLUDE) $(CFLAGS) -c -o $@ $< |
---|
84 | |
---|
85 | $(HAL_ARCH)/build/core/hal_kentry.o: $(HAL_ARCH)/core/hal_kentry.S \ |
---|
86 | $(HAL_ARCH)/core/hal_kentry.h \ |
---|
87 | $(KERNEL)/kernel_config.h \ |
---|
88 | $(HAL_ARCH)/core/hal_kernel_types.h |
---|
89 | $(CC) $(HAL_INCLUDE) $(CFLAGS) -c -o $@ $< |
---|
90 | |
---|
91 | $(HAL_ARCH)/build/core/hal_switch.o: $(HAL_ARCH)/core/hal_switch.S \ |
---|
92 | $(HAL)/generic/hal_switch.h |
---|
93 | $(CC) $(HAL_INCLUDE) $(CFLAGS) -c -o $@ $< |
---|
94 | $(DU) -D $@ > $@.txt |
---|
95 | |
---|
96 | clean: |
---|
97 | rm -rf $(HAL_ARCH)/build/* |
---|