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