xref: /DragonStub/gnuefi/Makefile (revision e0e1f53ce2056f4149f617993c8ef93cb2a5bb4c)
1530d68baSNigel Croxon#
2530d68baSNigel Croxon#  Copyright (C) 1999-2001 Hewlett-Packard Co.
3530d68baSNigel Croxon#	Contributed by David Mosberger <davidm@hpl.hp.com>
4530d68baSNigel Croxon#	Contributed by Stephane Eranian <eranian@hpl.hp.com>
5530d68baSNigel Croxon#
6530d68baSNigel Croxon#    All rights reserved.
7530d68baSNigel Croxon#
8530d68baSNigel Croxon#    Redistribution and use in source and binary forms, with or without
9530d68baSNigel Croxon#    modification, are permitted provided that the following conditions
10530d68baSNigel Croxon#    are met:
11530d68baSNigel Croxon#
12530d68baSNigel Croxon#    * Redistributions of source code must retain the above copyright
13530d68baSNigel Croxon#      notice, this list of conditions and the following disclaimer.
14530d68baSNigel Croxon#    * Redistributions in binary form must reproduce the above
15530d68baSNigel Croxon#      copyright notice, this list of conditions and the following
16530d68baSNigel Croxon#      disclaimer in the documentation and/or other materials
17530d68baSNigel Croxon#      provided with the distribution.
18530d68baSNigel Croxon#    * Neither the name of Hewlett-Packard Co. nor the names of its
19530d68baSNigel Croxon#      contributors may be used to endorse or promote products derived
20530d68baSNigel Croxon#      from this software without specific prior written permission.
21530d68baSNigel Croxon#
22530d68baSNigel Croxon#    THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND
23530d68baSNigel Croxon#    CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES,
24530d68baSNigel Croxon#    INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
25530d68baSNigel Croxon#    MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
26530d68baSNigel Croxon#    DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS
27530d68baSNigel Croxon#    BE LIABLE FOR ANYDIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY,
28530d68baSNigel Croxon#    OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
29530d68baSNigel Croxon#    PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
30530d68baSNigel Croxon#    PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
31530d68baSNigel Croxon#    THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR
32530d68baSNigel Croxon#    TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF
33530d68baSNigel Croxon#    THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
34530d68baSNigel Croxon#    SUCH DAMAGE.
35530d68baSNigel Croxon#
36530d68baSNigel Croxon
37530d68baSNigel CroxonSRCDIR = .
38530d68baSNigel Croxon
39530d68baSNigel CroxonVPATH = $(SRCDIR)
40530d68baSNigel Croxon
41530d68baSNigel Croxoninclude $(SRCDIR)/../Make.defaults
42530d68baSNigel Croxon
43530d68baSNigel CroxonTOPDIR = $(SRCDIR)/..
44530d68baSNigel Croxon
45530d68baSNigel CroxonCDIR=$(TOPDIR)/..
46*63a9a4d4SCallum FarmerPKGCONFIGDIR ?= $(LIBDIR)/pkgconfig
47530d68baSNigel CroxonFILES	= reloc_$(ARCH)
48530d68baSNigel Croxon
49530d68baSNigel CroxonOBJS	= $(FILES:%=%.o)
50530d68baSNigel Croxon
51530d68baSNigel Croxon# on aarch64, avoid jump tables before all relocations have been processed
52530d68baSNigel Croxonreloc_aarch64.o: CFLAGS += -fno-jump-tables
53530d68baSNigel Croxon
54530d68baSNigel CroxonTARGETS	= crt0-efi-$(ARCH).o libgnuefi.a
55530d68baSNigel Croxon
56*63a9a4d4SCallum Farmerall:	$(TARGETS) gnu-efi.pc
57530d68baSNigel Croxon
58230c36c6SNigel Croxonlibgnuefi.a: $(OBJS)
59230c36c6SNigel Croxon	$(AR) $(ARFLAGS) $@ $^
60230c36c6SNigel Croxon
61*63a9a4d4SCallum Farmergnu-efi.pc:
62*63a9a4d4SCallum Farmer	sed \
63*63a9a4d4SCallum Farmer		-e 's:@PREFIX@:$(PREFIX):g' \
64*63a9a4d4SCallum Farmer		-e 's:@EXEC_PREFIX@:$(EXEC_PREFIX):g' \
65*63a9a4d4SCallum Farmer		-e 's:@INCLUDEDIR@:$(INCLUDEDIR):g' \
66*63a9a4d4SCallum Farmer		-e 's:@LIBDIR@:$(LIBDIR):g' \
67*63a9a4d4SCallum Farmer		-e 's:@VERSION@:$(VERSION):g' \
68*63a9a4d4SCallum Farmer	$(SRCDIR)/gnu-efi.pc.in > gnu-efi.pc
69*63a9a4d4SCallum Farmer
70530d68baSNigel Croxon
71530d68baSNigel Croxonclean:
72530d68baSNigel Croxon	rm -f $(TARGETS) *~ *.o $(OBJS)
73530d68baSNigel Croxon
74530d68baSNigel Croxoninstall:
75ce7098fbSNigel Croxon	mkdir -p $(INSTALLROOT)$(LIBDIR)
76ce7098fbSNigel Croxon	$(INSTALL) -m 644 $(TARGETS) $(INSTALLROOT)$(LIBDIR)
77530d68baSNigel Croxonifneq (,$(findstring FreeBSD,$(OS)))
78530d68baSNigel Croxon ifeq ($(ARCH),x86_64)
79ce7098fbSNigel Croxon	$(INSTALL) -m 644 $(SRCDIR)/elf_$(ARCH)_fbsd_efi.lds $(INSTALLROOT)$(LIBDIR)
80530d68baSNigel Croxon else
81ce7098fbSNigel Croxon	$(INSTALL) -m 644 $(SRCDIR)/elf_$(ARCH)_efi.lds $(INSTALLROOT)$(LIBDIR)
82530d68baSNigel Croxon endif
83530d68baSNigel Croxonelse
84ce7098fbSNigel Croxon	$(INSTALL) -m 644 $(SRCDIR)/elf_$(ARCH)_efi.lds $(INSTALLROOT)$(LIBDIR)
85530d68baSNigel Croxonendif
86*63a9a4d4SCallum Farmer	$(INSTALL) -d $(INSTALLROOT)$(PKGCONFIGDIR)
87*63a9a4d4SCallum Farmer	$(INSTALL) -m 644 gnu-efi.pc $(INSTALLROOT)$(PKGCONFIGDIR)
88530d68baSNigel Croxon
89530d68baSNigel Croxoninclude $(SRCDIR)/../Make.rules
90