| 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/arch/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 | AUTOCHECK = $(realpath $(ROOT_PATH)/tools/autocheck.awk)
 | 
|---|
| 51 | KERNEL = kernel.elf
 | 
|---|
| 52 | MAP = kernel.map
 | 
|---|
| 53 | JOB = kernel.job
 | 
|---|
| 54 | MAP_PREV = $(MAP).prev
 | 
|---|
| 55 | DISASM = kernel.disasm
 | 
|---|
| 56 | DUMP = kernel.dump
 | 
|---|
| 57 | REAL_MAP = generic/src/debug/real_map
 | 
|---|
| 58 | 
 | 
|---|
| 59 | GENMAP = tools/genmap.py
 | 
|---|
| 60 | 
 | 
|---|
| 61 | LINK = arch/$(KARCH)/_link.ld
 | 
|---|
| 62 | EMPTY_MAP = generic/src/debug/empty_map.o
 | 
|---|
| 63 | SIZEOK_MAP = generic/src/debug/sizeok_map.o
 | 
|---|
| 64 | 
 | 
|---|
| 65 | ifeq ($(PRECHECK),y)
 | 
|---|
| 66 |         JOBFILE = $(ROOT_PATH)/tools/jobfile.py
 | 
|---|
| 67 |         # NOTE: You must not change the order of arguments.
 | 
|---|
| 68 |         CC_JOB = $(JOBFILE) $(JOB) $(CC) $< -o $@
 | 
|---|
| 69 | else
 | 
|---|
| 70 |         CC_JOB = $(CC) $< -o $@
 | 
|---|
| 71 | endif
 | 
|---|
| 72 | 
 | 
|---|
| 73 | .PHONY: all clean autogen_clean depend
 | 
|---|
| 74 | .DELETE_ON_ERROR:
 | 
|---|
| 75 | 
 | 
|---|
| 76 | all: $(VERSION_DEF) $(COMMON_MAKEFILE) $(COMMON_HEADER) $(CONFIG_MAKEFILE) $(CONFIG_HEADER) $(KERNEL) $(DISASM)
 | 
|---|
| 77 | 
 | 
|---|
| 78 | clean: autogen_clean
 | 
|---|
| 79 |         rm -f $(KERNEL) $(MAP) $(JOB) $(MAP_PREV) $(DISASM) $(DUMP) $(REAL_MAP).* arch/*/_link.ld arch/*/include/arch/common.h
 | 
|---|
| 80 |         find generic/src/ arch/*/src/ genarch/src/ test/ -name '*.o' -follow -exec rm '{}' \;
 | 
|---|
| 81 |         find generic/src/ arch/*/src/ genarch/src/ test/ -name '*.d' -follow -exec rm '{}' \;
 | 
|---|
| 82 | 
 | 
|---|
| 83 | ## Common compiler flags
 | 
|---|
| 84 | #
 | 
|---|
| 85 | 
 | 
|---|
| 86 | INCLUDES = generic/include genarch/include arch/$(KARCH)/include ../abi/arch/$(KARCH)/include ../abi/include
 | 
|---|
| 87 | INCLUDES_FLAGS = $(addprefix -I,$(INCLUDES))
 | 
|---|
| 88 | 
 | 
|---|
| 89 | DEFS = -D_HELENOS_SOURCE -DKERNEL -DRELEASE=$(RELEASE) "-DCOPYRIGHT=$(COPYRIGHT)" "-DNAME=$(NAME)" -D__$(BITS)_BITS__ -D__$(ENDIANESS)__
 | 
|---|
| 90 | 
 | 
|---|
| 91 | COMMON_CFLAGS = $(INCLUDES_FLAGS) -O$(OPTIMIZATION) -imacros $(CONFIG_HEADER) \
 | 
|---|
| 92 |         -ffreestanding -nostdlib \
 | 
|---|
| 93 |         -fexec-charset=UTF-8 -finput-charset=UTF-8 -fno-common \
 | 
