Iru Cai | e44b407 | 2016-04-15 13:42:11 +0800 | [diff] [blame] | 1 | LIBPAYLOAD_DIR=$(CURDIR)/libpayload |
| 2 | XCOMPILE=$(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 |
| 5 | LPOPTS=obj="$(CURDIR)/build" DESTDIR="$(CURDIR)" DOTCONFIG="$(CURDIR)/.config" |
Denis 'GNUtoo' Carikli | 7d82499 | 2016-01-25 09:20:24 +0100 | [diff] [blame] | 6 | |
| 7 | all: nvramcui.elf |
| 8 | |
Iru Cai | e44b407 | 2016-04-15 13:42:11 +0800 | [diff] [blame] | 9 | libpayload: |
| 10 | $(MAKE) -C ../libpayload $(LPOPTS) defconfig |
| 11 | $(MAKE) -C ../libpayload $(LPOPTS) |
| 12 | $(MAKE) -C ../libpayload $(LPOPTS) install |
| 13 | |
| 14 | ifneq ($(strip $(wildcard libpayload)),) |
| 15 | include $(XCOMPILE) |
| 16 | LPGCC = CC="$(GCC_CC_x86_32)" "$(LIBPAYLOAD_DIR)/bin/lpgcc" |
| 17 | %.elf: %.c |
Denis 'GNUtoo' Carikli | 7d82499 | 2016-01-25 09:20:24 +0100 | [diff] [blame] | 18 | $(LPGCC) -o $*.elf $*.c |
Iru Cai | e44b407 | 2016-04-15 13:42:11 +0800 | [diff] [blame] | 19 | else |
| 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 |
| 25 | endif |
Denis 'GNUtoo' Carikli | 7d82499 | 2016-01-25 09:20:24 +0100 | [diff] [blame] | 26 | |
| 27 | .PHONY: |
| 28 | clean: |
| 29 | rm -f nvramcui.elf |
Martin Roth | c3fbda4 | 2016-03-07 16:40:14 -0700 | [diff] [blame] | 30 | |
| 31 | distclean: clean |
Iru Cai | e44b407 | 2016-04-15 13:42:11 +0800 | [diff] [blame] | 32 | rm -rf build libpayload .config |