Subversion Repositories HelenOS

Rev

Rev 3665 | Go to most recent revision | Only display areas with differences | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed

Rev 3665 Rev 3742
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
INCLUDES = generic/include
36
INCLUDES = generic/include
37
OPTIMIZATION = 3
37
OPTIMIZATION = 3
38
 
38
 
39
## Common compiler flags
39
## Common compiler flags
40
#
40
#
41
 
41
 
42
DEFS = -D$(ARCH) -DARCH=\"$(ARCH)\" -DRELEASE=\"$(RELEASE)\" "-DNAME=\"$(NAME)\"" \
42
DEFS = -D$(ARCH) -DARCH=\"$(ARCH)\" -DRELEASE=\"$(RELEASE)\" "-DNAME=\"$(NAME)\"" \
43
	-DKERNEL
43
	-DKERNEL
44
 
44
 
45
GCC_CFLAGS = -I$(INCLUDES) -O$(OPTIMIZATION) \
45
GCC_CFLAGS = -I$(INCLUDES) -O$(OPTIMIZATION) \
46
	-fno-builtin -Wall -Wextra -Wno-unused-parameter -Wmissing-prototypes -Werror \
46
	-fno-builtin -Wall -Wextra -Wno-unused-parameter -Wmissing-prototypes -Werror \
47
	-nostdlib -nostdinc -pipe
47
	-nostdlib -nostdinc -pipe
48
 
48
 
49
ICC_CFLAGS = -I$(INCLUDES) -O$(OPTIMIZATION) \
49
ICC_CFLAGS = -I$(INCLUDES) -O$(OPTIMIZATION) \
50
	-fno-builtin -Wall -Wmissing-prototypes -Werror \
50
	-fno-builtin -Wall -Wmissing-prototypes -Werror \
51
	-nostdlib -nostdinc \
51
	-nostdlib -nostdinc \
52
	-wd170
52
	-wd170
53
 
53
 
54
SUNCC_CFLAGS = -I$(INCLUDES) -xO$(OPTIMIZATION) \
54
SUNCC_CFLAGS = -I$(INCLUDES) -xO$(OPTIMIZATION) \
55
	-xnolib -xc99=all -features=extensions \
55
	-xnolib -xc99=all -features=extensions \
56
	-erroff=E_ZERO_SIZED_STRUCT_UNION
56
	-erroff=E_ZERO_SIZED_STRUCT_UNION
57
 
57
 
58
LFLAGS = -M
58
LFLAGS = -M
59
AFLAGS =
59
AFLAGS =
60
 
60
 
61
ifdef REVISION
61
ifdef REVISION
62
	DEFS += "-DREVISION=\"$(REVISION)\""
62
	DEFS += "-DREVISION=\"$(REVISION)\""
63
endif
63
endif
64
 
64
 
65
ifdef TIMESTAMP
65
ifdef TIMESTAMP
66
	DEFS += "-DTIMESTAMP=\"$(TIMESTAMP)\""
66
	DEFS += "-DTIMESTAMP=\"$(TIMESTAMP)\""
67
endif
67
endif
68
 
68
 
69
-include arch/$(ARCH)/Makefile.inc
69
-include arch/$(ARCH)/Makefile.inc
70
-include genarch/Makefile.inc
70
-include genarch/Makefile.inc
71
 
71
 
72
## The at-sign
72
## The at-sign
73
#
73
#
74
# The $(ATSIGN) variable holds the ASCII character representing the at-sign
74
# The $(ATSIGN) variable holds the ASCII character representing the at-sign
75
# ('@') used in various $(AS) constructs (e.g. @progbits). On architectures that
75
# ('@') used in various $(AS) constructs (e.g. @progbits). On architectures that
76
# don't use '@' for starting a comment, $(ATSIGN) is merely '@'. However, on
76
# don't use '@' for starting a comment, $(ATSIGN) is merely '@'. However, on
77
# those that do use it for starting a comment (e.g. arm32), $(ATSIGN) must be
77
# those that do use it for starting a comment (e.g. arm32), $(ATSIGN) must be
78
# defined as the percentile-sign ('%') in the architecture-dependent
78
# defined as the percentile-sign ('%') in the architecture-dependent
79
# Makefile.inc.
79
# Makefile.inc.
80
#
80
#
81
ATSIGN ?= @
81
ATSIGN ?= @
82
 
82
 
83
## Cross-platform assembly to start a symtab.data section
83
## Cross-platform assembly to start a symtab.data section
84
#
84
#
85
SYMTAB_SECTION=".section symtab.data, \"a\", $(ATSIGN)progbits;"
85
SYMTAB_SECTION=".section symtab.data, \"a\", $(ATSIGN)progbits;"
86
 
