Subversion Repositories HelenOS

Rev

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

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