|---|
| 94 |         -fdebug-prefix-map=$(realpath $(ROOT_PATH))=. \
 | 
|---|
| 95 |         -Wa,--fatal-warnings
 | 
|---|
| 96 | 
 | 
|---|
| 97 | GCC_CFLAGS = -std=gnu11 -Wall -Wextra -Wno-unused-parameter \
 | 
|---|
| 98 |         -Wmissing-prototypes -Werror-implicit-function-declaration \
 | 
|---|
| 99 |         -Wwrite-strings -pipe -Wno-cast-function-type
 | 
|---|
| 100 | 
 | 
|---|
| 101 | CLANG_CFLAGS = -std=gnu11 -Wall -Wextra -Wno-unused-parameter \
 | 
|---|
| 102 |         -Wno-missing-field-initializers -Wno-unused-command-line-argument \
 | 
|---|
| 103 |         -Wmissing-prototypes -Werror-implicit-function-declaration \
 | 
|---|
| 104 |         -Wwrite-strings -pipe -fno-stack-protector -fno-PIC \
 | 
|---|
| 105 |         -mllvm -asm-macro-max-nesting-depth=1000
 | 
|---|
| 106 | 
 | 
|---|
| 107 | ifeq ($(CONFIG_DEBUG),y)
 | 
|---|
| 108 |         COMMON_CFLAGS += -Werror
 | 
|---|
| 109 | endif
 | 
|---|
| 110 | 
 | 
|---|
| 111 | ifeq ($(CONFIG_UBSAN_KERNEL),y)
 | 
|---|
| 112 |         COMMON_CFLAGS += -fsanitize=undefined
 | 
|---|
| 113 | endif
 | 
|---|
| 114 | 
 | 
|---|
| 115 | ifeq ($(CONFIG_LTO),y)
 | 
|---|
| 116 |         COMMON_CFLAGS += -flto
 | 
|---|
| 117 | endif
 | 
|---|
| 118 | 
 | 
|---|
| 119 | ifeq ($(CONFIG_LINE_DEBUG),y)
 | 
|---|
| 120 |         COMMON_CFLAGS += -g
 | 
|---|
| 121 | endif
 | 
|---|
| 122 | 
 | 
|---|
| 123 | LDFLAGS += -Wl,-n -T $(LINK) -Wl,-M,--fatal-warnings,--warn-common
 | 
|---|
| 124 | 
 | 
|---|
| 125 | ifeq ($(CONFIG_STRIP_BINARIES),y)
 | 
|---|
| 126 |         LDFLAGS += -s
 | 
|---|
| 127 | endif
 | 
|---|
| 128 | 
 | 
|---|
| 129 | -include arch/$(KARCH)/Makefile.inc
 | 
|---|
| 130 | -include genarch/Makefile.inc
 | 
|---|
| 131 | 
 | 
|---|
| 132 | ## The at-sign
 | 
|---|
| 133 | #
 | 
|---|
| 134 | # The $(ATSIGN) variable holds the ASCII character representing the at-sign
 | 
|---|
| 135 | # ('@') used in various $(AS) constructs (e.g. @progbits). On architectures that
 | 
|---|
| 136 | # don't use '@' for starting a comment, $(ATSIGN) is merely '@'. However, on
 | 
|---|
| 137 | # those that do use it for starting a comment (e.g. arm32), $(ATSIGN) must be
 | 
|---|
| 138 | # defined as the percentile-sign ('%') in the architecture-dependent
 | 
|---|
| 139 | # Makefile.inc.
 | 
|---|
| 140 | #
 | 
|---|
| 141 | 
 | 
|---|
| 142 | ATSIGN ?= @
 | 
|---|
| 143 | 
 | 
|---|
| 144 | ## Cross-platform assembly to start a symtab.data section
 | 
|---|
| 145 | #
 | 
|---|
| 146 | 
 | 
