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