Rev 2021 | Rev 2030 | Go to most recent revision | Only display areas with differences | Regard whitespace | Details | Blame | Last modification | View Log | RSS feed
Rev 2021 | Rev 2022 | ||
---|---|---|---|
1 | # |
1 | # |
2 | # Copyright (C) 2005 Martin Decky |
2 | # Copyright (C) 2005 Martin Decky |
3 | # All rights reserved. |
3 | # All rights reserved. |
4 | # |
4 | # |
5 | # Redistribution and use in source and binary forms, with or without |
5 | # Redistribution and use in source and binary forms, with or without |
6 | # modification, are permitted provided that the following conditions |
6 | # modification, are permitted provided that the following conditions |
7 | # are met: |
7 | # are met: |
8 | # |
8 | # |
9 | # - Redistributions of source code must retain the above copyright |
9 | # - Redistributions of source code must retain the above copyright |
10 | # notice, this list of conditions and the following disclaimer. |
10 | # notice, this list of conditions and the following disclaimer. |
11 | # - Redistributions in binary form must reproduce the above copyright |
11 | # - Redistributions in binary form must reproduce the above copyright |
12 | # notice, this list of conditions and the following disclaimer in the |
12 | # notice, this list of conditions and the following disclaimer in the |
13 | # documentation and/or other materials provided with the distribution. |
13 | # documentation and/or other materials provided with the distribution. |
14 | # - The name of the author may not be used to endorse or promote products |
14 | # - The name of the author may not be used to endorse or promote products |
15 | # derived from this software without specific prior written permission. |
15 | # derived from this software without specific prior written permission. |
16 | # |
16 | # |
17 | # THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR |
17 | # THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR |
18 | # IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES |
18 | # IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES |
19 | # OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. |
19 | # OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. |
20 | # IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, |
20 | # IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, |
21 | # INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT |
21 | # INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT |
22 | # NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, |
22 | # NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, |
23 | # DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY |
23 | # DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY |
24 | # THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT |
24 | # THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT |
25 | # (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF |
25 | # (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF |
26 | # THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
26 | # THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
27 | # |
27 | # |
28 | 28 | ||
29 | 29 | ||
30 | ## Include configuration |
30 | ## Include configuration |
31 | # |
31 | # |
32 | 32 | ||
33 | -include ../version |
33 | -include ../version |
34 | -include Makefile.config |
34 | -include Makefile.config |
35 | 35 | ||
36 | ## Common compiler flags |
36 | ## Common compiler flags |
37 | # |
37 | # |
38 | 38 | ||
39 | DEFS = -D$(ARCH) -DARCH=\"$(ARCH)\" -DRELEASE=\"$(RELEASE)\" "-DNAME=\"$(NAME)\"" -DKERNEL |
39 | DEFS = -D$(ARCH) -DARCH=\"$(ARCH)\" -DRELEASE=\"$(RELEASE)\" "-DNAME=\"$(NAME)\"" -DKERNEL |
40 | CFLAGS = -fno-builtin -fomit-frame-pointer -Wall -Werror-implicit-function-declaration -Wmissing-prototypes -Werror -O3 -nostdlib -nostdinc -Igeneric/include/ |
40 | CFLAGS = -fno-builtin -fomit-frame-pointer -Wall -Werror-implicit-function-declaration -Wmissing-prototypes -Werror -O3 -nostdlib -nostdinc -Igeneric/include/ |
41 | LFLAGS = -M |
41 | LFLAGS = -M |
42 | AFLAGS = |
42 | AFLAGS = |
43 | 43 | ||
44 | ifdef REVISION |
44 | ifdef REVISION |
45 | DEFS += "-DREVISION=\"$(REVISION)\"" |
45 | DEFS += "-DREVISION=\"$(REVISION)\"" |
46 | endif |
46 | endif |
47 | 47 | ||
48 | ifdef TIMESTAMP |
48 | ifdef TIMESTAMP |
49 | DEFS += "-DTIMESTAMP=\"$(TIMESTAMP)\"" |
49 | DEFS += "-DTIMESTAMP=\"$(TIMESTAMP)\"" |
50 | endif |
50 | endif |
51 | 51 | ||
52 | ## Setup kernel configuration |
52 | ## Setup kernel configuration |
53 | # |
53 | # |
54 | 54 | ||
55 | -include arch/$(ARCH)/Makefile.inc |
55 | -include arch/$(ARCH)/Makefile.inc |
56 | -include genarch/Makefile.inc |
56 | -include genarch/Makefile.inc |
57 | 57 | ||
58 | ifeq ($(CONFIG_DEBUG),y) |
58 | ifeq ($(CONFIG_DEBUG),y) |
59 | DEFS += -DCONFIG_DEBUG |
59 | DEFS += -DCONFIG_DEBUG |
60 | endif |
60 | endif |
61 | 61 | ||
62 | ifeq ($(CONFIG_DEBUG_SPINLOCK),y) |
62 | ifeq ($(CONFIG_DEBUG_SPINLOCK),y) |
63 | DEFS += -DCONFIG_DEBUG_SPINLOCK |
63 | DEFS += -DCONFIG_DEBUG_SPINLOCK |
64 | endif |
64 | endif |
65 | 65 | ||
66 | ifeq ($(CONFIG_DEBUG_AS_WATCHPOINT),y) |
66 | ifeq ($(CONFIG_DEBUG_AS_WATCHPOINT),y) |
67 | DEFS += -DCONFIG_DEBUG_AS_WATCHPOINT |
67 | DEFS += -DCONFIG_DEBUG_AS_WATCHPOINT |
68 | endif |
68 | endif |
69 | 69 | ||
70 | ifeq ($(CONFIG_FPU_LAZY),y) |
70 | ifeq ($(CONFIG_FPU_LAZY),y) |
71 | DEFS += -DCONFIG_FPU_LAZY |
71 | DEFS += -DCONFIG_FPU_LAZY |
72 | endif |
72 | endif |
73 | 73 | ||
74 | ifeq ($(CONFIG_DEBUG_ALLREGS),y) |
74 | ifeq ($(CONFIG_DEBUG_ALLREGS),y) |
75 | DEFS += -DCONFIG_DEBUG_ALLREGS |
75 | DEFS += -DCONFIG_DEBUG_ALLREGS |
76 | endif |
76 | endif |
77 | 77 | ||
78 | ifeq ($(CONFIG_VHPT),y) |
78 | ifeq ($(CONFIG_VHPT),y) |
79 | DEFS += -DCONFIG_VHPT |
79 | DEFS += -DCONFIG_VHPT |
80 | endif |
80 | endif |
81 | 81 | ||
82 | ifeq ($(CONFIG_TSB),y) |
82 | ifeq ($(CONFIG_TSB),y) |
83 | DEFS += -DCONFIG_TSB |
83 | DEFS += -DCONFIG_TSB |
84 | endif |
84 | endif |
85 | 85 | ||
86 | ifeq ($(CONFIG_Z8530),y) |
86 | ifeq ($(CONFIG_Z8530),y) |
87 | DEFS += -DCONFIG_Z8530 |
87 | DEFS += -DCONFIG_Z8530 |
88 | endif |
88 | endif |
89 | 89 | ||
90 | ifeq ($(CONFIG_NS16550),y) |
90 | ifeq ($(CONFIG_NS16550),y) |
91 | DEFS += -DCONFIG_NS16550 |
91 | DEFS += -DCONFIG_NS16550 |
92 | endif |
92 | endif |
93 | 93 | ||
94 | ifeq ($(CONFIG_VIRT_IDX_DCACHE),y) |
94 | ifeq ($(CONFIG_VIRT_IDX_DCACHE),y) |
95 | DEFS += -DCONFIG_VIRT_IDX_DCACHE |
95 | DEFS += -DCONFIG_VIRT_IDX_DCACHE |
96 | endif |
96 | endif |
97 | 97 | ||
98 | ifeq ($(CONFIG_POWEROFF),y) |
98 | ifeq ($(CONFIG_POWEROFF),y) |
99 | DEFS += -DCONFIG_POWEROFF |
99 | DEFS += -DCONFIG_POWEROFF |
100 | endif |
100 | endif |
101 | 101 | ||
102 | ifeq ($(CONFIG_FB),y) |
102 | ifeq ($(CONFIG_FB),y) |
103 | ifeq ($(ARCH),ia32) |
103 | ifeq ($(ARCH),ia32) |
104 | DEFS += -DCONFIG_VESA_WIDTH=$(CONFIG_VESA_WIDTH) |
104 | DEFS += -DCONFIG_VESA_WIDTH=$(CONFIG_VESA_WIDTH) |
105 | DEFS += -DCONFIG_VESA_HEIGHT=$(CONFIG_VESA_HEIGHT) |
105 | DEFS += -DCONFIG_VESA_HEIGHT=$(CONFIG_VESA_HEIGHT) |
106 | DEFS += -DCONFIG_VESA_BPP=$(CONFIG_VESA_BPP) |
106 | DEFS += -DCONFIG_VESA_BPP=$(CONFIG_VESA_BPP) |
107 | endif |
107 | endif |
108 | 108 | ||
109 | ifeq ($(ARCH),amd64) |
109 | ifeq ($(ARCH),amd64) |
110 | DEFS += -DCONFIG_VESA_WIDTH=$(CONFIG_VESA_WIDTH) |
110 | DEFS += -DCONFIG_VESA_WIDTH=$(CONFIG_VESA_WIDTH) |
111 | DEFS += -DCONFIG_VESA_HEIGHT=$(CONFIG_VESA_HEIGHT) |
111 | DEFS += -DCONFIG_VESA_HEIGHT=$(CONFIG_VESA_HEIGHT) |
112 | DEFS += -DCONFIG_VESA_BPP=$(CONFIG_VESA_BPP) |
112 | DEFS += -DCONFIG_VESA_BPP=$(CONFIG_VESA_BPP) |
113 | endif |
113 | endif |
114 | 114 | ||
115 | ifeq ($(ARCH),ia32xen) |
115 | ifeq ($(ARCH),ia32xen) |
116 | DEFS += -DCONFIG_VESA_WIDTH=$(CONFIG_VESA_WIDTH) |
116 | DEFS += -DCONFIG_VESA_WIDTH=$(CONFIG_VESA_WIDTH) |
117 | DEFS += -DCONFIG_VESA_HEIGHT=$(CONFIG_VESA_HEIGHT) |
117 | DEFS += -DCONFIG_VESA_HEIGHT=$(CONFIG_VESA_HEIGHT) |
118 | DEFS += -DCONFIG_VESA_BPP=$(CONFIG_VESA_BPP) |
118 | DEFS += -DCONFIG_VESA_BPP=$(CONFIG_VESA_BPP) |
119 | endif |
119 | endif |
120 | endif |
120 | endif |
121 | 121 | ||
122 | ifeq ($(CONFIG_BENCH),y) |
122 | ifeq ($(CONFIG_BENCH),y) |
123 | DEFS += -DCONFIG_BENCH |
123 | DEFS += -DCONFIG_BENCH |
124 | endif |
124 | endif |
125 | 125 | ||
126 | ## Toolchain configuration |
126 | ## Toolchain configuration |
127 | # |
127 | # |
128 | 128 | ||
129 | ifeq ($(COMPILER),native) |
129 | ifeq ($(COMPILER),native) |
130 | CC = gcc |
130 | CC = gcc |
131 | AS = as |
131 | AS = as |
132 | LD = ld |
132 | LD = ld |
133 | OBJCOPY = objcopy |
133 | OBJCOPY = objcopy |
134 | OBJDUMP = objdump |
134 | OBJDUMP = objdump |
135 | else |
135 | else |
136 | CC = $(TOOLCHAIN_DIR)/$(TARGET)-gcc |
136 | CC = $(TOOLCHAIN_DIR)/$(TARGET)-gcc |
137 | AS = $(TOOLCHAIN_DIR)/$(TARGET)-as |
137 | AS = $(TOOLCHAIN_DIR)/$(TARGET)-as |
138 | LD = $(TOOLCHAIN_DIR)/$(TARGET)-ld |
138 | LD = $(TOOLCHAIN_DIR)/$(TARGET)-ld |
139 | OBJCOPY = $(TOOLCHAIN_DIR)/$(TARGET)-objcopy |
139 | OBJCOPY = $(TOOLCHAIN_DIR)/$(TARGET)-objcopy |
140 | OBJDUMP = $(TOOLCHAIN_DIR)/$(TARGET)-objdump |
140 | OBJDUMP = $(TOOLCHAIN_DIR)/$(TARGET)-objdump |
141 | endif |
141 | endif |
142 | 142 | ||
143 | ## Generic kernel sources |
143 | ## Generic kernel sources |
144 | # |
144 | # |
145 | 145 | ||
146 | GENERIC_SOURCES = \ |
146 | GENERIC_SOURCES = \ |
147 | generic/src/adt/bitmap.c \ |
147 | generic/src/adt/bitmap.c \ |
148 | generic/src/adt/btree.c \ |
148 | generic/src/adt/btree.c \ |
149 | generic/src/adt/hash_table.c \ |
149 | generic/src/adt/hash_table.c \ |
150 | generic/src/adt/list.c \ |
150 | generic/src/adt/list.c \ |
151 | generic/src/console/chardev.c \ |
151 | generic/src/console/chardev.c \ |
152 | generic/src/console/console.c \ |
152 | generic/src/console/console.c \ |
153 | generic/src/console/kconsole.c \ |
153 | generic/src/console/kconsole.c \ |
154 | generic/src/console/klog.c \ |
154 | generic/src/console/klog.c \ |
155 | generic/src/console/cmd.c \ |
155 | generic/src/console/cmd.c \ |
156 | generic/src/cpu/cpu.c \ |
156 | generic/src/cpu/cpu.c \ |
157 | generic/src/ddi/ddi.c \ |
157 | generic/src/ddi/ddi.c \ |
158 | generic/src/ddi/irq.c \ |
158 | generic/src/ddi/irq.c \ |
159 | generic/src/ddi/device.c \ |
159 | generic/src/ddi/device.c \ |
160 | generic/src/interrupt/interrupt.c \ |
160 | generic/src/interrupt/interrupt.c \ |
161 | generic/src/main/main.c \ |
161 | generic/src/main/main.c \ |
162 | generic/src/main/kinit.c \ |
162 | generic/src/main/kinit.c \ |
163 | generic/src/main/uinit.c \ |
163 | generic/src/main/uinit.c \ |
164 | generic/src/main/version.c \ |
164 | generic/src/main/version.c \ |
165 | generic/src/proc/scheduler.c \ |
165 | generic/src/proc/scheduler.c \ |
166 | generic/src/proc/thread.c \ |
166 | generic/src/proc/thread.c \ |
167 | generic/src/proc/task.c \ |
167 | generic/src/proc/task.c \ |
168 | generic/src/proc/the.c \ |
168 | generic/src/proc/the.c \ |
169 | generic/src/syscall/syscall.c \ |
169 | generic/src/syscall/syscall.c \ |
170 | generic/src/syscall/copy.c \ |
170 | generic/src/syscall/copy.c \ |
171 | generic/src/mm/buddy.c \ |
171 | generic/src/mm/buddy.c \ |
172 | generic/src/mm/frame.c \ |
172 | generic/src/mm/frame.c \ |
173 | generic/src/mm/page.c \ |
173 | generic/src/mm/page.c \ |
174 | generic/src/mm/tlb.c \ |
174 | generic/src/mm/tlb.c \ |
175 | generic/src/mm/as.c \ |
175 | generic/src/mm/as.c \ |
176 | generic/src/mm/backend_anon.c \ |
176 | generic/src/mm/backend_anon.c \ |
177 | generic/src/mm/backend_elf.c \ |
177 | generic/src/mm/backend_elf.c \ |
178 | generic/src/mm/backend_phys.c \ |
178 | generic/src/mm/backend_phys.c \ |
179 | generic/src/mm/slab.c \ |
179 | generic/src/mm/slab.c \ |
180 | generic/src/lib/func.c \ |
180 | generic/src/lib/func.c \ |
181 | generic/src/lib/memstr.c \ |
181 | generic/src/lib/memstr.c \ |
182 | generic/src/lib/sort.c \ |
182 | generic/src/lib/sort.c \ |
183 | generic/src/lib/elf.c \ |
183 | generic/src/lib/elf.c \ |
184 | generic/src/lib/rd.c \ |
184 | generic/src/lib/rd.c \ |
185 | generic/src/printf/printf_core.c \ |
185 | generic/src/printf/printf_core.c \ |
186 | generic/src/printf/printf.c \ |
186 | generic/src/printf/printf.c \ |
187 | generic/src/printf/sprintf.c \ |
187 | generic/src/printf/sprintf.c \ |
188 | generic/src/printf/snprintf.c \ |
188 | generic/src/printf/snprintf.c \ |
189 | generic/src/printf/vprintf.c \ |
189 | generic/src/printf/vprintf.c \ |
190 | generic/src/printf/vsprintf.c \ |
190 | generic/src/printf/vsprintf.c \ |
191 | generic/src/printf/vsnprintf.c \ |
191 | generic/src/printf/vsnprintf.c \ |
192 | generic/src/debug/symtab.c \ |
192 | generic/src/debug/symtab.c \ |
193 | generic/src/time/clock.c \ |
193 | generic/src/time/clock.c \ |
194 | generic/src/time/timeout.c \ |
194 | generic/src/time/timeout.c \ |
195 | generic/src/time/delay.c \ |
195 | generic/src/time/delay.c \ |
196 | generic/src/preempt/preemption.c \ |
196 | generic/src/preempt/preemption.c \ |
197 | generic/src/synch/spinlock.c \ |
197 | generic/src/synch/spinlock.c \ |
198 | generic/src/synch/condvar.c \ |
198 | generic/src/synch/condvar.c \ |
199 | generic/src/synch/rwlock.c \ |
199 | generic/src/synch/rwlock.c \ |
200 | generic/src/synch/mutex.c \ |
200 | generic/src/synch/mutex.c \ |
201 | generic/src/synch/semaphore.c \ |
201 | generic/src/synch/semaphore.c \ |
202 | generic/src/synch/waitq.c \ |
202 | generic/src/synch/waitq.c \ |
203 | generic/src/synch/futex.c \ |
203 | generic/src/synch/futex.c \ |
204 | generic/src/smp/ipi.c \ |
204 | generic/src/smp/ipi.c \ |
205 | generic/src/smp/smp.c \ |
205 | generic/src/smp/smp.c \ |
206 | generic/src/ipc/ipc.c \ |
206 | generic/src/ipc/ipc.c \ |
207 | generic/src/ipc/sysipc.c \ |
207 | generic/src/ipc/sysipc.c \ |
208 | generic/src/ipc/ipcrsc.c \ |
208 | generic/src/ipc/ipcrsc.c \ |
209 | generic/src/ipc/irq.c \ |
209 | generic/src/ipc/irq.c \ |
210 | generic/src/security/cap.c \ |
210 | generic/src/security/cap.c \ |
211 | generic/src/sysinfo/sysinfo.c |
211 | generic/src/sysinfo/sysinfo.c |
212 | 212 | ||
213 | ## Test sources |
213 | ## Test sources |
214 | # |
214 | # |
215 | 215 | ||
216 | ifeq ($(CONFIG_TEST),y) |
216 | ifeq ($(CONFIG_TEST),y) |
217 | DEFS += -DCONFIG_TEST |
217 | DEFS += -DCONFIG_TEST |
218 | CFLAGS += -Itest/ |
218 | CFLAGS += -Itest/ |
219 | GENERIC_SOURCES += \ |
219 | GENERIC_SOURCES += \ |
220 | test/test.c \ |
220 | test/test.c \ |
221 | test/atomic/atomic1.c \ |
221 | test/atomic/atomic1.c \ |
222 | test/btree/btree1.c \ |
222 | test/btree/btree1.c \ |
223 | test/debug/mips1.c \ |
223 | test/debug/mips1.c \ |
224 | test/fault/fault1.c \ |
224 | test/fault/fault1.c \ |
225 | test/fpu/fpu1.c \ |
225 | test/fpu/fpu1.c \ |
226 | test/fpu/sse1.c \ |
226 | test/fpu/sse1.c \ |
227 | test/fpu/mips2.c \ |
227 | test/fpu/mips2.c \ |
228 | test/mm/falloc1.c \ |
228 | test/mm/falloc1.c \ |
229 | test/mm/falloc2.c \ |
229 | test/mm/falloc2.c \ |
230 | test/mm/mapping1.c \ |
230 | test/mm/mapping1.c \ |
231 | test/mm/slab1.c \ |
231 | test/mm/slab1.c \ |
232 | test/mm/slab2.c \ |
232 | test/mm/slab2.c \ |
233 | test/mm/purge1.c |
233 | test/mm/purge1.c \ |
- | 234 | test/synch/rwlock1.c \ |
|
- | 235 | test/synch/rwlock2.c \ |
|
- | 236 | test/synch/rwlock3.c \ |
|
- | 237 | test/synch/rwlock4.c \ |
|
- | 238 | test/synch/rwlock5.c \ |
|
- | 239 | test/synch/semaphore1.c \ |
|
- | 240 | test/synch/semaphore2.c \ |
|
- | 241 | test/print/print1.c \ |
|
- | 242 | test/thread/thread1.c \ |
|
- | 243 | test/sysinfo/sysinfo1.c |
|
234 | endif |
244 | endif |
235 | 245 | ||
236 | GENERIC_OBJECTS := $(addsuffix .o,$(basename $(GENERIC_SOURCES))) |
246 | GENERIC_OBJECTS := $(addsuffix .o,$(basename $(GENERIC_SOURCES))) |
237 | ARCH_OBJECTS := $(addsuffix .o,$(basename $(ARCH_SOURCES))) |
247 | ARCH_OBJECTS := $(addsuffix .o,$(basename $(ARCH_SOURCES))) |
238 | GENARCH_OBJECTS := $(addsuffix .o,$(basename $(GENARCH_SOURCES))) |
248 | GENARCH_OBJECTS := $(addsuffix .o,$(basename $(GENARCH_SOURCES))) |
239 | 249 | ||
240 | .PHONY: all build config distclean clean archlinks depend disasm |
250 | .PHONY: all build config distclean clean archlinks depend disasm |
241 | 251 | ||
242 | all: |
252 | all: |
243 | ../tools/config.py kernel.config default $(ARCH) $(COMPILER) $(CONFIG_DEBUG) $(MACHINE) |
253 | ../tools/config.py kernel.config default $(ARCH) $(COMPILER) $(CONFIG_DEBUG) $(MACHINE) |
244 | $(MAKE) -C . build |
254 | $(MAKE) -C . build |
245 | 255 | ||
246 | build: kernel.bin disasm |
256 | build: kernel.bin disasm |
247 | 257 | ||
248 | config: |
258 | config: |
249 | -rm Makefile.depend |
259 | -rm Makefile.depend |
250 | ../tools/config.py kernel.config |
260 | ../tools/config.py kernel.config |
251 | 261 | ||
252 | -include Makefile.depend |
262 | -include Makefile.depend |
253 | 263 | ||
254 | distclean: clean |
264 | distclean: clean |
255 | -rm Makefile.config |
265 | -rm Makefile.config |
256 | 266 | ||
257 | clean: |
267 | clean: |
258 | -rm -f kernel.bin kernel.raw kernel.map kernel.map.pre kernel.objdump kernel.disasm generic/src/debug/real_map.bin Makefile.depend* generic/include/arch generic/include/genarch arch/$(ARCH)/_link.ld |
268 | -rm -f kernel.bin kernel.raw kernel.map kernel.map.pre kernel.objdump kernel.disasm generic/src/debug/real_map.bin Makefile.depend* generic/include/arch generic/include/genarch arch/$(ARCH)/_link.ld |
259 | find generic/src/ arch/*/src/ genarch/src/ test/ -name '*.o' -follow -exec rm \{\} \; |
269 | find generic/src/ arch/*/src/ genarch/src/ test/ -name '*.o' -follow -exec rm \{\} \; |
260 | for arch in arch/* ; do \ |
270 | for arch in arch/* ; do \ |
261 | [ -e $$arch/_link.ld ] && rm $$arch/_link.ld 2>/dev/null ; \ |
271 | [ -e $$arch/_link.ld ] && rm $$arch/_link.ld 2>/dev/null ; \ |
262 | done ; exit 0 |
272 | done ; exit 0 |
263 | 273 | ||
264 | archlinks: |
274 | archlinks: |
265 | ln -sfn ../../arch/$(ARCH)/include/ generic/include/arch |
275 | ln -sfn ../../arch/$(ARCH)/include/ generic/include/arch |
266 | ln -sfn ../../genarch/include/ generic/include/genarch |
276 | ln -sfn ../../genarch/include/ generic/include/genarch |
267 | 277 | ||
268 | depend: archlinks |
278 | depend: archlinks |
269 | -makedepend $(DEFS) $(CFLAGS) -f - $(ARCH_SOURCES) $(GENARCH_SOURCES) $(GENERIC_SOURCES) > Makefile.depend 2> /dev/null |
279 | -makedepend $(DEFS) $(CFLAGS) -f - $(ARCH_SOURCES) $(GENARCH_SOURCES) $(GENERIC_SOURCES) > Makefile.depend 2> /dev/null |
270 | 280 | ||
271 | arch/$(ARCH)/_link.ld: arch/$(ARCH)/_link.ld.in |
281 | arch/$(ARCH)/_link.ld: arch/$(ARCH)/_link.ld.in |
272 | $(CC) $(DEFS) $(CFLAGS) -D__ASM__ -E -x c $< | grep -v "^\#" > $@ |
282 | $(CC) $(DEFS) $(CFLAGS) -D__ASM__ -E -x c $< | grep -v "^\#" > $@ |
273 | 283 | ||
274 | generic/src/debug/real_map.bin: depend arch/$(ARCH)/_link.ld $(ARCH_OBJECTS) $(GENARCH_OBJECTS) $(GENERIC_OBJECTS) |
284 | generic/src/debug/real_map.bin: depend arch/$(ARCH)/_link.ld $(ARCH_OBJECTS) $(GENARCH_OBJECTS) $(GENERIC_OBJECTS) |
275 | $(OBJCOPY) -I binary -O $(BFD_NAME) -B $(BFD_ARCH) --prefix-sections=symtab Makefile generic/src/debug/empty_map.o |
285 | $(OBJCOPY) -I binary -O $(BFD_NAME) -B $(BFD_ARCH) --prefix-sections=symtab Makefile generic/src/debug/empty_map.o |
276 | $(LD) -T arch/$(ARCH)/_link.ld $(LFLAGS) $(ARCH_OBJECTS) $(GENARCH_OBJECTS) $(GENERIC_OBJECTS) generic/src/debug/empty_map.o -o $@ -Map kernel.map.pre |
286 | $(LD) -T arch/$(ARCH)/_link.ld $(LFLAGS) $(ARCH_OBJECTS) $(GENARCH_OBJECTS) $(GENERIC_OBJECTS) generic/src/debug/empty_map.o -o $@ -Map kernel.map.pre |
277 | $(OBJDUMP) -t $(ARCH_OBJECTS) $(GENARCH_OBJECTS) $(GENERIC_OBJECTS) > kernel.objdump |
287 | $(OBJDUMP) -t $(ARCH_OBJECTS) $(GENARCH_OBJECTS) $(GENERIC_OBJECTS) > kernel.objdump |
278 | tools/genmap.py kernel.map.pre kernel.objdump generic/src/debug/real_map.bin |
288 | tools/genmap.py kernel.map.pre kernel.objdump generic/src/debug/real_map.bin |
279 | # Do it once again, this time to get correct even the symbols |
289 | # Do it once again, this time to get correct even the symbols |
280 | # on architectures, that have bss after symtab |
290 | # on architectures, that have bss after symtab |
281 | $(OBJCOPY) -I binary -O $(BFD_NAME) -B $(BFD_ARCH) --prefix-sections=symtab generic/src/debug/real_map.bin generic/src/debug/sizeok_map.o |
291 | $(OBJCOPY) -I binary -O $(BFD_NAME) -B $(BFD_ARCH) --prefix-sections=symtab generic/src/debug/real_map.bin generic/src/debug/sizeok_map.o |
282 | $(LD) -T arch/$(ARCH)/_link.ld $(LFLAGS) $(ARCH_OBJECTS) $(GENARCH_OBJECTS) $(GENERIC_OBJECTS) generic/src/debug/sizeok_map.o -o $@ -Map kernel.map.pre |
292 | $(LD) -T arch/$(ARCH)/_link.ld $(LFLAGS) $(ARCH_OBJECTS) $(GENARCH_OBJECTS) $(GENERIC_OBJECTS) generic/src/debug/sizeok_map.o -o $@ -Map kernel.map.pre |
283 | $(OBJDUMP) -t $(ARCH_OBJECTS) $(GENARCH_OBJECTS) $(GENERIC_OBJECTS) > kernel.objdump |
293 | $(OBJDUMP) -t $(ARCH_OBJECTS) $(GENARCH_OBJECTS) $(GENERIC_OBJECTS) > kernel.objdump |
284 | tools/genmap.py kernel.map.pre kernel.objdump generic/src/debug/real_map.bin |
294 | tools/genmap.py kernel.map.pre kernel.objdump generic/src/debug/real_map.bin |
285 | 295 | ||
286 | generic/src/debug/real_map.o: generic/src/debug/real_map.bin |
296 | generic/src/debug/real_map.o: generic/src/debug/real_map.bin |
287 | $(OBJCOPY) -I binary -O $(BFD_NAME) -B $(BFD_ARCH) --prefix-sections=symtab $< $@ |
297 | $(OBJCOPY) -I binary -O $(BFD_NAME) -B $(BFD_ARCH) --prefix-sections=symtab $< $@ |
288 | 298 | ||
289 | kernel.raw: depend arch/$(ARCH)/_link.ld $(ARCH_OBJECTS) $(GENARCH_OBJECTS) $(GENERIC_OBJECTS) generic/src/debug/real_map.o |
299 | kernel.raw: depend arch/$(ARCH)/_link.ld $(ARCH_OBJECTS) $(GENARCH_OBJECTS) $(GENERIC_OBJECTS) generic/src/debug/real_map.o |
290 | $(LD) -T arch/$(ARCH)/_link.ld $(LFLAGS) $(ARCH_OBJECTS) $(GENARCH_OBJECTS) $(GENERIC_OBJECTS) generic/src/debug/real_map.o -o $@ -Map kernel.map |
300 | $(LD) -T arch/$(ARCH)/_link.ld $(LFLAGS) $(ARCH_OBJECTS) $(GENARCH_OBJECTS) $(GENERIC_OBJECTS) generic/src/debug/real_map.o -o $@ -Map kernel.map |
291 | 301 | ||
292 | kernel.bin: kernel.raw |
302 | kernel.bin: kernel.raw |
293 | $(OBJCOPY) -O $(BFD) kernel.raw kernel.bin |
303 | $(OBJCOPY) -O $(BFD) kernel.raw kernel.bin |
294 | 304 | ||
295 | disasm: kernel.raw |
305 | disasm: kernel.raw |
296 | $(OBJDUMP) -d kernel.raw > kernel.disasm |
306 | $(OBJDUMP) -d kernel.raw > kernel.disasm |
297 | 307 | ||
298 | %.o: %.S |
308 | %.o: %.S |
299 | $(CC) $(DEFS) $(CFLAGS) -D__ASM__ -c $< -o $@ |
309 | $(CC) $(DEFS) $(CFLAGS) -D__ASM__ -c $< -o $@ |
300 | 310 | ||
301 | %.o: %.s |
311 | %.o: %.s |
302 | $(AS) $(AFLAGS) $< -o $@ |
312 | $(AS) $(AFLAGS) $< -o $@ |
303 | 313 | ||
304 | %.o: %.c |
314 | %.o: %.c |
305 | $(CC) $(DEFS) $(CFLAGS) -c $< -o $@ |
315 | $(CC) $(DEFS) $(CFLAGS) -c $< -o $@ |
306 | 316 |