|---|
| 147 | SYMTAB_SECTION = .section symtab.data, \"a\", $(ATSIGN)progbits;
 | 
|---|
| 148 | 
 | 
|---|
| 149 | ## Compilation options
 | 
|---|
| 150 | #
 | 
|---|
| 151 | 
 | 
|---|
| 152 | ifeq ($(COMPILER),clang)
 | 
|---|
| 153 |         CFLAGS = $(COMMON_CFLAGS) $(CLANG_CFLAGS)
 | 
|---|
| 154 | else
 | 
|---|
| 155 |         CFLAGS = $(COMMON_CFLAGS) $(GCC_CFLAGS)
 | 
|---|
| 156 | endif
 | 
|---|
| 157 | 
 | 
|---|
| 158 | INSTRUMENTATION = -finstrument-functions
 | 
|---|
| 159 | 
 | 
|---|
| 160 | ## Generic kernel sources
 | 
|---|
| 161 | #
 | 
|---|
| 162 | 
 | 
|---|
| 163 | GENERIC_SOURCES = \
 | 
|---|
| 164 |         generic/src/adt/bitmap.c \
 | 
|---|
| 165 |         generic/src/adt/hash_table.c \
 | 
|---|
| 166 |         generic/src/adt/list.c \
 | 
|---|
| 167 |         generic/src/adt/odict.c \
 | 
|---|
| 168 |         generic/src/console/chardev.c \
 | 
|---|
| 169 |         generic/src/console/console.c \
 | 
|---|
| 170 |         generic/src/console/prompt.c \
 | 
|---|
| 171 |         generic/src/cpu/cpu.c \
 | 
|---|
| 172 |         generic/src/cpu/cpu_mask.c \
 | 
|---|
| 173 |         generic/src/ddi/ddi.c \
 | 
|---|
| 174 |         generic/src/ddi/irq.c \
 | 
|---|
| 175 |         generic/src/debug/symtab.c \
 | 
|---|
| 176 |         generic/src/debug/stacktrace.c \
 | 
|---|
| 177 |         generic/src/debug/panic.c \
 | 
|---|
| 178 |         generic/src/debug/debug.c \
 | 
|---|
| 179 |         generic/src/interrupt/interrupt.c \
 | 
|---|
| 180 |         generic/src/log/log.c \
 | 
|---|
| 181 |         generic/src/main/main.c \
 | 
|---|
| 182 |         generic/src/main/kinit.c \
 | 
|---|
| 183 |         generic/src/main/uinit.c \
 | 
|---|
| 184 |         generic/src/main/version.c \
 | 
|---|
| 185 |         generic/src/main/shutdown.c \
 | 
|---|
| 186 |         generic/src/proc/current.c \
 | 
|---|
| 187 |         generic/src/proc/program.c \
 | 
|---|
| 188 |         generic/src/proc/scheduler.c \
 | 
|---|
| 189 |         generic/src/proc/thread.c \
 | 
|---|
| 190 |         generic/src/proc/task.c \
 | 
|---|
| 191 |         generic/src/syscall/syscall.c \
 | 
|---|
| 192 |         generic/src/syscall/copy.c \
 | 
|---|
| 193 |         generic/src/mm/km.c \
 | 
|---|
| 194 |         generic/src/mm/reserve.c \
 | 
|---|
| 195 |         generic/src/mm/frame.c \
 | 
|---|
| 196 |         generic/src/mm/page.c \
 | 
|---|
| 197 |         generic/src/mm/tlb.c \
 | 
|---|
| 198 |         generic/src/mm/as.c \
 | 
|---|
| 199 |         generic/src/mm/malloc.c \
 | 
|---|
| 200 |         generic/src/mm/backend_anon.c \
 | 
|---|
| 201 |         generic/src/mm/backend_elf.c \
 | 
|---|
| 202 |         generic/src/mm/backend_phys.c \
 | 
|---|
| 203 |         generic/src/mm/backend_user.c \
 | 
