Subversion Repositories HelenOS

Rev

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

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