source: mainline/boot/Makefile.build@ fa5ab58

lfn serial ticket/834-toolchain-update topic/msim-upgrade topic/simplify-dev-export
Last change on this file since fa5ab58 was 32355bc, checked in by Jiří Zárevúcky <zarevucky.jiri@…>, 6 years ago

Remove the generated common.h header

We haven't used it in some time, instead relying on the compiler
providing types with properties we want. Since we only support
building with GCC and Clang, extra detection code is just dead weight.

  • Property mode set to 100644
File size: 3.8 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 -Iarch/$(KARCH)/include -Igenarch/include -I$(ROOT_PATH)/abi/arch/$(KARCH)/include -I$(ROOT_PATH)/abi/include
34OPTIMIZATION = 3
35
36DEFS = -DBOOT -DRELEASE=$(RELEASE) "-DCOPYRIGHT=$(COPYRIGHT)" "-DNAME=$(NAME)" -D__$(BITS)_BITS__ -D__$(ENDIANESS)__
37
38LDFLAGS = -Wl,--fatal-warnings,--warn-common $(EXTRA_LDFLAGS)
39
40COMMON_CFLAGS = $(INCLUDES) -O$(OPTIMIZATION) -imacros $(CONFIG_HEADER) \
41 -ffreestanding -nostdlib \
42 -fexec-charset=UTF-8 -finput-charset=UTF-8 -fno-common \
43 -fdebug-prefix-map=$(realpath $(ROOT_PATH))=. \
44 -Wa,--fatal-warnings
45
46GCC_CFLAGS = -Wall -Wextra -Wno-unused-parameter -Wmissing-prototypes \
47 -std=gnu99 -Werror-implicit-function-declaration -Wwrite-strings \
48 -pipe
49
50CLANG_CFLAGS = -Wall -Wextra -Wno-unused-parameter -Wmissing-prototypes \
51 -Werror-implicit-function-declaration -Wwrite-strings \
52 -pipe -fno-stack-protector -fno-PIC
53
54ifeq ($(CONFIG_DEBUG),y)
55 COMMON_CFLAGS += -Werror
56endif
57
58ifeq ($(CONFIG_LINE_DEBUG),y)
59 COMMON_CFLAGS += -g
60endif
61
62ifeq ($(COMPILER),clang)
63 CFLAGS = $(COMMON_CFLAGS) $(CLANG_CFLAGS) $(EXTRA_CFLAGS)
64else
65 CFLAGS = $(COMMON_CFLAGS) $(GCC_CFLAGS) $(EXTRA_CFLAGS)
66endif
67
68OBJECTS := $(addsuffix .o,$(basename $(SOURCES)))
69DEPENDS := $(addsuffix .d,$(basename $(SOURCES)))
70
71ifeq ($(CONFIG_COMPRESSED_INIT),y)
72 COMPONENTS := $(addsuffix .gz, $(COMPONENTS))
73endif
74
75all: $(VERSION_DEF) $(COMMON_MAKEFILE) $(CONFIG_MAKEFILE) $(CONFIG_HEADER) $(BOOT_OUTPUT)
76
77clean:
78 rm -f $(RAW) $(MAP)
79
80-include $(DEPENDS)
81
82$(BOOT_OUTPUT): $(RAW)
83 $(OBJCOPY) -O $(BFD_OUTPUT) $< $@
84
85$(RAW): $(OBJECTS) $(LINK)
86 $(CC) $(CFLAGS) -Wl,-n $(LDFLAGS) -T $(LINK) -Wl,-M,-Map,$(MAP) -o $@ $(OBJECTS)
87
88$(LINK): | depend
89 $(CC) $(DEFS) $(CFLAGS) -D__ASSEMBLER__ -D__LINKER__ -E -x c $(LINK).in | grep -v "^\#" > $(LINK)
90
91%.o: %.s | depend
92 $(CC_JOB) -c -MD -MP $(DEFS) $(CFLAGS)
93
94%.o: %.S | depend
95 $(CC_JOB) -c -MD -MP $(DEFS) $(CFLAGS)
96
97%.o: %.c | depend
98 $(CC_JOB) -c -MD -MP $(DEFS) $(CFLAGS)
99
100depend: $(PRE_DEPEND)
101
102%.gz: %
103 gzip -n -k -9 -f $<
104
105$(COMPS).tar: $(COMPONENTS)
106 tar --mtime='2032-01-01 00:00:00' --group=0 --owner=0 --no-acls --no-selinux --no-xattrs --format=ustar --transform 's/.*\///g' -cvf $@ $^
107
108$(COMPS).o: $(COMPS).tar
109 # Create empty object file.
110 $(CC) -x c -c -o $@.new $(DEFS) $(CFLAGS) - </dev/null
111 # Add .payload section to it.
112 $(OBJCOPY) --add-section '.payload'=$< $@.new $@
113
114include Makefile.initrd
Note: See TracBrowser for help on using the repository browser.