source: mainline/boot/Makefile.build@ 339249f

lfn serial ticket/834-toolchain-update topic/msim-upgrade topic/simplify-dev-export
Last change on this file since 339249f was 4872160, checked in by Martin Decky <martin@…>, 15 years ago

new boot infrastructure

  • more code and metadata unification
  • import of up-to-date implementations from the kernel
  • the boot loaders should behave more similarly on all platforms
  • support for deflate compressed (LZ77) boot components
    • this again allows feasible boot images to be created on mips32
  • IA64 is still not booting
    • the broken forked GNU EFI library has been removed, a replacement of the functionality is on its way
  • Property mode set to 100644
File size: 4.4 KB
Line 
1#
2# Copyright (c) 2006 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.PHONY: all clean
30
31include Makefile.common
32
33INCLUDES = generic/include
34OPTIMIZATION = 3
35
36DEFS = -DRELEASE=$(RELEASE) "-DNAME=$(NAME)" -D__$(BITS)_BITS__ -D__$(ENDIANESS)__
37
38GCC_CFLAGS = -I$(INCLUDES) -O$(OPTIMIZATION) -imacros $(CONFIG_HEADER) \
39 -fexec-charset=UTF-8 -fwide-exec-charset=UTF-32$(ENDIANESS) \
40 -finput-charset=UTF-8 -ffreestanding -fno-builtin -nostdlib -nostdinc \
41 -Wall -Wextra -Wno-unused-parameter -Wmissing-prototypes \
42 -Werror-implicit-function-declaration -Wwrite-strings \
43 -Werror -pipe
44
45ICC_CFLAGS = -I$(INCLUDES) -O$(OPTIMIZATION) -imacros $(CONFIG_HEADER) \
46 -ffreestanding -fno-builtin -nostdlib -nostdinc -Wall -Wmissing-prototypes \
47 -Werror-implicit-function-declaration -Werror -wd170
48
49SUNCC_CFLAGS = -I$(INCLUDES) -xO$(OPTIMIZATION) \
50 -xnolib -xc99=all -features=extensions \
51 -erroff=E_ZERO_SIZED_STRUCT_UNION
52
53CLANG_CFLAGS = -I$(INCLUDES) -O$(OPTIMIZATION) -imacros $(CONFIG_HEADER) \
54 -fexec-charset=UTF-8 -fwide-exec-charset=UTF-32$(ENDIANESS) \
55 -finput-charset=UTF-8 -ffreestanding -fno-builtin -nostdlib -nostdinc \
56 -Wall -Wextra -Wno-unused-parameter -Wmissing-prototypes \
57 -Werror-implicit-function-declaration -Wwrite-strings \
58 -pipe -arch $(CLANG_ARCH)
59
60ifeq ($(COMPILER),gcc_native)
61 CFLAGS = $(GCC_CFLAGS) $(EXTRA_CFLAGS)
62 DEPEND_DEFS = $(DEFS) $(CONFIG_DEFS)
63endif
64
65ifeq ($(COMPILER),gcc_cross)
66 CFLAGS = $(GCC_CFLAGS) $(EXTRA_CFLAGS)
67 DEPEND_DEFS = $(DEFS) $(CONFIG_DEFS)
68endif
69
70ifeq ($(COMPILER),icc)
71 CFLAGS = $(ICC_CFLAGS) $(EXTRA_CFLAGS)
72 DEPEND_DEFS = $(DEFS) $(CONFIG_DEFS)
73endif
74
75ifeq ($(COMPILER),suncc)
76 CFLAGS = $(SUNCC_CFLAGS) $(EXTRA_CFLAGS)
77 DEFS += $(CONFIG_DEFS)
78 DEPEND_DEFS = $(DEFS)
79endif
80
81ifeq ($(COMPILER),clang)
82 CFLAGS = $(CLANG_CFLAGS) $(EXTRA_CFLAGS)
83 DEPEND_DEFS = $(DEFS) $(CONFIG_DEFS)
84endif
85
86OBJECTS := $(addsuffix .o,$(basename $(SOURCES)))
87COMPONENT_OBJECTS := $(addsuffix .co,$(basename $(MODULES)))
88
89all: $(VERSION_DEF) $(COMMON_MAKEFILE) $(COMMON_HEADER) $(CONFIG_MAKEFILE) $(CONFIG_HEADER) $(BOOT_OUTPUT)
90 -[ -f $(DEPEND) ] && cp -a $(DEPEND) $(DEPEND_PREV)
91
92clean:
93 rm -f $(RAW) $(MAP) $(ARCH_INCLUDE) $(GENARCH_INCLUDE)
94
95-include $(DEPEND)
96
97$(BOOT_OUTPUT): $(RAW)
98 $(OBJCOPY) -O $(BFD_OUTPUT) $< $@
99
100$(RAW): $(OBJECTS) $(COMPONENT_OBJECTS) $(LINK)
101 $(LD) -N $(LFLAGS) -T $(LINK) -M -Map $(MAP) -o $@ $(COMPONENT_OBJECTS) $(OBJECTS)
102
103%.o: %.S $(DEPEND)
104 $(CC) $(DEFS) $(CFLAGS) -D__ASM__ -c $< -o $@
105ifeq ($(PRECHECK),y)
106 $(JOBFILE) $(JOB) $< $@ as asm/preproc $(DEFS) $(CFLAGS) -D__ASM__
107endif
108
109%.o: %.c $(DEPEND)
110 $(CC) $(DEFS) $(CFLAGS) -c $< -o $@
111ifeq ($(PRECHECK),y)
112 $(JOBFILE) $(JOB) $< $@ cc core $(DEFS) $(CFLAGS)
113endif
114
115$(DEPEND): $(ARCH_INCLUDE) $(GENARCH_INCLUDE) $(COMMON_HEADER_ARCH)
116 makedepend -f - -- $(DEPEND_DEFS) $(CFLAGS) -- $(SOURCES) > $@ 2> /dev/null
117 -[ -f $(DEPEND_PREV) ] && diff -q $(DEPEND_PREV) $@ && mv -f $(DEPEND_PREV) $@
118
119$(ARCH_INCLUDE): arch/$(KARCH)/include/
120 ln -sfn ../../$< $@
121
122$(GENARCH_INCLUDE): genarch/include/
123 ln -sfn ../../$< $@
124
125$(COMMON_HEADER_ARCH): $(COMMON_HEADER)
126 ln -sfn ../../../$< $@
Note: See TracBrowser for help on using the repository browser.