Add memtest support.
[syslinux-debian/hramrach.git] / efi / Makefile
blob4bf5a22948a5c8f36da1d4b8308021dd90990335
1 ## -----------------------------------------------------------------------
2 ##
3 ## Copyright 2011 Intel Corporation; author: Matt Fleming
4 ##
5 ## This program is free software; you can redistribute it and/or modify
6 ## it under the terms of the GNU General Public License as published by
7 ## the Free Software Foundation, Inc., 53 Temple Place Ste 330,
8 ## Boston MA 02111-1307, USA; either version 2 of the License, or
9 ## (at your option) any later version; incorporated herein by reference.
11 ## -----------------------------------------------------------------------
13 VPATH = $(SRC)
14 include $(MAKEDIR)/lib.mk
15 include $(MAKEDIR)/efi.mk
17 # Upstream gnu-efi has old-style function definitions.
18 CFLAGS += -Wno-strict-prototypes
20 CORE_CSRC := $(wildcard $(core)/*.c $(core)/*/*.c $(core)/*/*/*.c)
21 CORE_COBJ := $(subst $(core),$(OBJ)/../core/,$(patsubst %.c,%.o,$(CORE_CSRC)))
23 # We don't want to include any of the networking stack or the thread
24 # code since it will be implemented completely differently for EFI.
25 FILTERED_OBJS:= $(subst $(core),$(OBJ)/../core/,$(patsubst %.c,%.o, \
26 $(wildcard $(core)/legacynet/*.c) \
27 $(wildcard $(core)/fs/pxe/*.c) \
28 $(wildcard $(core)/thread/*.c)))
30 # Don't include unit tests
31 FILTERED_OBJS += $(subst $(core),$(OBJ)/../core/, \
32 $(patsubst %.c,%.o,$(shell find $(core) -path "*/tests/*.c" -print)))
34 # Don't include console objects
35 CORE_OBJS = $(filter-out %hello.o %rawcon.o %plaincon.o %strcasecmp.o %bios.o \
36 %diskio_bios.o %ldlinux-c.o %isolinux-c.o %pxelinux-c.o \
37 %localboot.o %pxeboot.o \
38 $(FILTERED_OBJS),$(CORE_COBJ) $(CORE_SOBJ))
40 CORE_OBJS += $(addprefix $(OBJ)/../core/, \
41 fs/pxe/pxe.o fs/pxe/tftp.o fs/pxe/urlparse.o fs/pxe/dhcp_option.o \
42 fs/pxe/ftp.o fs/pxe/ftp_readdir.o fs/pxe/http.o fs/pxe/http_readdir.o)
44 LIB_OBJS = $(addprefix $(objdir)/com32/lib/,$(CORELIBOBJS))
46 CSRC = $(wildcard $(SRC)/*.c)
47 OBJS = $(subst $(SRC)/,,$(filter-out %wrapper.o, $(patsubst %.c,%.o,$(CSRC))))
49 OBJS += $(objdir)/core/codepage.o $(ARCH)/linux.o
51 # The DATE is set on the make command line when building binaries for
52 # official release. Otherwise, substitute a hex string that is pretty much
53 # guaranteed to be unique to be unique from build to build.
54 ifndef HEXDATE
55 HEXDATE := $(shell $(PERL) $(SRC)/../now.pl $(SRCS))
56 endif
57 ifndef DATE
58 DATE := $(shell sh $(SRC)/../gen-id.sh $(VERSION) $(HEXDATE))
59 endif
60 CFLAGS += -DDATE_STR='"$(DATE)"'
62 .PHONY: subdirs
63 subdirs:
64 mkdir -p $(ARCH)
66 $(OBJS): subdirs
68 # The targets to build in this directory
69 BTARGET = syslinux.efi
71 syslinux.so: $(OBJS) $(CORE_OBJS) $(LIB_OBJS)
72 $(LD) $(LDFLAGS) --strip-debug -o $@ $^ -lgnuefi -lefi
74 # We need to rename the .hash section because the EFI firmware
75 # linker really doesn't like it.
76 # $(OBJCOPY) --rename-section .gnu.hash=.sdata,load,data,alloc $^ $@
77 #syslinux.so: syslinux1.so
78 # cp $^ $@
80 wrapper: wrapper.c
81 $(CC) $^ -o $@
84 # Build the wrapper app and wrap our .so to produce a .efi
85 syslinux.efi: syslinux.so wrapper
86 $(OBJ)/wrapper syslinux.so $@
88 all: $(BTARGET)
90 codepage.o: ../codepage/cp865.cp
91 cp $(objdir)/../codepage/cp865.cp codepage.cp
92 $(CC) $(SFLAGS) -c -o $@ $(core)/codepage.S
94 install:
95 install -m 755 $(BTARGET) $(INSTALLROOT)$(AUXDIR)
97 strip:
99 tidy dist:
100 rm -f *.so *.o wrapper
101 find . \( -name \*.o -o -name \*.a -o -name .\*.d -o -name \*.tmp \) -print0 | \
102 xargs -0r rm -f
104 clean: tidy
106 spotless: clean
107 rm -f $(BTARGET)