source: mainline/boot/Makefile.build@ 35ebd42

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

Remove references to common.h from Makefiles.

  • Property mode set to 100644
File size: 4.1 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 depend
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),clang)
67 CFLAGS = $(COMMON_CFLAGS) $(CLANG_CFLAGS) $(EXTRA_CFLAGS)
68else
69 CFLAGS = $(COMMON_CFLAGS) $(GCC_CFLAGS) $(EXTRA_CFLAGS)
70endif
71
72OBJECTS := $(addsuffix .o,$(basename $(SOURCES)))
73DEPENDS := $(addsuffix .d,$(basename $(SOURCES)))
74
75all: $(VERSION_DEF) $(COMMON_MAKEFILE) $(COMMON_HEADER) $(CONFIG_MAKEFILE) $(CONFIG_HEADER) $(BOOT_OUTPUT)
76
77clean:
78 rm -f $(RAW) $(MAP) $(ARCH_INCLUDE) $(GENARCH_INCLUDE)
79
80-include $(DEPENDS)
81
82AS_CFLAGS := $(addprefix -Xassembler ,$(AFLAGS))
83
84$(BOOT_OUTPUT): $(RAW)
85 $(OBJCOPY) -O $(BFD_OUTPUT) $< $@
86
87$(RAW): $(OBJECTS) $(LINK)
88 $(LD) -n $(LFLAGS) -T $(LINK) -M -Map $(MAP) -o $@ $(OBJECTS)
89
90$(LINK): | depend
91 $(CC) $(DEFS) $(CFLAGS) -D__ASM__ -D__LINKER__ -E -x c $(LINK).in | grep -v "^\#" > $(LINK)
92
93%.o: %.S | depend
94 $(CC) -MD $(DEFS) $(CFLAGS) $(AS_CFLAGS) -D__ASM__ -c $< -o $@
95ifeq ($(PRECHECK),y)
96 $(JOBFILE) $(JOB) $< $@ as asm/preproc $(DEFS) $(CFLAGS) -D__ASM__
97endif
98
99%.o: %.c | depend
100 $(CC) -MD $(DEFS) $(CFLAGS) -c $< -o $@
101ifeq ($(PRECHECK),y)
102 $(JOBFILE) $(JOB) $< $@ cc core $(DEFS) $(CFLAGS)
103endif
104
105%.o: %.s | depend
106 $(CC) -MD $(DEFS) $(CFLAGS) $(AS_CFLAGS) -D__ASM__ -c $< -o $@
107ifeq ($(PRECHECK),y)
108 $(JOBFILE) $(JOB) $< $@ as asm
109endif
110
111depend: $(ARCH_INCLUDE) $(GENARCH_INCLUDE) $(PRE_DEPEND)
112
113$(COMPS).s: $(COMPS).zip
114 unzip -p $< $@ > $@
115
116$(COMPS).h: $(COMPS).zip
117 unzip -p $< $@ > $@
118
119$(COMPS)_desc.c: $(COMPS).zip
120 unzip -p $< $@ > $@
121
122$(COMPONENTS_DEFLATE): $(COMPS).zip
123 unzip -p $< $@ > $@
124
125$(COMPS).zip: $(COMPONENTS)
126 $(MKARRAY) --deflate $(COMPS) $(COMP) "$(AS_PROLOG)" ".section .components, \"a\"" $^
127
128include Makefile.initrd
129
130$(ARCH_INCLUDE) $(ARCH_INCLUDE)/%.h: arch/$(KARCH)/include/
131 ln -sfn ../../$< $@
132
133$(GENARCH_INCLUDE) $(GENARCH_INCLUDE)/%.h: genarch/include/
134 ln -sfn ../../$< $@
Note: See TracBrowser for help on using the repository browser.