Add makefile to build complete SDK install.

This commit is contained in:
Paul Sokolovsky 2014-11-15 23:52:44 +02:00
parent efaa4a87d5
commit 8caefb0d35

58
Makefile Normal file
View File

@ -0,0 +1,58 @@
TOP=$(PWD)
TOOLCHAIN=$(TOP)/toolchain
all: sdk_patch $(TOOLCHAIN)/lib/libhal.a $(TOOLCHAIN)/bin/xtensa-lx106-elf-gcc
@echo
@echo "Xtensa toolchain is built, to use it:"
@echo
@echo 'export PATH=$(TOOLCHAIN)/bin:$$PATH'
@echo
@echo "Espressif ESP8266 SDK is installed, to use it run compiler as follows:"
@echo
@echo "xtensa-lx106-elf-gcc -I$(TOP)/sdk/include -L$(TOP)/sdk/lib"
@echo
sdk_patch: sdk/lib/libpp.a
sdk/lib/libpp.a: esp_iot_sdk_v0.9.2/.dir FRM_ERR_PATCH.rar
unrar x -o+ FRM_ERR_PATCH.rar
cp FRM_ERR_PATCH/*.a $$(dirname $@)
FRM_ERR_PATCH.rar:
wget --content-disposition "http://bbs.espressif.com/download/file.php?id=10"
esp_iot_sdk_v0.9.2/.dir: esp_iot_sdk_v0.9.2_14_10_24.zip
unzip $^
ln -s $$(dirname $@) sdk
touch $@
esp_iot_sdk_v0.9.2_14_10_24.zip:
wget --content-disposition "http://bbs.espressif.com/download/file.php?id=9"
$(TOOLCHAIN)/lib/libhal.a: $(TOOLCHAIN)/bin/xtensa-lx106-elf-gcc
make -C lx106-hal -f ../Makefile libhal
libhal:
autoreconf -i
PATH=$(TOOLCHAIN)/bin:$(PATH) ./configure --host=xtensa-lx106-elf --prefix=$(TOOLCHAIN)
PATH=$(TOOLCHAIN)/bin:$(PATH) make
PATH=$(TOOLCHAIN)/bin:$(PATH) make install
$(TOOLCHAIN)/bin/xtensa-lx106-elf-gcc: crosstool-NG/ct-ng
make -C crosstool-NG -f ../Makefile toolchain
toolchain:
./ct-ng xtensa-lx106-elf
sed -r -i.org s%CT_PREFIX_DIR=.*%CT_PREFIX_DIR="$(TOOLCHAIN)"% .config
sed -r -i s%CT_INSTALL_DIR_RO=y%"#"CT_INSTALL_DIR_RO=y% .config
./ct-ng build
crosstool-NG/ct-ng:
make -C crosstool-NG -f ../Makefile ct-ng
ct-ng:
./bootstrap
./configure --prefix=`pwd`
make MAKELEVEL=0
make install MAKELEVEL=0