Makefile.private: correct the names of prerelease tarballs
[syslinux/sherbszt.git] / efi / Makefile
blobf4501e7f2e0096fdf5799e68e63bc502bc2adc62
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 CC_FOR_BUILD ?= $(CC)
19 # Upstream gnu-efi has old-style function definitions.
20 CFLAGS += -Wno-strict-prototypes
22 CORE_CSRC := $(sort $(wildcard $(core)/*.c $(core)/*/*.c $(core)/*/*/*.c))
23 CORE_COBJ := $(subst $(core),$(OBJ)/../core,$(patsubst %.c,%.o,$(CORE_CSRC)))
25 # We don't want to include any of the networking stack or the thread
26 # code since it will be implemented completely differently for EFI.
27 FILTERED_OBJS:= $(sort $(subst $(core),$(OBJ)/../core,$(patsubst %.c,%.o, \
28 $(wildcard $(core)/legacynet/*.c) \
29 $(wildcard $(core)/fs/pxe/*.c) \
30 $(wildcard $(core)/thread/*.c))))
32 # Don't include unit tests
33 FILTERED_OBJS += $(subst $(core),$(OBJ)/../core, \
34 $(patsubst %.c,%.o,$(shell find $(core) -path "*/tests/*.c" -print)))
36 # Don't include console objects
37 CORE_OBJS = $(filter-out %hello.o %rawcon.o %plaincon.o %strcasecmp.o %bios.o \
38 %diskio_bios.o %ldlinux-c.o %isolinux-c.o %pxelinux-c.o \
39 %localboot.o %pxeboot.o \
40 $(FILTERED_OBJS),$(CORE_COBJ) $(CORE_SOBJ))
42 CORE_OBJS += $(addprefix $(OBJ)/../core/, \
43 fs/pxe/pxe.o fs/pxe/tftp.o fs/pxe/urlparse.o fs/pxe/dhcp_option.o \
44 fs/pxe/ftp.o fs/pxe/ftp_readdir.o fs/pxe/http.o fs/pxe/http_readdir.o)
46 LIB_OBJS = $(addprefix $(objdir)/com32/lib/,$(CORELIBOBJS)) \
47 $(LIBEFI)
49 CSRC = $(sort $(wildcard $(SRC)/*.c))
50 OBJS = $(subst $(SRC)/,,$(filter-out %wrapper.o, $(patsubst %.c,%.o,$(CSRC))))
52 OBJS += $(objdir)/core/codepage.o $(ARCH)/linux.o
54 # The DATE is set on the make command line when building binaries for
55 # official release. Otherwise, substitute a hex string that is pretty much
56 # guaranteed to be unique to be unique from build to build.
57 ifndef HEXDATE
58 HEXDATE := $(shell $(PERL) $(SRC)/../now.pl $(SRCS))
59 endif
60 ifndef DATE
61 DATE := $(shell sh $(SRC)/../gen-id.sh $(VERSION) $(HEXDATE))
62 endif
63 CFLAGS += -DDATE_STR='"$(DATE)"'
65 $(OBJ)/$(ARCH):
66 mkdir -p $@
68 $(OBJS): | $(OBJ)/$(ARCH)
70 # The targets to build in this directory
71 BTARGET = syslinux.efi
73 syslinux.so: $(OBJS) $(CORE_OBJS) $(LIB_OBJS)
74 $(LD) $(LDFLAGS) --strip-debug -o $@ $^ -lgnuefi -lefi
76 # We need to rename the .hash section because the EFI firmware
77 # linker really doesn't like it.
78 # $(OBJCOPY) --rename-section .gnu.hash=.sdata,load,data,alloc $^ $@
79 #syslinux.so: syslinux1.so
80 # cp $^ $@
82 wrapper: wrapper.c
83 $(CC_FOR_BUILD) $^ -o $@
86 # Build the wrapper app and wrap our .so to produce a .efi
87 syslinux.efi: syslinux.so wrapper
88 $(OBJ)/wrapper syslinux.so $@
90 all: $(BTARGET)
92 codepage.o: ../codepage/cp865.cp
93 cp $(objdir)/../codepage/cp865.cp codepage.cp
94 $(CC) $(SFLAGS) -c -o $@ $(core)/codepage.S
96 install:
97 install -m 755 $(BTARGET) $(INSTALLROOT)$(AUXDIR)
99 strip:
101 tidy dist:
102 rm -f *.so *.o wrapper
103 find . \( -name \*.o -o -name \*.a -o -name .\*.d -o -name \*.tmp \) -print0 | \
104 xargs -0r rm -f
105 $(topdir)/efi/clean-gnu-efi.sh $(EFI_SUBARCH) $(objdir)
107 clean: tidy
109 spotless: clean
110 rm -f $(BTARGET)