|---|
| 204 |         generic/src/mm/slab.c \
 | 
|---|
| 205 |         generic/src/lib/halt.c \
 | 
|---|
| 206 |         generic/src/lib/mem.c \
 | 
|---|
| 207 |         generic/src/lib/memfnc.c \
 | 
|---|
| 208 |         generic/src/lib/gsort.c \
 | 
|---|
| 209 |         generic/src/lib/str.c \
 | 
|---|
| 210 |         generic/src/lib/strtol.c \
 | 
|---|
| 211 |         generic/src/lib/str_error.c \
 | 
|---|
| 212 |         generic/src/lib/elf.c \
 | 
|---|
| 213 |         generic/src/lib/ra.c \
 | 
|---|
| 214 |         generic/src/lib/rd.c \
 | 
|---|
| 215 |         generic/src/lib/ubsan.c \
 | 
|---|
| 216 |         generic/src/printf/printf_core.c \
 | 
|---|
| 217 |         generic/src/printf/printf.c \
 | 
|---|
| 218 |         generic/src/printf/snprintf.c \
 | 
|---|
| 219 |         generic/src/printf/vprintf.c \
 | 
|---|
| 220 |         generic/src/printf/vsnprintf.c \
 | 
|---|
| 221 |         generic/src/time/clock.c \
 | 
|---|
| 222 |         generic/src/time/timeout.c \
 | 
|---|
| 223 |         generic/src/time/delay.c \
 | 
|---|
| 224 |         generic/src/preempt/preemption.c \
 | 
|---|
| 225 |         generic/src/synch/spinlock.c \
 | 
|---|
| 226 |         generic/src/synch/condvar.c \
 | 
|---|
| 227 |         generic/src/synch/mutex.c \
 | 
|---|
| 228 |         generic/src/synch/semaphore.c \
 | 
|---|
| 229 |         generic/src/synch/smc.c \
 | 
|---|
| 230 |         generic/src/synch/waitq.c \
 | 
|---|
| 231 |         generic/src/synch/syswaitq.c \
 | 
|---|
| 232 |         generic/src/smp/ipi.c \
 | 
|---|
| 233 |         generic/src/smp/smp.c \
 | 
|---|
| 234 |         generic/src/ipc/ipc.c \
 | 
|---|
| 235 |         generic/src/ipc/sysipc.c \
 | 
|---|
| 236 |         generic/src/ipc/sysipc_ops.c \
 | 
|---|
| 237 |         generic/src/ipc/ops/conctmeto.c \
 | 
|---|
| 238 |         generic/src/ipc/ops/concttome.c \
 | 
|---|
| 239 |         generic/src/ipc/ops/dataread.c \
 | 
|---|
| 240 |         generic/src/ipc/ops/datawrite.c \
 | 
|---|
| 241 |         generic/src/ipc/ops/debug.c \
 | 
|---|
| 242 |         generic/src/ipc/ops/pagein.c \
 | 
|---|
| 243 |         generic/src/ipc/ops/sharein.c \
 | 
|---|
| 244 |         generic/src/ipc/ops/shareout.c \
 | 
|---|
| 245 |         generic/src/ipc/ops/stchngath.c \
 | 
|---|
| 246 |         generic/src/ipc/ipcrsc.c \
 | 
|---|
| 247 |         generic/src/ipc/irq.c \
 | 
|---|
| 248 |         generic/src/ipc/event.c \
 | 
|---|
| 249 |         generic/src/cap/cap.c \
 | 
|---|
| 250 |         generic/src/security/perm.c \
 | 
|---|
| 251 |         generic/src/sysinfo/sysinfo.c \
 | 
|---|
| 252 |         generic/src/sysinfo/stats.c
 | 
|---|
| 253 | 
 | 
|---|
| 254 | ## Kernel console support
 | 
|---|
| 255 | #
 | 
|---|
| 256 | 
 | 
