~ubuntu-branches/ubuntu/saucy/seabios/saucy-proposed

« back to all changes in this revision

Viewing changes to .pc/1.7.2.2.diff/Makefile

  • Committer: Package Import Robot
  • Author(s): Michael Tokarev
  • Date: 2013-07-08 21:34:44 UTC
  • mfrom: (1.1.7)
  • Revision ID: package-import@ubuntu.com-20130708213444-6ed9q23j39x143lu
Tags: 1.7.3-1
Multi-Arch: allowed

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
 
# SeaBIOS build system
2
 
#
3
 
# Copyright (C) 2008-2012  Kevin O'Connor <kevin@koconnor.net>
4
 
#
5
 
# This file may be distributed under the terms of the GNU LGPLv3 license.
6
 
 
7
 
# Output directory
8
 
OUT=out/
9
 
 
10
 
# Source files
11
 
SRCBOTH=misc.c stacks.c pmm.c output.c util.c block.c floppy.c ata.c mouse.c \
12
 
    kbd.c pci.c serial.c clock.c pic.c cdrom.c ps2port.c smp.c resume.c \
13
 
    pnpbios.c pirtable.c vgahooks.c ramdisk.c pcibios.c blockcmd.c \
14
 
    usb.c usb-uhci.c usb-ohci.c usb-ehci.c usb-hid.c usb-msc.c \
15
 
    virtio-ring.c virtio-pci.c virtio-blk.c virtio-scsi.c apm.c ahci.c \
16
 
    usb-uas.c lsi-scsi.c esp-scsi.c megasas.c
17
 
SRC16=$(SRCBOTH) system.c disk.c font.c
18
 
SRC32FLAT=$(SRCBOTH) post.c shadow.c memmap.c coreboot.c boot.c \
19
 
    acpi.c smm.c mptable.c smbios.c pciinit.c optionroms.c mtrr.c \
20
 
    lzmadecode.c bootsplash.c jpeg.c usb-hub.c paravirt.c \
21
 
    biostables.c xen.c bmp.c romfile.c
22
 
SRC32SEG=util.c output.c pci.c pcibios.c apm.c stacks.c
23
 
 
24
 
# Default compiler flags
25
 
cc-option=$(shell if test -z "`$(1) $(2) -S -o /dev/null -xc /dev/null 2>&1`" \
26
 
    ; then echo "$(2)"; else echo "$(3)"; fi ;)
27
 
 
28
 
COMMONCFLAGS := -I$(OUT) -Os -MD -g \
29
 
    -Wall -Wno-strict-aliasing -Wold-style-definition \
30
 
    $(call cc-option,$(CC),-Wtype-limits,) \
31
 
    -m32 -march=i386 -mregparm=3 -mpreferred-stack-boundary=2 \
32
 
    -minline-all-stringops \
33
 
    -freg-struct-return -ffreestanding -fno-delete-null-pointer-checks \
34
 
    -ffunction-sections -fdata-sections -fno-common
35
 
COMMONCFLAGS += $(call cc-option,$(CC),-nopie,)
36
 
COMMONCFLAGS += $(call cc-option,$(CC),-fno-stack-protector,)
37
 
COMMONCFLAGS += $(call cc-option,$(CC),-fno-stack-protector-all,)
38
 
 
39
 
CFLAGS32FLAT := $(COMMONCFLAGS) -DMODE16=0 -DMODESEGMENT=0 -fomit-frame-pointer
40
 
CFLAGSSEG := $(COMMONCFLAGS) -DMODESEGMENT=1 -fno-defer-pop \
41
 
    $(call cc-option,$(CC),-fno-jump-tables,-DMANUAL_NO_JUMP_TABLE) \
42
 
    $(call cc-option,$(CC),-fno-tree-switch-conversion,)
43
 
CFLAGS32SEG := $(CFLAGSSEG) -DMODE16=0 -fomit-frame-pointer
44
 
CFLAGS16INC := $(CFLAGSSEG) -DMODE16=1 -Wa,src/code16gcc.s \
45
 
    $(call cc-option,$(CC),--param large-stack-frame=4,-fno-inline)
46
 
CFLAGS16 := $(CFLAGS16INC) -fomit-frame-pointer
47
 
 
48
 
# Run with "make V=1" to see the actual compile commands
49
 
ifdef V
50
 
Q=
51
 
else
52
 
Q=@
53
 
MAKEFLAGS += --no-print-directory
54
 
