summaryrefslogtreecommitdiff
path: root/payloads/nvramcui/Makefile
blob: 0f27ff88edf3f6fbe1b74ff33d4bf42a422c3ad1 (plain)
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
LIBPAYLOAD_DIR=$(CURDIR)/libpayload
XCOMPILE=$(LIBPAYLOAD_DIR)/libpayload.xcompile
# build libpayload and put .config file in $(CURDIR) instead of ../libpayload
# to avoid pollute the libpayload source directory and possible conflicts
LPOPTS=obj="$(CURDIR)/build" DESTDIR="$(CURDIR)" DOTCONFIG="$(CURDIR)/.config"

all: nvramcui.elf

libpayload:
	$(MAKE) -C ../libpayload $(LPOPTS) defconfig
	$(MAKE) -C ../libpayload $(LPOPTS)
	$(MAKE) -C ../libpayload $(LPOPTS) install

ifneq ($(strip $(wildcard libpayload)),)
include $(XCOMPILE)
LPGCC = CC="$(GCC_CC_x86_32)" "$(LIBPAYLOAD_DIR)/bin/lpgcc"
%.elf: %.c
	$(LPGCC) -o $*.elf $*.c
else
# If libpayload is not found, first build libpayload,
# then do the make, this time it'll find libpayload
# and generate the nvramcui.elf target
%.elf: libpayload
	$(MAKE) all
endif

.PHONY:
clean:
	rm -f nvramcui.elf

distclean: clean
	rm -rf build libpayload .config