OLD | NEW |
(Empty) | |
| 1 # |
| 2 # Copyright (C) 1999-2001 Hewlett-Packard Co. |
| 3 # Contributed by David Mosberger <davidm@hpl.hp.com> |
| 4 # Contributed by Stephane Eranian <eranian@hpl.hp.com> |
| 5 # |
| 6 # This file is part of the gnu-efi package. |
| 7 # |
| 8 # GNU-EFI is free software; you can redistribute it and/or modify |
| 9 # it under the terms of the GNU General Public License as published by |
| 10 # the Free Software Foundation; either version 2, or (at your option) |
| 11 # any later version. |
| 12 # |
| 13 # GNU-EFI is distributed in the hope that it will be useful, |
| 14 # but WITHOUT ANY WARRANTY; without even the implied warranty of |
| 15 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
| 16 # GNU General Public License for more details. |
| 17 # |
| 18 # You should have received a copy of the GNU General Public License |
| 19 # along with GNU-EFI; see the file COPYING. If not, write to the Free |
| 20 # Software Foundation, 59 Temple Place - Suite 330, Boston, MA |
| 21 # 02111-1307, USA. |
| 22 # |
| 23 |
| 24 PREFIX ?= /usr/bin/x86_64-pc-linux-gnu- |
| 25 CC ?= $(PREFIX)gcc |
| 26 LD ?= $(PREFIX)ld |
| 27 OBJCOPY ?= $(PREFIX)objcopy |
| 28 |
| 29 |
| 30 EFIINC = /usr/include/efi |
| 31 EFILIB = /usr/lib |
| 32 EFICRT0 = /usr/lib |
| 33 |
| 34 ARCH = $(shell uname -m | sed s,i[3456789]86,ia32,) |
| 35 |
| 36 INCDIR = -I$(EFIINC) -I$(EFIINC)/$(ARCH) |
| 37 |
| 38 CPPFLAGS = -DCONFIG_$(ARCH) |
| 39 |
| 40 OPTIMFLAGS = -O2 |
| 41 DEBUGFLAGS = -Wall |
| 42 CFLAGS = $(OPTIMFLAGS) -fpic -fshort-wchar $(DEBUGFLAGS) |
| 43 CFLAGS += -DEFI_FUNCTION_WRAPPER |
| 44 LDFLAGS = -nostdlib -znocombreloc |
| 45 |
| 46 |
| 47 CRTOBJS = $(EFICRT0)/crt0-efi-$(ARCH).o |
| 48 LDSCRIPT = $(EFICRT0)/elf_$(ARCH)_efi.lds |
| 49 |
| 50 LDFLAGS += -T $(LDSCRIPT) -shared -Bsymbolic -L$(EFILIB) $(CRTOBJS) |
| 51 LOADLIBES = -lefi -lgnuefi $(shell $(CC) -print-libgcc-file-name) |
| 52 FORMAT = efi-app-$(ARCH) |
| 53 |
| 54 |
| 55 TARGETS = bootstub.efi |
| 56 |
| 57 all: $(TARGETS) |
| 58 |
| 59 clean: |
| 60 rm -f $(TARGETS) *~ *.o *.so |
| 61 |
| 62 install: bootstub.efi |
| 63 mkdir -p $(DESTDIR) |
| 64 cp -f $^ $(DESTDIR) |
| 65 |
| 66 .PHONY: all clean install |
| 67 |
| 68 |
| 69 bootstub.so: bootstub.o trampoline.o |
| 70 $(LD) $(LDFLAGS) $^ -o $@ $(LOADLIBES) |
| 71 |
| 72 %.efi: %.so |
| 73 $(OBJCOPY) -j .text -j .sdata -j .data -j .dynamic -j .dynsym -j .rel \ |
| 74 -j .rela -j .reloc --target=$(FORMAT) $*.so $@ |
| 75 |
| 76 %.so: %.o |
| 77 $(LD) $(LDFLAGS) $^ -o $@ $(LOADLIBES) |
| 78 |
| 79 %.o: %.c |
| 80 $(CC) $(INCDIR) $(CFLAGS) $(CPPFLAGS) -c $< -o $@ |
| 81 |
| 82 %.o: %.S |
| 83 $(CC) $(INCDIR) $(CFLAGS) $(CPPFLAGS) -c $< -o $@ |
OLD | NEW |