endif
55
 
 
56
 
# Common command definitions
57
 
export HOSTCC             := $(CC)
58
 
export CONFIG_SHELL       := sh
59
 
export KCONFIG_AUTOHEADER := autoconf.h
60
 
export KCONFIG_CONFIG     := $(CURDIR)/.config
61
 
AS=as
62
 
OBJCOPY=objcopy
63
 
OBJDUMP=objdump
64
 
STRIP=strip
65
 
PYTHON=python
66
 
IASL:=iasl
67
 
 
68
 
# Default targets
69
 
-include $(KCONFIG_CONFIG)
70
 
 
71
 
target-y = $(OUT) $(OUT)bios.bin
72
 
target-$(CONFIG_BUILD_VGABIOS) += $(OUT)vgabios.bin
73
 
 
74
 
all: $(target-y)
75
 
 
76
 
# Make definitions
77
 
.PHONY : all clean distclean FORCE
78
 
.DELETE_ON_ERROR:
79
 
 
80
 
vpath %.c src vgasrc
81
 
vpath %.S src vgasrc
82
 
 
83
 
 
84
 
################ Common build rules
85
 
 
86
 
# Verify the build environment works.
87
 
TESTGCC:=$(shell CC="$(CC)" LD="$(LD)" IASL="$(IASL)" tools/test-build.sh)
88
 
ifeq "$(TESTGCC)" "-1"
89
 
$(error "Please upgrade the build environment")
90
 
endif
91
 
 
92
 
ifeq "$(TESTGCC)" "0"
93
 
# Use -fwhole-program
94
 
CFLAGSWHOLE=-fwhole-program -DWHOLE_PROGRAM
95
 
endif
96
 
 
97
 
# Do a whole file compile by textually including all C code.
98
 
define whole-compile
99
 
@echo "  Compiling whole program $3"
100
 
$(Q)printf '$(foreach i,$2,#include "../$i"\n)' > $3.tmp.c
101
 
$(Q)$(CC) $1 $(CFLAGSWHOLE) -c $3.tmp.c -o $3
102
 
endef
103
 
 
104
 
%.strip.o: %.o
105
 
        @echo "  Stripping $@"
106
 
        $(Q)$(STRIP) $< -o $@
107
 
 
108
 
$(OUT)%.s: %.c
109
 
        @echo "  Compiling to assembler $@"
110
 
        $(Q)$(CC) $(CFLAGS16) -S -c $< -o $@
111
 
 
112
 
$(OUT)%.o: %.c $(OUT)autoconf.h
113
 
        @echo "  Compile checking $@"
114
 
        $(Q)$(CC) $(CFLAGS32FLAT) -c $< -o $@
115
 
 
116
 
$(OUT)%.lds: %.lds.S
117
 
        @echo "  Precompiling $@"
118
 
        $(Q)$(CPP) -P -D__ASSEMBLY__ $< -o $@
119
 
 
120
 
 
121
 
################ Main BIOS build rules
122
 
 
123
 
$(OUT)asm-offsets.s: $(OUT)autoconf.h
124
 
 
125
 
$(OUT)asm-offsets.h: $(OUT)asm-offsets.s
126
 
        @echo "  Generating offset file $@"
127
 
        $(Q)./tools/gen-offsets.sh $< $@
128
 
 
129
 
$(OUT)ccode16.o: $(OUT)autoconf.h $(patsubst %.c, out/%.o,$(SRC16)) ; $(call whole-compile, $(CFLAGS16), $(addprefix src/, $(SRC16)),$@)
130
 
 
131
 
$(OUT)code32seg.o: $(OUT)autoconf.h $(patsubst %.c, out/%.o,$(SRC32SEG)) ; $(call whole-compile, $(CFLAGS32SEG), $(addprefix src/, $(SRC32SEG)),$@)
132
 
 
133
 
$(OUT)ccode32flat.o: $(OUT)autoconf.h $(patsubst %.c, out/%.o,$(SRC32FLAT)) ; $(call whole-compile, $(CFLAGS32FLAT), $(addprefix src/, $(SRC32FLAT)),$@)
134
 
 
135
 
$(OUT)romlayout.o: romlayout.S $(OUT)asm-offsets.h
136
 
        @echo "  Compiling (16bit) $@"
137
 
        $(Q)$(CC) $(CFLAGS16) -c -D__ASSEMBLY__ $< -o $@
138
 
 
139
 