86
 
87
## Setup kernel configuration
87
## Setup kernel configuration
88
#
88
#
89
ifeq ($(CONFIG_DEBUG),y)
89
ifeq ($(CONFIG_DEBUG),y)
90
	DEFS += -DCONFIG_DEBUG
90
	DEFS += -DCONFIG_DEBUG
91
endif
91
endif
92
 
92
 
93
ifeq ($(CONFIG_EDEBUG),y)
93
ifeq ($(CONFIG_LOG),y)
94
	DEFS += -DCONFIG_EDEBUG
94
	DEFS += -DCONFIG_LOG
-
 
95
endif
-
 
96
 
-
 
97
ifeq ($(CONFIG_KCONSOLE),y)
-
 
98
	DEFS += -DCONFIG_KCONSOLE
95
endif
99
endif
96
 
100
 
97
ifeq ($(CONFIG_DEBUG_SPINLOCK),y)
101
ifeq ($(CONFIG_DEBUG_SPINLOCK),y)
98
	DEFS += -DCONFIG_DEBUG_SPINLOCK
102
	DEFS += -DCONFIG_DEBUG_SPINLOCK
99
endif
103
endif
100
 
104
 
101
ifeq ($(CONFIG_DEBUG_AS_WATCHPOINT),y)
105
ifeq ($(CONFIG_DEBUG_AS_WATCHPOINT),y)
102
	DEFS += -DCONFIG_DEBUG_AS_WATCHPOINT
106
	DEFS += -DCONFIG_DEBUG_AS_WATCHPOINT
103
endif
107
endif
104
 
108
 
105
ifeq ($(CONFIG_FPU_LAZY),y)
109
ifeq ($(CONFIG_FPU_LAZY),y)
106
	DEFS += -DCONFIG_FPU_LAZY
110
	DEFS += -DCONFIG_FPU_LAZY
107
endif
111
endif
108
 
112
 
109
ifeq ($(CONFIG_DEBUG_ALLREGS),y)
113
ifeq ($(CONFIG_DEBUG_ALLREGS),y)
110
	DEFS += -DCONFIG_DEBUG_ALLREGS
114
	DEFS += -DCONFIG_DEBUG_ALLREGS
111
endif
115
endif
112
 
116
 
113
ifeq ($(CONFIG_VHPT),y)
117
ifeq ($(CONFIG_VHPT),y)
114
	DEFS += -DCONFIG_VHPT
118
	DEFS += -DCONFIG_VHPT
115
endif
119
endif
116
 
120
 
117
ifeq ($(CONFIG_TSB),y)
121
ifeq ($(CONFIG_TSB),y)
118
	DEFS += -DCONFIG_TSB
122
	DEFS += -DCONFIG_TSB
119
endif
123
endif
120
 
124
 
121
ifeq ($(CONFIG_Z8530),y)
125
ifeq ($(CONFIG_Z8530),y)
122
	DEFS += -DCONFIG_Z8530
126
	DEFS += -DCONFIG_Z8530
123
endif
127
endif
124
 
128
 
125
ifeq ($(CONFIG_NS16550),y)
129
ifeq ($(CONFIG_NS16550),y)
126
	DEFS += -DCONFIG_NS16550
130
	DEFS += -DCONFIG_NS16550
127
endif
131
endif
128
 
132
 
129
ifeq ($(CONFIG_I8042_INTERRUPT_DRIVEN),y)
133
ifeq ($(CONFIG_I8042_INTERRUPT_DRIVEN),y)
130
	DEFS += -DCONFIG_I8042_INTERRUPT_DRIVEN
134
	DEFS += -DCONFIG_I8042_INTERRUPT_DRIVEN
131
endif
135
endif
132
 
136
 
133
ifeq ($(CONFIG_NS16550_INTERRUPT_DRIVEN),y)
137
ifeq ($(CONFIG_NS16550_INTERRUPT_DRIVEN),y)
134
	DEFS += -DCONFIG_NS16550_INTERRUPT_DRIVEN
138
	DEFS += -DCONFIG_NS16550_INTERRUPT_DRIVEN
135
endif
139
endif
136
 
140
 
137
ifeq ($(CONFIG_IOSAPIC),y)
141
ifeq ($(CONFIG_IOSAPIC),y)
138
	DEFS += -DCONFIG_IOSAPIC
142
	DEFS += -DCONFIG_IOSAPIC
139
endif
143
endif
140
 
144
 
