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