syslinux/efi/Makefile
<<
>>
Prefs
   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.
  10##
  11## -----------------------------------------------------------------------
  12
  13VPATH = $(SRC)
  14include $(MAKEDIR)/lib.mk
  15include $(MAKEDIR)/efi.mk
  16
  17# Upstream gnu-efi has old-style function definitions.
  18CFLAGS += -Wno-strict-prototypes
  19
  20CORE_CSRC := $(wildcard $(core)/*.c $(core)/*/*.c $(core)/*/*/*.c)
  21CORE_COBJ := $(subst $(core),$(OBJ)/../core/,$(patsubst %.c,%.o,$(CORE_CSRC)))
  22
  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.
  25FILTERED_OBJS:= $(subst $(core),$(OBJ)/../core/,$(patsubst %.c,%.o, \
  26        $(wildcard $(core)/legacynet/*.c) \
  27        $(wildcard $(core)/fs/pxe/*.c) \
  28        $(wildcard $(core)/thread/*.c)))
  29
  30# Don't include unit tests
  31FILTERED_OBJS += $(subst $(core),$(OBJ)/../core/, \
  32        $(patsubst %.c,%.o,$(shell find $(core) -path "*/tests/*.c" -print)))
  33
  34# Don't include console objects
  35CORE_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))
  39
  40CORE_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)
  43
  44LIB_OBJS = $(addprefix $(objdir)/com32/lib/,$(CORELIBOBJS)) \
  45        $(LIBEFI)
  46
  47CSRC = $(wildcard $(SRC)/*.c)
  48OBJS = $(subst $(SRC)/,,$(filter-out %wrapper.o, $(patsubst %.c,%.o,$(CSRC))))
  49
  50OBJS += $(objdir)/core/codepage.o $(ARCH)/linux.o
  51
  52# The DATE is set on the make command line when building binaries for
  53# official release.  Otherwise, substitute a hex string that is pretty much
  54# guaranteed to be unique to be unique from build to build.
  55ifndef HEXDATE
  56HEXDATE := $(shell $(PERL) $(SRC)/../now.pl $(SRCS))
  57endif
  58ifndef DATE
  59DATE    := $(shell sh $(SRC)/../gen-id.sh $(VERSION) $(HEXDATE))
  60endif
  61CFLAGS          += -DDATE_STR='"$(DATE)"'
  62
  63.PHONY: subdirs
  64subdirs:
  65        mkdir -p $(ARCH)
  66
  67$(OBJS): subdirs
  68
  69# The targets to build in this directory
  70BTARGET  = syslinux.efi
  71
  72syslinux.so: $(OBJS) $(CORE_OBJS) $(LIB_OBJS)
  73        $(LD) $(LDFLAGS) --strip-debug -o $@ $^ -lgnuefi -lefi
  74
  75# We need to rename the .hash section because the EFI firmware
  76# linker really doesn't like it.
  77# $(OBJCOPY) --rename-section .gnu.hash=.sdata,load,data,alloc $^ $@
  78#syslinux.so: syslinux1.so
  79#       cp $^ $@
  80
  81wrapper: wrapper.c
  82        $(CC) $^ -o $@
  83
  84#
  85# Build the wrapper app and wrap our .so to produce a .efi
  86syslinux.efi: syslinux.so wrapper
  87        $(OBJ)/wrapper syslinux.so $@
  88
  89all: $(BTARGET)
  90
  91codepage.o: ../codepage/cp865.cp
  92        cp $(objdir)/../codepage/cp865.cp codepage.cp
  93        $(CC) $(SFLAGS) -c -o $@ $(core)/codepage.S
  94
  95install:
  96        install -m 755 $(BTARGET) $(INSTALLROOT)$(AUXDIR)
  97
  98strip:
  99
 100tidy dist:
 101        rm -f *.so *.o wrapper
 102        find . \( -name \*.o -o -name \*.a -o -name .\*.d -o -name \*.tmp \) -print0 | \
 103                xargs -0r rm -f
 104        $(topdir)/efi/clean-gnu-efi.sh $(EFI_SUBARCH) $(objdir)
 105
 106clean: tidy
 107
 108spotless: clean
 109        rm -f $(BTARGET)
 110