141
ifeq ($(CONFIG_VIRT_IDX_DCACHE),y)
145
ifeq ($(CONFIG_VIRT_IDX_DCACHE),y)
142
	DEFS += -DCONFIG_VIRT_IDX_DCACHE
146
	DEFS += -DCONFIG_VIRT_IDX_DCACHE
143
endif
147
endif
144
 
148
 
145
ifeq ($(CONFIG_FB),y)
149
ifeq ($(CONFIG_FB),y)
146
	ifeq ($(ARCH),ia32)
150
	ifeq ($(ARCH),ia32)
147
		DEFS += -DCONFIG_VESA_WIDTH=$(CONFIG_VESA_WIDTH)
151
		DEFS += -DCONFIG_VESA_WIDTH=$(CONFIG_VESA_WIDTH)
148
		DEFS += -DCONFIG_VESA_HEIGHT=$(CONFIG_VESA_HEIGHT)
152
		DEFS += -DCONFIG_VESA_HEIGHT=$(CONFIG_VESA_HEIGHT)
149
		DEFS += -DCONFIG_VESA_BPP=$(CONFIG_VESA_BPP)
153
		DEFS += -DCONFIG_VESA_BPP=$(CONFIG_VESA_BPP)
150
	endif
154
	endif
151
	
155
	
152
	ifeq ($(ARCH),amd64)
156
	ifeq ($(ARCH),amd64)
153
		DEFS += -DCONFIG_VESA_WIDTH=$(CONFIG_VESA_WIDTH)
157
		DEFS += -DCONFIG_VESA_WIDTH=$(CONFIG_VESA_WIDTH)
154
		DEFS += -DCONFIG_VESA_HEIGHT=$(CONFIG_VESA_HEIGHT)
158
		DEFS += -DCONFIG_VESA_HEIGHT=$(CONFIG_VESA_HEIGHT)
155
		DEFS += -DCONFIG_VESA_BPP=$(CONFIG_VESA_BPP)
159
		DEFS += -DCONFIG_VESA_BPP=$(CONFIG_VESA_BPP)
156
	endif
160
	endif
157
	
161
	
158
	ifeq ($(ARCH),ia32xen)
162
	ifeq ($(ARCH),ia32xen)
159
		DEFS += -DCONFIG_VESA_WIDTH=$(CONFIG_VESA_WIDTH)
163
		DEFS += -DCONFIG_VESA_WIDTH=$(CONFIG_VESA_WIDTH)
160
		DEFS += -DCONFIG_VESA_HEIGHT=$(CONFIG_VESA_HEIGHT)
164
		DEFS += -DCONFIG_VESA_HEIGHT=$(CONFIG_VESA_HEIGHT)
161
		DEFS += -DCONFIG_VESA_BPP=$(CONFIG_VESA_BPP)
165
		DEFS += -DCONFIG_VESA_BPP=$(CONFIG_VESA_BPP)
162
	endif
166
	endif
163
endif
167
endif
164
 
168
 
165
ifeq ($(CONFIG_UDEBUG),y)
169
ifeq ($(CONFIG_UDEBUG),y)
166
	DEFS += -DCONFIG_UDEBUG
170
	DEFS += -DCONFIG_UDEBUG
167
endif
171
endif
168
 
172
 
169
## Simple detection for the type of the host system
173
## Simple detection for the type of the host system
170
#
174
#
171
HOST = $(shell uname)
175
HOST = $(shell uname)
172
 
176
 
173
## On Solaris, some utilities have slightly different names
177
## On Solaris, some utilities have slightly different names
174
#
178
#
175
ifeq ($(HOST),SunOS)
179
ifeq ($(HOST),SunOS)
176
	BINUTILS_PREFIX = "g"
180
	BINUTILS_PREFIX = "g"
177
else
181
else
178
	BINUTILS_PREFIX = ""
182
	BINUTILS_PREFIX = ""
179
endif
183
endif
180
 
184
 
181
## Toolchain configuration
185
## Toolchain configuration
182
#
186
#
183
 
187
 
184
ifeq ($(COMPILER),gcc_native)
188
ifeq ($(COMPILER),gcc_native)
185
	CC = gcc
189
	CC = gcc
186
	GCC = gcc
190
	GCC = gcc
187
	AS = $(BINUTILS_PREFIX)as
191
	AS = $(BINUTILS_PREFIX)as
188
	LD = $(BINUTILS_PREFIX)ld
192
	LD = $(BINUTILS_PREFIX)ld
189
	OBJCOPY = $(BINUTILS_PREFIX)objcopy
193
	OBJCOPY = $(BINUTILS_PREFIX)objcopy
