Makefile.IMA 6.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210
  1. # This is completely unsupported.
  2. #
  3. # Uasge: make -f scripts/Makefile.IMA
  4. #
  5. # Fix COMBINED_COMPILE upstream (in the Kbuild) and propagate
  6. # the changes back
  7. srctree := $(if $(KBUILD_SRC),$(KBUILD_SRC),$(CURDIR))
  8. objtree := $(CURDIR)
  9. src := $(srctree)
  10. obj := $(objtree)
  11. # Make generated files
  12. DUMMY := $(shell $(Q)$(srctree)/scripts/gen_build_files.sh $(srctree) $(objtree) >&2)
  13. # Look for make include files relative to root of src
  14. MAKEFLAGS += --include-dir=$(srctree)
  15. default: busybox
  16. include .config
  17. # Cross compiling and selecting different set of gcc/bin-utils
  18. ifeq ($(CROSS_COMPILE),)
  19. CROSS_COMPILE := $(subst ",,$(CONFIG_CROSS_COMPILER_PREFIX))
  20. endif
  21. ifneq ($(CROSS_COMPILE),)
  22. SUBARCH := $(shell echo $(CROSS_COMPILE) | cut -d- -f1)
  23. else
  24. SUBARCH := $(shell uname -m)
  25. endif
  26. SUBARCH := $(shell echo $(SUBARCH) | sed -e s/i.86/i386/ -e s/sun4u/sparc64/ \
  27. -e s/arm.*/arm/ -e s/sa110/arm/ \
  28. -e s/s390x/s390/ -e s/parisc64/parisc/ \
  29. -e s/ppc.*/powerpc/ -e s/mips.*/mips/ )
  30. ARCH ?= $(SUBARCH)
  31. ifndef HOSTCC
  32. HOSTCC = cc
  33. endif
  34. AS = $(CROSS_COMPILE)as
  35. CC = $(CROSS_COMPILE)gcc
  36. LD = $(CC) -nostdlib
  37. CPP = $(CC) -E
  38. AR = $(CROSS_COMPILE)ar
  39. NM = $(CROSS_COMPILE)nm
  40. STRIP = $(CROSS_COMPILE)strip
  41. OBJCOPY = $(CROSS_COMPILE)objcopy
  42. OBJDUMP = $(CROSS_COMPILE)objdump
  43. CFLAGS := $(CFLAGS)
  44. # We need some generic definitions
  45. include $(srctree)/scripts/Kbuild.include
  46. include Makefile.flags
  47. -include $(srctree)/arch/$(ARCH)/Makefile
  48. ifdef CONFIG_FEATURE_COMPRESS_USAGE
  49. usage_stuff = include/usage_compressed.h
  50. endif
  51. ifndef BB_VER
  52. BB_VER:=""
  53. endif
  54. WHOLE_PROGRAM:=$(call cc-option,-fwhole-program,)
  55. # pull in the config stuff
  56. lib-all-y := applets/applets.o
  57. lib-y:=
  58. include procps/Kbuild
  59. lib-all-y += $(patsubst %,procps/%,$(sort $(lib-y)))
  60. lib-y:=
  61. include networking/Kbuild
  62. lib-all-y += $(patsubst %,networking/%,$(sort $(lib-y)))
  63. lib-y:=
  64. include networking/udhcp/Kbuild
  65. lib-all-y += $(patsubst %,networking/udhcp/%,$(sort $(lib-y)))
  66. lib-y:=
  67. include networking/libiproute/Kbuild
  68. lib-all-y += $(patsubst %,networking/libiproute/%,$(sort $(lib-y)))
  69. lib-y:=
  70. include loginutils/Kbuild
  71. lib-all-y += $(patsubst %,loginutils/%,$(sort $(lib-y)))
  72. lib-y:=
  73. include archival/Kbuild
  74. lib-all-y += $(patsubst %,archival/%,$(sort $(lib-y)))
  75. lib-y:=
  76. include archival/libarchive/Kbuild
  77. lib-all-y += $(patsubst %,archival/libarchive/%,$(sort $(lib-y)))
  78. lib-y:=
  79. include applets/Kbuild
  80. lib-all-y += $(patsubst %,applets/%,$(sort $(lib-y)))
  81. lib-y:=
  82. include e2fsprogs/Kbuild
  83. lib-all-y += $(patsubst %,e2fsprogs/%,$(sort $(lib-y)))
  84. lib-y:=
  85. #include e2fsprogs/old_e2fsprogs/Kbuild
  86. #lib-all-y += $(patsubst %,e2fsprogs/old_e2fsprogs/%,$(sort $(lib-y)))
  87. #lib-y:=
  88. #include e2fsprogs/old_e2fsprogs/ext2fs/Kbuild
  89. #lib-all-y += $(patsubst %,e2fsprogs/old_e2fsprogs/ext2fs/%,$(sort $(lib-y)))
  90. #lib-y:=
  91. #include e2fsprogs/old_e2fsprogs/blkid/Kbuild
  92. #lib-all-y += $(patsubst %,e2fsprogs/old_e2fsprogs/blkid/%,$(sort $(lib-y)))
  93. #lib-y:=
  94. #include e2fsprogs/old_e2fsprogs/uuid/Kbuild
  95. #lib-all-y += $(patsubst %,e2fsprogs/old_e2fsprogs/uuid/%,$(sort $(lib-y)))
  96. #lib-y:=
  97. #include e2fsprogs/old_e2fsprogs/e2p/Kbuild
  98. #lib-all-y += $(patsubst %,e2fsprogs/old_e2fsprogs/e2p/%,$(sort $(lib-y)))
  99. #lib-y:=
  100. include debianutils/Kbuild
  101. lib-all-y += $(patsubst %,debianutils/%,$(sort $(lib-y)))
  102. lib-y:=
  103. include klibc-utils/Kbuild
  104. lib-all-y += $(patsubst %,klibc-utils/%,$(sort $(lib-y)))
  105. lib-y:=
  106. include runit/Kbuild
  107. lib-all-y += $(patsubst %,runit/%,$(sort $(lib-y)))
  108. lib-y:=
  109. include modutils/Kbuild
  110. lib-all-y += $(patsubst %,modutils/%,$(sort $(lib-y)))
  111. lib-y:=
  112. include miscutils/Kbuild
  113. lib-all-y += $(patsubst %,miscutils/%,$(sort $(lib-y)))
  114. lib-y:=
  115. include mailutils/Kbuild
  116. lib-all-y += $(patsubst %,mailutils/%,$(sort $(lib-y)))
  117. lib-y:=
  118. include coreutils/libcoreutils/Kbuild
  119. lib-all-y += $(patsubst %,coreutils/libcoreutils/%,$(sort $(lib-y)))
  120. lib-y:=
  121. include coreutils/Kbuild
  122. lib-all-y += $(patsubst %,coreutils/%,$(sort $(lib-y)))
  123. lib-y:=
  124. include sysklogd/Kbuild
  125. lib-all-y += $(patsubst %,sysklogd/%,$(sort $(lib-y)))
  126. lib-y:=
  127. include shell/Kbuild
  128. lib-all-y += $(patsubst %,shell/%,$(sort $(lib-y)))
  129. lib-y:=
  130. include console-tools/Kbuild
  131. lib-all-y += $(patsubst %,console-tools/%,$(sort $(lib-y)))
  132. lib-y:=
  133. include findutils/Kbuild
  134. lib-all-y += $(patsubst %,findutils/%,$(sort $(lib-y)))
  135. lib-y:=
  136. include util-linux/Kbuild
  137. lib-all-y += $(patsubst %,util-linux/%,$(sort $(lib-y)))
  138. lib-y:=
  139. include util-linux/volume_id/Kbuild
  140. lib-all-y += $(patsubst %,util-linux/volume_id/%,$(sort $(lib-y)))
  141. lib-y:=
  142. include init/Kbuild
  143. lib-all-y += $(patsubst %,init/%,$(sort $(lib-y)))
  144. lib-y:=
  145. include libpwdgrp/Kbuild
  146. lib-all-y += $(patsubst %,libpwdgrp/%,$(sort $(lib-y)))
  147. lib-y:=
  148. include editors/Kbuild
  149. lib-all-y += $(patsubst %,editors/%,$(sort $(lib-y)))
  150. lib-y:=
  151. include printutils/Kbuild
  152. lib-all-y += $(patsubst %,printutils/%,$(sort $(lib-y)))
  153. lib-y:=
  154. include selinux/Kbuild
  155. lib-all-y += $(patsubst %,selinux/%,$(sort $(lib-y)))
  156. lib-y:=
  157. include scripts/Kbuild
  158. lib-all-y += $(patsubst %,scripts/%,$(sort $(lib-y)))
  159. lib-y:=
  160. include libbb/Kbuild
  161. lib-all-y += $(patsubst %,libbb/%,$(sort $(lib-y)))
  162. lib-y:=
  163. comma:=,
  164. busybox_unstripped.o: $(usage_stuff) include/applet_tables.h include/NUM_APPLETS.h include/autoconf.h
  165. $(CC) $(CPPFLAGS) $(CFLAGS) $(EXTRA_CFLAGS) \
  166. $(patsubst %,-Wl$(comma)%,$(LDFLAGS) $(EXTRA_LDFLAGS)) \
  167. -DGCC_COMBINE=1 \
  168. --combine $(WHOLE_PROGRAM) \
  169. -funit-at-a-time -Wno-error -std=gnu99 \
  170. -c -o busybox_unstripped.o \
  171. $(lib-all-y:.o=.c)
  172. busybox: busybox_unstripped.o
  173. $(srctree)/scripts/trylink \
  174. busybox_unstripped \
  175. "$(CC) $(CFLAGS_busybox)" \
  176. "$(CFLAGS)" \
  177. "$(LDFLAGS)" \
  178. "busybox_unstripped.o" \
  179. "" \
  180. "crypt m"
  181. cp -f $(@)_unstripped $@
  182. -$(STRIP) -s -R .note -R .comment -R .version $@
  183. # If .config is newer than include/autoconf.h, someone tinkered
  184. # with it and forgot to run make oldconfig.
  185. include/autoconf.h: .config
  186. $(MAKE) -f $(srctree)/Makefile silentoldconfig
  187. # Override rules for host compile
  188. applets/usage: include/autoconf.h
  189. $(HOSTCC) -Wall -O2 -I$(srctree)/include -o applets/usage applets/usage.c
  190. applets/applet_tables: include/autoconf.h
  191. $(HOSTCC) -Wall -O2 -I$(srctree)/include -o applets/applet_tables applets/applet_tables.c