source: mainline/boot/Makefile.build@ ee794529

lfn serial ticket/834-toolchain-update topic/msim-upgrade topic/simplify-dev-export
Last change on this file since ee794529 was d75dc05, checked in by jzr <zarevucky.jiri@…>, 8 years ago

Remove the unmaintained and likely broken ICC support.

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