Makefile.IMA 6.2 KB

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