blob: 0f27ff88edf3f6fbe1b74ff33d4bf42a422c3ad1 [file] [log] [blame]
Iru Caie44b4072016-04-15 13:42:11 +08001LIBPAYLOAD_DIR=$(CURDIR)/libpayload
2XCOMPILE=$(LIBPAYLOAD_DIR)/libpayload.xcompile
3# build libpayload and put .config file in $(CURDIR) instead of ../libpayload
4# to avoid pollute the libpayload source directory and possible conflicts
5LPOPTS=obj="$(CURDIR)/build" DESTDIR="$(CURDIR)" DOTCONFIG="$(CURDIR)/.config"
Denis 'GNUtoo' Carikli7d824992016-01-25 09:20:24 +01006
7all: nvramcui.elf
8
Iru Caie44b4072016-04-15 13:42:11 +08009libpayload:
10 $(MAKE) -C ../libpayload $(LPOPTS) defconfig
11 $(MAKE) -C ../libpayload $(LPOPTS)
12 $(MAKE) -C ../libpayload $(LPOPTS) install
13
14ifneq ($(strip $(wildcard libpayload)),)
15include $(XCOMPILE)
16LPGCC = CC="$(GCC_CC_x86_32)" "$(LIBPAYLOAD_DIR)/bin/lpgcc"
17%.elf: %.c
Denis 'GNUtoo' Carikli7d824992016-01-25 09:20:24 +010018 $(LPGCC) -o $*.elf $*.c
Iru Caie44b4072016-04-15 13:42:11 +080019else
20# If libpayload is not found, first build libpayload,
21# then do the make, this time it'll find libpayload
22# and generate the nvramcui.elf target
23%.elf: libpayload
24 $(MAKE) all
25endif
Denis 'GNUtoo' Carikli7d824992016-01-25 09:20:24 +010026
27.PHONY:
28clean:
29 rm -f nvramcui.elf
Martin Rothc3fbda42016-03-07 16:40:14 -070030
31distclean: clean
Iru Caie44b4072016-04-15 13:42:11 +080032 rm -rf build libpayload .config