source: mainline/boot/Makefile.build@ e27e36e

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

use the .incbin directive instead of marshalling the data manually
(this is the fastest and also the most resource-conservative method)

  • Property mode set to 100644
File size: 5.0 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 = -Igeneric/include -I$(ROOT_PATH)/abi/include
34OPTIMIZATION = 3
35
36DEFS = -DBOOT -DRELEASE=$(RELEASE) "-DCOPYRIGHT=$(COPYRIGHT)" "-DNAME=$(NAME)" -D__$(BITS)_BITS__ -D__$(ENDIANESS)__
37
38LFLAGS = --fatal-warnings
39
40GCC_CFLAGS = $(INCLUDES) -O$(OPTIMIZATION) -imacros $(CONFIG_HEADER) \
41 -fexec-charset=UTF-8 -fwide-exec-charset=UTF-32$(ENDIANESS) \
42 -finput-charset=UTF-8 -ffreestanding -fno-builtin -nostdlib -nostdinc \
43 -Wall -Wextra -Wno-unused-parameter -Wmissing-prototypes \
44 -std=gnu99 -Werror-implicit-function-declaration -Wwrite-strings \
45 -pipe
46
47ICC_CFLAGS = $(INCLUDES) -O$(OPTIMIZATION) -imacros $(CONFIG_HEADER) \
48 -ffreestanding -fno-builtin -nostdlib -nostdinc -Wall -Wmissing-prototypes \
49 -Werror-implicit-function-declaration -wd170
50
51CLANG_CFLAGS = $(INCLUDES) -O$(OPTIMIZATION) -imacros $(CONFIG_HEADER) \
52 -fexec-charset=UTF-8 -fwide-exec-charset=UTF-32$(ENDIANESS) \
53 -finput-charset=UTF-8 -ffreestanding -fno-builtin -nostdlib -nostdinc \
54 -Wall -Wextra -Wno-unused-parameter -Wmissing-prototypes \
55 -Werror-implicit-function-declaration -Wwrite-strings \
56 -pipe
57
58ifeq ($(CONFIG_DEBUG),y)
59 GCC_CFLAGS += -Werror
60 ICC_CFLAGS += -Werror
61endif
62
63ifeq ($(CONFIG_LINE_DEBUG),y)
64 GCC_CFLAGS += -g
65 ICC_CFLAGS += -g
66 CLANG_CFLAGS += -g
67endif
68
69ifeq ($(COMPILER),gcc_native)
70 CFLAGS = $(GCC_CFLAGS) $(EXTRA_CFLAGS)
71 DEPEND_DEFS = $(DEFS) $(CONFIG_DEFS)
72endif
73
74ifeq ($(COMPILER),gcc_cross)
75 CFLAGS = $(GCC_CFLAGS) $(EXTRA_CFLAGS)
76 DEPEND_DEFS = $(DEFS) $(CONFIG_DEFS)
77endif
78
79ifeq ($(COMPILER),gcc_helenos)
80 CFLAGS = $(GCC_CFLAGS) $(EXTRA_CFLAGS)
81 DEPEND_DEFS = $(DEFS) $(CONFIG_DEFS)
82endif
83
84
85ifeq ($(COMPILER),icc)
86 CFLAGS = $(ICC_CFLAGS) $(EXTRA_CFLAGS)
87 DEPEND_DEFS = $(DEFS) $(CONFIG_DEFS)
88endif
89
90ifeq ($(COMPILER),clang)
91 CFLAGS = $(CLANG_CFLAGS) $(EXTRA_CFLAGS)
92 DEPEND_DEFS = $(DEFS) $(CONFIG_DEFS)
93endif
94
95OBJECTS := $(addsuffix .o,$(basename $(SOURCES)))
96
97all: $(VERSION_DEF) $(COMMON_MAKEFILE) $(COMMON_HEADER) $(CONFIG_MAKEFILE) $(CONFIG_HEADER) $(BOOT_OUTPUT)
98 -[ -f $(DEPEND) ] && cp -a $(DEPEND) $(DEPEND_PREV)
99
100clean:
101 rm -f $(RAW) $(MAP) $(ARCH_INCLUDE) $(GENARCH_INCLUDE)
102
103ifneq ($(MAKECMDGOALS),clean)
104-include $(DEPEND)
105endif
106
107$(BOOT_OUTPUT): $(RAW)
108 $(OBJCOPY) -O $(BFD_OUTPUT) $< $@
109
110$(RAW): $(OBJECTS) $(LINK)
111 $(LD) -n $(LFLAGS) -T $(LINK) -M -Map $(MAP) -o $@ $(OBJECTS)
112
113$(LINK): $(DEPEND)
114 $(GCC) $(DEFS) $(GCC_CFLAGS) -D__ASM__ -D__LINKER__ -E -x c $(LINK).in | grep -v "^\#" > $(LINK)
115
116%.o: %.S $(DEPEND)
117 $(CC) $(DEFS) $(CFLAGS) -D__ASM__ -c $< -o $@
118ifeq ($(PRECHECK),y)
119 $(JOBFILE) $(JOB) $< $@ as asm/preproc $(DEFS) $(CFLAGS) -D__ASM__
120endif
121
122%.o: %.c $(DEPEND)
123 $(CC) $(DEFS) $(CFLAGS) -c $< -o $@
124ifeq ($(PRECHECK),y)
125 $(JOBFILE) $(JOB) $< $@ cc core $(DEFS) $(CFLAGS)
126endif
127
128%.o: %.s $(DEPEND)
129 $(AS) $(AFLAGS) -o $@ $<
130ifeq ($(PRECHECK),y)
131 $(JOBFILE) $(JOB) $< $@ as asm
132endif
133
134$(DEPEND): $(ARCH_INCLUDE) $(GENARCH_INCLUDE) $(COMMON_HEADER_ARCH) $(PRE_DEPEND)
135 makedepend -f - -- $(DEPEND_DEFS) $(CFLAGS) -- $(SOURCES) > $@ 2> /dev/null
136 -[ -f $(DEPEND_PREV) ] && diff -q $(DEPEND_PREV) $@ && mv -f $(DEPEND_PREV) $@
137
138$(COMPS).s: $(COMPS).zip
139 unzip -p $< $@ > $@
140
141$(COMPS).h: $(COMPS).zip
142 unzip -p $< $@ > $@
143
144$(COMPS)_desc.c: $(COMPS).zip
145 unzip -p $< $@ > $@
146
147$(COMPONENTS_DEFLATE): $(COMPS).zip
148 unzip -p $< $@ > $@
149
150$(COMPS).zip: $(COMPONENTS)
151 $(MKARRAY) --deflate $(COMPS) $(COMP) "$(AS_PROLOG)" ".section .components, \"a\"" $^
152
153include Makefile.initrd
154
155$(ARCH_INCLUDE): arch/$(KARCH)/include/
156 ln -sfn ../../$< $@
157
158$(GENARCH_INCLUDE): genarch/include/
159 ln -sfn ../../$< $@
160
161$(COMMON_HEADER_ARCH): $(COMMON_HEADER)
162 ln -sfn ../../../$< $@
Note: See TracBrowser for help on using the repository browser.