| [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 |
|
|---|
| [4e9aaf5] | 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
|
|---|
| [6ecf5b8] | 38 | COMMON_HEADER_ARCH = arch/$(KARCH)/include/arch/common.h
|
|---|
| [4e9aaf5] | 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 |
|
|---|
| [d2f75eb] | 50 | AUTOCHECK = $(realpath $(ROOT_PATH)/tools/autocheck.awk)
|
|---|
| [4e9aaf5] | 51 | RAW = kernel.raw
|
|---|
| 52 | BIN = kernel.bin
|
|---|
| 53 | MAP = kernel.map
|
|---|
| 54 | JOB = kernel.job
|
|---|
| 55 | MAP_PREV = $(MAP).prev
|
|---|
| 56 | DISASM = kernel.disasm
|
|---|
| 57 | DUMP = kernel.dump
|
|---|
| 58 | REAL_MAP = generic/src/debug/real_map
|
|---|
| 59 |
|
|---|
| 60 | GENMAP = tools/genmap.py
|
|---|
| 61 |
|
|---|
| 62 | LINK = arch/$(KARCH)/_link.ld
|
|---|
| 63 | EMPTY_MAP = generic/src/debug/empty_map.o
|
|---|
| 64 | SIZEOK_MAP = generic/src/debug/sizeok_map.o
|
|---|
| 65 |
|
|---|
| [7f881cd8] | 66 | ifeq ($(PRECHECK),y)
|
|---|
| 67 | JOBFILE = $(ROOT_PATH)/tools/jobfile.py
|
|---|
| 68 | # XXX: Do not change the order of arguments.
|
|---|
| 69 | CC_JOB = $(JOBFILE) $(JOB) $(CC) $< -o $@
|
|---|
| 70 | else
|
|---|
| 71 | CC_JOB = $(CC) $< -o $@
|
|---|
| 72 | endif
|
|---|
| 73 |
|
|---|
| [4761f54] | 74 | .PHONY: all clean autogen_clean depend
|
|---|
| [d2f75eb] | 75 | .DELETE_ON_ERROR:
|
|---|
| [e16e036a] | 76 |
|
|---|
| [4e9aaf5] | 77 | all: $(VERSION_DEF) $(COMMON_MAKEFILE) $(COMMON_HEADER) $(CONFIG_MAKEFILE) $(CONFIG_HEADER) $(BIN) $(DISASM)
|
|---|
| [c9ed176] | 78 |
|
|---|
| [b8fac76] | 79 | clean: autogen_clean
|
|---|
| [4761f54] | 80 | rm -f $(RAW) $(BIN) $(MAP) $(JOB) $(MAP_PREV) $(DISASM) $(DUMP) $(REAL_MAP).* arch/*/_link.ld arch/*/include/arch/common.h
|
|---|
| [b8fac76] | 81 | find generic/src/ arch/*/src/ genarch/src/ test/ -name '*.o' -follow -exec rm '{}' \;
|
|---|
| [4761f54] | 82 | find generic/src/ arch/*/src/ genarch/src/ test/ -name '*.d' -follow -exec rm '{}' \;
|
|---|
| [4e9aaf5] | 83 |
|
|---|
| 84 | ## Common compiler flags
|
|---|
| 85 | #
|
|---|
| 86 |
|
|---|
| [6c5fc8e] | 87 | INCLUDES = generic/include genarch/include arch/$(KARCH)/include ../abi/include
|
|---|
| [6ecf5b8] | 88 | INCLUDES_FLAGS = $(addprefix -I,$(INCLUDES))
|
|---|
| [1cb092d] | 89 |
|
|---|
| [d9faae91] | 90 | DEFS = -DKERNEL -DRELEASE=$(RELEASE) "-DCOPYRIGHT=$(COPYRIGHT)" "-DNAME=$(NAME)" -D__$(BITS)_BITS__ -D__$(ENDIANESS)__
|
|---|
| [4e9aaf5] | 91 |
|
|---|
| [a0a273e] | 92 | COMMON_CFLAGS = $(INCLUDES_FLAGS) -O$(OPTIMIZATION) -imacros $(CONFIG_HEADER) \
|
|---|
| [1ab3c4b] | 93 | -ffreestanding -nostdlib -nostdinc \
|
|---|
| [dd162f6] | 94 | -fexec-charset=UTF-8 -finput-charset=UTF-8 -fno-common \
|
|---|
| 95 | -fdebug-prefix-map=$(realpath $(ROOT_PATH))=.
|
|---|
| [a0a273e] | 96 |
|
|---|
| 97 | GCC_CFLAGS = -std=gnu99 -Wall -Wextra -Wno-unused-parameter \
|
|---|
| 98 | -Wmissing-prototypes -Werror-implicit-function-declaration \
|
|---|
| 99 | -Wwrite-strings -pipe
|
|---|
| 100 |
|
|---|
| 101 | CLANG_CFLAGS = -std=gnu99 -Wall -Wextra -Wno-unused-parameter \
|
|---|
| [a41cda7] | 102 | -Wno-missing-field-initializers -Wno-unused-command-line-argument \
|
|---|
| [a0a273e] | 103 | -Wmissing-prototypes -Werror-implicit-function-declaration \
|
|---|
| 104 | -Wwrite-strings -pipe -fno-stack-protector -fno-PIC
|
|---|
| [4e9aaf5] | 105 |
|
|---|
| [e805e2f] | 106 | ifeq ($(CONFIG_DEBUG),y)
|
|---|
| [a0a273e] | 107 | COMMON_CFLAGS += -Werror
|
|---|
| [e805e2f] | 108 | endif
|
|---|
| 109 |
|
|---|
| [2f7d77c6] | 110 | ifeq ($(CONFIG_UBSAN_KERNEL),y)
|
|---|
| 111 | COMMON_CFLAGS += -fsanitize=undefined
|
|---|
| 112 | endif
|
|---|
| 113 |
|
|---|
| [cf84f1bf] | 114 | ifeq ($(CONFIG_LTO),y)
|
|---|
| [a0a273e] | 115 | COMMON_CFLAGS += -flto
|
|---|
| [cf84f1bf] | 116 | endif
|
|---|
| 117 |
|
|---|
| [9ded977] | 118 | ifeq ($(CONFIG_LINE_DEBUG),y)
|
|---|
| [a0a273e] | 119 | COMMON_CFLAGS += -g
|
|---|
| [9ded977] | 120 | endif
|
|---|
| 121 |
|
|---|
| [009c485] | 122 | AFLAGS += --fatal-warnings
|
|---|
| 123 | LDFLAGS += -Wl,-n -T $(LINK) -Wl,-M,--fatal-warnings,--warn-common
|
|---|
| [510bc07] | 124 |
|
|---|
| [315130c] | 125 | ifeq ($(CONFIG_STRIP_BINARIES),y)
|
|---|
| [009c485] | 126 | LDFLAGS += -s
|
|---|
| [315130c] | 127 | endif
|
|---|
| 128 |
|
|---|
| [4e9aaf5] | 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 |
|
|---|
| [3ec2acc] | 147 | SYMTAB_SECTION = .section symtab.data, \"a\", $(ATSIGN)progbits;
|
|---|
| [4e9aaf5] | 148 |
|
|---|
| 149 | ## Compilation options
|
|---|
| 150 | #
|
|---|
| 151 |
|
|---|
| 152 | ifeq ($(COMPILER),clang)
|
|---|
| [a0a273e] | 153 | CFLAGS = $(COMMON_CFLAGS) $(CLANG_CFLAGS)
|
|---|
| [4761f54] | 154 | else
|
|---|
| 155 | CFLAGS = $(COMMON_CFLAGS) $(GCC_CFLAGS)
|
|---|
| [4e9aaf5] | 156 | endif
|
|---|
| 157 |
|
|---|
| [4761f54] | 158 | INSTRUMENTATION = -finstrument-functions
|
|---|
| [cf84f1bf] | 159 |
|
|---|
| [4e9aaf5] | 160 | ## Generic kernel sources
|
|---|
| 161 | #
|
|---|
| 162 |
|
|---|
| 163 | GENERIC_SOURCES = \
|
|---|
| 164 | generic/src/adt/avl.c \
|
|---|
| 165 | generic/src/adt/bitmap.c \
|
|---|
| 166 | generic/src/adt/btree.c \
|
|---|
| [14c9aa6] | 167 | generic/src/adt/cht.c \
|
|---|
| [4e9aaf5] | 168 | generic/src/adt/hash_table.c \
|
|---|
| 169 | generic/src/adt/list.c \
|
|---|
| 170 | generic/src/console/chardev.c \
|
|---|
| 171 | generic/src/console/console.c \
|
|---|
| [f0d7bd9] | 172 | generic/src/console/prompt.c \
|
|---|
| [4e9aaf5] | 173 | generic/src/cpu/cpu.c \
|
|---|
| [22b5924] | 174 | generic/src/cpu/cpu_mask.c \
|
|---|
| [4e9aaf5] | 175 | generic/src/ddi/ddi.c \
|
|---|
| 176 | generic/src/ddi/irq.c \
|
|---|
| 177 | generic/src/debug/symtab.c \
|
|---|
| 178 | generic/src/debug/stacktrace.c \
|
|---|
| [06737a0] | 179 | generic/src/debug/panic.c \
|
|---|
| [263bda2] | 180 | generic/src/debug/debug.c \
|
|---|
| [4e9aaf5] | 181 | generic/src/interrupt/interrupt.c \
|
|---|
| [91db0280] | 182 | generic/src/log/log.c \
|
|---|
| [4e9aaf5] | 183 | generic/src/main/main.c \
|
|---|
| 184 | generic/src/main/kinit.c \
|
|---|
| 185 | generic/src/main/uinit.c \
|
|---|
| 186 | generic/src/main/version.c \
|
|---|
| 187 | generic/src/main/shutdown.c \
|
|---|
| 188 | generic/src/proc/program.c \
|
|---|
| 189 | generic/src/proc/scheduler.c \
|
|---|
| 190 | generic/src/proc/thread.c \
|
|---|
| 191 | generic/src/proc/task.c \
|
|---|
| 192 | generic/src/proc/the.c \
|
|---|
| 193 | generic/src/syscall/syscall.c \
|
|---|
| 194 | generic/src/syscall/copy.c \
|
|---|
| [622f409] | 195 | generic/src/mm/km.c \
|
|---|
| [630a8ef] | 196 | generic/src/mm/reserve.c \
|
|---|
| [4e9aaf5] | 197 | generic/src/mm/frame.c \
|
|---|
| 198 | generic/src/mm/page.c \
|
|---|
| 199 | generic/src/mm/tlb.c \
|
|---|
| 200 | generic/src/mm/as.c \
|
|---|
| 201 | generic/src/mm/backend_anon.c \
|
|---|
| 202 | generic/src/mm/backend_elf.c \
|
|---|
| 203 | generic/src/mm/backend_phys.c \
|
|---|
| [75b139f] | 204 | generic/src/mm/backend_user.c \
|
|---|
| [4e9aaf5] | 205 | generic/src/mm/slab.c \
|
|---|
| [b2e121a] | 206 | generic/src/lib/halt.c \
|
|---|
| [44a7ee5] | 207 | generic/src/lib/mem.c \
|
|---|
| [3abfe9a8] | 208 | generic/src/lib/memfnc.c \
|
|---|
| [f2460a50] | 209 | generic/src/lib/gsort.c \
|
|---|
| [19f857a] | 210 | generic/src/lib/str.c \
|
|---|
| [62ca560] | 211 | generic/src/lib/str_error.c \
|
|---|
| [4e9aaf5] | 212 | generic/src/lib/elf.c \
|
|---|
| [9fe7d6c] | 213 | generic/src/lib/ra.c \
|
|---|
| [4e9aaf5] | 214 | generic/src/lib/rd.c \
|
|---|
| [2f7d77c6] | 215 | generic/src/lib/ubsan.c \
|
|---|
| [4e9aaf5] | 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 \
|
|---|
| [43b8c65] | 230 | generic/src/synch/smp_memory_barrier.c \
|
|---|
| [4e9aaf5] | 231 | generic/src/synch/waitq.c \
|
|---|
| 232 | generic/src/synch/futex.c \
|
|---|
| [8a64e81e] | 233 | generic/src/synch/workqueue.c \
|
|---|
| [79d74fe] | 234 | generic/src/synch/rcu.c \
|
|---|
| [4e9aaf5] | 235 | generic/src/smp/ipi.c \
|
|---|
| 236 | generic/src/smp/smp.c \
|
|---|
| [2ee1ccc] | 237 | generic/src/smp/smp_call.c \
|
|---|
| [4e9aaf5] | 238 | generic/src/ipc/ipc.c \
|
|---|
| 239 | generic/src/ipc/sysipc.c \
|
|---|
| [f0defd2] | 240 | generic/src/ipc/sysipc_ops.c \
|
|---|
| 241 | generic/src/ipc/ops/conctmeto.c \
|
|---|
| 242 | generic/src/ipc/ops/concttome.c \
|
|---|
| 243 | generic/src/ipc/ops/dataread.c \
|
|---|
| 244 | generic/src/ipc/ops/datawrite.c \
|
|---|
| 245 | generic/src/ipc/ops/debug.c \
|
|---|
| [072607b] | 246 | generic/src/ipc/ops/pagein.c \
|
|---|
| [f0defd2] | 247 | generic/src/ipc/ops/sharein.c \
|
|---|
| 248 | generic/src/ipc/ops/shareout.c \
|
|---|
| 249 | generic/src/ipc/ops/stchngath.c \
|
|---|
| [4e9aaf5] | 250 | generic/src/ipc/ipcrsc.c \
|
|---|
| 251 | generic/src/ipc/irq.c \
|
|---|
| 252 | generic/src/ipc/event.c \
|
|---|
| [3f74275] | 253 | generic/src/cap/cap.c \
|
|---|
| [719a208] | 254 | generic/src/security/perm.c \
|
|---|
| [18b5402c] | 255 | generic/src/sysinfo/sysinfo.c \
|
|---|
| [9dae191e] | 256 | generic/src/sysinfo/stats.c
|
|---|
| [4e9aaf5] | 257 |
|
|---|
| 258 | ## Kernel console support
|
|---|
| 259 | #
|
|---|
| 260 |
|
|---|
| 261 | ifeq ($(CONFIG_KCONSOLE),y)
|
|---|
| 262 | GENERIC_SOURCES += \
|
|---|
| 263 | generic/src/console/kconsole.c \
|
|---|
| 264 | generic/src/console/cmd.c
|
|---|
| 265 | endif
|
|---|
| 266 |
|
|---|
| 267 | ## Udebug interface sources
|
|---|
| 268 | #
|
|---|
| 269 |
|
|---|
| 270 | ifeq ($(CONFIG_UDEBUG),y)
|
|---|
| 271 | GENERIC_SOURCES += \
|
|---|
| 272 | generic/src/ipc/kbox.c \
|
|---|
| 273 | generic/src/udebug/udebug.c \
|
|---|
| 274 | generic/src/udebug/udebug_ops.c \
|
|---|
| 275 | generic/src/udebug/udebug_ipc.c
|
|---|
| 276 | endif
|
|---|
| 277 |
|
|---|
| 278 | ## Test sources
|
|---|
| 279 | #
|
|---|
| 280 |
|
|---|
| 281 | ifeq ($(CONFIG_TEST),y)
|
|---|
| 282 | CFLAGS += -Itest/
|
|---|
| 283 | GENERIC_SOURCES += \
|
|---|
| 284 | test/test.c \
|
|---|
| 285 | test/atomic/atomic1.c \
|
|---|
| 286 | test/btree/btree1.c \
|
|---|
| [0949b7a] | 287 | test/cht/cht1.c \
|
|---|
| [4e9aaf5] | 288 | test/avltree/avltree1.c \
|
|---|
| 289 | test/fault/fault1.c \
|
|---|
| 290 | test/mm/falloc1.c \
|
|---|
| 291 | test/mm/falloc2.c \
|
|---|
| 292 | test/mm/mapping1.c \
|
|---|
| 293 | test/mm/slab1.c \
|
|---|
| 294 | test/mm/slab2.c \
|
|---|
| 295 | test/synch/semaphore1.c \
|
|---|
| 296 | test/synch/semaphore2.c \
|
|---|
| [8a64e81e] | 297 | test/synch/workqueue2.c \
|
|---|
| 298 | test/synch/workqueue3.c \
|
|---|
| [9f8745c5] | 299 | test/synch/rcu1.c \
|
|---|
| [4e9aaf5] | 300 | test/print/print1.c \
|
|---|
| 301 | test/print/print2.c \
|
|---|
| 302 | test/print/print3.c \
|
|---|
| 303 | test/print/print4.c \
|
|---|
| [855e0d8] | 304 | test/print/print5.c \
|
|---|
| [d71331b] | 305 | test/thread/thread1.c \
|
|---|
| 306 | test/smpcall/smpcall1.c
|
|---|
| [f1380b7] | 307 |
|
|---|
| [4e9aaf5] | 308 | ifeq ($(KARCH),mips32)
|
|---|
| 309 | GENERIC_SOURCES += test/debug/mips1.c
|
|---|
| 310 | else
|
|---|
| 311 | GENERIC_SOURCES += test/debug/mips1_skip.c
|
|---|
| 312 | endif
|
|---|
| [f1380b7] | 313 |
|
|---|
| [4e9aaf5] | 314 | ifeq ($(KARCH),ia64)
|
|---|
| 315 | GENERIC_SOURCES += test/mm/purge1.c
|
|---|
| 316 | else
|
|---|
| 317 | GENERIC_SOURCES += test/mm/purge1_skip.c
|
|---|
| 318 | endif
|
|---|
| [f1380b7] | 319 |
|
|---|
| [4e9aaf5] | 320 | endif
|
|---|
| 321 |
|
|---|
| [263bda2] | 322 | ## Sources where instrumentation is enabled
|
|---|
| 323 | #
|
|---|
| 324 |
|
|---|
| [da52547] | 325 | ifeq ($(CONFIG_TRACE),y)
|
|---|
| [7a0359b] | 326 | INSTRUMENTED_SOURCES = \
|
|---|
| 327 | generic/src/adt/btree.c \
|
|---|
| 328 | generic/src/cpu/cpu.c \
|
|---|
| 329 | generic/src/ddi/ddi.c \
|
|---|
| 330 | generic/src/interrupt/interrupt.c \
|
|---|
| 331 | generic/src/main/main.c \
|
|---|
| 332 | generic/src/main/kinit.c \
|
|---|
| 333 | generic/src/proc/the.c \
|
|---|
| 334 | generic/src/mm/frame.c \
|
|---|
| 335 | generic/src/mm/page.c \
|
|---|
| 336 | generic/src/mm/tlb.c \
|
|---|
| 337 | generic/src/mm/as.c \
|
|---|
| 338 | generic/src/mm/slab.c \
|
|---|
| 339 | generic/src/sysinfo/sysinfo.c \
|
|---|
| 340 | generic/src/console/kconsole.c
|
|---|
| 341 | else
|
|---|
| 342 | INSTRUMENTED_SOURCES =
|
|---|
| [263bda2] | 343 | endif
|
|---|
| 344 |
|
|---|
| [d2f75eb] | 345 | ARCH_SOURCES += $(ARCH_AUTOCHECK_HEADERS:%.h=%.check.c)
|
|---|
| 346 | GENARCH_SOURCES += $(GENARCH_AUTOCHECK_HEADERS:%.h=%.check.c)
|
|---|
| 347 |
|
|---|
| [4e9aaf5] | 348 | GENERIC_OBJECTS := $(addsuffix .o,$(basename $(GENERIC_SOURCES)))
|
|---|
| 349 | ARCH_OBJECTS := $(addsuffix .o,$(basename $(ARCH_SOURCES)))
|
|---|
| 350 | GENARCH_OBJECTS := $(addsuffix .o,$(basename $(GENARCH_SOURCES)))
|
|---|
| 351 |
|
|---|
| [4761f54] | 352 | GENERIC_DEPENDS := $(addsuffix .d,$(basename $(GENERIC_SOURCES)))
|
|---|
| 353 | ARCH_DEPENDS := $(addsuffix .d,$(basename $(ARCH_SOURCES)))
|
|---|
| 354 | GENARCH_DEPENDS := $(addsuffix .d,$(basename $(GENARCH_SOURCES)))
|
|---|
| 355 |
|
|---|
| [a0a273e] | 356 | AS_CFLAGS := $(addprefix -Xassembler ,$(AFLAGS))
|
|---|
| 357 |
|
|---|
| [4761f54] | 358 | -include $(GENERIC_DEPENDS)
|
|---|
| 359 | -include $(ARCH_DEPENDS)
|
|---|
| 360 | -include $(GENARCH_DEPENDS)
|
|---|
| 361 |
|
|---|
| [a0a273e] | 362 | ifeq ($(COMPILER),clang)
|
|---|
| 363 | AS_CFLAGS += -mllvm -asm-macro-max-nesting-depth=1000
|
|---|
| 364 | endif
|
|---|
| [cf84f1bf] | 365 |
|
|---|
| [4e9aaf5] | 366 | ifeq ($(CONFIG_SYMTAB),y)
|
|---|
| 367 | SYMTAB_OBJECTS := generic/src/debug/real_map.o
|
|---|
| 368 | else
|
|---|
| 369 | SYMTAB_OBJECTS :=
|
|---|
| 370 | endif
|
|---|
| 371 |
|
|---|
| 372 | $(BIN): $(RAW)
|
|---|
| 373 | $(OBJCOPY) -O $(BFD) $< $@
|
|---|
| 374 |
|
|---|
| 375 | $(DISASM): $(RAW)
|
|---|
| [9ded977] | 376 | ifeq ($(CONFIG_LINE_DEBUG),y)
|
|---|
| 377 | $(OBJDUMP) -d -S $< > $@
|
|---|
| 378 | else
|
|---|
| [4e9aaf5] | 379 | $(OBJDUMP) -d $< > $@
|
|---|
| [9ded977] | 380 | endif
|
|---|
| [4e9aaf5] | 381 |
|
|---|
| 382 | $(RAW): $(LINK) $(ARCH_OBJECTS) $(GENARCH_OBJECTS) $(GENERIC_OBJECTS) $(SYMTAB_OBJECTS)
|
|---|
| [009c485] | 383 | $(CC) $(DEFS) $(CFLAGS) $(LDFLAGS) -Wl,-Map,$(MAP) -o $@ $(ARCH_OBJECTS) $(GENARCH_OBJECTS) $(GENERIC_OBJECTS) $(EXTRA_OBJECTS) $(SYMTAB_OBJECTS)
|
|---|
| [4e9aaf5] | 384 |
|
|---|
| [d2f75eb] | 385 | $(LINK): $(LINK).in
|
|---|
| [53ad43c] | 386 | $(CC) $(DEFS) $(CFLAGS) -D__ASSEMBLER__ -D__LINKER__ -E -x c $< | grep -v "^\#" > $@
|
|---|
| [4e9aaf5] | 387 |
|
|---|
| [d2f75eb] | 388 | %.check.c: %.h $(AUTOCHECK)
|
|---|
| 389 | cd $(<D) && $(AUTOCHECK) $(<F) > $(@F)
|
|---|
| [b8fac76] | 390 |
|
|---|
| [d2f75eb] | 391 | %.o: %.S
|
|---|
| [53ad43c] | 392 | $(CC_JOB) -c -MD -MP $(DEFS) $(CFLAGS) $(AS_CFLAGS)
|
|---|
| [4e9aaf5] | 393 |
|
|---|
| [d2f75eb] | 394 | %.o: %.s
|
|---|
| [53ad43c] | 395 | $(CC_JOB) -c -MD -MP $(DEFS) $(CFLAGS) $(AS_CFLAGS)
|
|---|
| [4e9aaf5] | 396 |
|
|---|
| [d2f75eb] | 397 | %.o: %.c
|
|---|
| [c631734] | 398 | $(CC_JOB) -c -MD -MP $(DEFS) $(CFLAGS) $(EXTRA_FLAGS) $(FPU_NO_CFLAGS) $(if $(findstring $<,$(INSTRUMENTED_SOURCES)),$(INSTRUMENTATION))
|
|---|
| [4e9aaf5] | 399 |
|
|---|
| 400 | $(REAL_MAP).o: $(REAL_MAP).bin
|
|---|
| [a0a273e] | 401 | echo "$(AS_PROLOG)""$(SYMTAB_SECTION)"" .incbin \"$<\"" | $(CC) $(CFLAGS) $(AS_CFLAGS) -x assembler -c -o $@ -
|
|---|
| [4e9aaf5] | 402 |
|
|---|
| 403 | $(REAL_MAP).bin: $(LINK) $(ARCH_OBJECTS) $(GENARCH_OBJECTS) $(GENERIC_OBJECTS)
|
|---|
| [a0a273e] | 404 | echo "$(AS_PROLOG)""$(SYMTAB_SECTION)" | $(CC) $(CFLAGS) $(AS_CFLAGS) -x assembler -c -o $(EMPTY_MAP) -
|
|---|
| [009c485] | 405 | $(CC) $(DEFS) $(CFLAGS) $(LDFLAGS) -Wl,-Map,$(MAP_PREV) -o $@ $(ARCH_OBJECTS) $(GENARCH_OBJECTS) $(GENERIC_OBJECTS) $(EXTRA_OBJECTS) $(EMPTY_MAP)
|
|---|
| [4e9aaf5] | 406 | $(OBJDUMP) -t $(ARCH_OBJECTS) $(GENARCH_OBJECTS) $(GENERIC_OBJECTS) > $(DUMP)
|
|---|
| 407 | $(GENMAP) $(MAP_PREV) $(DUMP) $@
|
|---|
| [f1380b7] | 408 |
|
|---|
| [4e9aaf5] | 409 | # Do it once again, this time to get correct even the symbols
|
|---|
| 410 | # on architectures that have bss after symtab
|
|---|
| [f1380b7] | 411 |
|
|---|
| [a0a273e] | 412 | echo "$(AS_PROLOG)""$(SYMTAB_SECTION)"" .incbin \"$@\"" | $(CC) $(CFLAGS) $(AS_CFLAGS) -x assembler -c -o $(SIZEOK_MAP) -
|
|---|
| [009c485] | 413 | $(CC) $(DEFS) $(CFLAGS) $(LDFLAGS) -Wl,-Map,$(MAP_PREV) -o $@ $(ARCH_OBJECTS) $(GENARCH_OBJECTS) $(GENERIC_OBJECTS) $(EXTRA_OBJECTS) $(SIZEOK_MAP)
|
|---|
| [4e9aaf5] | 414 | $(OBJDUMP) -t $(ARCH_OBJECTS) $(GENARCH_OBJECTS) $(GENERIC_OBJECTS) > $(DUMP)
|
|---|
| 415 | $(GENMAP) $(MAP_PREV) $(DUMP) $@
|
|---|