Rev 3386 | Rev 4263 | Go to most recent revision | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed
Rev 3386 | Rev 4153 | ||
---|---|---|---|
Line 28... | Line 28... | ||
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 | -include ../config.defs |
|
35 | 36 | ||
36 | INCLUDES = generic/include |
37 | INCLUDES = generic/include |
37 | OPTIMIZATION = 3 |
38 | OPTIMIZATION = 3 |
38 | 39 | ||
- | 40 | ifndef CROSS_PREFIX |
|
- | 41 | CROSS_PREFIX = /usr/local |
|
- | 42 | endif |
|
- | 43 | ||
39 | ## Common compiler flags |
44 | ## Common compiler flags |
40 | # |
45 | # |
41 | 46 | ||
42 | DEFS = -D$(ARCH) -DARCH=\"$(ARCH)\" -DRELEASE=\"$(RELEASE)\" "-DNAME=\"$(NAME)\"" \ |
47 | DEFS = -DKERNEL -DRELEASE=$(RELEASE) "-DNAME=$(NAME)" |
43 | -DKERNEL |
- | |
44 | 48 | ||
45 | GCC_CFLAGS = -I$(INCLUDES) -O$(OPTIMIZATION) \ |
49 | GCC_CFLAGS = -I$(INCLUDES) -O$(OPTIMIZATION) -imacros ../config.h \ |
46 | -fno-builtin -Wall -Wextra -Wno-unused-parameter -Wmissing-prototypes -Werror \ |
50 | -fno-builtin -Wall -Wextra -Wno-unused-parameter -Wmissing-prototypes -Werror \ |
47 | -nostdlib -nostdinc |
51 | -nostdlib -nostdinc -pipe |
48 | 52 | ||
49 | ICC_CFLAGS = -I$(INCLUDES) -O$(OPTIMIZATION) \ |
53 | ICC_CFLAGS = -I$(INCLUDES) -O$(OPTIMIZATION) -imacros ../config.h \ |
50 | -fno-builtin -Wall -Wmissing-prototypes -Werror \ |
54 | -fno-builtin -Wall -Wmissing-prototypes -Werror \ |
51 | -nostdlib -nostdinc \ |
55 | -nostdlib -nostdinc \ |
52 | -wd170 |
56 | -wd170 |
53 | 57 | ||
54 | SUNCC_CFLAGS = -I$(INCLUDES) -xO$(OPTIMIZATION) \ |
58 | SUNCC_CFLAGS = -I$(INCLUDES) -xO$(OPTIMIZATION) \ |
Line 56... | Line 60... | ||
56 | -erroff=E_ZERO_SIZED_STRUCT_UNION |
60 | -erroff=E_ZERO_SIZED_STRUCT_UNION |
57 | 61 | ||
58 | LFLAGS = -M |
62 | LFLAGS = -M |
59 | AFLAGS = |
63 | AFLAGS = |
60 | 64 | ||
61 | ifdef REVISION |
- | |
62 | DEFS += "-DREVISION=\"$(REVISION)\"" |
- | |
63 | endif |
- | |
64 | - | ||
65 | ifdef TIMESTAMP |
- | |
66 | DEFS += "-DTIMESTAMP=\"$(TIMESTAMP)\"" |
- | |
67 | endif |
- | |
68 | - | ||
69 | -include arch/$(ARCH)/Makefile.inc |
65 | -include arch/$(KARCH)/Makefile.inc |
70 | -include genarch/Makefile.inc |
66 | -include genarch/Makefile.inc |
71 | 67 | ||
72 | ## The at-sign |
68 | ## The at-sign |
73 | # |
69 | # |
74 | # The $(ATSIGN) variable holds the ASCII character representing the at-sign |
70 | # The $(ATSIGN) variable holds the ASCII character representing the at-sign |
Line 82... | Line 78... | ||
82 | 78 | ||
83 | ## Cross-platform assembly to start a symtab.data section |
79 | ## Cross-platform assembly to start a symtab.data section |
84 | # |
80 | # |
85 | SYMTAB_SECTION=".section symtab.data, \"a\", $(ATSIGN)progbits;" |
81 | SYMTAB_SECTION=".section symtab.data, \"a\", $(ATSIGN)progbits;" |
86 | 82 | ||
87 | ## Setup kernel configuration |
- | |
88 | # |
- | |
89 | ifeq ($(CONFIG_DEBUG),y) |
- | |
90 | DEFS += -DCONFIG_DEBUG |
- | |
91 | endif |
- | |
92 | - | ||
93 | ifeq ($(CONFIG_EDEBUG),y) |
- | |
94 | DEFS += -DCONFIG_EDEBUG |
- | |
95 | endif |
- | |
96 | - | ||
97 | ifeq ($(CONFIG_DEBUG_SPINLOCK),y) |
- | |
98 | DEFS += -DCONFIG_DEBUG_SPINLOCK |
- | |
99 | endif |
- | |
100 | - | ||
101 | ifeq ($(CONFIG_DEBUG_AS_WATCHPOINT),y) |
- | |
102 | DEFS += -DCONFIG_DEBUG_AS_WATCHPOINT |
- | |
103 | endif |
- | |
104 | - | ||
105 | ifeq ($(CONFIG_FPU_LAZY),y) |
- | |
106 | DEFS += -DCONFIG_FPU_LAZY |
- | |
107 | endif |
- | |
108 | - | ||
109 | ifeq ($(CONFIG_DEBUG_ALLREGS),y) |
- | |
110 | DEFS += -DCONFIG_DEBUG_ALLREGS |
- | |
111 | endif |
- | |
112 | - | ||
113 | ifeq ($(CONFIG_VHPT),y) |
- | |
114 | DEFS += -DCONFIG_VHPT |
- | |
115 | endif |
- | |
116 | - | ||
117 | ifeq ($(CONFIG_TSB),y) |
- | |
118 | DEFS += -DCONFIG_TSB |
- | |
119 | endif |
- | |
120 | - | ||
121 | ifeq ($(CONFIG_Z8530),y) |
- | |
122 | DEFS += -DCONFIG_Z8530 |
- | |
123 | endif |
- | |
124 | - | ||
125 | ifeq ($(CONFIG_NS16550),y) |
- | |
126 | DEFS += -DCONFIG_NS16550 |
- | |
127 | endif |
- | |
128 | - | ||
129 | ifeq ($(CONFIG_VIRT_IDX_DCACHE),y) |
- | |
130 | DEFS += -DCONFIG_VIRT_IDX_DCACHE |
- | |
131 | endif |
- | |
132 | - | ||
133 | ifeq ($(CONFIG_FB),y) |
- | |
134 | ifeq ($(ARCH),ia32) |
- | |
135 | DEFS += -DCONFIG_VESA_WIDTH=$(CONFIG_VESA_WIDTH) |
- | |
136 | DEFS += -DCONFIG_VESA_HEIGHT=$(CONFIG_VESA_HEIGHT) |
- | |
137 | DEFS += -DCONFIG_VESA_BPP=$(CONFIG_VESA_BPP) |
- | |
138 | endif |
- | |
139 | - | ||
140 | ifeq ($(ARCH),amd64) |
- | |
141 | DEFS += -DCONFIG_VESA_WIDTH=$(CONFIG_VESA_WIDTH) |
- | |
142 | DEFS += -DCONFIG_VESA_HEIGHT=$(CONFIG_VESA_HEIGHT) |
- | |
143 | DEFS += -DCONFIG_VESA_BPP=$(CONFIG_VESA_BPP) |
- | |
144 | endif |
- | |
145 | - | ||
146 | ifeq ($(ARCH),ia32xen) |
- | |
147 | DEFS += -DCONFIG_VESA_WIDTH=$(CONFIG_VESA_WIDTH) |
- | |
148 | DEFS += -DCONFIG_VESA_HEIGHT=$(CONFIG_VESA_HEIGHT) |
- | |
149 | DEFS += -DCONFIG_VESA_BPP=$(CONFIG_VESA_BPP) |
- | |
150 | endif |
- | |
151 | endif |
- | |
152 | - | ||
153 | ## Simple detection for the type of the host system |
83 | ## Simple detection for the type of the host system |
154 | # |
84 | # |
155 | HOST = $(shell uname) |
85 | HOST = $(shell uname) |
156 | 86 | ||
157 | ## On Solaris, some utilities have slightly different names |
87 | ## On Solaris, some utilities have slightly different names |
Line 172... | Line 102... | ||
172 | LD = $(BINUTILS_PREFIX)ld |
102 | LD = $(BINUTILS_PREFIX)ld |
173 | OBJCOPY = $(BINUTILS_PREFIX)objcopy |
103 | OBJCOPY = $(BINUTILS_PREFIX)objcopy |
174 | OBJDUMP = $(BINUTILS_PREFIX)objdump |
104 | OBJDUMP = $(BINUTILS_PREFIX)objdump |
175 | LIBDIR = /usr/lib |
105 | LIBDIR = /usr/lib |
176 | CFLAGS = $(GCC_CFLAGS) |
106 | CFLAGS = $(GCC_CFLAGS) |
- | 107 | DEPEND_DEFS = $(DEFS) $(CONFIG_DEFS) |
|
177 | endif |
108 | endif |
178 | 109 | ||
179 | ifeq ($(COMPILER),icc_native) |
110 | ifeq ($(COMPILER),icc_native) |
180 | CC = icc |
111 | CC = icc |
181 | GCC = gcc |
112 | GCC = gcc |
Line 183... | Line 114... | ||
183 | LD = ld |
114 | LD = ld |
184 | OBJCOPY = objcopy |
115 | OBJCOPY = objcopy |
185 | OBJDUMP = objdump |
116 | OBJDUMP = objdump |
186 | LIBDIR = /usr/lib |
117 | LIBDIR = /usr/lib |
187 | CFLAGS = $(ICC_CFLAGS) |
118 | CFLAGS = $(ICC_CFLAGS) |
- | 119 | DEPEND_DEFS = $(DEFS) $(CONFIG_DEFS) |
|
188 | endif |
120 | endif |
189 | 121 | ||
190 | ifeq ($(COMPILER),suncc_native) |
122 | ifeq ($(COMPILER),suncc_native) |
191 | CC = suncc |
123 | CC = suncc |
192 | GCC = gcc |
124 | GCC = gcc |
Line 194... | Line 126... | ||
194 | LD = $(BINUTILS_PREFIX)ld |
126 | LD = $(BINUTILS_PREFIX)ld |
195 | OBJCOPY = $(BINUTILS_PREFIX)objcopy |
127 | OBJCOPY = $(BINUTILS_PREFIX)objcopy |
196 | OBJDUMP = $(BINUTILS_PREFIX)objdump |
128 | OBJDUMP = $(BINUTILS_PREFIX)objdump |
197 | LIBDIR = /usr/lib |
129 | LIBDIR = /usr/lib |
198 | CFLAGS = $(SUNCC_CFLAGS) |
130 | CFLAGS = $(SUNCC_CFLAGS) |
- | 131 | DEFS += $(CONFIG_DEFS) |
|
- | 132 | DEPEND_DEFS = $(DEFS) |
|
199 | endif |
133 | endif |
200 | 134 | ||
201 | ifeq ($(COMPILER),gcc_cross) |
135 | ifeq ($(COMPILER),gcc_cross) |
202 | CC = $(TOOLCHAIN_DIR)/bin/$(TARGET)-gcc |
136 | CC = $(TOOLCHAIN_DIR)/bin/$(TARGET)-gcc |
203 | GCC = $(CC) |
137 | GCC = $(CC) |
Line 205... | Line 139... | ||
205 | LD = $(TOOLCHAIN_DIR)/bin/$(TARGET)-ld |
139 | LD = $(TOOLCHAIN_DIR)/bin/$(TARGET)-ld |
206 | OBJCOPY = $(TOOLCHAIN_DIR)/bin/$(TARGET)-objcopy |
140 | OBJCOPY = $(TOOLCHAIN_DIR)/bin/$(TARGET)-objcopy |
207 | OBJDUMP = $(TOOLCHAIN_DIR)/bin/$(TARGET)-objdump |
141 | OBJDUMP = $(TOOLCHAIN_DIR)/bin/$(TARGET)-objdump |
208 | LIBDIR = $(TOOLCHAIN_DIR)/lib |
142 | LIBDIR = $(TOOLCHAIN_DIR)/lib |
209 | CFLAGS = $(GCC_CFLAGS) |
143 | CFLAGS = $(GCC_CFLAGS) |
- | 144 | DEPEND_DEFS = $(DEFS) $(CONFIG_DEFS) |
|
210 | endif |
145 | endif |
211 | 146 | ||
212 | ## Generic kernel sources |
147 | ## Generic kernel sources |
213 | # |
148 | # |
214 | 149 | ||
Line 218... | Line 153... | ||
218 | generic/src/adt/btree.c \ |
153 | generic/src/adt/btree.c \ |
219 | generic/src/adt/hash_table.c \ |
154 | generic/src/adt/hash_table.c \ |
220 | generic/src/adt/list.c \ |
155 | generic/src/adt/list.c \ |
221 | generic/src/console/chardev.c \ |
156 | generic/src/console/chardev.c \ |
222 | generic/src/console/console.c \ |
157 | generic/src/console/console.c \ |
223 | generic/src/console/kconsole.c \ |
- | |
224 | generic/src/console/cmd.c \ |
- | |
225 | generic/src/cpu/cpu.c \ |
158 | generic/src/cpu/cpu.c \ |
226 | generic/src/ddi/ddi.c \ |
159 | generic/src/ddi/ddi.c \ |
227 | generic/src/ddi/irq.c \ |
160 | generic/src/ddi/irq.c \ |
228 | generic/src/ddi/device.c \ |
161 | generic/src/ddi/device.c \ |
- | 162 | generic/src/debug/symtab.c \ |
|
229 | generic/src/interrupt/interrupt.c \ |
163 | generic/src/interrupt/interrupt.c \ |
230 | generic/src/main/main.c \ |
164 | generic/src/main/main.c \ |
231 | generic/src/main/kinit.c \ |
165 | generic/src/main/kinit.c \ |
232 | generic/src/main/uinit.c \ |
166 | generic/src/main/uinit.c \ |
233 | generic/src/main/version.c \ |
167 | generic/src/main/version.c \ |
Line 250... | Line 184... | ||
250 | generic/src/mm/backend_phys.c \ |
184 | generic/src/mm/backend_phys.c \ |
251 | generic/src/mm/slab.c \ |
185 | generic/src/mm/slab.c \ |
252 | generic/src/lib/func.c \ |
186 | generic/src/lib/func.c \ |
253 | generic/src/lib/memstr.c \ |
187 | generic/src/lib/memstr.c \ |
254 | generic/src/lib/sort.c \ |
188 | generic/src/lib/sort.c \ |
- | 189 | generic/src/lib/string.c \ |
|
255 | generic/src/lib/elf.c \ |
190 | generic/src/lib/elf.c \ |
256 | generic/src/lib/rd.c \ |
191 | generic/src/lib/rd.c \ |
257 | generic/src/printf/printf_core.c \ |
192 | generic/src/printf/printf_core.c \ |
258 | generic/src/printf/printf.c \ |
193 | generic/src/printf/printf.c \ |
259 | generic/src/printf/sprintf.c \ |
194 | generic/src/printf/sprintf.c \ |
260 | generic/src/printf/snprintf.c \ |
195 | generic/src/printf/snprintf.c \ |
261 | generic/src/printf/vprintf.c \ |
196 | generic/src/printf/vprintf.c \ |
262 | generic/src/printf/vsprintf.c \ |
197 | generic/src/printf/vsprintf.c \ |
263 | generic/src/printf/vsnprintf.c \ |
198 | generic/src/printf/vsnprintf.c \ |
264 | generic/src/debug/symtab.c \ |
- | |
265 | generic/src/time/clock.c \ |
199 | generic/src/time/clock.c \ |
266 | generic/src/time/timeout.c \ |
200 | generic/src/time/timeout.c \ |
267 | generic/src/time/delay.c \ |
201 | generic/src/time/delay.c \ |
268 | generic/src/preempt/preemption.c \ |
202 | generic/src/preempt/preemption.c \ |
269 | generic/src/synch/spinlock.c \ |
203 | generic/src/synch/spinlock.c \ |
Line 281... | Line 215... | ||
281 | generic/src/ipc/ipcrsc.c \ |
215 | generic/src/ipc/ipcrsc.c \ |
282 | generic/src/ipc/irq.c \ |
216 | generic/src/ipc/irq.c \ |
283 | generic/src/security/cap.c \ |
217 | generic/src/security/cap.c \ |
284 | generic/src/sysinfo/sysinfo.c |
218 | generic/src/sysinfo/sysinfo.c |
285 | 219 | ||
- | 220 | ## Kernel console support |
|
- | 221 | # |
|
- | 222 | ||
- | 223 | ifeq ($(CONFIG_KCONSOLE),y) |
|
- | 224 | GENERIC_SOURCES += \ |
|
- | 225 | generic/src/console/kconsole.c \ |
|
- | 226 | generic/src/console/cmd.c |
|
- | 227 | endif |
|
- | 228 | ||
- | 229 | ## Udebug interface sources |
|
- | 230 | # |
|
- | 231 | ||
- | 232 | ifeq ($(CONFIG_UDEBUG),y) |
|
- | 233 | GENERIC_SOURCES += \ |
|
- | 234 | generic/src/ipc/kbox.c \ |
|
- | 235 | generic/src/udebug/udebug.c \ |
|
- | 236 | generic/src/udebug/udebug_ops.c \ |
|
- | 237 | generic/src/udebug/udebug_ipc.c |
|
- | 238 | endif |
|
- | 239 | ||
286 | ## Test sources |
240 | ## Test sources |
287 | # |
241 | # |
288 | 242 | ||
289 | ifeq ($(CONFIG_TEST),y) |
243 | ifeq ($(CONFIG_TEST),y) |
290 | DEFS += -DCONFIG_TEST |
- | |
291 | CFLAGS += -Itest/ |
244 | CFLAGS += -Itest/ |
292 | GENERIC_SOURCES += \ |
245 | GENERIC_SOURCES += \ |
293 | test/test.c \ |
246 | test/test.c \ |
294 | test/atomic/atomic1.c \ |
247 | test/atomic/atomic1.c \ |
295 | test/btree/btree1.c \ |
248 | test/btree/btree1.c \ |
296 | test/avltree/avltree1.c \ |
249 | test/avltree/avltree1.c \ |
297 | test/debug/mips1.c \ |
- | |
298 | test/fault/fault1.c \ |
250 | test/fault/fault1.c \ |
299 | test/fpu/fpu1.c \ |
- | |
300 | test/fpu/sse1.c \ |
- | |
301 | test/fpu/mips2.c \ |
- | |
302 | test/mm/falloc1.c \ |
251 | test/mm/falloc1.c \ |
303 | test/mm/falloc2.c \ |
252 | test/mm/falloc2.c \ |
304 | test/mm/mapping1.c \ |
253 | test/mm/mapping1.c \ |
305 | test/mm/slab1.c \ |
254 | test/mm/slab1.c \ |
306 | test/mm/slab2.c \ |
255 | test/mm/slab2.c \ |
307 | test/mm/purge1.c \ |
- | |
308 | test/synch/rwlock1.c \ |
256 | test/synch/rwlock1.c \ |
309 | test/synch/rwlock2.c \ |
257 | test/synch/rwlock2.c \ |
310 | test/synch/rwlock3.c \ |
258 | test/synch/rwlock3.c \ |
311 | test/synch/rwlock4.c \ |
259 | test/synch/rwlock4.c \ |
312 | test/synch/rwlock5.c \ |
260 | test/synch/rwlock5.c \ |
313 | test/synch/semaphore1.c \ |
261 | test/synch/semaphore1.c \ |
314 | test/synch/semaphore2.c \ |
262 | test/synch/semaphore2.c \ |
315 | test/print/print1.c \ |
263 | test/print/print1.c \ |
316 | test/thread/thread1.c \ |
264 | test/thread/thread1.c \ |
317 | test/sysinfo/sysinfo1.c |
265 | test/sysinfo/sysinfo1.c |
- | 266 | ||
- | 267 | ifeq ($(KARCH),mips32) |
|
- | 268 | GENERIC_SOURCES += test/debug/mips1.c |
|
- | 269 | else |
|
- | 270 | GENERIC_SOURCES += test/debug/mips1_skip.c |
|
- | 271 | endif |
|
- | 272 | ||
- | 273 | ifeq ($(KARCH),ia64) |
|
- | 274 | GENERIC_SOURCES += test/mm/purge1.c |
|
- | 275 | else |
|
- | 276 | GENERIC_SOURCES += test/mm/purge1_skip.c |
|
- | 277 | endif |
|
- | 278 | ||
- | 279 | ifeq ($(CONFIG_FPU),y) |
|
- | 280 | ifeq ($(KARCH),ia32) |
|
- | 281 | TEST_FPU1 = y |
|
- | 282 | TEST_SSE1 = y |
|
- | 283 | GENERIC_SOURCES += test/fpu/fpu1_x86.c |
|
- | 284 | endif |
|
- | 285 | ||
- | 286 | ifeq ($(KARCH),amd64) |
|
- | 287 | TEST_FPU1 = y |
|
- | 288 | TEST_SSE1 = y |
|
- | 289 | GENERIC_SOURCES += test/fpu/fpu1_x86.c |
|
- | 290 | endif |
|
- | 291 | ||
- | 292 | ifeq ($(KARCH),ia64) |
|
- | 293 | TEST_FPU1 = y |
|
- | 294 | GENERIC_SOURCES += test/fpu/fpu1_ia64.c |
|
- | 295 | endif |
|
- | 296 | ||
- | 297 | ifeq ($(KARCH),mips32) |
|
- | 298 | TEST_MIPS2 = y |
|
- | 299 | endif |
|
- | 300 | endif |
|
- | 301 | ||
- | 302 | ifneq ($(TEST_FPU1),y) |
|
- | 303 | GENERIC_SOURCES += test/fpu/fpu1_skip.c |
|
- | 304 | endif |
|
- | 305 | ||
- | 306 | ifeq ($(TEST_SSE1),y) |
|
- | 307 | GENERIC_SOURCES += test/fpu/sse1.c |
|
- | 308 | else |
|
- | 309 | GENERIC_SOURCES += test/fpu/sse1_skip.c |
|
- | 310 | endif |
|
- | 311 | ||
- | 312 | ifeq ($(TEST_MIPS2),y) |
|
- | 313 | GENERIC_SOURCES += test/fpu/mips2.c |
|
- | 314 | else |
|
- | 315 | GENERIC_SOURCES += test/fpu/mips2_skip.c |
|
- | 316 | endif |
|
- | 317 | ||
318 | endif |
318 | endif |
319 | 319 | ||
320 | GENERIC_OBJECTS := $(addsuffix .o,$(basename $(GENERIC_SOURCES))) |
320 | GENERIC_OBJECTS := $(addsuffix .o,$(basename $(GENERIC_SOURCES))) |
321 | ARCH_OBJECTS := $(addsuffix .o,$(basename $(ARCH_SOURCES))) |
321 | ARCH_OBJECTS := $(addsuffix .o,$(basename $(ARCH_SOURCES))) |
322 | GENARCH_OBJECTS := $(addsuffix .o,$(basename $(GENARCH_SOURCES))) |
322 | GENARCH_OBJECTS := $(addsuffix .o,$(basename $(GENARCH_SOURCES))) |
323 | 323 | ||
- | 324 | ifeq ($(CONFIG_SYMTAB),y) |
|
- | 325 | SYMTAB_OBJECTS := generic/src/debug/real_map.o |
|
- | 326 | else |
|
- | 327 | SYMTAB_OBJECTS := |
|
- | 328 | endif |
|
- | 329 | ||
324 | .PHONY: all build config distclean clean archlinks depend disasm |
330 | .PHONY: all build clean archlinks depend disasm |
325 | 331 | ||
326 | all: |
- | |
327 | ../tools/config.py kernel.config default $(ARCH) $(COMPILER) $(CONFIG_DEBUG) $(MACHINE) |
332 | all: ../Makefile.config ../config.h ../config.defs |
- | 333 | -rm Makefile.depend |
|
328 | $(MAKE) -C . build |
334 | $(MAKE) -C . build |
329 | 335 | ||
330 | build: kernel.bin disasm |
336 | build: kernel.bin disasm |
331 | 337 | ||
332 | config: |
- | |
333 | -rm Makefile.depend |
- | |
334 | ../tools/config.py kernel.config |
- | |
335 | - | ||
336 | -include Makefile.depend |
338 | -include Makefile.depend |
337 | 339 | ||
338 | distclean: clean |
- | |
339 | -rm Makefile.config |
- | |
340 | - | ||
341 | clean: |
340 | clean: |
342 | -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 |
341 | -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/$(KARCH)/_link.ld |
343 | find generic/src/ arch/*/src/ genarch/src/ test/ -name '*.o' -follow -exec rm \{\} \; |
342 | find generic/src/ arch/*/src/ genarch/src/ test/ -name '*.o' -follow -exec rm \{\} \; |
344 | for arch in arch/* ; do \ |
343 | for arch in arch/* ; do \ |
345 | [ -e $$arch/_link.ld ] && rm $$arch/_link.ld 2>/dev/null ; \ |
344 | [ -e $$arch/_link.ld ] && rm $$arch/_link.ld 2>/dev/null ; \ |
346 | done ; exit 0 |
345 | done ; exit 0 |
347 | 346 | ||
348 | archlinks: |
347 | archlinks: |
349 | ln -sfn ../../arch/$(ARCH)/include/ generic/include/arch |
348 | ln -sfn ../../arch/$(KARCH)/include/ generic/include/arch |
350 | ln -sfn ../../genarch/include/ generic/include/genarch |
349 | ln -sfn ../../genarch/include/ generic/include/genarch |
351 | 350 | ||
352 | depend: archlinks |
351 | depend: archlinks |
353 | -makedepend $(DEFS) $(CFLAGS) -f - $(ARCH_SOURCES) $(GENARCH_SOURCES) $(GENERIC_SOURCES) > Makefile.depend 2> /dev/null |
352 | -makedepend -f - -- $(DEPEND_DEFS) $(CFLAGS) -- $(ARCH_SOURCES) $(GENARCH_SOURCES) $(GENERIC_SOURCES) > Makefile.depend 2> /dev/null |
354 | 353 | ||
355 | arch/$(ARCH)/_link.ld: arch/$(ARCH)/_link.ld.in |
354 | arch/$(KARCH)/_link.ld: arch/$(KARCH)/_link.ld.in |
356 | $(GCC) $(DEFS) $(GCC_CFLAGS) -D__ASM__ -D__LINKER__ -E -x c $< | grep -v "^\#" > $@ |
355 | $(GCC) $(DEFS) $(GCC_CFLAGS) -D__ASM__ -D__LINKER__ -E -x c $< | grep -v "^\#" > $@ |
357 | 356 | ||
358 | generic/src/debug/real_map.bin: depend arch/$(ARCH)/_link.ld $(ARCH_OBJECTS) $(GENARCH_OBJECTS) $(GENERIC_OBJECTS) |
357 | generic/src/debug/real_map.bin: depend arch/$(KARCH)/_link.ld $(ARCH_OBJECTS) $(GENARCH_OBJECTS) $(GENERIC_OBJECTS) |
359 | echo $(SYMTAB_SECTION) | $(AS) $(AFLAGS) -o generic/src/debug/empty_map.o |
358 | echo $(SYMTAB_SECTION) | $(AS) $(AFLAGS) -o generic/src/debug/empty_map.o |
360 | $(LD) -T arch/$(ARCH)/_link.ld $(LFLAGS) $(ARCH_OBJECTS) $(GENARCH_OBJECTS) $(GENERIC_OBJECTS) $(EXTRA_OBJECTS) generic/src/debug/empty_map.o -o $@ -Map kernel.map.pre |
359 | $(LD) -T arch/$(KARCH)/_link.ld $(LFLAGS) $(ARCH_OBJECTS) $(GENARCH_OBJECTS) $(GENERIC_OBJECTS) $(EXTRA_OBJECTS) generic/src/debug/empty_map.o -o $@ -Map kernel.map.pre |
361 | $(OBJDUMP) -t $(ARCH_OBJECTS) $(GENARCH_OBJECTS) $(GENERIC_OBJECTS) > kernel.objdump |
360 | $(OBJDUMP) -t $(ARCH_OBJECTS) $(GENARCH_OBJECTS) $(GENERIC_OBJECTS) > kernel.objdump |
362 | tools/genmap.py kernel.map.pre kernel.objdump generic/src/debug/real_map.bin |
361 | tools/genmap.py kernel.map.pre kernel.objdump generic/src/debug/real_map.bin |
363 | # Do it once again, this time to get correct even the symbols |
362 | # Do it once again, this time to get correct even the symbols |
364 | # on architectures, that have bss after symtab |
363 | # on architectures, that have bss after symtab |
365 | echo $(SYMTAB_SECTION)" .incbin \"$@\"" | $(AS) $(AFLAGS) -o generic/src/debug/sizeok_map.o |
364 | echo $(SYMTAB_SECTION)" .incbin \"$@\"" | $(AS) $(AFLAGS) -o generic/src/debug/sizeok_map.o |
366 | $(LD) -T arch/$(ARCH)/_link.ld $(LFLAGS) $(ARCH_OBJECTS) $(GENARCH_OBJECTS) $(GENERIC_OBJECTS) $(EXTRA_OBJECTS) generic/src/debug/sizeok_map.o -o $@ -Map kernel.map.pre |
365 | $(LD) -T arch/$(KARCH)/_link.ld $(LFLAGS) $(ARCH_OBJECTS) $(GENARCH_OBJECTS) $(GENERIC_OBJECTS) $(EXTRA_OBJECTS) generic/src/debug/sizeok_map.o -o $@ -Map kernel.map.pre |
367 | $(OBJDUMP) -t $(ARCH_OBJECTS) $(GENARCH_OBJECTS) $(GENERIC_OBJECTS) > kernel.objdump |
366 | $(OBJDUMP) -t $(ARCH_OBJECTS) $(GENARCH_OBJECTS) $(GENERIC_OBJECTS) > kernel.objdump |
368 | tools/genmap.py kernel.map.pre kernel.objdump generic/src/debug/real_map.bin |
367 | tools/genmap.py kernel.map.pre kernel.objdump generic/src/debug/real_map.bin |
369 | 368 | ||
370 | generic/src/debug/real_map.o: generic/src/debug/real_map.bin |
369 | generic/src/debug/real_map.o: generic/src/debug/real_map.bin |
371 | echo $(SYMTAB_SECTION)" .incbin \"$<\"" | $(AS) $(AFLAGS) -o $@ |
370 | echo $(SYMTAB_SECTION)" .incbin \"$<\"" | $(AS) $(AFLAGS) -o $@ |
372 | 371 | ||
373 | kernel.raw: depend arch/$(ARCH)/_link.ld $(ARCH_OBJECTS) $(GENARCH_OBJECTS) $(GENERIC_OBJECTS) generic/src/debug/real_map.o |
372 | kernel.raw: depend arch/$(KARCH)/_link.ld $(ARCH_OBJECTS) $(GENARCH_OBJECTS) $(GENERIC_OBJECTS) $(SYMTAB_OBJECTS) |
374 | $(LD) -T arch/$(ARCH)/_link.ld $(LFLAGS) $(ARCH_OBJECTS) $(GENARCH_OBJECTS) $(GENERIC_OBJECTS) $(EXTRA_OBJECTS) generic/src/debug/real_map.o -o $@ -Map kernel.map |
373 | $(LD) -T arch/$(KARCH)/_link.ld $(LFLAGS) $(ARCH_OBJECTS) $(GENARCH_OBJECTS) $(GENERIC_OBJECTS) $(EXTRA_OBJECTS) $(SYMTAB_OBJECTS) -o $@ -Map kernel.map |
375 | 374 | ||
376 | kernel.bin: kernel.raw |
375 | kernel.bin: kernel.raw |
377 | $(OBJCOPY) -O $(BFD) kernel.raw kernel.bin |
376 | $(OBJCOPY) -O $(BFD) kernel.raw kernel.bin |
378 | 377 | ||
379 | disasm: kernel.raw |
378 | disasm: kernel.raw |