Makefile 658 B

123456789101112131415161718192021222324252627282930313233343536
  1. CC ?= gcc
  2. CXX ?= g++
  3. CMAKE ?= cmake
  4. CMAKE_BUILD_TYPE ?= Release
  5. define build_cross
  6. -rm -fr build-$(2)
  7. mkdir build-$(2)
  8. cd build-$(2) && \
  9. $(CMAKE) \
  10. -D CMAKE_BUILD_TYPE=$(CMAKE_BUILD_TYPE) \
  11. -D CMAKE_TOOLCHAIN_FILE=cmake/$(1)-$(2).cmake \
  12. ..
  13. make -j$$((nproc+1)) VERBOSE=$(VERBOSE) -C build-$(2)
  14. endef
  15. .PHONY: imx6 ath79
  16. all:
  17. -rm -fr build
  18. mkdir build
  19. cd build && CC=$(CC) CXX=$(CXX) $(CMAKE) \
  20. -D CMAKE_BUILD_TYPE=$(CMAKE_BUILD_TYPE) \
  21. ..
  22. make -j$$((nproc+1)) VERBOSE=$(VERBOSE) -C build
  23. imx6:
  24. $(call build_cross,openwrt-toolchain,$@)
  25. ath79:
  26. $(call build_cross,openwrt-toolchain,$@)
  27. clean:
  28. @-rm -fr build*
  29. -include local.mk