-
Notifications
You must be signed in to change notification settings - Fork 11
/
Copy pathMakefile
135 lines (103 loc) · 2.92 KB
/
Makefile
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
#
# This Source Code Form is subject to the terms of the Mozilla Public
# License, v. 2.0. If a copy of the MPL was not distributed with this
# file, You can obtain one at http://mozilla.org/MPL/2.0/.
#
# Copyright 2020 Joyent, Inc.
#
NAME = ipxe
TOP := $(shell pwd)
ROOT = $(TOP)/proto
RELEASE_TARBALL = $(NAME)-$(STAMP).tar.gz
# ipxe doesn't quite clean up after itself
CLEAN_FILES += \
src/config/local/crypto.h \
src/config/local/fault.h \
src/config/local/reboot.h \
src/config/local/usb.h \
$(ROOT) \
$(NAME)-*.tar.gz
#
# ipxe assumes GNU without using prefixed commands.
#
IPXE_ENV = \
CC=/opt/local/bin/gcc \
AS=/opt/local/bin/as \
LD=/opt/local/bin/gld \
AWK=/usr/bin/nawk \
GREP=/usr/xpg4/bin/grep \
V=1
TAR = /usr/bin/gtar
MKDIR = /usr/bin/mkdir
MKFILE = /usr/sbin/mkfile
CP = /usr/bin/cp
OBJCOPY = /opt/local/bin/objcopy
CHMOD = /usr/bin/chmod
RM = /usr/bin/rm -f
INS = /usr/sbin/install
FILEMODE = 644
DIRMODE = 755
INS.file = $(RM) $@; $(INS) -s -m $(FILEMODE) -f $(@D) $<
INS.dir = $(INS) -s -d -m $(DIRMODE) $@
EFI_BINS = ipxe.efi snponly.efi
EFI_SRC_BIN = src/bin-x86_64-efi
EFI_TARGETS = $(EFI_BINS:%=$(EFI_SRC_BIN)/%)
BOOT_BINS = \
undionly.kpxe \
default.ipxe \
ipxe.lkrn \
$(EFI_BINS)
BOOT_ROOT = $(ROOT)/boot
ROOT_BOOT_BINS = $(BOOT_BINS:%=$(BOOT_ROOT)/%)
ROOT_BOOT = $(ROOT_BOOT_BINS)
$(BOOT_ROOT)/ipxe.lkrn : FILEMODE = 755
$(BOOT_ROOT)/default.ipxe : FILEMODE = 644
$(BOOT_ROOT)/undionly.kpxe : FILEMODE = 644
# our base image is triton-origin-x86_64-19.4.0
BASE_IMAGE_UUID = 59ba2e5e-976f-4e09-8aac-a4a7ef0395f5
ENGBLD_USE_BUILDIMAGE = false
ENGBLD_REQUIRE := $(shell git submodule update --init deps/eng)
include ./deps/eng/tools/mk/Makefile.defs
TOP ?= $(error Unable to access eng.git submodule Makefiles.)
.PHONY: all
all: src/bin/ipxe.lkrn $(EFI_TARGETS)
.PHONY: install
install: all $(ROOT_BOOT)
mkdir -p $(ROOT)/etc/version
echo $(TIMESTAMP) >$(ROOT)/etc/version/ipxe
$(ROOT):
$(INS.dir)
$(BOOT_ROOT): | $(ROOT)
$(INS.dir)
$(BOOT_ROOT)/%: src/bin/% | $(BOOT_ROOT)
$(INS.file)
$(BOOT_ROOT)/ipxe.efi: src/bin-x86_64-efi/ipxe.efi | $(BOOT_ROOT)
$(INS.file)
$(BOOT_ROOT)/snponly.efi: src/bin-x86_64-efi/snponly.efi | $(BOOT_ROOT)
$(INS.file)
$(BOOT_ROOT)/%: boot/% | $(BOOT_ROOT)
$(INS.file)
src/bin/%:
(cd src && $(MAKE) bin/$(@F) $(IPXE_ENV))
src/bin-x86_64-efi/%:
(cd src && $(MAKE) bin-x86_64-efi/$(@F) $(IPXE_ENV))
.PHONY: test
test:
.PHONY: pkg
pkg: install
clean:: ipxe.clean
rm -rf $(CLEAN_FILES)
ipxe.clean:
(cd src && $(MAKE) clean $(IPXE_ENV))
release: $(RELEASE_TARBALL)
$(RELEASE_TARBALL): pkg
(cd $(ROOT); $(TAR) -I pigz -cf $(TOP)/$(RELEASE_TARBALL) .)
publish: release
@if [[ -z "$(ENGBLD_BITS_DIR)" ]]; then \
echo "error: 'ENGBLD_BITS_DIR' must be set for 'publish' target"; \
exit 1; \
fi
mkdir -p $(ENGBLD_BITS_DIR)/ipxe
cp $(RELEASE_TARBALL) $(ENGBLD_BITS_DIR)/ipxe/$(RELEASE_TARBALL)
include ./deps/eng/tools/mk/Makefile.deps
include ./deps/eng/tools/mk/Makefile.targ