Changes in kernel/Makefile [8786aa5:1cb092d] in mainline
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
kernel/Makefile
r8786aa5 r1cb092d 27 27 # 28 28 29 include Makefile.common 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 30 70 31 71 .PHONY: all clean 32 72 33 all: ../version ../Makefile.config ../config.h ../config.defs 34 -[ -f $(DEPEND) ] && mv -f $(DEPEND) $(DEPEND_PREV) 35 $(MAKE) -f Makefile.build PRECHECK=$(PRECHECK) 73 all: $(VERSION_DEF) $(COMMON_MAKEFILE) $(COMMON_HEADER) $(CONFIG_MAKEFILE) $(CONFIG_HEADER) $(BIN) $(DISASM) 74 -[ -f $(DEPEND) ] && cp -a $(DEPEND) $(DEPEND_PREV) 36 75 37 76 clean: 38 rm -f $(DEPEND) $(DEPEND_PREV) $(RAW) $(BIN) $(MAP) $(JOB) $(MAP_PREV) $(DISASM) $(DUMP) $(REAL_MAP).* $(ARCH_INCLUDE) $(GENARCH_INCLUDE) arch/*/_link.ld 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 39 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 -Werror -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 -Werror -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 -include arch/$(KARCH)/Makefile.inc 116 -include genarch/Makefile.inc 117 -include $(DEPEND) 118 119 ## The at-sign 120 # 121 # The $(ATSIGN) variable holds the ASCII character representing the at-sign 122 # ('@') used in various $(AS) constructs (e.g. @progbits). On architectures that 123 # don't use '@' for starting a comment, $(ATSIGN) is merely '@'. However, on 124 # those that do use it for starting a comment (e.g. arm32), $(ATSIGN) must be 125 # defined as the percentile-sign ('%') in the architecture-dependent 126 # Makefile.inc. 127 # 128 129 ATSIGN ?= @ 130 131 ## Cross-platform assembly to start a symtab.data section 132 # 133 134 SYMTAB_SECTION = ".section symtab.data, \"a\", $(ATSIGN)progbits;" 135 136 ## Compilation options 137 # 138 139 ifeq ($(COMPILER),gcc_native) 140 CFLAGS = $(GCC_CFLAGS) 141 DEPEND_DEFS = $(DEFS) $(CONFIG_DEFS) 142 endif 143 144 ifeq ($(COMPILER),gcc_cross) 145 CFLAGS = $(GCC_CFLAGS) 146 DEPEND_DEFS = $(DEFS) $(CONFIG_DEFS) 147 endif 148 149 ifeq ($(COMPILER),icc) 150 CFLAGS = $(ICC_CFLAGS) 151 DEPEND_DEFS = $(DEFS) $(CONFIG_DEFS) 152 endif 153 154 ifeq ($(COMPILER),suncc) 155 CFLAGS = $(SUNCC_CFLAGS) 156 DEFS += $(CONFIG_DEFS) 157 DEPEND_DEFS = $(DEFS) 158 endif 159 160 ifeq ($(COMPILER),clang) 161 CFLAGS = $(CLANG_CFLAGS) 162 DEPEND_DEFS = $(DEFS) $(CONFIG_DEFS) 163 endif 164 165 ## Generic kernel sources 166 # 167 168 GENERIC_SOURCES = \ 169 generic/src/adt/avl.c \ 170 generic/src/adt/bitmap.c \ 171 generic/src/adt/btree.c \ 172 generic/src/adt/hash_table.c \ 173 generic/src/adt/list.c \ 174 generic/src/console/chardev.c \ 175 generic/src/console/console.c \ 176 generic/src/cpu/cpu.c \ 177 generic/src/ddi/ddi.c \ 178 generic/src/ddi/irq.c \ 179 generic/src/ddi/device.c \ 180 generic/src/debug/symtab.c \ 181 generic/src/debug/stacktrace.c \ 182 generic/src/interrupt/interrupt.c \ 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/proc/tasklet.c \ 194 generic/src/syscall/syscall.c \ 195 generic/src/syscall/copy.c \ 196 generic/src/mm/buddy.c \ 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 \ 204 generic/src/mm/slab.c \ 205 generic/src/lib/func.c \ 206 generic/src/lib/memstr.c \ 207 generic/src/lib/sort.c \ 208 generic/src/lib/str.c \ 209 generic/src/lib/elf.c \ 210 generic/src/lib/rd.c \ 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 \ 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 \ 225 generic/src/synch/smc.c \ 226 generic/src/synch/waitq.c \ 227 generic/src/synch/futex.c \ 228 generic/src/smp/ipi.c \ 229 generic/src/smp/smp.c \ 230 generic/src/ipc/ipc.c \ 231 generic/src/ipc/sysipc.c \ 232 generic/src/ipc/ipcrsc.c \ 233 generic/src/ipc/irq.c \ 234 generic/src/ipc/event.c \ 235 generic/src/security/cap.c \ 236 generic/src/sysinfo/sysinfo.c \ 237 generic/src/sysinfo/stats.c 238 239 ## Kernel console support 240 # 241 242 ifeq ($(CONFIG_KCONSOLE),y) 243 GENERIC_SOURCES += \ 244 generic/src/console/kconsole.c \ 245 generic/src/console/cmd.c 246 endif 247 248 ## Udebug interface sources 249 # 250 251 ifeq ($(CONFIG_UDEBUG),y) 252 GENERIC_SOURCES += \ 253 generic/src/ipc/kbox.c \ 254 generic/src/udebug/udebug.c \ 255 generic/src/udebug/udebug_ops.c \ 256 generic/src/udebug/udebug_ipc.c 257 endif 258 259 ## Test sources 260 # 261 262 ifeq ($(CONFIG_TEST),y) 263 CFLAGS += -Itest/ 264 GENERIC_SOURCES += \ 265 test/test.c \ 266 test/atomic/atomic1.c \ 267 test/btree/btree1.c \ 268 test/avltree/avltree1.c \ 269 test/fault/fault1.c \ 270 test/mm/falloc1.c \ 271 test/mm/falloc2.c \ 272 test/mm/mapping1.c \ 273 test/mm/slab1.c \ 274 test/mm/slab2.c \ 275 test/synch/rwlock1.c \ 276 test/synch/rwlock2.c \ 277 test/synch/rwlock3.c \ 278 test/synch/rwlock4.c \ 279 test/synch/rwlock5.c \ 280 test/synch/semaphore1.c \ 281 test/synch/semaphore2.c \ 282 test/print/print1.c \ 283 test/print/print2.c \ 284 test/print/print3.c \ 285 test/print/print4.c \ 286 test/thread/thread1.c 287 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 300 ifeq ($(CONFIG_FPU),y) 301 ifeq ($(KARCH),ia32) 302 TEST_FPU1 = y 303 TEST_SSE1 = y 304 GENERIC_SOURCES += test/fpu/fpu1_x86.c 305 endif 306 307 ifeq ($(KARCH),amd64) 308 TEST_FPU1 = y 309 TEST_SSE1 = y 310 GENERIC_SOURCES += test/fpu/fpu1_x86.c 311 endif 312 313 ifeq ($(KARCH),ia64) 314 TEST_FPU1 = y 315 GENERIC_SOURCES += test/fpu/fpu1_ia64.c 316 endif 317 318 ifeq ($(KARCH),mips32) 319 TEST_MIPS2 = y 320 endif 321 endif 322 323 ifneq ($(TEST_FPU1),y) 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 339 endif 340 341 GENERIC_OBJECTS := $(addsuffix .o,$(basename $(GENERIC_SOURCES))) 342 ARCH_OBJECTS := $(addsuffix .o,$(basename $(ARCH_SOURCES))) 343 GENARCH_OBJECTS := $(addsuffix .o,$(basename $(GENARCH_SOURCES))) 344 345 ifeq ($(CONFIG_SYMTAB),y) 346 SYMTAB_OBJECTS := generic/src/debug/real_map.o 347 else 348 SYMTAB_OBJECTS := 349 endif 350 351 $(BIN): $(RAW) 352 $(OBJCOPY) -O $(BFD) $< $@ 353 354 $(DISASM): $(RAW) 355 $(OBJDUMP) -d $< > $@ 356 357 $(RAW): $(LINK) $(ARCH_OBJECTS) $(GENARCH_OBJECTS) $(GENERIC_OBJECTS) $(SYMTAB_OBJECTS) 358 $(LD) -N $(LFLAGS) -T $(LINK) -M -Map $(MAP) -o $@ $(ARCH_OBJECTS) $(GENARCH_OBJECTS) $(GENERIC_OBJECTS) $(EXTRA_OBJECTS) $(SYMTAB_OBJECTS) 359 ifeq ($(CONFIG_STRIP_BINARIES),y) 360 $(STRIP) $(RAW) 361 endif 362 363 $(LINK): $(LINK).in $(DEPEND) 364 $(GCC) $(DEFS) $(GCC_CFLAGS) -D__ASM__ -D__LINKER__ -E -x c $< | grep -v "^\#" > $@ 365 366 %.o: %.S $(DEPEND) 367 $(GCC) $(DEFS) $(GCC_CFLAGS) -D__ASM__ -c $< -o $@ 368 ifeq ($(PRECHECK),y) 369 $(JOBFILE) $(JOB) $< $@ as asm/preproc $(DEFS) $(GCC_CFLAGS) -D__ASM__ 370 endif 371 372 %.o: %.s $(DEPEND) 373 $(AS) $(AFLAGS) -o $@ $< 374 ifeq ($(PRECHECK),y) 375 $(JOBFILE) $(JOB) $< $@ as asm $(DEFS) $(CFLAGS) $(EXTRA_FLAGS) 376 endif 377 378 # 379 # The FPU tests are the only objects for which we allow the compiler to generate 380 # FPU instructions. 381 # 382 383 test/fpu/%.o: test/fpu/%.c $(DEPEND) 384 $(CC) $(DEFS) $(CFLAGS) $(EXTRA_FLAGS) -c $< -o $@ 385 ifeq ($(PRECHECK),y) 386 $(JOBFILE) $(JOB) $< $@ cc test $(DEFS) $(CFLAGS) $(EXTRA_FLAGS) 387 endif 388 389 # 390 # Ordinary objects. 391 # 392 393 %.o: %.c $(DEPEND) 394 $(CC) $(DEFS) $(CFLAGS) $(EXTRA_FLAGS) $(FPU_NO_CFLAGS) -c $< -o $@ 395 ifeq ($(PRECHECK),y) 396 $(JOBFILE) $(JOB) $< $@ cc core $(DEFS) $(CFLAGS) $(EXTRA_FLAGS) $(FPU_NO_CFLAGS) 397 endif 398 399 $(REAL_MAP).o: $(REAL_MAP).bin 400 echo $(SYMTAB_SECTION)" .incbin \"$<\"" | $(AS) $(AFLAGS) -o $@ 401 402 $(REAL_MAP).bin: $(LINK) $(ARCH_OBJECTS) $(GENARCH_OBJECTS) $(GENERIC_OBJECTS) 403 echo $(SYMTAB_SECTION) | $(AS) $(AFLAGS) -o $(EMPTY_MAP) 404 $(LD) -N $(LFLAGS) -T $(LINK) -M -Map $(MAP_PREV) -o $@ $(ARCH_OBJECTS) $(GENARCH_OBJECTS) $(GENERIC_OBJECTS) $(EXTRA_OBJECTS) $(EMPTY_MAP) 405 $(OBJDUMP) -t $(ARCH_OBJECTS) $(GENARCH_OBJECTS) $(GENERIC_OBJECTS) > $(DUMP) 406 $(GENMAP) $(MAP_PREV) $(DUMP) $@ 407 408 # Do it once again, this time to get correct even the symbols 409 # on architectures that have bss after symtab 410 411 echo $(SYMTAB_SECTION)" .incbin \"$@\"" | $(AS) $(AFLAGS) -o $(SIZEOK_MAP) 412 $(LD) -N $(LFLAGS) -T $(LINK) -M -Map $(MAP_PREV) -o $@ $(ARCH_OBJECTS) $(GENARCH_OBJECTS) $(GENERIC_OBJECTS) $(EXTRA_OBJECTS) $(SIZEOK_MAP) 413 $(OBJDUMP) -t $(ARCH_OBJECTS) $(GENARCH_OBJECTS) $(GENERIC_OBJECTS) > $(DUMP) 414 $(GENMAP) $(MAP_PREV) $(DUMP) $@ 415 416 $(DEPEND): $(ARCH_INCLUDE) $(GENARCH_INCLUDE) $(COMMON_HEADER_ARCH) 417 makedepend -f - -- $(DEPEND_DEFS) $(CFLAGS) -- $(ARCH_SOURCES) $(GENARCH_SOURCES) $(GENERIC_SOURCES) > $@ 2> /dev/null 418 -[ -f $(DEPEND_PREV) ] && diff -q $(DEPEND_PREV) $@ && mv -f $(DEPEND_PREV) $@ 419 420 $(ARCH_INCLUDE): arch/$(KARCH)/include/ 421 ln -sfn ../../$< $@ 422 423 $(GENARCH_INCLUDE): genarch/include/ 424 ln -sfn ../../$< $@ 425 426 $(COMMON_HEADER_ARCH): $(COMMON_HEADER) 427 ln -sfn ../../../$< $@
Note:
See TracChangeset
for help on using the changeset viewer.