libpayload: Implement gcc wrappers for libpayload
libpayload uses a ton of flags and other scary gcc and ld options. These wrappers hide most of that from the user, so that using libpayload is as easy as lpgcc -o hello hello.c Signed-off-by: Jordan Crouse <jordan.crouse@amd.com> Acked-by: Uwe Hermann <uwe@hermann-uwe.de> git-svn-id: svn://svn.coreboot.org/coreboot/trunk@3226 2b7e53f0-3cfb-0310-b3e9-8179ed1497e1
This commit is contained in:
@ -29,23 +29,17 @@
|
||||
|
||||
# Sample libpayload Makefile.
|
||||
|
||||
CC = gcc
|
||||
CROSS_CFLAGS = -m32
|
||||
CC := ../bin/lpgcc
|
||||
|
||||
INCLUDES = -I../include
|
||||
INCLUDES += -I$(shell $(CC) $(CROSS_CFLAGS) -print-search-dirs | head -n 1 | cut -d' ' -f2)include
|
||||
|
||||
LIBPAYLOAD = ../libpayload.a
|
||||
LIBGCC := $(shell $(CC) $(CROSS_CFLAGS) -print-libgcc-file-name)
|
||||
CFLAGS := -Wall -Werror -Os -fno-stack-protector -nostdinc $(INCLUDES)
|
||||
CFLAGS := -Wall -Werror -Os
|
||||
|
||||
all: hello.elf
|
||||
|
||||
hello.elf: hello.o
|
||||
ld -T ../libpayload.ldscript -o $@ hello.o ../i386/head.o $(LIBPAYLOAD) $(LIBGCC)
|
||||
$(CC) -o $@ hello.o
|
||||
|
||||
hello.o: hello.c
|
||||
$(CC) $(CROSS_CFLAGS) $(CFLAGS) -c -o $@ $<
|
||||
$(CC) $(CFLAGS) -c -o $@ $<
|
||||
|
||||
clean:
|
||||
rm -f hello.elf hello.o
|
||||
|
Reference in New Issue
Block a user