diff --git a/Makefile b/Makefile index 78c6fbed2..dc3befa93 100644 --- a/Makefile +++ b/Makefile @@ -1,6 +1,9 @@ # the repository might not have been checked out yet, so make this # able to fail: --include koreader-base/Makefile.defs +-include $(KOR_BASE)/Makefile.defs + +# koreader-base directory +KOR_BASE=koreader-base # we want VERSION to carry the version of koreader, not koreader-base VERSION=$(shell git describe HEAD) @@ -14,50 +17,49 @@ EMU_DIR=emu # files to copy from main directory LUA_FILES=reader.lua -all: koreader-base/koreader-base koreader-base/extr +all: $(KOR_BASE)/koreader-base $(KOR_BASE)/extr -koreader-base/koreader-base: - cd koreader-base && make koreader-base - -koreader-base/extr: - cd koreader-base && make extr +$(KOR_BASE)/koreader-base $(KOR_BASE)/extr: + make -C $(KOR_BASE) koreader-base extr fetchthirdparty: git submodule init git submodule update - cd koreader-base && make fetchthirdparty + make -C $(KOR_BASE) fetchthirdparty clean: - cd koreader-base && make clean + make -C $(KOR_BASE) clean cleanthirdparty: - cd koreader-base && make cleanthirdparty + make -C $(KOR_BASE) cleanthirdparty bootstrapemu: test -d $(EMU_DIR) || mkdir $(EMU_DIR) - test -d $(EMU_DIR)/libs-emu || (cd $(EMU_DIR) && ln -s ../koreader-base/libs-emu ./) - test -d $(EMU_DIR)/fonts || (cd $(EMU_DIR) && ln -s ../koreader-base/fonts ./) - test -d $(EMU_DIR)/data || (cd $(EMU_DIR) && ln -s ../koreader-base/data ./) + test -d $(EMU_DIR)/libs-emu || (cd $(EMU_DIR) && ln -s ../$(KOR_BASE)/libs-emu ./) + test -d $(EMU_DIR)/fonts || (cd $(EMU_DIR) && ln -s ../$(KOR_BASE)/fonts ./) + test -d $(EMU_DIR)/data || (cd $(EMU_DIR) && ln -s ../$(KOR_BASE)/data ./) test -d $(EMU_DIR)/frontend || (cd $(EMU_DIR) && ln -s ../frontend ./) test -d $(EMU_DIR)/resources || (cd $(EMU_DIR) && ln -s ../resources ./) - test -e $(EMU_DIR)/koreader-base || (cd $(EMU_DIR) && ln -s ../koreader-base/koreader-base ./) - test -e $(EMU_DIR)/extr || (cd $(EMU_DIR) && ln -s ../koreader-base/extr ./) + test -e $(EMU_DIR)/koreader-base || (cd $(EMU_DIR) && ln -s ../$(KOR_BASE)/koreader-base ./) + test -e $(EMU_DIR)/extr || (cd $(EMU_DIR) && ln -s ../$(KOR_BASE)/extr ./) test -e $(EMU_DIR)/reader.lua || (cd $(EMU_DIR) && ln -s ../reader.lua ./) -customupdate: koreader-base/koreader-base koreader-base/extr +customupdate: $(KOR_BASE)/koreader-base $(KOR_BASE)/extr # ensure that the binaries were built for ARM - file koreader-base/koreader-base | grep ARM || exit 1 - file koreader-base/extr | grep ARM || exit 1 + file $(KOR_BASE)/koreader-base | grep ARM || exit 1 + file $(KOR_BASE)/extr | grep ARM || exit 1 + # remove old package and dir if any rm -f koreader-$(VERSION).zip rm -rf $(INSTALL_DIR) + # create new dir for package mkdir -p $(INSTALL_DIR)/{history,screenshots,clipboard,libs} - cp -p README.md COPYING koreader-base/koreader-base koreader-base/extr kpdf.sh $(LUA_FILES) $(INSTALL_DIR) + cp -p README.md COPYING $(KOR_BASE)/{koreader-base,extr} kpdf.sh $(LUA_FILES) $(INSTALL_DIR) $(STRIP) --strip-unneeded $(INSTALL_DIR)/koreader-base $(INSTALL_DIR)/extr mkdir $(INSTALL_DIR)/data - cp -L koreader-base/$(DJVULIB) koreader-base/$(CRELIB) koreader-base/$(LUALIB) koreader-base/$(K2PDFOPTLIB) $(INSTALL_DIR)/libs + cp -L koreader-base/$(DJVULIB) $(KOR_BASE)/$(CRELIB) $(KOR_BASE)/$(LUALIB) $(KOR_BASE)/$(K2PDFOPTLIB) $(INSTALL_DIR)/libs $(STRIP) --strip-unneeded $(INSTALL_DIR)/libs/* - cp -rpL koreader-base/data/*.css $(INSTALL_DIR)/data - cp -rpL koreader-base/fonts $(INSTALL_DIR) + cp -rpL $(KOR_BASE)/data/*.css $(INSTALL_DIR)/data + cp -rpL $(KOR_BASE)/fonts $(INSTALL_DIR) rm $(INSTALL_DIR)/fonts/droid/DroidSansFallbackFull.ttf echo $(VERSION) > git-rev cp -r git-rev resources $(INSTALL_DIR) @@ -65,4 +67,5 @@ customupdate: koreader-base/koreader-base koreader-base/extr mkdir $(INSTALL_DIR)/fonts/host zip -9 -r koreader-$(VERSION).zip $(INSTALL_DIR) launchpad/ extensions/ rm -rf $(INSTALL_DIR) - @echo "copy koreader-$(VERSION).zip to /mnt/us/customupdates and install with shift+shift+I" + # @TODO write a installation script in KUAL (houqp) +