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$(SHARED_INCLUDE) \ |
---|
56 | -I$(KERNEL)/devices \ |
---|
57 | -I$(KERNEL)/libk |
---|
58 | |
---|
59 | # Rule to generate .o for HAL. |
---|
60 | compile: dirs $(CORE_OBJS) $(DRIVERS_OBJS) |
---|
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: drivers/%.c \ |
---|
72 | drivers/%.h \ |
---|
73 | $(KERNEL)/kernel_config.h \ |
---|
74 | 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: core/%.c \ |
---|
80 | $(HAL)/generic/%.h \ |
---|
81 | $(KERNEL)/kernel_config.h \ |
---|
82 | core/hal_kernel_types.h |
---|
83 | $(CC) $(HAL_INCLUDE) $(CFLAGS) -c -o $@ $< |
---|
84 | |
---|
85 | $(HAL_ARCH)/build/core/hal_boot.o: core/hal_boot.S \ |
---|
86 | core/hal_boot.h \ |
---|
87 | core/hal_multiboot.h \ |
---|
88 | core/hal_segmentation.h \ |
---|
89 | $(KERNEL)/kernel_config.h \ |
---|
90 | core/hal_kernel_types.h |
---|
91 | $(CC) $(HAL_INCLUDE) $(CFLAGS) -c -o $@ $< |
---|
92 | |
---|
93 | $(HAL_ARCH)/build/core/hal_smpboot.o: core/hal_smpboot.S \ |
---|
94 | core/hal_boot.h \ |
---|
95 | core/hal_multiboot.h \ |
---|
96 | core/hal_segmentation.h \ |
---|
97 | $(KERNEL)/kernel_config.h \ |
---|
98 | core/hal_kernel_types.h |
---|
99 | $(CC) $(HAL_INCLUDE) $(CFLAGS) -c -o $@ $< |
---|
100 | |
---|
101 | $(HAL_ARCH)/build/core/hal_init.o: core/hal_init.c \ |
---|
102 | core/hal_boot.h \ |
---|
103 | core/hal_multiboot.h \ |
---|
104 | core/hal_segmentation.h \ |
---|
105 | core/hal_acpi.h \ |
---|
106 | core/hal_apic.h \ |
---|
107 | core/hal_internal.h \ |
---|
108 | $(KERNEL)/kernel_config.h \ |
---|
109 | core/hal_kernel_types.h |
---|
110 | $(CC) $(HAL_INCLUDE) $(CFLAGS) -c -o $@ $< |
---|
111 | |
---|
112 | $(HAL_ARCH)/build/core/hal_cpu.o: core/hal_cpu.S \ |
---|
113 | core/hal_boot.h \ |
---|
114 | core/hal_segmentation.h \ |
---|
115 | $(KERNEL)/kernel_config.h \ |
---|
116 | core/hal_kernel_types.h |
---|
117 | $(CC) $(HAL_INCLUDE) $(CFLAGS) -c -o $@ $< |
---|
118 | |
---|
119 | $(HAL_ARCH)/build/core/hal_kentry.o: core/hal_kentry.S \ |
---|
120 | core/hal_kentry.h \ |
---|
121 | core/hal_boot.h \ |
---|
122 | $(KERNEL)/kernel_config.h \ |
---|
123 | core/hal_kernel_types.h |
---|
124 | $(CC) $(HAL_INCLUDE) $(CFLAGS) -c -o $@ $< |
---|
125 | |
---|
126 | $(HAL_ARCH)/build/core/hal_acpi.o: core/hal_acpi.c \ |
---|
127 | core/hal_acpi.h \ |
---|
128 | $(KERNEL)/kernel_config.h \ |
---|
129 | core/hal_kernel_types.h |
---|
130 | $(CC) $(HAL_INCLUDE) $(CFLAGS) -c -o $@ $< |
---|
131 | |
---|
132 | $(HAL_ARCH)/build/core/hal_apic.o: core/hal_apic.c \ |
---|
133 | core/hal_apic.h \ |
---|
134 | $(KERNEL)/kernel_config.h \ |
---|
135 | core/hal_kernel_types.h |
---|
136 | $(CC) $(HAL_INCLUDE) $(CFLAGS) -c -o $@ $< |
---|
137 | |
---|
138 | $(HAL_ARCH)/build/core/x86_printf.o: core/x86_printf.c \ |
---|
139 | $(KERNEL)/kernel_config.h \ |
---|
140 | core/hal_kernel_types.h |
---|
141 | $(CC) $(HAL_INCLUDE) $(CFLAGS) -c -o $@ $< |
---|
142 | |
---|
143 | clean: |
---|
144 | rm -rf $(HAL_ARCH)/build/* |
---|