summaryrefslogtreecommitdiffstats
path: root/GNU_efi_HelloWorld/Makefile
diff options
context:
space:
mode:
Diffstat (limited to 'GNU_efi_HelloWorld/Makefile')
-rw-r--r--GNU_efi_HelloWorld/Makefile28
1 files changed, 19 insertions, 9 deletions
diff --git a/GNU_efi_HelloWorld/Makefile b/GNU_efi_HelloWorld/Makefile
index e3a5956..80f1398 100644
--- a/GNU_efi_HelloWorld/Makefile
+++ b/GNU_efi_HelloWorld/Makefile
@@ -2,6 +2,7 @@ ARCH = $(shell uname -m | sed s,i[3456789]86,ia32,)
OBJS = hello.o
TARGET = hello.efi
+TARGET_DEBUG = hello.debug
EFIINC = /usr/include/efi
EFFINCS = -I$(EFIINC) -I$(EFIINC)/$(ARCH) -I$(EFIINC)/protocol
@@ -10,28 +11,37 @@ EFI_CRT_OBJS = $(EFILIB)/crt0-efi-$(ARCH).o
EFI_LDS = $(EFILIB)/elf_$(ARCH)_efi.lds
CFLAGS = $(EFFINCS) -fno-stack-protector -fpic \
- -fshort-wchar -mno-red-zone -Wall \
- -ggdb
+ -fshort-wchar -mno-red-zone -Wall
+CFLAGS += -ggdb3 -O0 -DDEBUG -DEFI_DEBUG=1
ifeq ($(ARCH),x86_64)
CFLAGS += -DEFI_FUNCTION_WRAPPER
endif
LDFLAGS = -nostdlib -znocombreloc -T $(EFI_LDS) -shared \
- -Bsymbolic -L $(EFILIB) $(EFI_CRT_OBJS)
+ -Bsymbolic -L $(EFILIB) $(EFI_CRT_OBJS)
-all: $(TARGET)
+SECTIONS = .text .sdata .data .dynamic .dynsym .rel .rela .reloc
+
+DEBUG_SECTIONS = .debug_info .debug_abbrev .debug_aranges \
+ .debug_line .debug_str
+
+all: clear $(TARGET) $(TARGET_DEBUG)
cp hello.efi ../test_code/hda-contents/
hello.so: $(OBJS)
ld $(LDFLAGS) $(OBJS) -o $@ -lefi -lgnuefi
%.efi: %.so
- objcopy -j .text -j .sdata -j .data -j .dynamic \
- -j .dynsym -j .rel -j .rela -j .reloc \
+ objcopy $(foreach sec,$(SECTIONS),-j $(sec)) \
+ --target=efi-app-$(ARCH) $^ $@
+
+%.debug: %.so
+ objcopy $(foreach sec,$(SECTIONS) $(DEBUG_SECTIONS),-j $(sec)) \
--target=efi-app-$(ARCH) $^ $@
clear:
- rm *.efi
- rm *.o
- rm *.so
+ rm -f *.efi
+ rm -f *.debug
+ rm -f *.o
+ rm -f *.so