$(OUT)romlayout16.lds: $(OUT)ccode32flat.o $(OUT)code32seg.o $(OUT)ccode16.o $(OUT)romlayout.o tools/layoutrom.py
140
 
        @echo "  Building ld scripts"
141
 
        $(Q)./tools/buildversion.sh $(OUT)version.c
142
 
        $(Q)$(CC) $(CFLAGS32FLAT) -c $(OUT)version.c -o $(OUT)version.o
143
 
        $(Q)$(LD) -melf_i386 -r $(OUT)ccode32flat.o $(OUT)version.o -o $(OUT)code32flat.o
144
 
        $(Q)$(LD) -melf_i386 -r $(OUT)ccode16.o $(OUT)romlayout.o -o $(OUT)code16.o
145
 
        $(Q)$(OBJDUMP) -thr $(OUT)code32flat.o > $(OUT)code32flat.o.objdump
146
 
        $(Q)$(OBJDUMP) -thr $(OUT)code32seg.o > $(OUT)code32seg.o.objdump
147
 
        $(Q)$(OBJDUMP) -thr $(OUT)code16.o > $(OUT)code16.o.objdump
148
 
        $(Q)$(PYTHON) ./tools/layoutrom.py $(OUT)code16.o.objdump $(OUT)code32seg.o.objdump $(OUT)code32flat.o.objdump $(OUT)romlayout16.lds $(OUT)romlayout32seg.lds $(OUT)romlayout32flat.lds
149
 
 
150
 
# These are actually built by tools/layoutrom.py above, but by pulling them
151
 
# into an extra rule we prevent make -j from spawning layoutrom.py 4 times.
152
 
$(OUT)romlayout32seg.lds $(OUT)romlayout32flat.lds $(OUT)code32flat.o $(OUT)code16.o: $(OUT)romlayout16.lds
153
 
 
154
 
$(OUT)rom16.o: $(OUT)code16.o $(OUT)romlayout16.lds
155
 
        @echo "  Linking $@"
156
 
        $(Q)$(LD) -T $(OUT)romlayout16.lds $< -o $@
157
 
 
158
 
$(OUT)rom32seg.o: $(OUT)code32seg.o $(OUT)romlayout32seg.lds
159
 
        @echo "  Linking $@"
160
 
        $(Q)$(LD) -T $(OUT)romlayout32seg.lds $< -o $@
161
 
 
162
 
$(OUT)rom.o: $(OUT)rom16.strip.o $(OUT)rom32seg.strip.o $(OUT)code32flat.o $(OUT)romlayout32flat.lds
163
 
        @echo "  Linking $@"
164
 
        $(Q)$(LD) -T $(OUT)romlayout32flat.lds $(OUT)rom16.strip.o $(OUT)rom32seg.strip.o $(OUT)code32flat.o -o $@
165
 
 
166
 
$(OUT)bios.bin.elf $(OUT)bios.bin: $(OUT)rom.o tools/checkrom.py
167
 
        @echo "  Prepping $@"
168
 
        $(Q)$(OBJDUMP) -thr $< > $<.objdump
169
 
        $(Q)$(OBJCOPY) -O binary $< $(OUT)bios.bin.raw
170
 
        $(Q)$(PYTHON) ./tools/checkrom.py $<.objdump $(OUT)bios.bin.raw $(OUT)bios.bin
171
 
        $(Q)$(STRIP) -R .comment $< -o $(OUT)bios.bin.elf
172
 
 
173
 
 
174
 
################ VGA build rules
175
 
 
176
 
# VGA src files
177
 
SRCVGA=src/output.c src/util.c src/pci.c \
178
 
    vgasrc/vgabios.c vgasrc/vgafb.c vgasrc/vgafonts.c vgasrc/vbe.c \
179
 
    vgasrc/stdvga.c vgasrc/stdvgamodes.c vgasrc/stdvgaio.c \
180
 
    vgasrc/clext.c vgasrc/bochsvga.c vgasrc/geodevga.c
181
 
 
182
 
CFLAGS16VGA = $(CFLAGS16INC) -Isrc
183
 
 
184
 
$(OUT)vgaccode16.raw.s: $(OUT)autoconf.h ; $(call whole-compile, $(CFLAGS16VGA) -S, $(SRCVGA),$@)
185
 
 
186
 
$(OUT)vgaccode16.o: $(OUT)vgaccode16.raw.s
187
 
        @echo "  Fixup VGA rom assembler"