|---|
| 257 | ifeq ($(CONFIG_KCONSOLE),y)
 | 
|---|
| 258 | GENERIC_SOURCES += \
 | 
|---|
| 259 |         generic/src/console/kconsole.c \
 | 
|---|
| 260 |         generic/src/console/cmd.c
 | 
|---|
| 261 | endif
 | 
|---|
| 262 | 
 | 
|---|
| 263 | ## Udebug interface sources
 | 
|---|
| 264 | #
 | 
|---|
| 265 | 
 | 
|---|
| 266 | ifeq ($(CONFIG_UDEBUG),y)
 | 
|---|
| 267 | GENERIC_SOURCES += \
 | 
|---|
| 268 |         generic/src/ipc/kbox.c \
 | 
|---|
| 269 |         generic/src/udebug/udebug.c \
 | 
|---|
| 270 |         generic/src/udebug/udebug_ops.c \
 | 
|---|
| 271 |         generic/src/udebug/udebug_ipc.c
 | 
|---|
| 272 | endif
 | 
|---|
| 273 | 
 | 
|---|
| 274 | ## Test sources
 | 
|---|
| 275 | #
 | 
|---|
| 276 | 
 | 
|---|
| 277 | ifeq ($(CONFIG_TEST),y)
 | 
|---|
| 278 |         CFLAGS += -Itest/
 | 
|---|
| 279 |         GENERIC_SOURCES += \
 | 
|---|
| 280 |                 test/test.c \
 | 
|---|
| 281 |                 test/atomic/atomic1.c \
 | 
|---|
| 282 |                 test/fault/fault1.c \
 | 
|---|
| 283 |                 test/mm/falloc1.c \
 | 
|---|
| 284 |                 test/mm/falloc2.c \
 | 
|---|
| 285 |                 test/mm/mapping1.c \
 | 
|---|
| 286 |                 test/mm/slab1.c \
 | 
|---|
| 287 |                 test/mm/slab2.c \
 | 
|---|
| 288 |                 test/synch/semaphore1.c \
 | 
|---|
| 289 |                 test/synch/semaphore2.c \
 | 
|---|
| 290 |                 test/print/print1.c \
 | 
|---|
| 291 |                 test/print/print2.c \
 | 
|---|
| 292 |                 test/print/print3.c \
 | 
|---|
| 293 |                 test/print/print4.c \
 | 
|---|
| 294 |                 test/print/print5.c \
 | 
|---|
| 295 |                 test/thread/thread1.c
 | 
|---|
| 296 | 
 | 
|---|
| 297 |         ifeq ($(KARCH),mips32)
 | 
|---|
| 298 |                 GENERIC_SOURCES += test/debug/mips1.c
 | 
|---|
| 299 |         else
 | 
|---|
| 300 |                 GENERIC_SOURCES += test/debug/mips1_skip.c
 | 
|---|
| 301 |         endif
 | 
|---|
| 302 | 
 | 
|---|
| 303 |         ifeq ($(KARCH),ia64)
 | 
|---|
| 304 |                 GENERIC_SOURCES += test/mm/purge1.c
 | 
|---|
| 305 |         else
 | 
|---|
| 306 |                 GENERIC_SOURCES += test/mm/purge1_skip.c
 | 
|---|
| 307 |         endif
 | 
|---|
| 308 | 
 | 
|---|
| 309 | endif
 | 
|---|
| 310 | 
 | 
|---|
| 311 | ## Sources where instrumentation is enabled
 | 
|---|
| 312 | #
 | 
|---|
| 313 | 
 | 
|---|
| 314 | ifeq ($(CONFIG_TRACE),y)
 | 
|---|
| 315 |         INSTRUMENTED_SOURCES = \
 | 
|---|
| 316 |                 generic/src/cpu/cpu.c \
 | 
|---|
| 317 |                 generic/src/ddi/ddi.c \
 | 
|---|
| 318 |                 generic/src/interrupt/interrupt.c \
 | 