190
	OBJDUMP = $(BINUTILS_PREFIX)objdump
194
	OBJDUMP = $(BINUTILS_PREFIX)objdump
191
	LIBDIR = /usr/lib
195
	LIBDIR = /usr/lib
192
	CFLAGS = $(GCC_CFLAGS)
196
	CFLAGS = $(GCC_CFLAGS)
193
endif
197
endif
194
 
198
 
195
ifeq ($(COMPILER),icc_native)
199
ifeq ($(COMPILER),icc_native)
196
	CC = icc
200
	CC = icc
197
	GCC = gcc
201
	GCC = gcc
198
	AS = as
202
	AS = as
199
	LD = ld
203
	LD = ld
200
	OBJCOPY = objcopy
204
	OBJCOPY = objcopy
201
	OBJDUMP = objdump
205
	OBJDUMP = objdump
202
	LIBDIR = /usr/lib
206
	LIBDIR = /usr/lib
203
	CFLAGS = $(ICC_CFLAGS)
207
	CFLAGS = $(ICC_CFLAGS)
204
endif
208
endif
205
 
209
 
206
ifeq ($(COMPILER),suncc_native)
210
ifeq ($(COMPILER),suncc_native)
207
	CC = suncc
211
	CC = suncc
208
	GCC = gcc
212
	GCC = gcc
209
	AS = $(BINUTILS_PREFIX)as
213
	AS = $(BINUTILS_PREFIX)as
210
	LD = $(BINUTILS_PREFIX)ld
214
	LD = $(BINUTILS_PREFIX)ld
211
	OBJCOPY = $(BINUTILS_PREFIX)objcopy
215
	OBJCOPY = $(BINUTILS_PREFIX)objcopy
212
	OBJDUMP = $(BINUTILS_PREFIX)objdump
216
	OBJDUMP = $(BINUTILS_PREFIX)objdump
213
	LIBDIR = /usr/lib
217
	LIBDIR = /usr/lib
214
	CFLAGS = $(SUNCC_CFLAGS)
218
	CFLAGS = $(SUNCC_CFLAGS)
215
endif
219
endif
216
 
220
 
217
ifeq ($(COMPILER),gcc_cross)
221
ifeq ($(COMPILER),gcc_cross)
218
	CC = $(TOOLCHAIN_DIR)/bin/$(TARGET)-gcc
222
	CC = $(TOOLCHAIN_DIR)/bin/$(TARGET)-gcc
219
	GCC = $(CC)
223
	GCC = $(CC)
220
	AS = $(TOOLCHAIN_DIR)/bin/$(TARGET)-as
224
	AS = $(TOOLCHAIN_DIR)/bin/$(TARGET)-as
221
	LD = $(TOOLCHAIN_DIR)/bin/$(TARGET)-ld
225
	LD = $(TOOLCHAIN_DIR)/bin/$(TARGET)-ld
222
	OBJCOPY = $(TOOLCHAIN_DIR)/bin/$(TARGET)-objcopy
226
	OBJCOPY = $(TOOLCHAIN_DIR)/bin/$(TARGET)-objcopy
223
	OBJDUMP = $(TOOLCHAIN_DIR)/bin/$(TARGET)-objdump
227
	OBJDUMP = $(TOOLCHAIN_DIR)/bin/$(TARGET)-objdump
224
	LIBDIR = $(TOOLCHAIN_DIR)/lib
228
	LIBDIR = $(TOOLCHAIN_DIR)/lib
225
	CFLAGS = $(GCC_CFLAGS)
229
	CFLAGS = $(GCC_CFLAGS)
226
endif
230
endif
227
 
231
 
228
## Generic kernel sources
232
## Generic kernel sources
229
#
233
#
230
 
234
 
231
GENERIC_SOURCES = \
235
GENERIC_SOURCES = \
232
	generic/src/adt/avl.c \
236
	generic/src/adt/avl.c \
233
	generic/src/adt/bitmap.c \
237
	generic/src/adt/bitmap.c \
234
	generic/src/adt/btree.c \
238
	generic/src/adt/btree.c \
235
	generic/src/adt/hash_table.c \
239
	generic/src/adt/hash_table.c \
236
	generic/src/adt/list.c \
240
	generic/src/adt/list.c \
237
	generic/src/console/chardev.c \
241
	generic/src/console/chardev.c \
238
	generic/src/console/console.c \
242
	generic/src/console/console.c \
239
	generic/src/console/kconsole.c \
-
 
240
	generic/src/console/cmd.c \
-
 
241
	generic/src/cpu/cpu.c \
