Makefile 4.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112
  1. #
  2. # Copyright (C) 2006-2010 OpenWrt.org
  3. #
  4. # This is free software, licensed under the GNU General Public License v2.
  5. # See /LICENSE for more information.
  6. #
  7. curdir:=package
  8. include $(INCLUDE_DIR)/feeds.mk
  9. include $(INCLUDE_DIR)/rootfs.mk
  10. -include $(TMP_DIR)/.packagedeps
  11. package-y += kernel/linux
  12. $(curdir)/autoremove:=1
  13. $(curdir)/builddirs:=$(sort $(package-) $(package-y) $(package-m))
  14. $(curdir)/builddirs-default:=. $(sort $(package-y) $(package-m))
  15. $(curdir)/builddirs-prereq:=. $(sort $(prereq-y) $(prereq-m))
  16. ifdef CHECK_ALL
  17. $(curdir)/builddirs-check:=$($(curdir)/builddirs)
  18. $(curdir)/builddirs-download:=$($(curdir)/builddirs)
  19. endif
  20. ifneq ($(IGNORE_ERRORS),)
  21. package-y-filter := $(package-y)
  22. package-m-filter := $(filter-out $(package-y),$(package-m))
  23. package-n-filter := $(filter-out $(package-y) $(package-m),$(package-))
  24. package-ignore-errors := $(filter n m y,$(IGNORE_ERRORS))
  25. package-ignore-errors := $(if $(package-ignore-errors),$(package-ignore-errors),n m)
  26. package-ignore-subdirs := $(sort $(foreach m,$(package-ignore-errors),$(package-$(m)-filter)))
  27. $(curdir)/builddirs-ignore-download := $(package-ignore-subdirs)
  28. $(curdir)/builddirs-ignore-compile := $(package-ignore-subdirs)
  29. $(curdir)/builddirs-ignore-host-download := $(package-ignore-subdirs)
  30. $(curdir)/builddirs-ignore-host-compile := $(package-ignore-subdirs)
  31. endif
  32. PACKAGE_INSTALL_FILES:= \
  33. $(foreach pkg,$(sort $(package-y)), \
  34. $(foreach variant, \
  35. $(if $(strip $(package/$(pkg)/variants)), \
  36. $(package/$(pkg)/variants), \
  37. $(if $(package/$(pkg)/default-variant), \
  38. $(package/$(pkg)/default-variant), \
  39. default \
  40. ) \
  41. ), \
  42. $(PKG_INFO_DIR)/$(lastword $(subst /,$(space),$(pkg))).$(variant).install \
  43. ) \
  44. )
  45. $(curdir)/cleanup: $(TMP_DIR)/.build
  46. rm -rf $(STAGING_DIR_ROOT)
  47. $(curdir)/merge:
  48. rm -rf $(PACKAGE_DIR_ALL)
  49. mkdir -p $(PACKAGE_DIR_ALL)
  50. -$(foreach pdir,$(PACKAGE_SUBDIRS),$(if $(wildcard $(pdir)/*.ipk),ln -s $(pdir)/*.ipk $(PACKAGE_DIR_ALL);))
  51. $(curdir)/merge-index: $(curdir)/merge
  52. (cd $(PACKAGE_DIR_ALL) && $(SCRIPT_DIR)/ipkg-make-index.sh . 2>&1 > Packages; )
  53. ifndef SDK
  54. $(curdir)/compile: $(curdir)/system/opkg/host/compile
  55. endif
  56. $(curdir)/install: $(TMP_DIR)/.build $(curdir)/merge $(if $(CONFIG_TARGET_PER_DEVICE_ROOTFS),$(curdir)/merge-index)
  57. - find $(STAGING_DIR_ROOT) -type d | $(XARGS) chmod 0755
  58. rm -rf $(TARGET_DIR) $(TARGET_DIR_ORIG)
  59. mkdir -p $(TARGET_DIR)/tmp
  60. $(call opkg,$(TARGET_DIR)) install \
  61. $(call opkg_package_files,$(foreach pkg,$(shell cat $(PACKAGE_INSTALL_FILES) 2>/dev/null),$(pkg)$(call GetABISuffix,$(pkg))))
  62. @for file in $(PACKAGE_INSTALL_FILES); do \
  63. [ -s $$file.flags ] || continue; \
  64. for flag in `cat $$file.flags`; do \
  65. $(call opkg,$(TARGET_DIR)) flag $$flag `cat $$file`; \
  66. done; \
  67. done || true
  68. $(CP) $(TARGET_DIR) $(TARGET_DIR_ORIG)
  69. $(call prepare_rootfs,$(TARGET_DIR),$(TOPDIR)/files)
  70. $(curdir)/index: FORCE
  71. @echo Generating package index...
  72. @for d in $(PACKAGE_SUBDIRS); do ( \
  73. mkdir -p $$d; \
  74. cd $$d || continue; \
  75. $(SCRIPT_DIR)/ipkg-make-index.sh . 2>&1 > Packages.manifest; \
  76. grep -vE '^(Maintainer|LicenseFiles|Source|SourceName|Require|SourceDateEpoch)' Packages.manifest > Packages; \
  77. case "$$(((64 + $$(stat -L -c%s Packages)) % 128))" in 110|111) \
  78. $(call ERROR_MESSAGE,WARNING: Applying padding in $$d/Packages to workaround usign SHA-512 bug!); \
  79. { echo ""; echo ""; } >> Packages;; \
  80. esac; \
  81. gzip -9nc Packages > Packages.gz; \
  82. ); done
  83. ifdef CONFIG_SIGNED_PACKAGES
  84. @echo Signing package index...
  85. @for d in $(PACKAGE_SUBDIRS); do ( \
  86. [ -d $$d ] && \
  87. cd $$d || continue; \
  88. $(STAGING_DIR_HOST)/bin/usign -S -m Packages -s $(BUILD_KEY); \
  89. ); done
  90. endif
  91. $(curdir)/flags-install:= -j1
  92. $(eval $(call stampfile,$(curdir),package,prereq,.config))
  93. $(eval $(call stampfile,$(curdir),package,cleanup,$(TMP_DIR)/.build))
  94. $(eval $(call stampfile,$(curdir),package,compile,$(TMP_DIR)/.build))
  95. $(eval $(call stampfile,$(curdir),package,install,$(TMP_DIR)/.build))
  96. $(eval $(call stampfile,$(curdir),package,check,$(TMP_DIR)/.build))
  97. $(eval $(call subdir,$(curdir)))