1 | ############################################################################# |
---|
2 | # HAL Makefile for x86_64 # |
---|
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 | |
---|
19 | DRIVERS_OBJS = $(HAL_ARCH)/build/drivers/ioc_ata.o \ |
---|
20 | $(HAL_ARCH)/build/drivers/pic_apic.o \ |
---|
21 | $(HAL_ARCH)/build/drivers/txt_rs232.o |
---|
22 | |
---|
23 | CORE_OBJS = \ |
---|
24 | $(HAL_ARCH)/build/core/hal_boot.o \ |
---|
25 | $(HAL_ARCH)/build/core/hal_smpboot.o \ |
---|
26 | $(HAL_ARCH)/build/core/hal_init.o \ |
---|
27 | $(HAL_ARCH)/build/core/hal_cpu.o \ |
---|
28 | $(HAL_ARCH)/build/core/hal_kentry.o \ |
---|
29 | $(HAL_ARCH)/build/core/hal_acpi.o \ |
---|
30 | $(HAL_ARCH)/build/core/hal_apic.o \ |
---|
31 | $(HAL_ARCH)/build/core/x86_printf.o \ |
---|
32 | $(HAL_ARCH)/build/core/hal_drivers.o \ |
---|
33 | $(HAL_ARCH)/build/core/hal_special.o \ |
---|
34 | $(HAL_ARCH)/build/core/hal_context.o \ |
---|
35 | $(HAL_ARCH)/build/core/hal_atomic.o \ |
---|
36 | $(HAL_ARCH)/build/core/hal_remote.o \ |
---|
37 | $(HAL_ARCH)/build/core/hal_uspace.o \ |
---|
38 | $(HAL_ARCH)/build/core/hal_irqmask.o \ |
---|
39 | $(HAL_ARCH)/build/core/hal_gpt.o \ |
---|
40 | $(HAL_ARCH)/build/core/hal_ppm.o \ |
---|
41 | $(HAL_ARCH)/build/core/hal_exception.o \ |
---|
42 | $(HAL_ARCH)/build/core/hal_interrupt.o \ |
---|
43 | $(HAL_ARCH)/build/core/hal_syscall.o \ |
---|
44 | |
---|
45 | |
---|
46 | HAL_INCLUDE = -I$(KERNEL) \ |
---|
47 | -Idrivers \ |
---|
48 | -I$(HAL)/generic \ |
---|
49 | -Icore \ |
---|
50 | -I../../tools/arch_info \ |
---|
51 | -I$(KERNEL)/kern \ |
---|
52 | -I$(KERNEL)/mm \ |
---|
53 | -I$(KERNEL)/fs \ |
---|
54 | -I$(KERNEL)/syscalls \ |
---|
55 | -I$(KERNEL)/devices \ |
---|
56 | -I$(KERNEL)/libk |
---|
57 | |
---|
58 | # Rule to generate .o for HAL. |
---|
59 | compile: dirs $(CORE_OBJS) $(DRIVERS_OBJS) |
---|
60 | |
---|
61 | # Rule to create the build directories. |
---|
62 | dirs: |
---|
63 | @mkdir -p $(HAL_ARCH)/build |
---|
64 | @mkdir -p $(HAL_ARCH)/build/drivers |
---|
65 | @mkdir -p $(HAL_ARCH)/build/core |
---|
66 | |
---|
67 | |
---|
68 | ############################## |
---|
69 | # rules to compile the drivers |
---|
70 | $(HAL_ARCH)/build/drivers/%.o: drivers/%.c \ |
---|
71 | drivers/%.h \ |
---|
72 | $(KERNEL)/kernel_config.h \ |
---|
73 | core/hal_types.h |
---|
74 | $(CC) $(HAL_INCLUDE) $(CFLAGS) -c -o $@ $< |
---|
75 | |
---|
76 | ###################################### |
---|
77 | # Rules to generate kernel/hal objects |
---|
78 | $(HAL_ARCH)/build/core/%.o: core/%.c \ |
---|
79 | $(HAL)/generic/%.h \ |
---|
80 | $(KERNEL)/kernel_config.h \ |
---|
81 | core/hal_types.h |
---|
82 | $(CC) $(HAL_INCLUDE) $(CFLAGS) -c -o $@ $< |
---|
83 | |
---|
84 | $(HAL_ARCH)/build/core/hal_boot.o: core/hal_boot.S \ |
---|
85 | core/hal_boot.h \ |
---|
86 | core/hal_multiboot.h \ |
---|
87 | core/hal_segmentation.h \ |
---|
88 | $(KERNEL)/kernel_config.h \ |
---|
89 | core/hal_types.h |
---|
90 | $(CC) $(HAL_INCLUDE) $(CFLAGS) -c -o $@ $< |
---|
91 | |
---|
92 | $(HAL_ARCH)/build/core/hal_smpboot.o: core/hal_smpboot.S \ |
---|
93 | core/hal_boot.h \ |
---|
94 | core/hal_multiboot.h \ |
---|
95 | core/hal_segmentation.h \ |
---|
96 | $(KERNEL)/kernel_config.h \ |
---|
97 | core/hal_types.h |
---|
98 | $(CC) $(HAL_INCLUDE) $(CFLAGS) -c -o $@ $< |
---|
99 | |
---|
100 | $(HAL_ARCH)/build/core/hal_init.o: core/hal_init.c \ |
---|
101 | core/hal_boot.h \ |
---|
102 | core/hal_multiboot.h \ |
---|
103 | core/hal_segmentation.h \ |
---|
104 | core/hal_acpi.h \ |
---|
105 | core/hal_apic.h \ |
---|
106 | core/hal_internal.h \ |
---|
107 | $(KERNEL)/kernel_config.h \ |
---|
108 | core/hal_types.h |
---|
109 | $(CC) $(HAL_INCLUDE) $(CFLAGS) -c -o $@ $< |
---|
110 | |
---|
111 | $(HAL_ARCH)/build/core/hal_cpu.o: core/hal_cpu.S \ |
---|
112 | core/hal_boot.h \ |
---|
113 | core/hal_segmentation.h \ |
---|
114 | $(KERNEL)/kernel_config.h \ |
---|
115 | core/hal_types.h |
---|
116 | $(CC) $(HAL_INCLUDE) $(CFLAGS) -c -o $@ $< |
---|
117 | |
---|
118 | $(HAL_ARCH)/build/core/hal_kentry.o: core/hal_kentry.S \ |
---|
119 | core/hal_kentry.h \ |
---|
120 | core/hal_boot.h \ |
---|
121 | $(KERNEL)/kernel_config.h \ |
---|
122 | core/hal_types.h |
---|
123 | $(CC) $(HAL_INCLUDE) $(CFLAGS) -c -o $@ $< |
---|
124 | |
---|
125 | $(HAL_ARCH)/build/core/hal_acpi.o: core/hal_acpi.c \ |
---|
126 | core/hal_acpi.h \ |
---|
127 | $(KERNEL)/kernel_config.h \ |
---|
128 | core/hal_types.h |
---|
129 | $(CC) $(HAL_INCLUDE) $(CFLAGS) -c -o $@ $< |
---|
130 | |
---|
131 | $(HAL_ARCH)/build/core/hal_apic.o: core/hal_apic.c \ |
---|
132 | core/hal_apic.h \ |
---|
133 | $(KERNEL)/kernel_config.h \ |
---|
134 | core/hal_types.h |
---|
135 | $(CC) $(HAL_INCLUDE) $(CFLAGS) -c -o $@ $< |
---|
136 | |
---|
137 | $(HAL_ARCH)/build/core/x86_printf.o: core/x86_printf.c \ |
---|
138 | $(KERNEL)/kernel_config.h \ |
---|
139 | core/hal_types.h |
---|
140 | $(CC) $(HAL_INCLUDE) $(CFLAGS) -c -o $@ $< |
---|
141 | |
---|
142 | clean: |
---|
143 | rm -rf $(HAL_ARCH)/build/* |
---|