243
	generic/src/cpu/cpu.c \
242
	generic/src/ddi/ddi.c \
244
	generic/src/ddi/ddi.c \
243
	generic/src/ddi/irq.c \
245
	generic/src/ddi/irq.c \
244
	generic/src/ddi/device.c \
246
	generic/src/ddi/device.c \
245
	generic/src/interrupt/interrupt.c \
247
	generic/src/interrupt/interrupt.c \
246
	generic/src/main/main.c \
248
	generic/src/main/main.c \
247
	generic/src/main/kinit.c \
249
	generic/src/main/kinit.c \
248
	generic/src/main/uinit.c \
250
	generic/src/main/uinit.c \
249
	generic/src/main/version.c \
251
	generic/src/main/version.c \
250
	generic/src/main/shutdown.c \
252
	generic/src/main/shutdown.c \
251
	generic/src/proc/program.c \
253
	generic/src/proc/program.c \
252
	generic/src/proc/scheduler.c \
254
	generic/src/proc/scheduler.c \
253
	generic/src/proc/thread.c \
255
	generic/src/proc/thread.c \
254
	generic/src/proc/task.c \
256
	generic/src/proc/task.c \
255
	generic/src/proc/the.c \
257
	generic/src/proc/the.c \
256
	generic/src/proc/tasklet.c \
258
	generic/src/proc/tasklet.c \
257
	generic/src/syscall/syscall.c \
259
	generic/src/syscall/syscall.c \
258
	generic/src/syscall/copy.c \
260
	generic/src/syscall/copy.c \
259
	generic/src/mm/buddy.c \
261
	generic/src/mm/buddy.c \
260
	generic/src/mm/frame.c \
262
	generic/src/mm/frame.c \
261
	generic/src/mm/page.c \
263
	generic/src/mm/page.c \
262
	generic/src/mm/tlb.c \
264
	generic/src/mm/tlb.c \
263
	generic/src/mm/as.c \
265
	generic/src/mm/as.c \
264
	generic/src/mm/backend_anon.c \
266
	generic/src/mm/backend_anon.c \
265
	generic/src/mm/backend_elf.c \
267
	generic/src/mm/backend_elf.c \
266
	generic/src/mm/backend_phys.c \
268
	generic/src/mm/backend_phys.c \
267
	generic/src/mm/slab.c \
269
	generic/src/mm/slab.c \
268
	generic/src/lib/func.c \
270
	generic/src/lib/func.c \
269
	generic/src/lib/memstr.c \
271
	generic/src/lib/memstr.c \
270
	generic/src/lib/sort.c \
272
	generic/src/lib/sort.c \
271
	generic/src/lib/elf.c \
273
	generic/src/lib/elf.c \
272
	generic/src/lib/rd.c \
274
	generic/src/lib/rd.c \
273
	generic/src/printf/printf_core.c \
275
	generic/src/printf/printf_core.c \
274
	generic/src/printf/printf.c \
276
	generic/src/printf/printf.c \
275
	generic/src/printf/sprintf.c \
277
	generic/src/printf/sprintf.c \
276
	generic/src/printf/snprintf.c \
278
	generic/src/printf/snprintf.c \
277
	generic/src/printf/vprintf.c \
279
	generic/src/printf/vprintf.c \
278
	generic/src/printf/vsprintf.c \
280
	generic/src/printf/vsprintf.c \
279
	generic/src/printf/vsnprintf.c \
281
	generic/src/printf/vsnprintf.c \
280
	generic/src/debug/symtab.c \
282
	generic/src/debug/symtab.c \
281
	generic/src/time/clock.c \
283
	generic/src/time/clock.c \
282
	generic/src/time/timeout.c \
284
	generic/src/time/timeout.c \
283
	generic/src/time/delay.c \
285
	generic/src/time/delay.c \
284
	generic/src/preempt/preemption.c \
286
	generic/src/preempt/preemption.c \
285
	generic/src/synch/spinlock.c \
287
	generic/src/synch/spinlock.c \
286
	generic/src/synch/condvar.c \
288
	generic/src/synch/condvar.c \
287
	generic/src/synch/rwlock.c \
289
	generic/src/synch/rwlock.c \
288
	generic/src/synch/mutex.c \
290
	generic/src/synch/mutex.c \
289
	generic/src/synch/semaphore.c \
291
	generic/src/synch/semaphore.c \
290
	generic/src/synch/smc.c \
292
	generic/src/synch/smc.c \
291
	generic/src/synch/waitq.c \
293
	generic/src/synch/waitq.c \
292
	generic/src/synch/futex.c \
