Makefile 4.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111
  1. #
  2. # Makefile - Embedthis MakeMe Makefile wrapper for per-platform makefiles
  3. #
  4. # This Makefile is for Unix/Linux and Cygwin. On windows, it can be invoked via make.bat.
  5. #
  6. # You can use this Makefile and build via "make" with a pre-selected configuration. Alternatively,
  7. # you can build using the MakeMe tool for for a fully configurable build. If you wish to
  8. # cross-compile, you should use MakeMe.
  9. #
  10. # See projects/$(OS)-$(ARCH)-$(PROFILE)-me.h for configuration default settings. Can override
  11. # via make environment variables. For example: make ME_COM_SQLITE=0. These are converted to
  12. # DFLAGS and will then override the me.h default values. Use "make help" for a list of available
  13. # make variable options.
  14. #
  15. NAME := makeme
  16. OS := $(shell uname | sed 's/CYGWIN.*/windows/;s/Darwin/macosx/' | tr '[A-Z]' '[a-z]')
  17. PROFILE := default
  18. ifeq ($(ARCH),)
  19. ifeq ($(OS),windows)
  20. ifeq ($(PROCESSOR_ARCHITECTURE),AMD64)
  21. ARCH?=x64
  22. else
  23. ARCH?=x86
  24. endif
  25. else
  26. ARCH:= $(shell uname -m | sed 's/i.86/x86/;s/x86_64/x64/;s/mips.*/mips/')
  27. endif
  28. endif
  29. ifeq ($(OS),windows)
  30. MAKE := MAKEFLAGS= projects/windows.bat $(ARCH) nmake -nologo
  31. EXT := nmake
  32. else
  33. MAKE := $(shell if which gmake >/dev/null 2>&1; then echo gmake ; else echo make ; fi) --no-print-directory
  34. EXT := mk
  35. endif
  36. BIN := $(OS)-$(ARCH)-$(PROFILE)/bin
  37. PATH := $(PWD)/build/$(BIN):$(PATH)
  38. .EXPORT_ALL_VARIABLES:
  39. all compile:
  40. @if [ ! -f projects/$(NAME)-$(OS)-$(PROFILE).$(EXT) ] ; then \
  41. echo "The build configuration projects/$(NAME)-$(OS)-$(PROFILE).$(EXT) is not supported" ; exit 255 ; \
  42. fi
  43. @$(MAKE) -f projects/$(NAME)-$(OS)-$(PROFILE).$(EXT) $@
  44. @echo " [Info] To run locally, put $(OS)-$(ARCH)-$(PROFILE)/bin in your path."
  45. clean clobber install installBinary uninstall run:
  46. $(MAKE) -f projects/$(NAME)-$(OS)-$(PROFILE).$(EXT) $@
  47. @echo ' [Info] $@ complete'
  48. deploy:
  49. @echo ' [Deploy] $(MAKE) ME_ROOT_PREFIX=$(OS)-$(ARCH)-$(PROFILE)/deploy -f projects/$(NAME)-$(OS)-$(PROFILE). $(EXT) installBinary'
  50. @$(MAKE) ME_ROOT_PREFIX=$(OS)-$(ARCH)-$(PROFILE)/deploy -f projects/$(NAME)-$(OS)-$(PROFILE).$(EXT) installBinary
  51. version:
  52. @$(MAKE) -f projects/$(NAME)-$(OS)-$(PROFILE).$(EXT) $@
  53. boot:
  54. @rm -fr build/$(OS)-$(ARCH)-*
  55. @$(MAKE) -f projects/$(NAME)-$(OS)-$(PROFILE).$(EXT) compile
  56. build/$(OS)-$(ARCH)-$(PROFILE)/bin/me --release configure build
  57. update:
  58. git pull
  59. @$(MAKE) -f projects/$(NAME)-$(OS)-$(PROFILE).$(EXT) compile
  60. build/$(OS)-$(ARCH)-$(PROFILE)/bin/me build
  61. help:
  62. @echo '' >&2
  63. @echo 'usage: make [clean, compile, deploy, install, run, uninstall]' >&2
  64. @echo '' >&2
  65. @echo 'The default configuration can be modified by setting make variables' >&2
  66. @echo 'Set to 0 to disable and 1 to enable:' >&2
  67. @echo '' >&2
  68. @echo ' ME_MPR_LOGGING # Enable application logging' >&2
  69. @echo ' ME_MPR_TRACING # Enable debug tracing' >&2
  70. @echo ' ME_COM_MBEDTLS # Enable the mbed TLS stack' >&2
  71. @echo '' >&2
  72. @echo 'For example, to disable MBEDTLS:' >&2
  73. @echo '' >&2
  74. @echo ' ME_COM_MBEDTLS=0 make' >&2
  75. @echo '' >&2
  76. @echo 'Other make environment variables:' >&2
  77. @echo ' ARCH # CPU architecture (x86, x64, ppc, ...)' >&2
  78. @echo ' OS # Operating system (linux, macosx, windows, vxworks, ...)' >&2
  79. @echo ' CC # Compiler to use ' >&2
  80. @echo ' LD # Linker to use' >&2
  81. @echo ' CONFIG # Output directory for built items. Defaults to OS-ARCH-PROFILE' >&2
  82. @echo ' CFLAGS # Add compiler options. For example: -Wall' >&2
  83. @echo ' DEBUG # Set to "debug" for symbols, "release" for optimized builds' >&2
  84. @echo ' DFLAGS # Add compiler defines. For example: -DCOLOR=blue' >&2
  85. @echo ' IFLAGS # Add compiler include directories. For example: -I/extra/includes' >&2
  86. @echo ' LDFLAGS # Add linker options' >&2
  87. @echo ' LIBPATHS # Add linker library search directories. For example: -L/libraries' >&2
  88. @echo ' LIBS # Add linker libraries. For example: -lpthreads' >&2
  89. @echo ' PROFILE # Set to "static" for static linking or "default" for dynamic' >&2
  90. @echo '' >&2
  91. @echo 'Use "SHOW=1 make" to show executed commands.' >&2
  92. @echo '' >&2
  93. LOCAL_MAKEFILE := $(strip $(wildcard ./.local.mk))
  94. ifneq ($(LOCAL_MAKEFILE),)
  95. include $(LOCAL_MAKEFILE)
  96. endif