Makefile.custom 6.0 KB

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