294
	generic/src/synch/futex.c \
293
	generic/src/smp/ipi.c \
295
	generic/src/smp/ipi.c \
294
	generic/src/smp/smp.c \
296
	generic/src/smp/smp.c \
295
	generic/src/ipc/ipc.c \
297
	generic/src/ipc/ipc.c \
296
	generic/src/ipc/sysipc.c \
298
	generic/src/ipc/sysipc.c \
297
	generic/src/ipc/ipcrsc.c \
299
	generic/src/ipc/ipcrsc.c \
298
	generic/src/ipc/irq.c \
300
	generic/src/ipc/irq.c \
299
	generic/src/security/cap.c \
301
	generic/src/security/cap.c \
300
	generic/src/sysinfo/sysinfo.c
302
	generic/src/sysinfo/sysinfo.c
301
 
303
 
-
 
304
## Kernel console support
-
 
305
#
-
 
306
 
-
 
307
ifeq ($(CONFIG_KCONSOLE),y)
-
 
308
GENERIC_SOURCES += \
-
 
309
	generic/src/console/kconsole.c \
-
 
310
	generic/src/console/cmd.c
-
 
311
endif
-
 
312
 
302
## Udebug interface sources
313
## Udebug interface sources
303
#
314
#
304
 
315
 
305
ifeq ($(CONFIG_UDEBUG),y)
316
ifeq ($(CONFIG_UDEBUG),y)
306
GENERIC_SOURCES += \
317
GENERIC_SOURCES += \
307
	generic/src/ipc/kbox.c \
318
	generic/src/ipc/kbox.c \
308
	generic/src/udebug/udebug.c \
319
	generic/src/udebug/udebug.c \
309
	generic/src/udebug/udebug_ops.c \
320
	generic/src/udebug/udebug_ops.c \
310
	generic/src/udebug/udebug_ipc.c
321
	generic/src/udebug/udebug_ipc.c
311
endif
322
endif
312
 
323
 
313
## Test sources
324
## Test sources
314
#
325
#
315
 
326
 
316
ifeq ($(CONFIG_TEST),y)
327
ifeq ($(CONFIG_TEST),y)
317
	DEFS += -DCONFIG_TEST
328
	DEFS += -DCONFIG_TEST
318
	CFLAGS += -Itest/
329
	CFLAGS += -Itest/
319
	GENERIC_SOURCES += \
330
	GENERIC_SOURCES += \
320
		test/test.c \
331
		test/test.c \
321
		test/atomic/atomic1.c \
332
		test/atomic/atomic1.c \
322
		test/btree/btree1.c \
333
		test/btree/btree1.c \
323
		test/avltree/avltree1.c \
334
		test/avltree/avltree1.c \
324
		test/debug/mips1.c \
335
		test/debug/mips1.c \
325
		test/fault/fault1.c \
336
		test/fault/fault1.c \
326
		test/fpu/fpu1.c \
337
		test/fpu/fpu1.c \
327
		test/fpu/sse1.c \
338
		test/fpu/sse1.c \
328
		test/fpu/mips2.c \
339
		test/fpu/mips2.c \
329
		test/mm/falloc1.c \
340
		test/mm/falloc1.c \
330
		test/mm/falloc2.c \
341
		test/mm/falloc2.c \
331
		test/mm/mapping1.c \
342
		test/mm/mapping1.c \
332
		test/mm/slab1.c \
343
		test/mm/slab1.c \
333
		test/mm/slab2.c \
344
		test/mm/slab2.c \
334
		test/mm/purge1.c \
345
		test/mm/purge1.c \
335
		test/synch/rwlock1.c \
346
		test/synch/rwlock1.c \
336
		test/synch/rwlock2.c \
347
		test/synch/rwlock2.c \
337
		test/synch/rwlock3.c \
348
		test/synch/rwlock3.c \
338
		test/synch/rwlock4.c \
349
		test/synch/rwlock4.c \
339
		test/synch/rwlock5.c \
350
		test/synch/rwlock5.c \
340
		test/synch/semaphore1.c \
351
		test/synch/semaphore1.c \
341
		test/synch/semaphore2.c \
352
		test/synch/semaphore2.c \
342
		test/print/print1.c \
353
		test/print/print1.c \
343
		test/thread/thread1.c \
354
		test/thread/thread1.c \
344
		test/sysinfo/sysinfo1.c
355
		test/sysinfo/sysinfo1.c
345
endif
356
endif
346
 
357
 
