Changes to Makefiles to support cross-compiling ARM64 binaries on
[refind] / Makefile
1 # Makefile for rEFInd
2
3 # This program is licensed under the terms of the GNU GPL, version 3,
4 # or (at your option) any later version.
5 # You should have received a copy of the GNU General Public License
6 # along with this program. If not, see <http://www.gnu.org/licenses/>.
7
8 CXXFLAGS=-O2 -fpic -D_REENTRANT -D_GNU_SOURCE -Wall -g
9 NAMES=refind
10 SRCS=$(NAMES:=.c)
11 OBJS=$(NAMES:=.o)
12 HEADERS=$(NAMES:=.h)
13 LOADER_DIR=refind
14 FS_DIR=filesystems
15 LIBEG_DIR=libeg
16 MOK_DIR=mok
17 GPTSYNC_DIR=gptsync
18 EFILIB_DIR=EfiLib
19
20 export EDK2BASE = /usr/local/UDK2014/MyWorkSpace
21 export GENFW = $(EDK2BASE)/BaseTools/Source/C/bin/GenFw
22 export prefix = /usr/bin/
23 ifeq ($(ARCH),aarch64)
24 export CC = $(prefix)aarch64-linux-gnu-gcc
25 export AS = $(prefix)aarch64-linux-gnu-as
26 export LD = $(prefix)aarch64-linux-gnu-ld
27 export AR = $(prefix)aarch64-linux-gnu-ar
28 export RANLIB = $(prefix)aarch64-linux-gnu-ranlib
29 export OBJCOPY = $(prefix)aarch64-linux-gnu-objcopy
30 else
31 export CC = $(prefix)gcc
32 export AS = $(prefix)as
33 export LD = $(prefix)ld
34 export AR = $(prefix)ar
35 export RANLIB = $(prefix)ranlib
36 export OBJCOPY = $(prefix)objcopy
37 endif
38
39 # Build rEFInd, including libeg
40 all: tiano
41
42 gnuefi:
43 +make -C $(LIBEG_DIR)
44 +make -C $(MOK_DIR)
45 +make -C $(EFILIB_DIR)
46 +make -C $(LOADER_DIR)
47 +make -C $(GPTSYNC_DIR) gnuefi
48 # +make -C $(FS_DIR) all_gnuefi
49
50 fs:
51 +make -C $(FS_DIR)
52
53 fs_gnuefi:
54 +make -C $(FS_DIR) all_gnuefi
55
56 tiano:
57 +make AR_TARGET=EfiLib -C $(EFILIB_DIR) -f Make.tiano
58 +make AR_TARGET=libeg -C $(LIBEG_DIR) -f Make.tiano
59 +make AR_TARGET=mok -C $(MOK_DIR) -f Make.tiano
60 +make BUILDME=refind DLL_TARGET=refind -C $(LOADER_DIR) -f Make.tiano
61 ifneq ($(ARCH),aarch64)
62 +make -C $(GPTSYNC_DIR) -f Make.tiano
63 endif
64 # +make -C $(FS_DIR)
65
66 gptsync:
67 +make -C $(GPTSYNC_DIR) -f Make.tiano
68
69 gptsync_gnuefi:
70 +make -C $(GPTSYNC_DIR) gnuefi
71
72 clean:
73 make -C $(LIBEG_DIR) clean
74 make -C $(MOK_DIR) clean
75 make -C $(LOADER_DIR) clean
76 make -C $(EFILIB_DIR) clean
77 make -C $(FS_DIR) clean
78 make -C $(GPTSYNC_DIR) clean
79 rm -f include/*~
80
81 # NOTE TO DISTRIBUTION MAINTAINERS:
82 # The "install" target installs the program directly to the ESP
83 # and it modifies the *CURRENT COMPUTER's* NVRAM. Thus, you should
84 # *NOT* use this target as part of the build process for your
85 # binary packages (RPMs, Debian packages, etc.). (Gentoo could
86 # use it in an ebuild, though....) You COULD, however, copy the
87 # files to a directory somewhere (/usr/share/refind or whatever)
88 # and then call refind-install as part of the binary package
89 # installation process.
90
91 install:
92 ./refind-install
93
94 # DO NOT DELETE