Makefile.IMA 6.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211
  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. CPPFLAGS += -D"KBUILD_STR(s)=\#s" #-Q
  45. # We need some generic definitions
  46. include $(srctree)/scripts/Kbuild.include
  47. include Makefile.flags
  48. -include $(srctree)/arch/$(ARCH)/Makefile
  49. ifdef CONFIG_FEATURE_COMPRESS_USAGE
  50. usage_stuff = include/usage_compressed.h
  51. endif
  52. ifndef BB_VER
  53. BB_VER:=""
  54. endif
  55. WHOLE_PROGRAM:=$(call cc-option,-fwhole-program,)
  56. # pull in the config stuff
  57. lib-all-y := applets/applets.o
  58. lib-y:=
  59. include procps/Kbuild
  60. lib-all-y += $(patsubst %,procps/%,$(sort $(lib-y)))
  61. lib-y:=
  62. include networking/Kbuild
  63. lib-all-y += $(patsubst %,networking/%,$(sort $(lib-y)))
  64. lib-y:=
  65. include networking/udhcp/Kbuild
  66. lib-all-y += $(patsubst %,networking/udhcp/%,$(sort $(lib-y)))
  67. lib-y:=
  68. include networking/libiproute/Kbuild
  69. lib-all-y += $(patsubst %,networking/libiproute/%,$(sort $(lib-y)))
  70. lib-y:=
  71. include loginutils/Kbuild
  72. lib-all-y += $(patsubst %,loginutils/%,$(sort $(lib-y)))
  73. lib-y:=
  74. include archival/Kbuild
  75. lib-all-y += $(patsubst %,archival/%,$(sort $(lib-y)))
  76. lib-y:=
  77. include archival/libarchive/Kbuild
  78. lib-all-y += $(patsubst %,archival/libarchive/%,$(sort $(lib-y)))
  79. lib-y:=
  80. include applets/Kbuild
  81. lib-all-y += $(patsubst %,applets/%,$(sort $(lib-y)))
  82. lib-y:=
  83. include e2fsprogs/Kbuild
  84. lib-all-y += $(patsubst %,e2fsprogs/%,$(sort $(lib-y)))
  85. lib-y:=
  86. #include e2fsprogs/old_e2fsprogs/Kbuild
  87. #lib-all-y += $(patsubst %,e2fsprogs/old_e2fsprogs/%,$(sort $(lib-y)))
  88. #lib-y:=
  89. #include e2fsprogs/old_e2fsprogs/ext2fs/Kbuild
  90. #lib-all-y += $(patsubst %,e2fsprogs/old_e2fsprogs/ext2fs/%,$(sort $(lib-y)))
  91. #lib-y:=
  92. #include e2fsprogs/old_e2fsprogs/blkid/Kbuild
  93. #lib-all-y += $(patsubst %,e2fsprogs/old_e2fsprogs/blkid/%,$(sort $(lib-y)))
  94. #lib-y:=
  95. #include e2fsprogs/old_e2fsprogs/uuid/Kbuild
  96. #lib-all-y += $(patsubst %,e2fsprogs/old_e2fsprogs/uuid/%,$(sort $(lib-y)))
  97. #lib-y:=
  98. #include e2fsprogs/old_e2fsprogs/e2p/Kbuild
  99. #lib-all-y += $(patsubst %,e2fsprogs/old_e2fsprogs/e2p/%,$(sort $(lib-y)))
  100. #lib-y:=
  101. include debianutils/Kbuild
  102. lib-all-y += $(patsubst %,debianutils/%,$(sort $(lib-y)))
  103. lib-y:=
  104. include klibc-utils/Kbuild
  105. lib-all-y += $(patsubst %,klibc-utils/%,$(sort $(lib-y)))
  106. lib-y:=
  107. include runit/Kbuild
  108. lib-all-y += $(patsubst %,runit/%,$(sort $(lib-y)))
  109. lib-y:=
  110. include modutils/Kbuild
  111. lib-all-y += $(patsubst %,modutils/%,$(sort $(lib-y)))
  112. lib-y:=
  113. include miscutils/Kbuild
  114. lib-all-y += $(patsubst %,miscutils/%,$(sort $(lib-y)))
  115. lib-y:=
  116. include mailutils/Kbuild
  117. lib-all-y += $(patsubst %,mailutils/%,$(sort $(lib-y)))
  118. lib-y:=
  119. include coreutils/libcoreutils/Kbuild
  120. lib-all-y += $(patsubst %,coreutils/libcoreutils/%,$(sort $(lib-y)))
  121. lib-y:=
  122. include coreutils/Kbuild
  123. lib-all-y += $(patsubst %,coreutils/%,$(sort $(lib-y)))
  124. lib-y:=
  125. include sysklogd/Kbuild
  126. lib-all-y += $(patsubst %,sysklogd/%,$(sort $(lib-y)))
  127. lib-y:=
  128. include shell/Kbuild
  129. lib-all-y += $(patsubst %,shell/%,$(sort $(lib-y)))
  130. lib-y:=
  131. include console-tools/Kbuild
  132. lib-all-y += $(patsubst %,console-tools/%,$(sort $(lib-y)))
  133. lib-y:=
  134. include findutils/Kbuild
  135. lib-all-y += $(patsubst %,findutils/%,$(sort $(lib-y)))
  136. lib-y:=
  137. include util-linux/Kbuild
  138. lib-all-y += $(patsubst %,util-linux/%,$(sort $(lib-y)))
  139. lib-y:=
  140. include util-linux/volume_id/Kbuild
  141. lib-all-y += $(patsubst %,util-linux/volume_id/%,$(sort $(lib-y)))
  142. lib-y:=
  143. include init/Kbuild
  144. lib-all-y += $(patsubst %,init/%,$(sort $(lib-y)))
  145. lib-y:=
  146. include libpwdgrp/Kbuild
  147. lib-all-y += $(patsubst %,libpwdgrp/%,$(sort $(lib-y)))
  148. lib-y:=
  149. include editors/Kbuild
  150. lib-all-y += $(patsubst %,editors/%,$(sort $(lib-y)))
  151. lib-y:=
  152. include printutils/Kbuild
  153. lib-all-y += $(patsubst %,printutils/%,$(sort $(lib-y)))
  154. lib-y:=
  155. include selinux/Kbuild
  156. lib-all-y += $(patsubst %,selinux/%,$(sort $(lib-y)))
  157. lib-y:=
  158. include scripts/Kbuild
  159. lib-all-y += $(patsubst %,scripts/%,$(sort $(lib-y)))
  160. lib-y:=
  161. include libbb/Kbuild
  162. lib-all-y += $(patsubst %,libbb/%,$(sort $(lib-y)))
  163. lib-y:=
  164. comma:=,
  165. busybox_unstripped.o: $(usage_stuff) include/applet_tables.h include/NUM_APPLETS.h include/autoconf.h
  166. $(CC) $(CPPFLAGS) $(CFLAGS) $(EXTRA_CFLAGS) \
  167. $(patsubst %,-Wl$(comma)%,$(LDFLAGS) $(EXTRA_LDFLAGS)) \
  168. -DGCC_COMBINE=1 \
  169. --combine $(WHOLE_PROGRAM) \
  170. -funit-at-a-time -Wno-error -std=gnu99 \
  171. -c -o busybox_unstripped.o \
  172. $(lib-all-y:.o=.c)
  173. busybox: busybox_unstripped.o
  174. $(srctree)/scripts/trylink \
  175. busybox_unstripped \
  176. "$(CC) $(CFLAGS_busybox)" \
  177. "$(CFLAGS)" \
  178. "$(LDFLAGS)" \
  179. "busybox_unstripped.o" \
  180. "" \
  181. "crypt m"
  182. cp -f $(@)_unstripped $@
  183. -$(STRIP) -s -R .note -R .comment -R .version $@
  184. # If .config is newer than include/autoconf.h, someone tinkered
  185. # with it and forgot to run make oldconfig.
  186. include/autoconf.h: .config
  187. $(MAKE) -f $(srctree)/Makefile silentoldconfig
  188. # Override rules for host compile
  189. applets/usage: include/autoconf.h
  190. $(HOSTCC) -Wall -O2 -I$(srctree)/include -o applets/usage applets/usage.c
  191. applets/applet_tables: include/autoconf.h
  192. $(HOSTCC) -Wall -O2 -I$(srctree)/include -o applets/applet_tables applets/applet_tables.c