347
GENERIC_OBJECTS := $(addsuffix .o,$(basename $(GENERIC_SOURCES)))
358
GENERIC_OBJECTS := $(addsuffix .o,$(basename $(GENERIC_SOURCES)))
348
ARCH_OBJECTS := $(addsuffix .o,$(basename $(ARCH_SOURCES)))
359
ARCH_OBJECTS := $(addsuffix .o,$(basename $(ARCH_SOURCES)))
349
GENARCH_OBJECTS := $(addsuffix .o,$(basename $(GENARCH_SOURCES)))
360
GENARCH_OBJECTS := $(addsuffix .o,$(basename $(GENARCH_SOURCES)))
350
 
361
 
351
.PHONY: all build config distclean clean archlinks depend disasm
362
.PHONY: all build config distclean clean archlinks depend disasm
352
 
363
 
353
all:
364
all:
354
	../tools/config.py kernel.config default $(ARCH) $(COMPILER) $(CONFIG_DEBUG) $(MACHINE)
365
	../tools/config.py kernel.config default $(ARCH) $(COMPILER) $(CONFIG_DEBUG) $(MACHINE)
355
	$(MAKE) -C . build
366
	$(MAKE) -C . build
356
 
367
 
357
build: kernel.bin disasm
368
build: kernel.bin disasm
358
 
369
 
359
config:
370
config:
360
	-rm Makefile.depend
371
	-rm Makefile.depend
361
	../tools/config.py kernel.config
372
	../tools/config.py kernel.config
362
 
373
 
363
-include Makefile.depend
374
-include Makefile.depend
364
 
375
 
365
distclean: clean
376
distclean: clean
366
	-rm Makefile.config
377
	-rm Makefile.config
367
 
378
 
368
clean:
379
clean:
369
	-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
380
	-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
370
	find generic/src/ arch/*/src/ genarch/src/ test/ -name '*.o' -follow -exec rm \{\} \;
381
	find generic/src/ arch/*/src/ genarch/src/ test/ -name '*.o' -follow -exec rm \{\} \;
