| [e16e036a] | 1 | #
|
|---|
| [df4ed85] | 2 | # Copyright (c) 2005 Martin Decky
|
|---|
| [e16e036a] | 3 | # All rights reserved.
|
|---|
| 4 | #
|
|---|
| 5 | # Redistribution and use in source and binary forms, with or without
|
|---|
| 6 | # modification, are permitted provided that the following conditions
|
|---|
| 7 | # are met:
|
|---|
| 8 | #
|
|---|
| 9 | # - Redistributions of source code must retain the above copyright
|
|---|
| 10 | # notice, this list of conditions and the following disclaimer.
|
|---|
| 11 | # - Redistributions in binary form must reproduce the above copyright
|
|---|
| 12 | # notice, this list of conditions and the following disclaimer in the
|
|---|
| 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
|
|---|
| 15 | # derived from this software without specific prior written permission.
|
|---|
| 16 | #
|
|---|
| 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
|
|---|
| 19 | # OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
|
|---|
| 20 | # IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
|
|---|
| 21 | # INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
|
|---|
| 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
|
|---|
| 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
|
|---|
| 26 | # THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
|---|
| 27 | #
|
|---|
| 28 |
|
|---|
| 29 |
|
|---|
| [9371c30] | 30 | ## Include configuration
|
|---|
| [e16e036a] | 31 | #
|
|---|
| 32 |
|
|---|
| [9a0367f] | 33 | include ../version
|
|---|
| 34 | -include ../Makefile.config
|
|---|
| [98a4e76] | 35 | -include ../config.defs
|
|---|
| [e16e036a] | 36 |
|
|---|
| [44bec47] | 37 | INCLUDES = generic/include
|
|---|
| [eb1c0a3] | 38 | OPTIMIZATION = 3
|
|---|
| [44bec47] | 39 |
|
|---|
| [98a4e76] | 40 | ifndef CROSS_PREFIX
|
|---|
| 41 | CROSS_PREFIX = /usr/local
|
|---|
| 42 | endif
|
|---|
| 43 |
|
|---|
| [e16e036a] | 44 | ## Common compiler flags
|
|---|
| 45 | #
|
|---|
| 46 |
|
|---|
| [ac47b7c2] | 47 | DEFS = -DKERNEL -DRELEASE=$(RELEASE) "-DNAME=$(NAME)" -D__$(BITS)_BITS__ -D__$(ENDIANESS)__
|
|---|
| [52d30c4] | 48 |
|
|---|
| [98a4e76] | 49 | GCC_CFLAGS = -I$(INCLUDES) -O$(OPTIMIZATION) -imacros ../config.h \
|
|---|
| [ac47b7c2] | 50 | -fexec-charset=UTF-8 -fwide-exec-charset=UTF-32$(ENDIANESS) \
|
|---|
| [6ab8697] | 51 | -finput-charset=UTF-8 -ffreestanding -fno-builtin -nostdlib -nostdinc \
|
|---|
| 52 | -Wall -Wextra -Wno-unused-parameter -Wmissing-prototypes -Werror \
|
|---|
| 53 | -pipe
|
|---|
| [44bec47] | 54 |
|
|---|
| [98a4e76] | 55 | ICC_CFLAGS = -I$(INCLUDES) -O$(OPTIMIZATION) -imacros ../config.h \
|
|---|
| [6ab8697] | 56 | -ffreestanding -fno-builtin -nostdlib -nostdinc -Wall -Wmissing-prototypes \
|
|---|
| 57 | -Werror -wd170
|
|---|
| [52d30c4] | 58 |
|
|---|
| [44bec47] | 59 | SUNCC_CFLAGS = -I$(INCLUDES) -xO$(OPTIMIZATION) \
|
|---|
| [3ee8a075] | 60 | -xnolib -xc99=all -features=extensions \
|
|---|
| [52d30c4] | 61 | -erroff=E_ZERO_SIZED_STRUCT_UNION
|
|---|
| [92d349c8] | 62 |
|
|---|
| [69dc065] | 63 | CLANG_CFLAGS = -I$(INCLUDES) -O$(OPTIMIZATION) -imacros ../config.h \
|
|---|
| 64 | -fexec-charset=UTF-8 -fwide-exec-charset=UTF-32$(ENDIANESS) \
|
|---|
| [6ab8697] | 65 | -finput-charset=UTF-8 -ffreestanding -fno-builtin -nostdlib -nostdinc \
|
|---|
| 66 | -Wall -Wextra -Wno-unused-parameter -Wmissing-prototypes -pipe \
|
|---|
| 67 | -arch $(CLANG_ARCH)
|
|---|
| [69dc065] | 68 |
|
|---|
| [e16e036a] | 69 | LFLAGS = -M
|
|---|
| [ba22dcb] | 70 | AFLAGS =
|
|---|
| 71 |
|
|---|
| [98a4e76] | 72 | -include arch/$(KARCH)/Makefile.inc
|
|---|
| [839470f] | 73 | -include genarch/Makefile.inc
|
|---|
| [c9ed176] | 74 |
|
|---|
| [1314e3b] | 75 | ## The at-sign
|
|---|
| 76 | #
|
|---|
| [bcfd586] | 77 | # The $(ATSIGN) variable holds the ASCII character representing the at-sign
|
|---|
| [1314e3b] | 78 | # ('@') used in various $(AS) constructs (e.g. @progbits). On architectures that
|
|---|
| 79 | # don't use '@' for starting a comment, $(ATSIGN) is merely '@'. However, on
|
|---|
| 80 | # those that do use it for starting a comment (e.g. arm32), $(ATSIGN) must be
|
|---|
| 81 | # defined as the percentile-sign ('%') in the architecture-dependent
|
|---|
| 82 | # Makefile.inc.
|
|---|
| 83 | #
|
|---|
| 84 | ATSIGN ?= @
|
|---|
| 85 |
|
|---|
| 86 | ## Cross-platform assembly to start a symtab.data section
|
|---|
| 87 | #
|
|---|
| 88 | SYMTAB_SECTION=".section symtab.data, \"a\", $(ATSIGN)progbits;"
|
|---|
| 89 |
|
|---|
| [f5b4fb9] | 90 | ## Simple detection for the type of the host system
|
|---|
| 91 | #
|
|---|
| 92 | HOST = $(shell uname)
|
|---|
| 93 |
|
|---|
| 94 | ## On Solaris, some utilities have slightly different names
|
|---|
| 95 | #
|
|---|
| 96 | ifeq ($(HOST),SunOS)
|
|---|
| 97 | BINUTILS_PREFIX = "g"
|
|---|
| 98 | else
|
|---|
| 99 | BINUTILS_PREFIX = ""
|
|---|
| 100 | endif
|
|---|
| 101 |
|
|---|
| [e16e036a] | 102 | ## Toolchain configuration
|
|---|
| 103 | #
|
|---|
| 104 |
|
|---|
| [c31e536] | 105 | ifeq ($(COMPILER),gcc_native)
|
|---|
| [e16e036a] | 106 | CC = gcc
|
|---|
| [f563126] | 107 | GCC = $(CC)
|
|---|
| [f5b4fb9] | 108 | AS = $(BINUTILS_PREFIX)as
|
|---|
| 109 | LD = $(BINUTILS_PREFIX)ld
|
|---|
| 110 | OBJCOPY = $(BINUTILS_PREFIX)objcopy
|
|---|
| 111 | OBJDUMP = $(BINUTILS_PREFIX)objdump
|
|---|
| [bd1deed] | 112 | LIBDIR = /usr/lib
|
|---|
| [52d30c4] | 113 | CFLAGS = $(GCC_CFLAGS)
|
|---|
| [98a4e76] | 114 | DEPEND_DEFS = $(DEFS) $(CONFIG_DEFS)
|
|---|
| [c31e536] | 115 | endif
|
|---|
| 116 |
|
|---|
| [69dc065] | 117 | ifeq ($(COMPILER),gcc_cross)
|
|---|
| 118 | CC = $(TOOLCHAIN_DIR)/bin/$(TARGET)-gcc
|
|---|
| 119 | GCC = $(CC)
|
|---|
| 120 | AS = $(TOOLCHAIN_DIR)/bin/$(TARGET)-as
|
|---|
| 121 | LD = $(TOOLCHAIN_DIR)/bin/$(TARGET)-ld
|
|---|
| 122 | OBJCOPY = $(TOOLCHAIN_DIR)/bin/$(TARGET)-objcopy
|
|---|
| 123 | OBJDUMP = $(TOOLCHAIN_DIR)/bin/$(TARGET)-objdump
|
|---|
| 124 | LIBDIR = $(TOOLCHAIN_DIR)/lib
|
|---|
| 125 | CFLAGS = $(GCC_CFLAGS)
|
|---|
| 126 | DEPEND_DEFS = $(DEFS) $(CONFIG_DEFS)
|
|---|
| 127 | endif
|
|---|
| 128 |
|
|---|
| 129 | ifeq ($(COMPILER),icc)
|
|---|
| [c31e536] | 130 | CC = icc
|
|---|
| [4a8635b] | 131 | GCC = gcc
|
|---|
| [c31e536] | 132 | AS = as
|
|---|
| 133 | LD = ld
|
|---|
| 134 | OBJCOPY = objcopy
|
|---|
| 135 | OBJDUMP = objdump
|
|---|
| 136 | LIBDIR = /usr/lib
|
|---|
| [44bec47] | 137 | CFLAGS = $(ICC_CFLAGS)
|
|---|
| [98a4e76] | 138 | DEPEND_DEFS = $(DEFS) $(CONFIG_DEFS)
|
|---|
| [c31e536] | 139 | endif
|
|---|
| 140 |
|
|---|
| [69dc065] | 141 | ifeq ($(COMPILER),suncc)
|
|---|
| [1e847fb] | 142 | CC = suncc
|
|---|
| [4a8635b] | 143 | GCC = gcc
|
|---|
| [f5b4fb9] | 144 | AS = $(BINUTILS_PREFIX)as
|
|---|
| 145 | LD = $(BINUTILS_PREFIX)ld
|
|---|
| 146 | OBJCOPY = $(BINUTILS_PREFIX)objcopy
|
|---|
| 147 | OBJDUMP = $(BINUTILS_PREFIX)objdump
|
|---|
| [1e847fb] | 148 | LIBDIR = /usr/lib
|
|---|
| [52d30c4] | 149 | CFLAGS = $(SUNCC_CFLAGS)
|
|---|
| [98a4e76] | 150 | DEFS += $(CONFIG_DEFS)
|
|---|
| 151 | DEPEND_DEFS = $(DEFS)
|
|---|
| [1e847fb] | 152 | endif
|
|---|
| 153 |
|
|---|
| [69dc065] | 154 | ifeq ($(COMPILER),clang)
|
|---|
| 155 | CC = clang
|
|---|
| 156 | GCC = gcc
|
|---|
| 157 | AS = $(BINUTILS_PREFIX)as
|
|---|
| 158 | LD = $(BINUTILS_PREFIX)ld
|
|---|
| 159 | OBJCOPY = $(BINUTILS_PREFIX)objcopy
|
|---|
| 160 | OBJDUMP = $(BINUTILS_PREFIX)objdump
|
|---|
| 161 | LIBDIR = /usr/lib
|
|---|
| 162 | CFLAGS = $(CLANG_CFLAGS)
|
|---|
| [98a4e76] | 163 | DEPEND_DEFS = $(DEFS) $(CONFIG_DEFS)
|
|---|
| [e16e036a] | 164 | endif
|
|---|
| 165 |
|
|---|
| 166 | ## Generic kernel sources
|
|---|
| 167 | #
|
|---|
| 168 |
|
|---|
| 169 | GENERIC_SOURCES = \
|
|---|
| [0d65d76] | 170 | generic/src/adt/avl.c \
|
|---|
| [97a7eff] | 171 | generic/src/adt/bitmap.c \
|
|---|
| [018d957e] | 172 | generic/src/adt/btree.c \
|
|---|
| [c585827] | 173 | generic/src/adt/hash_table.c \
|
|---|
| [5c9a08b] | 174 | generic/src/adt/list.c \
|
|---|
| [2677758] | 175 | generic/src/console/chardev.c \
|
|---|
| 176 | generic/src/console/console.c \
|
|---|
| [e16e036a] | 177 | generic/src/cpu/cpu.c \
|
|---|
| [9a8d91b] | 178 | generic/src/ddi/ddi.c \
|
|---|
| [7dcf22a] | 179 | generic/src/ddi/irq.c \
|
|---|
| 180 | generic/src/ddi/device.c \
|
|---|
| [e16e0d59] | 181 | generic/src/debug/symtab.c \
|
|---|
| [973be64e] | 182 | generic/src/interrupt/interrupt.c \
|
|---|
| [169c408] | 183 | generic/src/main/main.c \
|
|---|
| 184 | generic/src/main/kinit.c \
|
|---|
| 185 | generic/src/main/uinit.c \
|
|---|
| [0132630] | 186 | generic/src/main/version.c \
|
|---|
| [f74bbaf] | 187 | generic/src/main/shutdown.c \
|
|---|
| [c98e6ee] | 188 | generic/src/proc/program.c \
|
|---|
| [169c408] | 189 | generic/src/proc/scheduler.c \
|
|---|
| 190 | generic/src/proc/thread.c \
|
|---|
| 191 | generic/src/proc/task.c \
|
|---|
| 192 | generic/src/proc/the.c \
|
|---|
| [56976a17] | 193 | generic/src/proc/tasklet.c \
|
|---|
| [a59e81e] | 194 | generic/src/syscall/syscall.c \
|
|---|
| [e3c762cd] | 195 | generic/src/syscall/copy.c \
|
|---|
| [169c408] | 196 | generic/src/mm/buddy.c \
|
|---|
| 197 | generic/src/mm/frame.c \
|
|---|
| 198 | generic/src/mm/page.c \
|
|---|
| 199 | generic/src/mm/tlb.c \
|
|---|
| [20d50a1] | 200 | generic/src/mm/as.c \
|
|---|
| [0ee077ee] | 201 | generic/src/mm/backend_anon.c \
|
|---|
| 202 | generic/src/mm/backend_elf.c \
|
|---|
| 203 | generic/src/mm/backend_phys.c \
|
|---|
| [4e147a6] | 204 | generic/src/mm/slab.c \
|
|---|
| [169c408] | 205 | generic/src/lib/func.c \
|
|---|
| 206 | generic/src/lib/memstr.c \
|
|---|
| 207 | generic/src/lib/sort.c \
|
|---|
| [16da5f8e] | 208 | generic/src/lib/string.c \
|
|---|
| [de6b301] | 209 | generic/src/lib/elf.c \
|
|---|
| [d4b5542] | 210 | generic/src/lib/rd.c \
|
|---|
| [6445baf] | 211 | generic/src/printf/printf_core.c \
|
|---|
| 212 | generic/src/printf/printf.c \
|
|---|
| 213 | generic/src/printf/snprintf.c \
|
|---|
| 214 | generic/src/printf/vprintf.c \
|
|---|
| 215 | generic/src/printf/vsnprintf.c \
|
|---|
| [169c408] | 216 | generic/src/time/clock.c \
|
|---|
| 217 | generic/src/time/timeout.c \
|
|---|
| 218 | generic/src/time/delay.c \
|
|---|
| 219 | generic/src/preempt/preemption.c \
|
|---|
| 220 | generic/src/synch/spinlock.c \
|
|---|
| 221 | generic/src/synch/condvar.c \
|
|---|
| 222 | generic/src/synch/rwlock.c \
|
|---|
| 223 | generic/src/synch/mutex.c \
|
|---|
| 224 | generic/src/synch/semaphore.c \
|
|---|
| [c98e6ee] | 225 | generic/src/synch/smc.c \
|
|---|
| [169c408] | 226 | generic/src/synch/waitq.c \
|
|---|
| [9aa72b4] | 227 | generic/src/synch/futex.c \
|
|---|
| [6d9c49a] | 228 | generic/src/smp/ipi.c \
|
|---|
| [26678e5] | 229 | generic/src/smp/smp.c \
|
|---|
| [e74cb73] | 230 | generic/src/ipc/ipc.c \
|
|---|
| [4e49572] | 231 | generic/src/ipc/sysipc.c \
|
|---|
| [1077d91] | 232 | generic/src/ipc/ipcrsc.c \
|
|---|
| [162f919] | 233 | generic/src/ipc/irq.c \
|
|---|
| [13a638d] | 234 | generic/src/ipc/event.c \
|
|---|
| [2666daa] | 235 | generic/src/security/cap.c \
|
|---|
| 236 | generic/src/sysinfo/sysinfo.c
|
|---|
| [bbf5657] | 237 |
|
|---|
| [4406fd65] | 238 | ## Kernel console support
|
|---|
| 239 | #
|
|---|
| 240 |
|
|---|
| 241 | ifeq ($(CONFIG_KCONSOLE),y)
|
|---|
| 242 | GENERIC_SOURCES += \
|
|---|
| 243 | generic/src/console/kconsole.c \
|
|---|
| 244 | generic/src/console/cmd.c
|
|---|
| 245 | endif
|
|---|
| 246 |
|
|---|
| [9a1b20c] | 247 | ## Udebug interface sources
|
|---|
| 248 | #
|
|---|
| 249 |
|
|---|
| 250 | ifeq ($(CONFIG_UDEBUG),y)
|
|---|
| 251 | GENERIC_SOURCES += \
|
|---|
| [e028660] | 252 | generic/src/ipc/kbox.c \
|
|---|
| [9a1b20c] | 253 | generic/src/udebug/udebug.c \
|
|---|
| 254 | generic/src/udebug/udebug_ops.c \
|
|---|
| 255 | generic/src/udebug/udebug_ipc.c
|
|---|
| 256 | endif
|
|---|
| 257 |
|
|---|
| [36a140b] | 258 | ## Test sources
|
|---|
| 259 | #
|
|---|
| 260 |
|
|---|
| [50661ab] | 261 | ifeq ($(CONFIG_TEST),y)
|
|---|
| [319e60e] | 262 | CFLAGS += -Itest/
|
|---|
| 263 | GENERIC_SOURCES += \
|
|---|
| 264 | test/test.c \
|
|---|
| [50661ab] | 265 | test/atomic/atomic1.c \
|
|---|
| 266 | test/btree/btree1.c \
|
|---|
| [0d65d76] | 267 | test/avltree/avltree1.c \
|
|---|
| [50661ab] | 268 | test/fault/fault1.c \
|
|---|
| [f272cb8] | 269 | test/mm/falloc1.c \
|
|---|
| 270 | test/mm/falloc2.c \
|
|---|
| 271 | test/mm/mapping1.c \
|
|---|
| 272 | test/mm/slab1.c \
|
|---|
| 273 | test/mm/slab2.c \
|
|---|
| [70b6de1] | 274 | test/synch/rwlock1.c \
|
|---|
| 275 | test/synch/rwlock2.c \
|
|---|
| 276 | test/synch/rwlock3.c \
|
|---|
| 277 | test/synch/rwlock4.c \
|
|---|
| 278 | test/synch/rwlock5.c \
|
|---|
| 279 | test/synch/semaphore1.c \
|
|---|
| 280 | test/synch/semaphore2.c \
|
|---|
| 281 | test/print/print1.c \
|
|---|
| [5251bab] | 282 | test/print/print2.c \
|
|---|
| 283 | test/print/print3.c \
|
|---|
| 284 | test/print/print4.c \
|
|---|
| [70b6de1] | 285 | test/thread/thread1.c \
|
|---|
| 286 | test/sysinfo/sysinfo1.c
|
|---|
| [98a4e76] | 287 |
|
|---|
| [17f168e] | 288 | ifeq ($(KARCH),mips32)
|
|---|
| 289 | GENERIC_SOURCES += test/debug/mips1.c
|
|---|
| 290 | else
|
|---|
| 291 | GENERIC_SOURCES += test/debug/mips1_skip.c
|
|---|
| 292 | endif
|
|---|
| 293 |
|
|---|
| 294 | ifeq ($(KARCH),ia64)
|
|---|
| 295 | GENERIC_SOURCES += test/mm/purge1.c
|
|---|
| 296 | else
|
|---|
| 297 | GENERIC_SOURCES += test/mm/purge1_skip.c
|
|---|
| 298 | endif
|
|---|
| 299 |
|
|---|
| [98a4e76] | 300 | ifeq ($(CONFIG_FPU),y)
|
|---|
| 301 | ifeq ($(KARCH),ia32)
|
|---|
| 302 | TEST_FPU1 = y
|
|---|
| 303 | TEST_SSE1 = y
|
|---|
| [e45a3b9] | 304 | GENERIC_SOURCES += test/fpu/fpu1_x86.c
|
|---|
| [98a4e76] | 305 | endif
|
|---|
| 306 |
|
|---|
| 307 | ifeq ($(KARCH),amd64)
|
|---|
| 308 | TEST_FPU1 = y
|
|---|
| 309 | TEST_SSE1 = y
|
|---|
| [e45a3b9] | 310 | GENERIC_SOURCES += test/fpu/fpu1_x86.c
|
|---|
| [98a4e76] | 311 | endif
|
|---|
| 312 |
|
|---|
| 313 | ifeq ($(KARCH),ia64)
|
|---|
| 314 | TEST_FPU1 = y
|
|---|
| [e45a3b9] | 315 | GENERIC_SOURCES += test/fpu/fpu1_ia64.c
|
|---|
| [98a4e76] | 316 | endif
|
|---|
| 317 |
|
|---|
| 318 | ifeq ($(KARCH),mips32)
|
|---|
| 319 | TEST_MIPS2 = y
|
|---|
| 320 | endif
|
|---|
| 321 | endif
|
|---|
| 322 |
|
|---|
| [e45a3b9] | 323 | ifneq ($(TEST_FPU1),y)
|
|---|
| [98a4e76] | 324 | GENERIC_SOURCES += test/fpu/fpu1_skip.c
|
|---|
| 325 | endif
|
|---|
| 326 |
|
|---|
| 327 | ifeq ($(TEST_SSE1),y)
|
|---|
| 328 | GENERIC_SOURCES += test/fpu/sse1.c
|
|---|
| 329 | else
|
|---|
| 330 | GENERIC_SOURCES += test/fpu/sse1_skip.c
|
|---|
| 331 | endif
|
|---|
| 332 |
|
|---|
| 333 | ifeq ($(TEST_MIPS2),y)
|
|---|
| 334 | GENERIC_SOURCES += test/fpu/mips2.c
|
|---|
| 335 | else
|
|---|
| 336 | GENERIC_SOURCES += test/fpu/mips2_skip.c
|
|---|
| 337 | endif
|
|---|
| 338 |
|
|---|
| [36a140b] | 339 | endif
|
|---|
| 340 |
|
|---|
| [e16e036a] | 341 | GENERIC_OBJECTS := $(addsuffix .o,$(basename $(GENERIC_SOURCES)))
|
|---|
| 342 | ARCH_OBJECTS := $(addsuffix .o,$(basename $(ARCH_SOURCES)))
|
|---|
| 343 | GENARCH_OBJECTS := $(addsuffix .o,$(basename $(GENARCH_SOURCES)))
|
|---|
| [c9ed176] | 344 |
|
|---|
| [e2b762ec] | 345 | ifeq ($(CONFIG_SYMTAB),y)
|
|---|
| 346 | SYMTAB_OBJECTS := generic/src/debug/real_map.o
|
|---|
| 347 | else
|
|---|
| 348 | SYMTAB_OBJECTS :=
|
|---|
| 349 | endif
|
|---|
| 350 |
|
|---|
| [9a0367f] | 351 | .PHONY: all build clean archlinks depend disasm
|
|---|
| [c9ed176] | 352 |
|
|---|
| [98a4e76] | 353 | all: ../Makefile.config ../config.h ../config.defs
|
|---|
| [9a0367f] | 354 | -rm Makefile.depend
|
|---|
| [940cac0] | 355 | $(MAKE) -C . build
|
|---|
| [839470f] | 356 |
|
|---|
| [b629483] | 357 | build: kernel.bin disasm
|
|---|
| [839470f] | 358 |
|
|---|
| [c9ed176] | 359 | -include Makefile.depend
|
|---|
| 360 |
|
|---|
| [e16e036a] | 361 | clean:
|
|---|
| [98a4e76] | 362 | -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
|
|---|
| [839470f] | 363 | find generic/src/ arch/*/src/ genarch/src/ test/ -name '*.o' -follow -exec rm \{\} \;
|
|---|
| [41f7564] | 364 | for arch in arch/* ; do \
|
|---|
| 365 | [ -e $$arch/_link.ld ] && rm $$arch/_link.ld 2>/dev/null ; \
|
|---|
| 366 | done ; exit 0
|
|---|
| [c9ed176] | 367 |
|
|---|
| [839470f] | 368 | archlinks:
|
|---|
| [98a4e76] | 369 | ln -sfn ../../arch/$(KARCH)/include/ generic/include/arch
|
|---|
| [e16e036a] | 370 | ln -sfn ../../genarch/include/ generic/include/genarch
|
|---|
| [c9ed176] | 371 |
|
|---|
| [6095342] | 372 | depend: archlinks
|
|---|
| [98a4e76] | 373 | -makedepend -f - -- $(DEPEND_DEFS) $(CFLAGS) -- $(ARCH_SOURCES) $(GENARCH_SOURCES) $(GENERIC_SOURCES) > Makefile.depend 2> /dev/null
|
|---|
| [c9ed176] | 374 |
|
|---|
| [98a4e76] | 375 | arch/$(KARCH)/_link.ld: arch/$(KARCH)/_link.ld.in
|
|---|
| [4a8635b] | 376 | $(GCC) $(DEFS) $(GCC_CFLAGS) -D__ASM__ -D__LINKER__ -E -x c $< | grep -v "^\#" > $@
|
|---|
| [c9ed176] | 377 |
|
|---|
| [98a4e76] | 378 | generic/src/debug/real_map.bin: depend arch/$(KARCH)/_link.ld $(ARCH_OBJECTS) $(GENARCH_OBJECTS) $(GENERIC_OBJECTS)
|
|---|
| [1314e3b] | 379 | echo $(SYMTAB_SECTION) | $(AS) $(AFLAGS) -o generic/src/debug/empty_map.o
|
|---|
| [98a4e76] | 380 | $(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
|
|---|
| [e16e036a] | 381 | $(OBJDUMP) -t $(ARCH_OBJECTS) $(GENARCH_OBJECTS) $(GENERIC_OBJECTS) > kernel.objdump
|
|---|
| [169c408] | 382 | tools/genmap.py kernel.map.pre kernel.objdump generic/src/debug/real_map.bin
|
|---|
| [3550c393] | 383 | # Do it once again, this time to get correct even the symbols
|
|---|
| 384 | # on architectures, that have bss after symtab
|
|---|
| [1314e3b] | 385 | echo $(SYMTAB_SECTION)" .incbin \"$@\"" | $(AS) $(AFLAGS) -o generic/src/debug/sizeok_map.o
|
|---|
| [98a4e76] | 386 | $(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
|
|---|
| [3550c393] | 387 | $(OBJDUMP) -t $(ARCH_OBJECTS) $(GENARCH_OBJECTS) $(GENERIC_OBJECTS) > kernel.objdump
|
|---|
| 388 | tools/genmap.py kernel.map.pre kernel.objdump generic/src/debug/real_map.bin
|
|---|
| [c9ed176] | 389 |
|
|---|
| [169c408] | 390 | generic/src/debug/real_map.o: generic/src/debug/real_map.bin
|
|---|
| [1314e3b] | 391 | echo $(SYMTAB_SECTION)" .incbin \"$<\"" | $(AS) $(AFLAGS) -o $@
|
|---|
| [c9ed176] | 392 |
|
|---|
| [e2b762ec] | 393 | kernel.raw: depend arch/$(KARCH)/_link.ld $(ARCH_OBJECTS) $(GENARCH_OBJECTS) $(GENERIC_OBJECTS) $(SYMTAB_OBJECTS)
|
|---|
| 394 | $(LD) -T arch/$(KARCH)/_link.ld $(LFLAGS) $(ARCH_OBJECTS) $(GENARCH_OBJECTS) $(GENERIC_OBJECTS) $(EXTRA_OBJECTS) $(SYMTAB_OBJECTS) -o $@ -Map kernel.map
|
|---|
| [c9ed176] | 395 |
|
|---|
| [6e259d5] | 396 | kernel.bin: kernel.raw
|
|---|
| 397 | $(OBJCOPY) -O $(BFD) kernel.raw kernel.bin
|
|---|
| 398 |
|
|---|
| [2ccd275] | 399 | disasm: kernel.raw
|
|---|
| 400 | $(OBJDUMP) -d kernel.raw > kernel.disasm
|
|---|
| 401 |
|
|---|
| [c9ed176] | 402 | %.o: %.S
|
|---|
| [4a8635b] | 403 | $(GCC) $(DEFS) $(GCC_CFLAGS) -D__ASM__ -c $< -o $@
|
|---|
| [c9ed176] | 404 |
|
|---|
| 405 | %.o: %.s
|
|---|
| [6bc4dbd] | 406 | $(AS) $(AFLAGS) $< -o $@
|
|---|
| [c9ed176] | 407 |
|
|---|
| [23cdc921] | 408 | #
|
|---|
| 409 | # The FPU tests are the only objects for which we allow the compiler to generate
|
|---|
| 410 | # FPU instructions.
|
|---|
| 411 | #
|
|---|
| 412 | test/fpu/%.o: test/fpu/%.c
|
|---|
| [bd1deed] | 413 | $(CC) $(DEFS) $(CFLAGS) $(EXTRA_FLAGS) -c $< -o $@
|
|---|
| [23cdc921] | 414 |
|
|---|
| 415 | #
|
|---|
| 416 | # Ordinary objects.
|
|---|
| 417 | #
|
|---|
| 418 | %.o: %.c
|
|---|
| 419 | $(CC) $(DEFS) $(CFLAGS) $(EXTRA_FLAGS) $(FPU_NO_CFLAGS) -c $< -o $@
|
|---|