|---|
| 319 |                 generic/src/main/main.c \
 | 
|---|
| 320 |                 generic/src/main/kinit.c \
 | 
|---|
| 321 |                 generic/src/proc/the.c \
 | 
|---|
| 322 |                 generic/src/mm/frame.c \
 | 
|---|
| 323 |                 generic/src/mm/page.c \
 | 
|---|
| 324 |                 generic/src/mm/tlb.c \
 | 
|---|
| 325 |                 generic/src/mm/as.c \
 | 
|---|
| 326 |                 generic/src/mm/slab.c \
 | 
|---|
| 327 |                 generic/src/sysinfo/sysinfo.c \
 | 
|---|
| 328 |                 generic/src/console/kconsole.c
 | 
|---|
| 329 | else
 | 
|---|
| 330 |         INSTRUMENTED_SOURCES =
 | 
|---|
| 331 | endif
 | 
|---|
| 332 | 
 | 
|---|
| 333 | ARCH_SOURCES += $(ARCH_AUTOCHECK_HEADERS:%.h=%.check.c)
 | 
|---|
| 334 | GENARCH_SOURCES += $(GENARCH_AUTOCHECK_HEADERS:%.h=%.check.c)
 | 
|---|
| 335 | 
 | 
|---|
| 336 | GENERIC_OBJECTS := $(addsuffix .o,$(basename $(GENERIC_SOURCES)))
 | 
|---|
| 337 | ARCH_OBJECTS := $(addsuffix .o,$(basename $(ARCH_SOURCES)))
 | 
|---|
| 338 | GENARCH_OBJECTS := $(addsuffix .o,$(basename $(GENARCH_SOURCES)))
 | 
|---|
| 339 | 
 | 
|---|
| 340 | GENERIC_DEPENDS := $(addsuffix .d,$(basename $(GENERIC_SOURCES)))
 | 
|---|
| 341 | ARCH_DEPENDS := $(addsuffix .d,$(basename $(ARCH_SOURCES)))
 | 
|---|
| 342 | GENARCH_DEPENDS := $(addsuffix .d,$(basename $(GENARCH_SOURCES)))
 | 
|---|
| 343 | 
 | 
|---|
| 344 | -include $(GENERIC_DEPENDS)
 | 
|---|
| 345 | -include $(ARCH_DEPENDS)
 | 
|---|
| 346 | -include $(GENARCH_DEPENDS)
 | 
|---|
| 347 | 
 | 
|---|
| 348 | ifeq ($(CONFIG_SYMTAB),y)
 | 
|---|
| 349 |         SYMTAB_OBJECTS := generic/src/debug/real_map.o
 | 
|---|
| 350 | else
 | 
|---|
| 351 |         SYMTAB_OBJECTS :=
 | 
|---|
| 352 | endif
 | 
|---|
| 353 | 
 | 
|---|
| 354 | $(DISASM): $(KERNEL)
 | 
|---|
| 355 | ifeq ($(CONFIG_LINE_DEBUG),y)
 | 
|---|
| 356 |         $(OBJDUMP) -d -S $< > $@
 | 
|---|
| 357 | else
 | 
|---|
| 358 |         $(OBJDUMP) -d $< > $@
 | 
|---|
| 359 | endif
 | 
|---|
| 360 | 
 | 
|---|
| 361 | $(KERNEL): $(LINK) $(ARCH_OBJECTS) $(GENARCH_OBJECTS) $(GENERIC_OBJECTS) $(SYMTAB_OBJECTS)
 | 
|---|
| 362 |         $(CC) $(DEFS) $(CFLAGS) $(LDFLAGS) -Wl,-Map,$(MAP) -o $@ $(ARCH_OBJECTS) $(GENARCH_OBJECTS) $(GENERIC_OBJECTS) $(EXTRA_OBJECTS) $(SYMTAB_OBJECTS)
 | 
|---|
| 363 | 
 | 