371
	for arch in arch/* ; do \
382
	for arch in arch/* ; do \
372
	    [ -e $$arch/_link.ld ] && rm $$arch/_link.ld 2>/dev/null ; \
383
	    [ -e $$arch/_link.ld ] && rm $$arch/_link.ld 2>/dev/null ; \
373
	done ; exit 0
384
	done ; exit 0
374
 
385
 
375
archlinks:
386
archlinks:
376
	ln -sfn ../../arch/$(ARCH)/include/ generic/include/arch
387
	ln -sfn ../../arch/$(ARCH)/include/ generic/include/arch
377
	ln -sfn ../../genarch/include/ generic/include/genarch
388
	ln -sfn ../../genarch/include/ generic/include/genarch
378
 
389
 
379
depend: archlinks
390
depend: archlinks
380
	-makedepend -f - -- $(DEFS) $(CFLAGS) -- $(ARCH_SOURCES) $(GENARCH_SOURCES) $(GENERIC_SOURCES) > Makefile.depend 2> /dev/null
391
	-makedepend -f - -- $(DEFS) $(CFLAGS) -- $(ARCH_SOURCES) $(GENARCH_SOURCES) $(GENERIC_SOURCES) > Makefile.depend 2> /dev/null
381
 
392
 
382
arch/$(ARCH)/_link.ld: arch/$(ARCH)/_link.ld.in
393
arch/$(ARCH)/_link.ld: arch/$(ARCH)/_link.ld.in
383
	$(GCC) $(DEFS) $(GCC_CFLAGS) -D__ASM__ -D__LINKER__ -E -x c $< | grep -v "^\#" > $@
394
	$(GCC) $(DEFS) $(GCC_CFLAGS) -D__ASM__ -D__LINKER__ -E -x c $< | grep -v "^\#" > $@
384
 
395
 
385
generic/src/debug/real_map.bin: depend arch/$(ARCH)/_link.ld $(ARCH_OBJECTS) $(GENARCH_OBJECTS) $(GENERIC_OBJECTS)
396
generic/src/debug/real_map.bin: depend arch/$(ARCH)/_link.ld $(ARCH_OBJECTS) $(GENARCH_OBJECTS) $(GENERIC_OBJECTS)
386
	echo $(SYMTAB_SECTION) | $(AS) $(AFLAGS) -o generic/src/debug/empty_map.o
397
	echo $(SYMTAB_SECTION) | $(AS) $(AFLAGS) -o generic/src/debug/empty_map.o
387
	$(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
398
	$(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
388
	$(OBJDUMP) -t $(ARCH_OBJECTS) $(GENARCH_OBJECTS) $(GENERIC_OBJECTS) > kernel.objdump
399
	$(OBJDUMP) -t $(ARCH_OBJECTS) $(GENARCH_OBJECTS) $(GENERIC_OBJECTS) > kernel.objdump
389
	tools/genmap.py kernel.map.pre kernel.objdump generic/src/debug/real_map.bin 
400
	tools/genmap.py kernel.map.pre kernel.objdump generic/src/debug/real_map.bin 
390
	# Do it once again, this time to get correct even the symbols
401
	# Do it once again, this time to get correct even the symbols
391
	# on architectures, that have bss after symtab
402
	# on architectures, that have bss after symtab
392
	echo $(SYMTAB_SECTION)" .incbin \"$@\"" | $(AS) $(AFLAGS) -o generic/src/debug/sizeok_map.o
403
	echo $(SYMTAB_SECTION)" .incbin \"$@\"" | $(AS) $(AFLAGS) -o generic/src/debug/sizeok_map.o
393
	$(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
404
	$(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
394
	$(OBJDUMP) -t $(ARCH_OBJECTS) $(GENARCH_OBJECTS) $(GENERIC_OBJECTS) > kernel.objdump
405
	$(OBJDUMP) -t $(ARCH_OBJECTS) $(GENARCH_OBJECTS) $(GENERIC_OBJECTS) > kernel.objdump
395
	tools/genmap.py kernel.map.pre kernel.objdump generic/src/debug/real_map.bin 
406
	tools/genmap.py kernel.map.pre kernel.objdump generic/src/debug/real_map.bin 
396
 
407
 
397
generic/src/debug/real_map.o: generic/src/debug/real_map.bin
408
generic/src/debug/real_map.o: generic/src/debug/real_map.bin
398
	echo $(SYMTAB_SECTION)" .incbin \"$<\"" | $(AS) $(AFLAGS) -o $@ 
409
	echo $(SYMTAB_SECTION)" .incbin \"$<\"" | $(AS) $(AFLAGS) -o $@ 
399
 
410
 
400
kernel.raw: depend arch/$(ARCH)/_link.ld $(ARCH_OBJECTS) $(GENARCH_OBJECTS) $(GENERIC_OBJECTS) generic/src/debug/real_map.o
411
kernel.raw: depend arch/$(ARCH)/_link.ld $(ARCH_OBJECTS) $(GENARCH_OBJECTS) $(GENERIC_OBJECTS) generic/src/debug/real_map.o
401
	$(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
412
	$(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
402
 
413
 
403
kernel.bin: kernel.raw
414
kernel.bin: kernel.raw
404
	$(OBJCOPY) -O $(BFD) kernel.raw kernel.bin
415
	$(OBJCOPY) -O $(BFD) kernel.raw kernel.bin
405
 
416
 
406
disasm: kernel.raw
417
disasm: kernel.raw
407
	$(OBJDUMP) -d kernel.raw > kernel.disasm
418
	$(OBJDUMP) -d kernel.raw > kernel.disasm
408
 
419
 
409
%.o: %.S
420
%.o: %.S
410
	$(GCC) $(DEFS) $(GCC_CFLAGS) -D__ASM__ -c $< -o $@
421
	$(GCC) $(DEFS) $(GCC_CFLAGS) -D__ASM__ -c $< -o $@
411
 
422
 
412
%.o: %.s
423
%.o: %.s
413
	$(AS) $(AFLAGS) $< -o $@
424
	$(AS) $(AFLAGS) $< -o $@
414
 
425
 
415
#
426
#
416
# The FPU tests are the only objects for which we allow the compiler to generate
427
# The FPU tests are the only objects for which we allow the compiler to generate
417
# FPU instructions.
428
# FPU instructions.
418
#
429
#
419
test/fpu/%.o: test/fpu/%.c
430
test/fpu/%.o: test/fpu/%.c
420
	$(CC) $(DEFS) $(CFLAGS) $(EXTRA_FLAGS) -c $< -o $@
431
	$(CC) $(DEFS) $(CFLAGS) $(EXTRA_FLAGS) -c $< -o $@
421
 
432
 
422
#
433
#
423
# Ordinary objects.
434
# Ordinary objects.
424
#
435
#
425
%.o: %.c
436
%.o: %.c
426
	$(CC) $(DEFS) $(CFLAGS) $(EXTRA_FLAGS) $(FPU_NO_CFLAGS) -c $< -o $@ 
437
	$(CC) $(DEFS) $(CFLAGS) $(EXTRA_FLAGS) $(FPU_NO_CFLAGS) -c $< -o $@ 
427
 
438