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