| 1 | #
|
|---|
| 2 | # Copyright (c) 2005 Martin Decky
|
|---|
| 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 | ## Configuration
|
|---|
| 30 | #
|
|---|
| 31 |
|
|---|
| 32 | ROOT_PATH = ..
|
|---|
| 33 |
|
|---|
| 34 | VERSION_DEF = $(ROOT_PATH)/version
|
|---|
| 35 |
|
|---|
| 36 | COMMON_MAKEFILE = $(ROOT_PATH)/Makefile.common
|
|---|
| 37 | COMMON_HEADER = $(ROOT_PATH)/common.h
|
|---|
| 38 | COMMON_HEADER_ARCH = arch/$(KARCH)/include/common.h
|
|---|
| 39 |
|
|---|
| 40 | CONFIG_MAKEFILE = $(ROOT_PATH)/Makefile.config
|
|---|
| 41 | CONFIG_HEADER = $(ROOT_PATH)/config.h
|
|---|
| 42 |
|
|---|
| 43 | -include $(VERSION_DEF)
|
|---|
| 44 | -include $(COMMON_MAKEFILE)
|
|---|
| 45 | -include $(CONFIG_MAKEFILE)
|
|---|
| 46 |
|
|---|
| 47 | ## Common names
|
|---|
| 48 | #
|
|---|
| 49 |
|
|---|
| 50 | DEPEND = Makefile.depend
|
|---|
| 51 | DEPEND_PREV = $(DEPEND).prev
|
|---|
| 52 | RAW = kernel.raw
|
|---|
| 53 | BIN = kernel.bin
|
|---|
| 54 | MAP = kernel.map
|
|---|
| 55 | JOB = kernel.job
|
|---|
| 56 | MAP_PREV = $(MAP).prev
|
|---|
| 57 | DISASM = kernel.disasm
|
|---|
| 58 | DUMP = kernel.dump
|
|---|
| 59 | REAL_MAP = generic/src/debug/real_map
|
|---|
| 60 |
|
|---|
| 61 | ARCH_INCLUDE = generic/include/arch
|
|---|
| 62 | GENARCH_INCLUDE = generic/include/genarch
|
|---|
| 63 |
|
|---|
| 64 | GENMAP = tools/genmap.py
|
|---|
| 65 | JOBFILE = $(ROOT_PATH)/tools/jobfile.py
|
|---|
| 66 |
|
|---|
| 67 | LINK = arch/$(KARCH)/_link.ld
|
|---|
| 68 | EMPTY_MAP = generic/src/debug/empty_map.o
|
|---|
| 69 | SIZEOK_MAP = generic/src/debug/sizeok_map.o
|
|---|
| 70 |
|
|---|
| 71 | .PHONY: all clean
|
|---|
| 72 |
|
|---|
| 73 | all: $(VERSION_DEF) $(COMMON_MAKEFILE) $(COMMON_HEADER) $(CONFIG_MAKEFILE) $(CONFIG_HEADER) $(BIN) $(DISASM)
|
|---|
| 74 | -[ -f $(DEPEND) ] && cp -a $(DEPEND) $(DEPEND_PREV)
|
|---|
| 75 |
|
|---|
| 76 | clean:
|
|---|
| 77 | rm -f $(DEPEND) $(DEPEND_PREV) $(RAW) $(BIN) $(MAP) $(JOB) $(MAP_PREV) $(DISASM) $(DUMP) $(REAL_MAP).* $(ARCH_INCLUDE) $(GENARCH_INCLUDE) arch/*/_link.ld arch/*/include/common.h
|
|---|
| 78 | find generic/src/ arch/*/src/ genarch/src/ test/ -name '*.o' -follow -exec rm \{\} \;
|
|---|
| 79 |
|
|---|
| 80 | ## Common compiler flags
|
|---|
| 81 | #
|
|---|
| 82 |
|
|---|
| 83 | INCLUDES = generic/include
|
|---|
| 84 |
|
|---|
| 85 | ifeq ($(CONFIG_OPTIMIZE_FOR_SIZE),y)
|
|---|
| 86 | OPTIMIZATION = s
|
|---|
| 87 | else
|
|---|
| 88 | OPTIMIZATION = 3
|
|---|
| 89 | endif
|
|---|
| 90 |
|
|---|
| 91 | DEFS = -DKERNEL -DRELEASE=$(RELEASE) "-DNAME=$(NAME)" -D__$(BITS)_BITS__ -D__$(ENDIANESS)__
|
|---|
| 92 |
|
|---|
| 93 | GCC_CFLAGS = -I$(INCLUDES) -O$(OPTIMIZATION) -imacros $(CONFIG_HEADER) \
|
|---|
| 94 | -fexec-charset=UTF-8 -fwide-exec-charset=UTF-32$(ENDIANESS) \
|
|---|
| 95 | -finput-charset=UTF-8 -ffreestanding -fno-builtin -nostdlib -nostdinc \
|
|---|
| 96 | -Wall -Wextra -Wno-unused-parameter -Wmissing-prototypes \
|
|---|
| 97 | -Werror-implicit-function-declaration -Wwrite-strings \
|
|---|
| 98 | -pipe
|
|---|
| 99 |
|
|---|
| 100 | ICC_CFLAGS = -I$(INCLUDES) -O$(OPTIMIZATION) -imacros $(CONFIG_HEADER) \
|
|---|
| 101 | -ffreestanding -fno-builtin -nostdlib -nostdinc -Wall -Wmissing-prototypes \
|
|---|
| 102 | -Werror-implicit-function-declaration -wd170
|
|---|
| 103 |
|
|---|
| 104 | SUNCC_CFLAGS = -I$(INCLUDES) -xO$(OPTIMIZATION) \
|
|---|
| 105 | -xnolib -xc99=all -features=extensions \
|
|---|
| 106 | -erroff=E_ZERO_SIZED_STRUCT_UNION
|
|---|
| 107 |
|
|---|
| 108 | CLANG_CFLAGS = -I$(INCLUDES) -O$(OPTIMIZATION) -imacros $(CONFIG_HEADER) \
|
|---|
| 109 | -fexec-charset=UTF-8 -fwide-exec-charset=UTF-32$(ENDIANESS) \
|
|---|
| 110 | -finput-charset=UTF-8 -ffreestanding -fno-builtin -nostdlib -nostdinc \
|
|---|
| 111 | -Wall -Wextra -Wno-unused-parameter -Wmissing-prototypes \
|
|---|
| 112 | -Werror-implicit-function-declaration -Wwrite-strings \
|
|---|
| 113 | -pipe -arch $(CLANG_ARCH)
|
|---|
| 114 |
|
|---|
| 115 | ifeq ($(CONFIG_DEBUG),y)
|
|---|
| 116 | GCC_CFLAGS += -Werror
|
|---|
| 117 | ICC_CFLAGS += -Werror
|
|---|
| 118 | endif
|
|---|
| 119 |
|
|---|
| 120 | ifeq ($(CONFIG_LTO),y)
|
|---|
| 121 | GCC_CFLAGS += -flto
|
|---|
| 122 | endif
|
|---|
| 123 |
|
|---|
| 124 | ifeq ($(CONFIG_LINE_DEBUG),y)
|
|---|
| 125 | GCC_CFLAGS += -g
|
|---|
| 126 | ICC_CFLAGS += -g
|
|---|
| 127 | SUNCC_CFLAGS += -g
|
|---|
| 128 | CLANG_CFLAGS += -g
|
|---|
| 129 | endif
|
|---|
| 130 |
|
|---|
| 131 | #
|
|---|
| 132 | # Mind the mutual ordering with the inclusion of the arch Makefile.inc.
|
|---|
| 133 | # AFLAGS and LFLAGS must be initialized before the inclusion.
|
|---|
| 134 | #
|
|---|
| 135 | AFLAGS =
|
|---|
| 136 | LFLAGS = -N -T $(LINK) -M
|
|---|
| 137 |
|
|---|
| 138 | #
|
|---|
| 139 | # Mind the mutual ordering with the initialization of AFLAGS and LFLAGS.
|
|---|
| 140 | # The arch Makefile.inc must be included after the initialization.
|
|---|
| 141 | #
|
|---|
| 142 | -include arch/$(KARCH)/Makefile.inc
|
|---|
| 143 | -include genarch/Makefile.inc
|
|---|
| 144 | -include $(DEPEND)
|
|---|
| 145 |
|
|---|
| 146 | ## The at-sign
|
|---|
| 147 | #
|
|---|
| 148 | # The $(ATSIGN) variable holds the ASCII character representing the at-sign
|
|---|
| 149 | # ('@') used in various $(AS) constructs (e.g. @progbits). On architectures that
|
|---|
| 150 | # don't use '@' for starting a comment, $(ATSIGN) is merely '@'. However, on
|
|---|
| 151 | # those that do use it for starting a comment (e.g. arm32), $(ATSIGN) must be
|
|---|
| 152 | # defined as the percentile-sign ('%') in the architecture-dependent
|
|---|
| 153 | # Makefile.inc.
|
|---|
| 154 | #
|
|---|
| 155 |
|
|---|
| 156 | ATSIGN ?= @
|
|---|
| 157 |
|
|---|
| 158 | ## Cross-platform assembly to start a symtab.data section
|
|---|
| 159 | #
|
|---|
| 160 |
|
|---|
| 161 | SYMTAB_SECTION = ".section symtab.data, \"a\", $(ATSIGN)progbits;"
|
|---|
| 162 |
|
|---|
| 163 | ## Compilation options
|
|---|
| 164 | #
|
|---|
| 165 |
|
|---|
| 166 | ifeq ($(COMPILER),gcc_native)
|
|---|
| 167 | CFLAGS = $(GCC_CFLAGS)
|
|---|
| 168 | DEPEND_DEFS = $(DEFS) $(CONFIG_DEFS)
|
|---|
| 169 | INSTRUMENTATION = -finstrument-functions
|
|---|
| 170 | endif
|
|---|
| 171 |
|
|---|
| 172 | ifeq ($(COMPILER),gcc_cross)
|
|---|
| 173 | CFLAGS = $(GCC_CFLAGS)
|
|---|
| 174 | DEPEND_DEFS = $(DEFS) $(CONFIG_DEFS)
|
|---|
| 175 | INSTRUMENTATION = -finstrument-functions
|
|---|
| 176 | endif
|
|---|
| 177 |
|
|---|
| 178 | ifeq ($(COMPILER),icc)
|
|---|
| 179 | CFLAGS = $(ICC_CFLAGS)
|
|---|
| 180 | DEPEND_DEFS = $(DEFS) $(CONFIG_DEFS)
|
|---|
| 181 | INSTRUMENTATION =
|
|---|
| 182 | endif
|
|---|
| 183 |
|
|---|
| 184 | ifeq ($(COMPILER),suncc)
|
|---|
| 185 | CFLAGS = $(SUNCC_CFLAGS)
|
|---|
| 186 | DEFS += $(CONFIG_DEFS)
|
|---|
| 187 | DEPEND_DEFS = $(DEFS)
|
|---|
| 188 | INSTRUMENTATION =
|
|---|
| 189 | endif
|
|---|
| 190 |
|
|---|
| 191 | ifeq ($(COMPILER),clang)
|
|---|
| 192 | CFLAGS = $(CLANG_CFLAGS)
|
|---|
| 193 | DEPEND_DEFS = $(DEFS) $(CONFIG_DEFS)
|
|---|
| 194 | INSTRUMENTATION =
|
|---|
| 195 | endif
|
|---|
| 196 |
|
|---|
| 197 |
|
|---|
| 198 | ## Generic kernel sources
|
|---|
| 199 | #
|
|---|
| 200 |
|
|---|
| 201 | GENERIC_SOURCES = \
|
|---|
| 202 | generic/src/adt/avl.c \
|
|---|
| 203 | generic/src/adt/bitmap.c \
|
|---|
| 204 | generic/src/adt/btree.c \
|
|---|
| 205 | generic/src/adt/hash_table.c \
|
|---|
| 206 | generic/src/adt/list.c \
|
|---|
| 207 | generic/src/console/chardev.c \
|
|---|
| 208 | generic/src/console/console.c \
|
|---|
| 209 | generic/src/cpu/cpu.c \
|
|---|
| 210 | generic/src/ddi/ddi.c \
|
|---|
| 211 | generic/src/ddi/irq.c \
|
|---|
| 212 | generic/src/ddi/device.c \
|
|---|
| 213 | generic/src/debug/symtab.c \
|
|---|
| 214 | generic/src/debug/stacktrace.c \
|
|---|
| 215 | generic/src/debug/panic.c \
|
|---|
| 216 | generic/src/debug/debug.c \
|
|---|
| 217 | generic/src/interrupt/interrupt.c \
|
|---|
| 218 | generic/src/main/main.c \
|
|---|
| 219 | generic/src/main/kinit.c \
|
|---|
| 220 | generic/src/main/uinit.c \
|
|---|
| 221 | generic/src/main/version.c \
|
|---|
| 222 | generic/src/main/shutdown.c \
|
|---|
| 223 | generic/src/proc/program.c \
|
|---|
| 224 | generic/src/proc/scheduler.c \
|
|---|
| 225 | generic/src/proc/thread.c \
|
|---|
| 226 | generic/src/proc/task.c \
|
|---|
| 227 | generic/src/proc/the.c \
|
|---|
| 228 | generic/src/proc/tasklet.c \
|
|---|
| 229 | generic/src/syscall/syscall.c \
|
|---|
| 230 | generic/src/syscall/copy.c \
|
|---|
| 231 | generic/src/mm/buddy.c \
|
|---|
| 232 | generic/src/mm/frame.c \
|
|---|
| 233 | generic/src/mm/page.c \
|
|---|
| 234 | generic/src/mm/tlb.c \
|
|---|
| 235 | generic/src/mm/as.c \
|
|---|
| 236 | generic/src/mm/backend_anon.c \
|
|---|
| 237 | generic/src/mm/backend_elf.c \
|
|---|
| 238 | generic/src/mm/backend_phys.c \
|
|---|
| 239 | generic/src/mm/slab.c \
|
|---|
| 240 | generic/src/lib/func.c \
|
|---|
| 241 | generic/src/lib/memstr.c \
|
|---|
| 242 | generic/src/lib/memfnc.c \
|
|---|
| 243 | generic/src/lib/sort.c \
|
|---|
| 244 | generic/src/lib/str.c \
|
|---|
| 245 | generic/src/lib/elf.c \
|
|---|
| 246 | generic/src/lib/rd.c \
|
|---|
| 247 | generic/src/printf/printf_core.c \
|
|---|
| 248 | generic/src/printf/printf.c \
|
|---|
| 249 | generic/src/printf/snprintf.c \
|
|---|
| 250 | generic/src/printf/vprintf.c \
|
|---|
| 251 | generic/src/printf/vsnprintf.c \
|
|---|
| 252 | generic/src/time/clock.c \
|
|---|
| 253 | generic/src/time/timeout.c \
|
|---|
| 254 | generic/src/time/delay.c \
|
|---|
| 255 | generic/src/preempt/preemption.c \
|
|---|
| 256 | generic/src/synch/spinlock.c \
|
|---|
| 257 | generic/src/synch/condvar.c \
|
|---|
| 258 | generic/src/synch/mutex.c \
|
|---|
| 259 | generic/src/synch/semaphore.c \
|
|---|
| 260 | generic/src/synch/smc.c \
|
|---|
| 261 | generic/src/synch/waitq.c \
|
|---|
| 262 | generic/src/synch/futex.c \
|
|---|
| 263 | generic/src/smp/ipi.c \
|
|---|
| 264 | generic/src/smp/smp.c \
|
|---|
| 265 | generic/src/ipc/ipc.c \
|
|---|
| 266 | generic/src/ipc/sysipc.c \
|
|---|
| 267 | generic/src/ipc/ipcrsc.c \
|
|---|
| 268 | generic/src/ipc/irq.c \
|
|---|
| 269 | generic/src/ipc/event.c \
|
|---|
| 270 | generic/src/security/cap.c \
|
|---|
| 271 | generic/src/sysinfo/sysinfo.c \
|
|---|
| 272 | generic/src/sysinfo/stats.c
|
|---|
| 273 |
|
|---|
| 274 | ## Kernel console support
|
|---|
| 275 | #
|
|---|
| 276 |
|
|---|
| 277 | ifeq ($(CONFIG_KCONSOLE),y)
|
|---|
| 278 | GENERIC_SOURCES += \
|
|---|
| 279 | generic/src/console/kconsole.c \
|
|---|
| 280 | generic/src/console/cmd.c
|
|---|
| 281 | endif
|
|---|
| 282 |
|
|---|
| 283 | ## Udebug interface sources
|
|---|
| 284 | #
|
|---|
| 285 |
|
|---|
| 286 | ifeq ($(CONFIG_UDEBUG),y)
|
|---|
| 287 | GENERIC_SOURCES += \
|
|---|
| 288 | generic/src/ipc/kbox.c \
|
|---|
| 289 | generic/src/udebug/udebug.c \
|
|---|
| 290 | generic/src/udebug/udebug_ops.c \
|
|---|
| 291 | generic/src/udebug/udebug_ipc.c
|
|---|
| 292 | endif
|
|---|
| 293 |
|
|---|
| 294 | ## Test sources
|
|---|
| 295 | #
|
|---|
| 296 |
|
|---|
| 297 | ifeq ($(CONFIG_TEST),y)
|
|---|
| 298 | CFLAGS += -Itest/
|
|---|
| 299 | GENERIC_SOURCES += \
|
|---|
| 300 | test/test.c \
|
|---|
| 301 | test/atomic/atomic1.c \
|
|---|
| 302 | test/btree/btree1.c \
|
|---|
| 303 | test/avltree/avltree1.c \
|
|---|
| 304 | test/fault/fault1.c \
|
|---|
| 305 | test/mm/falloc1.c \
|
|---|
| 306 | test/mm/falloc2.c \
|
|---|
| 307 | test/mm/mapping1.c \
|
|---|
| 308 | test/mm/slab1.c \
|
|---|
| 309 | test/mm/slab2.c \
|
|---|
| 310 | test/synch/semaphore1.c \
|
|---|
| 311 | test/synch/semaphore2.c \
|
|---|
| 312 | test/print/print1.c \
|
|---|
| 313 | test/print/print2.c \
|
|---|
| 314 | test/print/print3.c \
|
|---|
| 315 | test/print/print4.c \
|
|---|
| 316 | test/print/print5.c \
|
|---|
| 317 | test/thread/thread1.c
|
|---|
| 318 |
|
|---|
| 319 | ifeq ($(KARCH),mips32)
|
|---|
| 320 | GENERIC_SOURCES += test/debug/mips1.c
|
|---|
| 321 | else
|
|---|
| 322 | GENERIC_SOURCES += test/debug/mips1_skip.c
|
|---|
| 323 | endif
|
|---|
| 324 |
|
|---|
| 325 | ifeq ($(KARCH),ia64)
|
|---|
| 326 | GENERIC_SOURCES += test/mm/purge1.c
|
|---|
| 327 | else
|
|---|
| 328 | GENERIC_SOURCES += test/mm/purge1_skip.c
|
|---|
| 329 | endif
|
|---|
| 330 |
|
|---|
| 331 | ifeq ($(CONFIG_FPU),y)
|
|---|
| 332 | ifeq ($(KARCH),ia32)
|
|---|
| 333 | TEST_FPU1 = y
|
|---|
| 334 | TEST_SSE1 = y
|
|---|
| 335 | GENERIC_SOURCES += test/fpu/fpu1_x86.c
|
|---|
| 336 | endif
|
|---|
| 337 |
|
|---|
| 338 | ifeq ($(KARCH),amd64)
|
|---|
| 339 | TEST_FPU1 = y
|
|---|
| 340 | TEST_SSE1 = y
|
|---|
| 341 | GENERIC_SOURCES += test/fpu/fpu1_x86.c
|
|---|
| 342 | endif
|
|---|
| 343 |
|
|---|
| 344 | ifeq ($(KARCH),ia64)
|
|---|
| 345 | TEST_FPU1 = y
|
|---|
| 346 | GENERIC_SOURCES += test/fpu/fpu1_ia64.c
|
|---|
| 347 | endif
|
|---|
| 348 |
|
|---|
| 349 | ifeq ($(KARCH),mips32)
|
|---|
| 350 | TEST_MIPS2 = y
|
|---|
| 351 | endif
|
|---|
| 352 | endif
|
|---|
| 353 |
|
|---|
| 354 | ifneq ($(TEST_FPU1),y)
|
|---|
| 355 | GENERIC_SOURCES += test/fpu/fpu1_skip.c
|
|---|
| 356 | endif
|
|---|
| 357 |
|
|---|
| 358 | ifeq ($(TEST_SSE1),y)
|
|---|
| 359 | GENERIC_SOURCES += test/fpu/sse1.c
|
|---|
| 360 | else
|
|---|
| 361 | GENERIC_SOURCES += test/fpu/sse1_skip.c
|
|---|
| 362 | endif
|
|---|
| 363 |
|
|---|
| 364 | ifeq ($(TEST_MIPS2),y)
|
|---|
| 365 | GENERIC_SOURCES += test/fpu/mips2.c
|
|---|
| 366 | else
|
|---|
| 367 | GENERIC_SOURCES += test/fpu/mips2_skip.c
|
|---|
| 368 | endif
|
|---|
| 369 |
|
|---|
| 370 | endif
|
|---|
| 371 |
|
|---|
| 372 | ## Sources where instrumentation is enabled
|
|---|
| 373 | #
|
|---|
| 374 |
|
|---|
| 375 | ifeq ($(CONFIG_TRACE),y)
|
|---|
| 376 | INSTRUMENTED_SOURCES = \
|
|---|
| 377 | generic/src/adt/btree.c \
|
|---|
| 378 | generic/src/cpu/cpu.c \
|
|---|
| 379 | generic/src/ddi/ddi.c \
|
|---|
| 380 | generic/src/interrupt/interrupt.c \
|
|---|
| 381 | generic/src/main/main.c \
|
|---|
| 382 | generic/src/main/kinit.c \
|
|---|
| 383 | generic/src/proc/the.c \
|
|---|
| 384 | generic/src/proc/tasklet.c \
|
|---|
| 385 | generic/src/mm/frame.c \
|
|---|
| 386 | generic/src/mm/page.c \
|
|---|
| 387 | generic/src/mm/tlb.c \
|
|---|
| 388 | generic/src/mm/as.c \
|
|---|
| 389 | generic/src/mm/slab.c \
|
|---|
| 390 | generic/src/sysinfo/sysinfo.c \
|
|---|
| 391 | generic/src/console/kconsole.c
|
|---|
| 392 | else
|
|---|
| 393 | INSTRUMENTED_SOURCES =
|
|---|
| 394 | endif
|
|---|
| 395 |
|
|---|
| 396 | GENERIC_OBJECTS := $(addsuffix .o,$(basename $(GENERIC_SOURCES)))
|
|---|
| 397 | ARCH_OBJECTS := $(addsuffix .o,$(basename $(ARCH_SOURCES)))
|
|---|
| 398 | GENARCH_OBJECTS := $(addsuffix .o,$(basename $(GENARCH_SOURCES)))
|
|---|
| 399 |
|
|---|
| 400 | LFLAGS_LTO := $(addprefix -Xlinker ,$(LFLAGS))
|
|---|
| 401 |
|
|---|
| 402 | ifeq ($(CONFIG_SYMTAB),y)
|
|---|
| 403 | SYMTAB_OBJECTS := generic/src/debug/real_map.o
|
|---|
| 404 | else
|
|---|
| 405 | SYMTAB_OBJECTS :=
|
|---|
| 406 | endif
|
|---|
| 407 |
|
|---|
| 408 | $(BIN): $(RAW)
|
|---|
| 409 | $(OBJCOPY) -O $(BFD) $< $@
|
|---|
| 410 |
|
|---|
| 411 | $(DISASM): $(RAW)
|
|---|
| 412 | ifeq ($(CONFIG_LINE_DEBUG),y)
|
|---|
| 413 | $(OBJDUMP) -d -S $< > $@
|
|---|
| 414 | else
|
|---|
| 415 | $(OBJDUMP) -d $< > $@
|
|---|
| 416 | endif
|
|---|
| 417 |
|
|---|
| 418 | $(RAW): $(LINK) $(ARCH_OBJECTS) $(GENARCH_OBJECTS) $(GENERIC_OBJECTS) $(SYMTAB_OBJECTS)
|
|---|
| 419 | ifeq ($(CONFIG_LTO),y)
|
|---|
| 420 | $(GCC) $(LFLAGS_LTO) -Xlinker -Map -Xlinker $(MAP) $(DEFS) $(GCC_CFLAGS) -o $@ $(ARCH_OBJECTS) $(GENARCH_OBJECTS) $(GENERIC_OBJECTS) $(EXTRA_OBJECTS) $(SYMTAB_OBJECTS)
|
|---|
| 421 | else
|
|---|
| 422 | $(LD) $(LFLAGS) -Map $(MAP) -o $@ $(ARCH_OBJECTS) $(GENARCH_OBJECTS) $(GENERIC_OBJECTS) $(EXTRA_OBJECTS) $(SYMTAB_OBJECTS)
|
|---|
| 423 | endif
|
|---|
| 424 | ifeq ($(CONFIG_STRIP_BINARIES),y)
|
|---|
| 425 | $(STRIP) $(RAW)
|
|---|
| 426 | endif
|
|---|
| 427 |
|
|---|
| 428 | $(LINK): $(LINK).in $(DEPEND)
|
|---|
| 429 | $(GCC) $(DEFS) $(GCC_CFLAGS) -D__ASM__ -D__LINKER__ -E -x c $< | grep -v "^\#" > $@
|
|---|
| 430 |
|
|---|
| 431 | %.o: %.S $(DEPEND)
|
|---|
| 432 | $(GCC) $(DEFS) $(GCC_CFLAGS) -D__ASM__ -c -o $@ $<
|
|---|
| 433 | ifeq ($(PRECHECK),y)
|
|---|
| 434 | $(JOBFILE) $(JOB) $< $@ as asm/preproc $(DEFS) $(GCC_CFLAGS) -D__ASM__
|
|---|
| 435 | endif
|
|---|
| 436 |
|
|---|
| 437 | %.o: %.s $(DEPEND)
|
|---|
| 438 | $(AS) $(AFLAGS) -o $@ $<
|
|---|
| 439 | ifeq ($(PRECHECK),y)
|
|---|
| 440 | $(JOBFILE) $(JOB) $< $@ as asm $(DEFS) $(CFLAGS) $(EXTRA_FLAGS)
|
|---|
| 441 | endif
|
|---|
| 442 |
|
|---|
| 443 | #
|
|---|
| 444 | # The FPU tests are the only objects for which we allow the compiler to generate
|
|---|
| 445 | # FPU instructions.
|
|---|
| 446 | #
|
|---|
| 447 |
|
|---|
| 448 | test/fpu/%.o: test/fpu/%.c $(DEPEND)
|
|---|
| 449 | $(CC) $(DEFS) $(CFLAGS) $(EXTRA_FLAGS) -c -o $@ $<
|
|---|
| 450 | ifeq ($(PRECHECK),y)
|
|---|
| 451 | $(JOBFILE) $(JOB) $< $@ cc test $(DEFS) $(CFLAGS) $(EXTRA_FLAGS)
|
|---|
| 452 | endif
|
|---|
| 453 |
|
|---|
| 454 | #
|
|---|
| 455 | # Ordinary objects.
|
|---|
| 456 | #
|
|---|
| 457 |
|
|---|
| 458 | %.o: %.c $(DEPEND)
|
|---|
| 459 | $(CC) $(DEFS) $(CFLAGS) $(EXTRA_FLAGS) $(FPU_NO_CFLAGS) $(if $(findstring $<,$(INSTRUMENTED_SOURCES)),$(INSTRUMENTATION)) -c -o $@ $<
|
|---|
| 460 | ifeq ($(PRECHECK),y)
|
|---|
| 461 | $(JOBFILE) $(JOB) $< $@ cc core $(DEFS) $(CFLAGS) $(EXTRA_FLAGS) $(FPU_NO_CFLAGS)
|
|---|
| 462 | endif
|
|---|
| 463 |
|
|---|
| 464 | $(REAL_MAP).o: $(REAL_MAP).bin
|
|---|
| 465 | echo $(SYMTAB_SECTION)" .incbin \"$<\"" | $(AS) $(AFLAGS) -o $@
|
|---|
| 466 |
|
|---|
| 467 | $(REAL_MAP).bin: $(LINK) $(ARCH_OBJECTS) $(GENARCH_OBJECTS) $(GENERIC_OBJECTS)
|
|---|
| 468 | echo $(SYMTAB_SECTION) | $(AS) $(AFLAGS) -o $(EMPTY_MAP)
|
|---|
| 469 | ifeq ($(CONFIG_LTO),y)
|
|---|
| 470 | $(GCC) $(LFLAGS_LTO) -Xlinker -Map -Xlinker $(MAP_PREV) $(DEFS) $(GCC_CFLAGS) -o $@ $(ARCH_OBJECTS) $(GENARCH_OBJECTS) $(GENERIC_OBJECTS) $(EXTRA_OBJECTS) $(EMPTY_MAP)
|
|---|
| 471 | else
|
|---|
| 472 | $(LD) $(LFLAGS) -Map $(MAP_PREV) -o $@ $(ARCH_OBJECTS) $(GENARCH_OBJECTS) $(GENERIC_OBJECTS) $(EXTRA_OBJECTS) $(EMPTY_MAP)
|
|---|
| 473 | endif
|
|---|
| 474 | $(OBJDUMP) -t $(ARCH_OBJECTS) $(GENARCH_OBJECTS) $(GENERIC_OBJECTS) > $(DUMP)
|
|---|
| 475 | $(GENMAP) $(MAP_PREV) $(DUMP) $@
|
|---|
| 476 |
|
|---|
| 477 | # Do it once again, this time to get correct even the symbols
|
|---|
| 478 | # on architectures that have bss after symtab
|
|---|
| 479 |
|
|---|
| 480 | echo $(SYMTAB_SECTION)" .incbin \"$@\"" | $(AS) $(AFLAGS) -o $(SIZEOK_MAP)
|
|---|
| 481 | ifeq ($(CONFIG_LTO),y)
|
|---|
| 482 | $(GCC) $(LFLAGS_LTO) -Xlinker -Map -Xlinker $(MAP_PREV) $(DEFS) $(GCC_CFLAGS) -o $@ $(ARCH_OBJECTS) $(GENARCH_OBJECTS) $(GENERIC_OBJECTS) $(EXTRA_OBJECTS) $(SIZEOK_MAP)
|
|---|
| 483 | else
|
|---|
| 484 | $(LD) $(LFLAGS) -Map $(MAP_PREV) -o $@ $(ARCH_OBJECTS) $(GENARCH_OBJECTS) $(GENERIC_OBJECTS) $(EXTRA_OBJECTS) $(SIZEOK_MAP)
|
|---|
| 485 | endif
|
|---|
| 486 | $(OBJDUMP) -t $(ARCH_OBJECTS) $(GENARCH_OBJECTS) $(GENERIC_OBJECTS) > $(DUMP)
|
|---|
| 487 | $(GENMAP) $(MAP_PREV) $(DUMP) $@
|
|---|
| 488 |
|
|---|
| 489 | $(DEPEND): $(ARCH_INCLUDE) $(GENARCH_INCLUDE) $(COMMON_HEADER_ARCH)
|
|---|
| 490 | makedepend -f - -- $(DEPEND_DEFS) $(CFLAGS) -- $(ARCH_SOURCES) $(GENARCH_SOURCES) $(GENERIC_SOURCES) > $@ 2> /dev/null
|
|---|
| 491 | -[ -f $(DEPEND_PREV) ] && diff -q $(DEPEND_PREV) $@ && mv -f $(DEPEND_PREV) $@
|
|---|
| 492 |
|
|---|
| 493 | $(ARCH_INCLUDE): arch/$(KARCH)/include/
|
|---|
| 494 | ln -sfn ../../$< $@
|
|---|
| 495 |
|
|---|
| 496 | $(GENARCH_INCLUDE): genarch/include/
|
|---|
| 497 | ln -sfn ../../$< $@
|
|---|
| 498 |
|
|---|
| 499 | $(COMMON_HEADER_ARCH): $(COMMON_HEADER)
|
|---|
| 500 | ln -sfn ../../../$< $@
|
|---|