188
 
        $(Q)$(PYTHON) ./tools/vgafixup.py $< $(OUT)vgaccode16.s
189
 
        $(Q)$(AS) --32 src/code16gcc.s $(OUT)vgaccode16.s -o $@
190
 
 
191
 
$(OUT)vgaentry.o: vgaentry.S $(OUT)autoconf.h
192
 
        @echo "  Compiling (16bit) $@"
193
 
        $(Q)$(CC) $(CFLAGS16VGA) -c -D__ASSEMBLY__ $< -o $@
194
 
 
195
 
$(OUT)vgarom.o: $(OUT)vgaccode16.o $(OUT)vgaentry.o $(OUT)vgalayout.lds
196
 
        @echo "  Linking $@"
197
 
        $(Q)./tools/buildversion.sh $(OUT)vgaversion.c VAR16
198
 
        $(Q)$(CC) $(CFLAGS16VGA) -c $(OUT)vgaversion.c -o $(OUT)vgaversion.o
199
 
        $(Q)$(LD) --gc-sections -T $(OUT)vgalayout.lds $(OUT)vgaccode16.o $(OUT)vgaentry.o $(OUT)vgaversion.o -o $@
200
 
 
201
 
$(OUT)vgabios.bin.raw: $(OUT)vgarom.o
202
 
        @echo "  Extracting binary $@"
203
 
        $(Q)$(OBJCOPY) -O binary $< $@
204
 
 
205
 
$(OUT)vgabios.bin: $(OUT)vgabios.bin.raw tools/buildrom.py
206
 
        @echo "  Finalizing rom $@"
207
 
        $(Q)$(PYTHON) ./tools/buildrom.py $< $@
208
 
 
209
 
 
210
 
################ DSDT build rules
211
 
 
212
 
iasl-option=$(shell if test -z "`$(1) $(2) 2>&1 > /dev/null`" \
213
 
    ; then echo "$(2)"; else echo "$(3)"; fi ;)
214
 
 
215
 
$(OUT)%.hex: src/%.dsl ./tools/acpi_extract_preprocess.py ./tools/acpi_extract.py
216
 
        @echo "  Compiling IASL $@"
217
 
        $(Q)cpp -P $< > $(OUT)$*.dsl.i.orig
218
 
        $(Q)$(PYTHON) ./tools/acpi_extract_preprocess.py $(OUT)$*.dsl.i.orig > $(OUT)$*.dsl.i
219
 
        $(Q)$(IASL) $(call iasl-option,$(IASL),-Pn,) -vs -l -tc -p $(OUT)$* $(OUT)$*.dsl.i
220
 
        $(Q)$(PYTHON) ./tools/acpi_extract.py $(OUT)$*.lst > $(OUT)$*.off
221
 
        $(Q)cat $(OUT)$*.off > $@
222
 
 
223
 
$(OUT)acpi.o: $(OUT)acpi-dsdt.hex $(OUT)ssdt-proc.hex $(OUT)ssdt-pcihp.hex $(OUT)ssdt-susp.hex $(OUT)q35-acpi-dsdt.hex
224
 
 
225
 
################ Kconfig rules
226
 
 
227
 
define do-kconfig
228
 
$(Q)mkdir -p $(OUT)/tools/kconfig/lxdialog
229
 
$(Q)mkdir -p $(OUT)/include/config
230
 
$(Q)$(MAKE) -C $(OUT) -f $(CURDIR)/tools/kconfig/Makefile srctree=$(CURDIR) src=tools/kconfig obj=tools/kconfig Q=$(Q) Kconfig=$(CURDIR)/src/Kconfig $1
231
 
endef
232
 
 
233
 
$(OUT)autoconf.h : $(KCONFIG_CONFIG) ; $(call do-kconfig, silentoldconfig)
234
 
$(KCONFIG_CONFIG): ; $(call do-kconfig, defconfig)
235
 
%onfig: ; $(call do-kconfig, $@)
236
 
help: ; $(call do-kconfig, $@)
237
 
 
238
 
 
239
 
################ Generic rules
240
 
 
241
 
clean:
242
 
        $(Q)rm -rf $(OUT)
243
 
 
244
 
distclean: clean
245
 
        $(Q)rm -f .config .config.old
246
 
 
247
 
$(OUT):
248
 
        $(Q)mkdir $@
249
 
 
250
 
-include $(OUT)*.d