summaryrefslogtreecommitdiff
path: root/efi/Makefile
blob: 11ea9c2dbdaf7cd639557ae6bb27b461f87fe67d (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
## -----------------------------------------------------------------------
##
##   Copyright 2011 Intel Corporation; author: Matt Fleming
##
##   This program is free software; you can redistribute it and/or modify
##   it under the terms of the GNU General Public License as published by
##   the Free Software Foundation, Inc., 53 Temple Place Ste 330,
##   Boston MA 02111-1307, USA; either version 2 of the License, or
##   (at your option) any later version; incorporated herein by reference.
##
## -----------------------------------------------------------------------

VPATH = $(SRC)
include $(MAKEDIR)/lib.mk
include $(MAKEDIR)/efi.mk

CORE_CSRC := $(wildcard $(core)/*.c $(core)/*/*.c $(core)/*/*/*.c)
CORE_COBJ := $(subst $(core),$(OBJ)/../core/,$(patsubst %.c,%.o,$(CORE_CSRC)))

# Don't include console objects
CORE_OBJS = $(filter-out %hello.o %rawcon.o %plaincon.o %strcasecmp.o %bios.o \
	%diskio_bios.o %ldlinux-c.o %isolinux-c.o %pxelinux-c.o,$(CORE_COBJ))

LIB_OBJS = $(addprefix $(objdir)/com32/lib/,$(CORELIBOBJS))

CSRC = $(wildcard $(SRC)/*.c)
OBJS = $(subst $(SRC)/,,$(filter-out %wrapper.o, $(patsubst %.c,%.o,$(CSRC))))

OBJS += $(objdir)/core/codepage.o

# The targets to build in this directory
BTARGET  = syslinux.efi

syslinux.so: $(OBJS) $(CORE_OBJS) $(LIB_OBJS)
	$(LD) $(LDFLAGS) -o $@ $^ -lgnuefi -lefi

# We need to rename the .hash section because the EFI firmware
# linker really doesn't like it.
# $(OBJCOPY) --rename-section .gnu.hash=.sdata,load,data,alloc $^ $@
#syslinux.so: syslinux1.so
#	cp $^ $@

wrapper: wrapper.c
	$(CC) $^ -o $@

#
# Build the wrapper app and wrap our .so to produce a .efi
syslinux.efi: syslinux.so wrapper
	$(OBJ)/wrapper syslinux.so $@

all: $(BTARGET)

codepage.o: ../codepage/cp865.cp
	cp $(objdir)/../codepage/cp865.cp codepage.cp
	$(CC) $(SFLAGS) -c -o $@ $(core)/codepage.S

installer: syslinux.efi

install: all
	mkdir -m 755 -p $(INSTALLROOT)$(AUXDIR)/efi$(BITS)
	install -m 755 $(BTARGET) $(INSTALLROOT)$(AUXDIR)/efi$(BITS)

strip:

tidy dist:
	rm -f *.so *.o wrapper
	find . \( -name \*.o -o -name \*.a -o -name .\*.d -o -name \*.tmp \) -print0 | \
		xargs -0r rm -f

clean: tidy

spotless: clean
	rm -f $(BTARGET)