|---|
| 364 | $(LINK): $(LINK).in
 | 
|---|
| 365 |         $(CC) $(DEFS) $(CFLAGS) -D__ASSEMBLER__ -D__LINKER__ -E -x c $< | grep -v "^\#" > $@
 | 
|---|
| 366 | 
 | 
|---|
| 367 | %.check.c: %.h $(AUTOCHECK)
 | 
|---|
| 368 |         cd $(<D) && $(AUTOCHECK) $(<F) > $(@F)
 | 
|---|
| 369 | 
 | 
|---|
| 370 | %.o: %.S
 | 
|---|
| 371 |         $(CC_JOB) -c -MD -MP $(DEFS) $(CFLAGS)
 | 
|---|
| 372 | 
 | 
|---|
| 373 | %.o: %.s
 | 
|---|
| 374 |         $(CC_JOB) -c -MD -MP $(DEFS) $(CFLAGS)
 | 
|---|
| 375 | 
 | 
|---|
| 376 | %.o: %.c
 | 
|---|
| 377 |         $(CC_JOB) -c -MD -MP $(DEFS) $(CFLAGS) $(EXTRA_FLAGS) $(FPU_NO_CFLAGS) $(if $(findstring $<,$(INSTRUMENTED_SOURCES)),$(INSTRUMENTATION))
 | 
|---|
| 378 | 
 | 
|---|
| 379 | $(REAL_MAP).o: $(REAL_MAP).bin
 | 
|---|
| 380 |         echo "$(AS_PROLOG)""$(SYMTAB_SECTION)"" .incbin \"$<\"" | $(CC) $(CFLAGS) -x assembler -c -o $@ -
 | 
|---|
| 381 | 
 | 
|---|
| 382 | $(REAL_MAP).bin: $(LINK) $(ARCH_OBJECTS) $(GENARCH_OBJECTS) $(GENERIC_OBJECTS)
 | 
|---|
| 383 |         echo "$(AS_PROLOG)""$(SYMTAB_SECTION)" | $(CC) $(CFLAGS) -x assembler -c -o $(EMPTY_MAP) -
 | 
|---|
| 384 |         $(CC) $(DEFS) $(CFLAGS) $(LDFLAGS) -Wl,-Map,$(MAP_PREV) -o $@ $(ARCH_OBJECTS) $(GENARCH_OBJECTS) $(GENERIC_OBJECTS) $(EXTRA_OBJECTS) $(EMPTY_MAP)
 | 
|---|
| 385 |         $(OBJDUMP) -t $(ARCH_OBJECTS) $(GENARCH_OBJECTS) $(GENERIC_OBJECTS) > $(DUMP)
 | 
|---|
| 386 |         $(GENMAP) $(MAP_PREV) $(DUMP) $@
 | 
|---|
| 387 | 
 | 
|---|
| 388 |         # Do it once again, this time to get correct even the symbols
 | 
|---|
| 389 |         # on architectures that have bss after symtab
 | 
|---|
| 390 | 
 | 
|---|
| 391 |         echo "$(AS_PROLOG)""$(SYMTAB_SECTION)"" .incbin \"$@\"" | $(CC) $(CFLAGS) -x assembler -c -o $(SIZEOK_MAP) -
 | 
|---|
| 392 |         $(CC) $(DEFS) $(CFLAGS) $(LDFLAGS) -Wl,-Map,$(MAP_PREV) -o $@ $(ARCH_OBJECTS) $(GENARCH_OBJECTS) $(GENERIC_OBJECTS) $(EXTRA_OBJECTS) $(SIZEOK_MAP)
 | 
|---|
| 393 |         $(OBJDUMP) -t $(ARCH_OBJECTS) $(GENARCH_OBJECTS) $(GENERIC_OBJECTS) > $(DUMP)
 | 
|---|
| 394 |         $(GENMAP) $(MAP_PREV) $(DUMP) $@
 | 
|---|