Makefile.custom 5.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178
  1. # ==========================================================================
  2. # Build system
  3. # ==========================================================================
  4. busybox.links: $(srctree)/applets/busybox.mkll $(objtree)/include/autoconf.h include/applets.h
  5. $(Q)-$(SHELL) $^ >$@
  6. .PHONY: install
  7. ifeq ($(CONFIG_INSTALL_APPLET_SYMLINKS),y)
  8. INSTALL_OPTS:= --symlinks
  9. endif
  10. ifeq ($(CONFIG_INSTALL_APPLET_HARDLINKS),y)
  11. INSTALL_OPTS:= --hardlinks
  12. endif
  13. ifeq ($(CONFIG_INSTALL_APPLET_SCRIPT_WRAPPERS),y)
  14. ifeq ($(CONFIG_INSTALL_SH_APPLET_SYMLINK),y)
  15. INSTALL_OPTS:= --sw-sh-sym
  16. endif
  17. ifeq ($(CONFIG_INSTALL_SH_APPLET_HARDLINK),y)
  18. INSTALL_OPTS:= --sw-sh-hard
  19. endif
  20. ifeq ($(CONFIG_INSTALL_SH_APPLET_SCRIPT_WRAPPER),y)
  21. INSTALL_OPTS:= --scriptwrapper
  22. endif
  23. endif
  24. install: $(srctree)/applets/install.sh busybox busybox.links
  25. $(Q)DO_INSTALL_LIBS="$(strip $(LIBBUSYBOX_SONAME) $(DO_INSTALL_LIBS))" \
  26. $(SHELL) $< $(CONFIG_PREFIX) $(INSTALL_OPTS)
  27. ifeq ($(strip $(CONFIG_FEATURE_SUID)),y)
  28. @echo
  29. @echo
  30. @echo --------------------------------------------------
  31. @echo You will probably need to make your busybox binary
  32. @echo setuid root to ensure all configured applets will
  33. @echo work properly.
  34. @echo --------------------------------------------------
  35. @echo
  36. endif
  37. uninstall: busybox.links
  38. rm -f $(CONFIG_PREFIX)/bin/busybox
  39. for i in `cat busybox.links` ; do rm -f $(CONFIG_PREFIX)$$i; done
  40. ifneq ($(strip $(DO_INSTALL_LIBS)),n)
  41. for i in $(LIBBUSYBOX_SONAME) $(DO_INSTALL_LIBS); do \
  42. rm -f $(CONFIG_PREFIX)$$i; \
  43. done
  44. endif
  45. # Not very elegant: copies testsuite to objdir...
  46. # (cp -pPR is POSIX-compliant (cp -dpR or cp -a would not be))
  47. .PHONY: check
  48. .PHONY: test
  49. check test: busybox busybox.links
  50. test -d $(objtree)/testsuite || cp -pPR $(srctree)/testsuite $(objtree)
  51. bindir=$(objtree) srcdir=$(srctree)/testsuite \
  52. $(SHELL) -c "cd $(objtree)/testsuite && $(srctree)/testsuite/runtest $(if $(KBUILD_VERBOSE:0=),-v)"
  53. .PHONY: release
  54. release: distclean
  55. cd ..; \
  56. rm -r -f busybox-$(VERSION).$(PATCHLEVEL).$(SUBLEVEL)$(EXTRAVERSION); \
  57. cp -pPR busybox busybox-$(VERSION).$(PATCHLEVEL).$(SUBLEVEL)$(EXTRAVERSION) && { \
  58. find busybox-$(VERSION).$(PATCHLEVEL).$(SUBLEVEL)$(EXTRAVERSION)/ -type d \
  59. -name .svn \
  60. -print \
  61. -exec rm -r -f {} \; ; \
  62. find busybox-$(VERSION).$(PATCHLEVEL).$(SUBLEVEL)$(EXTRAVERSION)/ -type d \
  63. -name .git \
  64. -print \
  65. -exec rm -r -f {} \; ; \
  66. find busybox-$(VERSION).$(PATCHLEVEL).$(SUBLEVEL)$(EXTRAVERSION)/ -type f \
  67. -name .\#* \
  68. -print \
  69. -exec rm -f {} \; ; \
  70. tar -czf busybox-$(VERSION).$(PATCHLEVEL).$(SUBLEVEL)$(EXTRAVERSION).tar.gz \
  71. busybox-$(VERSION).$(PATCHLEVEL).$(SUBLEVEL)$(EXTRAVERSION)/ ; }
  72. .PHONY: checkhelp
  73. checkhelp:
  74. $(Q)$(srctree)/scripts/checkhelp.awk \
  75. $(patsubst %,$(srctree)/%,$(wildcard $(patsubst %,%/Config.in,$(busybox-dirs) ./)))
  76. .PHONY: sizes
  77. sizes: busybox_unstripped
  78. $(NM) --size-sort $(<)
  79. .PHONY: bloatcheck
  80. bloatcheck: busybox_old busybox_unstripped
  81. @$(srctree)/scripts/bloat-o-meter busybox_old busybox_unstripped
  82. @$(CROSS_COMPILE)size busybox_old busybox_unstripped
  83. .PHONY: baseline
  84. baseline: busybox_unstripped
  85. @mv busybox_unstripped busybox_old
  86. .PHONY: objsizes
  87. objsizes: busybox_unstripped
  88. $(srctree)/scripts/objsizes
  89. .PHONY: stksizes
  90. stksizes: busybox_unstripped
  91. $(CROSS_COMPILE)objdump -d busybox_unstripped | $(srctree)/scripts/checkstack.pl $(ARCH) | uniq
  92. .PHONY: bigdata
  93. bigdata: busybox_unstripped
  94. $(CROSS_COMPILE)nm --size-sort busybox_unstripped | grep -vi ' [trw] '
  95. # Documentation Targets
  96. .PHONY: doc
  97. doc: docs/busybox.pod docs/BusyBox.txt docs/busybox.1 docs/BusyBox.html
  98. # FIXME: Doesn't belong here
  99. cmd_doc =
  100. quiet_cmd_doc = $(Q)echo " DOC $(@F)"
  101. silent_cmd_doc =
  102. disp_doc = $($(quiet)cmd_doc)
  103. # sed adds newlines after "Options:" etc,
  104. # this is needed in order to get good BusyBox.{1,txt,html}
  105. docs/busybox.pod: $(srctree)/docs/busybox_header.pod \
  106. include/usage.h \
  107. $(srctree)/docs/busybox_footer.pod \
  108. applets/usage_pod
  109. $(disp_doc)
  110. $(Q)-mkdir -p docs
  111. $(Q)-( \
  112. cat $(srctree)/docs/busybox_header.pod; \
  113. echo; \
  114. applets/usage_pod | sed 's/^[A-Za-z][A-Za-z ]*[a-z]:$$/&\n/'; \
  115. cat $(srctree)/docs/busybox_footer.pod; \
  116. ) > docs/busybox.pod
  117. docs/BusyBox.txt: docs/busybox.pod
  118. $(disp_doc)
  119. $(Q)-mkdir -p docs
  120. $(Q)-pod2text $< > $@
  121. docs/busybox.1: docs/busybox.pod
  122. $(disp_doc)
  123. $(Q)-mkdir -p docs
  124. $(Q)-pod2man --center=busybox --release="version $(KERNELVERSION)" $< > $@
  125. docs/BusyBox.html: docs/busybox.net/BusyBox.html
  126. $(disp_doc)
  127. $(Q)-mkdir -p docs
  128. $(Q)-rm -f docs/BusyBox.html
  129. $(Q)-cp docs/busybox.net/BusyBox.html docs/BusyBox.html
  130. docs/busybox.net/BusyBox.html: docs/busybox.pod
  131. $(Q)-mkdir -p docs/busybox.net
  132. $(Q)-pod2html --noindex $< > $@
  133. $(Q)-rm -f pod2htm*
  134. # documentation, cross-reference
  135. # Modern distributions already ship synopsis packages (e.g. debian)
  136. # If you have an old distribution go to http://synopsis.fresco.org/
  137. syn_tgt = $(wildcard $(patsubst %,%/*.c,$(busybox-alldirs)))
  138. syn = $(patsubst %.c, %.syn, $(syn_tgt))
  139. comma:= ,
  140. brace_open:= (
  141. brace_close:= )
  142. SYN_CPPFLAGS := $(strip $(CPPFLAGS) $(EXTRA_CPPFLAGS))
  143. SYN_CPPFLAGS := $(subst $(brace_open),\$(brace_open),$(SYN_CPPFLAGS))
  144. SYN_CPPFLAGS := $(subst $(brace_close),\$(brace_close),$(SYN_CPPFLAGS))
  145. #SYN_CPPFLAGS := $(subst ",\",$(SYN_CPPFLAGS))
  146. #")
  147. #SYN_CPPFLAGS := [$(patsubst %,'%'$(comma),$(SYN_CPPFLAGS))'']
  148. %.syn: %.c
  149. synopsis -p C -l Comments.SSDFilter,Comments.Previous -Wp,preprocess=True,cppflags="'$(SYN_CPPFLAGS)'" -o $@ $<
  150. .PHONY: html
  151. html: $(syn)
  152. synopsis -f HTML -Wf,title="'BusyBox Documentation'" -o $@ $^
  153. -include $(srctree)/Makefile.local