Makefile 2.8 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798
  1. .PHONY: all install clean distclean configure
  2. .NOTPARALLEL:
  3. include ../versions.mak
  4. export JANSSON_DIR := $(shell pwd -P)
  5. SPECIAL_TARGETS :=
  6. ifneq ($(findstring configure,$(MAKECMDGOALS)),)
  7. # Run from $(ASTTOPDIR)/configure
  8. SPECIAL_TARGETS += configure
  9. endif
  10. ifeq ($(findstring clean,$(MAKECMDGOALS)),clean)
  11. # clean or distclean
  12. SPECIAL_TARGETS += clean
  13. endif
  14. ifeq ($(findstring uninstall,$(MAKECMDGOALS)),uninstall)
  15. SPECIAL_TARGETS += uninstall
  16. endif
  17. ifneq ($(wildcard ../../makeopts),)
  18. include ../../makeopts
  19. endif
  20. ifeq ($(SPECIAL_TARGETS),)
  21. # Run locally or from $(ASTTOPDIR)/Makefile. All include files should be present
  22. ifeq ($(wildcard ../../makeopts),)
  23. $(error ASTTOPDIR/configure hasn't been run)
  24. endif
  25. ifeq ($(JANSSON_BUNDLED),yes)
  26. ifneq ($(wildcard ../../menuselect.makeopts),)
  27. include ../../menuselect.makeopts
  28. else
  29. $(warning ASTTOPDIR/menuselect hasn't been run yet. Can't find debug options.)
  30. endif
  31. all: dest/include/jansson.h
  32. else
  33. all:
  34. endif
  35. endif
  36. include ../../Makefile.rules
  37. include ../Makefile.rules
  38. include Makefile.rules
  39. ECHO_PREFIX := $(ECHO_PREFIX) echo '[jansson] '
  40. SHELL_ECHO_PREFIX := echo '[jansson] '
  41. dest/include/jansson.h: source/config.status
  42. $(ECHO_PREFIX) Building bundled jansson.
  43. $(CMD_PREFIX) (cd source; make $(REALLY_QUIET))
  44. $(CMD_PREFIX) (cd source; make install DESTDIR= $(REALLY_QUIET))
  45. .DELETE_ON_ERROR:
  46. $(DOWNLOAD_DIR)/$(TARBALL_FILE): ../versions.mak
  47. $(CMD_PREFIX) ($(TARBALL_EXISTS) && $(TARBALL_VERIFY) && touch $@) || (rm -rf $@ ;\
  48. $(TARBALL_DOWNLOAD)) || (rm -rf $@ ;\
  49. $(SHELL_ECHO_PREFIX) Retrying download ; $(TARBALL_DOWNLOAD))
  50. source/.unpacked: $(DOWNLOAD_DIR)/$(TARBALL_FILE)
  51. $(CMD_PREFIX) $(TARBALL_VERIFY) || (rm -rf $@ ;\
  52. $(SHELL_ECHO_PREFIX) Retrying download ; $(TARBALL_DOWNLOAD))
  53. $(ECHO_PREFIX) Unpacking $<
  54. -@rm -rf source jansson-*/ >/dev/null 2>&1
  55. $(CMD_PREFIX) $(TAR) -xjf $<
  56. @mv jansson-$(JANSSON_VERSION) source
  57. $(ECHO_PREFIX) Applying patches "$(realpath patches)" "$(realpath .)/source"
  58. $(CMD_PREFIX) ../apply_patches $(QUIET_CONFIGURE) "$(realpath patches)" "$(realpath .)/source"
  59. -@touch source/.unpacked
  60. .rebuild_needed: $(wildcard ../../.lastclean)
  61. $(ECHO_PREFIX) Rebuilding
  62. $(CMD_PREFIX) $(MAKE) clean $(REALLY_QUIET)
  63. source/config.status: source/.unpacked Makefile.rules .rebuild_needed
  64. $(ECHO_PREFIX) Configuring
  65. $(CMD_PREFIX) (cd source ; ./configure $(QUIET_CONFIGURE) $(JANSSON_CONFIG_OPTS) --disable-shared \
  66. --enable-static --prefix=$(JANSSON_DIR)/dest --libdir=$(JANSSON_DIR)/dest/lib)
  67. configure: source/config.status
  68. install:
  69. uninstall:
  70. clean:
  71. $(ECHO_PREFIX) Cleaning
  72. +-$(CMD_PREFIX) test -d source dest && $(SUBMAKE) -C source clean || :
  73. distclean:
  74. $(ECHO_PREFIX) Distcleaning
  75. -$(CMD_PREFIX) rm -rf source jansson-*.tar.bz2 .rebuild_needed