Makefile.custom 5.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187
  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. check test: busybox busybox.links
  54. test -d $(objtree)/testsuite || cp -pPR $(srctree)/testsuite $(objtree)
  55. bindir=$(objtree) srcdir=$(srctree)/testsuite \
  56. $(SHELL) -c "cd $(objtree)/testsuite && $(srctree)/testsuite/runtest $(if $(KBUILD_VERBOSE:0=),-v)"
  57. .PHONY: release
  58. release: distclean
  59. cd ..; \
  60. rm -r -f busybox-$(VERSION).$(PATCHLEVEL).$(SUBLEVEL)$(EXTRAVERSION); \
  61. cp -pPR busybox busybox-$(VERSION).$(PATCHLEVEL).$(SUBLEVEL)$(EXTRAVERSION) && { \
  62. find busybox-$(VERSION).$(PATCHLEVEL).$(SUBLEVEL)$(EXTRAVERSION)/ -type d \
  63. -name .svn \
  64. -print \
  65. -exec rm -r -f {} \; ; \
  66. find busybox-$(VERSION).$(PATCHLEVEL).$(SUBLEVEL)$(EXTRAVERSION)/ -type d \
  67. -name .git \
  68. -print \
  69. -exec rm -r -f {} \; ; \
  70. find busybox-$(VERSION).$(PATCHLEVEL).$(SUBLEVEL)$(EXTRAVERSION)/ -type f \
  71. -name .gitignore \
  72. -print \
  73. -exec rm -f {} \; ; \
  74. find busybox-$(VERSION).$(PATCHLEVEL).$(SUBLEVEL)$(EXTRAVERSION)/ -type f \
  75. -name .\#* \
  76. -print \
  77. -exec rm -f {} \; ; \
  78. tar -czf busybox-$(VERSION).$(PATCHLEVEL).$(SUBLEVEL)$(EXTRAVERSION).tar.gz \
  79. busybox-$(VERSION).$(PATCHLEVEL).$(SUBLEVEL)$(EXTRAVERSION)/ ; }
  80. .PHONY: checkhelp
  81. checkhelp:
  82. $(Q)$(srctree)/scripts/checkhelp.awk \
  83. $(patsubst %,$(srctree)/%,$(wildcard $(patsubst %,%/Config.in,$(busybox-dirs) ./)))
  84. .PHONY: sizes
  85. sizes: busybox_unstripped
  86. $(NM) --size-sort $(<)
  87. .PHONY: bloatcheck
  88. bloatcheck: busybox_old busybox_unstripped
  89. @$(srctree)/scripts/bloat-o-meter busybox_old busybox_unstripped
  90. @$(CROSS_COMPILE)size busybox_old busybox_unstripped
  91. .PHONY: baseline
  92. baseline: busybox_unstripped
  93. @mv busybox_unstripped busybox_old
  94. .PHONY: objsizes
  95. objsizes: busybox_unstripped
  96. $(srctree)/scripts/objsizes
  97. .PHONY: stksizes
  98. stksizes: busybox_unstripped
  99. $(CROSS_COMPILE)objdump -d busybox_unstripped | $(srctree)/scripts/checkstack.pl $(ARCH) | uniq
  100. .PHONY: bigdata
  101. bigdata: busybox_unstripped
  102. $(CROSS_COMPILE)nm --size-sort busybox_unstripped | grep -vi ' [trw] '
  103. # Documentation Targets
  104. .PHONY: doc
  105. doc: docs/busybox.pod docs/BusyBox.txt docs/busybox.1 docs/BusyBox.html
  106. # FIXME: Doesn't belong here
  107. cmd_doc =
  108. quiet_cmd_doc = $(Q)echo " DOC $(@F)"
  109. silent_cmd_doc =
  110. disp_doc = $($(quiet)cmd_doc)
  111. # sed adds newlines after "Options:" etc,
  112. # this is needed in order to get good BusyBox.{1,txt,html}
  113. docs/busybox.pod: $(srctree)/docs/busybox_header.pod \
  114. include/usage.h \
  115. $(srctree)/docs/busybox_footer.pod \
  116. applets/usage_pod
  117. $(disp_doc)
  118. $(Q)-mkdir -p docs
  119. $(Q)-( \
  120. cat $(srctree)/docs/busybox_header.pod; \
  121. echo; \
  122. applets/usage_pod | sed 's/^[A-Za-z][A-Za-z ]*[a-z]:$$/&\n/'; \
  123. cat $(srctree)/docs/busybox_footer.pod; \
  124. ) > docs/busybox.pod
  125. docs/BusyBox.txt: docs/busybox.pod
  126. $(disp_doc)
  127. $(Q)-mkdir -p docs
  128. $(Q)-pod2text $< > $@
  129. docs/busybox.1: docs/busybox.pod
  130. $(disp_doc)
  131. $(Q)-mkdir -p docs
  132. $(Q)-pod2man --center=busybox --release="version $(KERNELVERSION)" $< > $@
  133. docs/BusyBox.html: docs/busybox.net/BusyBox.html
  134. $(disp_doc)
  135. $(Q)-mkdir -p docs
  136. $(Q)-rm -f docs/BusyBox.html
  137. $(Q)-cp docs/busybox.net/BusyBox.html docs/BusyBox.html
  138. docs/busybox.net/BusyBox.html: docs/busybox.pod
  139. $(Q)-mkdir -p docs/busybox.net
  140. $(Q)-pod2html --noindex $< > $@
  141. $(Q)-rm -f pod2htm*
  142. # documentation, cross-reference
  143. # Modern distributions already ship synopsis packages (e.g. debian)
  144. # If you have an old distribution go to http://synopsis.fresco.org/
  145. syn_tgt = $(wildcard $(patsubst %,%/*.c,$(busybox-alldirs)))
  146. syn = $(patsubst %.c, %.syn, $(syn_tgt))
  147. comma:= ,
  148. brace_open:= (
  149. brace_close:= )
  150. SYN_CPPFLAGS := $(strip $(CPPFLAGS) $(EXTRA_CPPFLAGS))
  151. SYN_CPPFLAGS := $(subst $(brace_open),\$(brace_open),$(SYN_CPPFLAGS))
  152. SYN_CPPFLAGS := $(subst $(brace_close),\$(brace_close),$(SYN_CPPFLAGS))
  153. #SYN_CPPFLAGS := $(subst ",\",$(SYN_CPPFLAGS))
  154. #")
  155. #SYN_CPPFLAGS := [$(patsubst %,'%'$(comma),$(SYN_CPPFLAGS))'']
  156. %.syn: %.c
  157. synopsis -p C -l Comments.SSDFilter,Comments.Previous -Wp,preprocess=True,cppflags="'$(SYN_CPPFLAGS)'" -o $@ $<
  158. .PHONY: html
  159. html: $(syn)
  160. synopsis -f HTML -Wf,title="'BusyBox Documentation'" -o $@ $^
  161. -include $(srctree)/Makefile.local