Makefile 2.6 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091
  1. ############################################################################
  2. # apps/fsutils/inih/Makefile
  3. #
  4. # Licensed to the Apache Software Foundation (ASF) under one or more
  5. # contributor license agreements. See the NOTICE file distributed with
  6. # this work for additional information regarding copyright ownership. The
  7. # ASF licenses this file to you under the Apache License, Version 2.0 (the
  8. # "License"); you may not use this file except in compliance with the
  9. # License. You may obtain a copy of the License at
  10. #
  11. # http://www.apache.org/licenses/LICENSE-2.0
  12. #
  13. # Unless required by applicable law or agreed to in writing, software
  14. # distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
  15. # WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
  16. # License for the specific language governing permissions and limitations
  17. # under the License.
  18. #
  19. ############################################################################
  20. include $(APPDIR)/Make.defs
  21. CP = cp -R
  22. UNPACK = tar -xzf
  23. PACKEXT = .tar.gz
  24. NXTOOLSDIR = $(APPDIR)/tools
  25. INIH_GITHUB_NAME = benhoyt/inih
  26. INIH_VERSION = r42
  27. INIH_SRC_SHA256 = 53ac3591be39a004ddc7874d0a57e7b9bc92be14192808bbef510c5c533cb1d8
  28. INIH_EXT = tar.gz
  29. INIH_SOURCES = inih-$(INIH_VERSION)
  30. INIH_TARBALL = $(INIH_VERSION).$(INIH_EXT)
  31. INIH_URL = https://github.com/$(INIH_GITHUB_NAME)/archive
  32. CSRCS = $(INIH_SOURCES)/ini.c
  33. # inih configuration from Kconfig
  34. ifeq ($(CONFIG_INIH_MULTI_LINE_ENTRIES),y)
  35. CFLAGS += -DINI_ALLOW_MULTILINE=1
  36. else
  37. CFLAGS += -DINI_ALLOW_MULTILINE=0
  38. endif
  39. ifeq ($(CONFIG_INIH_USE_MALLOC),y)
  40. CFLAGS += -DINI_USE_STACK=0
  41. CFLAGS += -DINI_ALLOW_REALLOC=1
  42. CFLAGS += -DINI_INITIAL_ALLOC=$(CONFIG_INIH_INITIAL_ALLOC)
  43. else
  44. CFLAGS += -DINI_USE_STACK=1
  45. CFLAGS += -DINI_ALLOW_REALLOC=0
  46. endif
  47. CFLAGS += -DINI_MAX_LINE=$(CONFIG_INIH_MAX_LINE)
  48. # compile-time configuration of inih
  49. CFLAGS += -DINI_ALLOW_BOM=0
  50. CFLAGS += -DINI_ALLOW_INLINE_COMMENTS=1
  51. CFLAGS += -DINI_STOP_ON_FIRST_ERROR=0
  52. CFLAGS += -DINI_HANDLER_LINENO=1
  53. # building of inih
  54. $(INIH_TARBALL):
  55. @echo "Downloading: $@"
  56. $(Q) curl -L -o $@ $(INIH_URL)/$@
  57. ${Q} $(NXTOOLSDIR)/check-hash.sh sha256 $(INIH_SRC_SHA256) $@
  58. $(INIH_SOURCES): $(INIH_TARBALL)
  59. @echo "Unpacking $< -> $@"
  60. $(Q) $(call DELDIR, $@)
  61. $(Q) $(UNPACK) $<
  62. $(Q) touch $@
  63. create_includes:
  64. $(Q) $(CP) $(INIH_SOURCES)/ini.h $(APPDIR)/include/fsutils
  65. context:: $(INIH_SOURCES)
  66. $(Q) $(MAKE) create_includes
  67. clean::
  68. $(Q) $(call DELFILE, $(APPDIR)/include/fsutils/ini.h)
  69. $(Q) $(foreach COBJ, $(COBJS), $(call DELFILE, $(COBJ)))
  70. distclean::
  71. $(Q) $(call DELDIR, $(INIH_SOURCES))
  72. $(Q) $(call DELDIR, $(INIH_TARBALL))
  73. include $(APPDIR)/Application.mk