X-Git-Url: https://git.librecmc.org/?a=blobdiff_plain;f=scripts%2FMakefile.IMA;h=a34db50f473d5ad936bbcb59d5bef301ba61ebeb;hb=a3aa3e309506ea96fa8f7546f6b22fa85263a934;hp=1d7bc2cc336f49df2f5f896e1eeb816a8326f869;hpb=4ee7cd4f6f9f85871c8814bb524d3e691a2992a9;p=oweals%2Fbusybox.git diff --git a/scripts/Makefile.IMA b/scripts/Makefile.IMA index 1d7bc2cc3..a34db50f4 100644 --- a/scripts/Makefile.IMA +++ b/scripts/Makefile.IMA @@ -1,4 +1,7 @@ # This is completely unsupported. +# +# Uasge: make -f scripts/Makefile.IMA +# # Fix COMBINED_COMPILE upstream (in the Kbuild) and propagate # the changes back srctree := $(if $(KBUILD_SRC),$(KBUILD_SRC),$(CURDIR)) @@ -6,12 +9,61 @@ objtree := $(CURDIR) src := $(srctree) obj := $(objtree) +# Look for make include files relative to root of kernel src +MAKEFLAGS += --include-dir=$(srctree) + default: busybox + include .config + +# Cross compiling and selecting different set of gcc/bin-utils +ifeq ($(CROSS_COMPILE),) +CROSS_COMPILE := $(subst ",,$(CONFIG_CROSS_COMPILER_PREFIX)) +endif + +ifneq ($(CROSS_COMPILE),) +SUBARCH := $(shell echo $(CROSS_COMPILE) | cut -d- -f1) +else +SUBARCH := $(shell uname -m) +endif +SUBARCH := $(shell echo $(SUBARCH) | sed -e s/i.86/i386/ -e s/sun4u/sparc64/ \ + -e s/arm.*/arm/ -e s/sa110/arm/ \ + -e s/s390x/s390/ -e s/parisc64/parisc/ \ + -e s/ppc.*/powerpc/ -e s/mips.*/mips/ ) +ARCH ?= $(SUBARCH) + +ifndef HOSTCC +HOSTCC = cc +endif +AS = $(CROSS_COMPILE)as +CC = $(CROSS_COMPILE)gcc +LD = $(CC) -nostdlib +CPP = $(CC) -E +AR = $(CROSS_COMPILE)ar +NM = $(CROSS_COMPILE)nm +STRIP = $(CROSS_COMPILE)strip +OBJCOPY = $(CROSS_COMPILE)objcopy +OBJDUMP = $(CROSS_COMPILE)objdump + +CFLAGS := $(CFLAGS) +CPPFLAGS += -D"KBUILD_STR(s)=\#s" #-Q + +# We need some generic definitions +include $(srctree)/scripts/Kbuild.include + +include Makefile.flags + +-include $(srctree)/arch/$(ARCH)/Makefile ifdef CONFIG_FEATURE_COMPRESS_USAGE usage_stuff = include/usage_compressed.h endif +ifndef BB_VER +BB_VER:="" +endif + +WHOLE_PROGRAM:=$(call cc-option,-fwhole-program,) + # pull in the config stuff lib-all-y := applets/applets.o lib-y:= @@ -90,6 +142,9 @@ lib-y:= include util-linux/Kbuild lib-all-y += $(patsubst %,util-linux/%,$(sort $(lib-y))) lib-y:= +include util-linux/volume_id/Kbuild +lib-all-y += $(patsubst %,util-linux/volume_id/%,$(sort $(lib-y))) +lib-y:= include init/Kbuild lib-all-y += $(patsubst %,init/%,$(sort $(lib-y))) lib-y:= @@ -99,6 +154,9 @@ lib-y:= include editors/Kbuild lib-all-y += $(patsubst %,editors/%,$(sort $(lib-y))) lib-y:= +include printutils/Kbuild +lib-all-y += $(patsubst %,printutils/%,$(sort $(lib-y))) +lib-y:= include selinux/Kbuild lib-all-y += $(patsubst %,selinux/%,$(sort $(lib-y))) lib-y:= @@ -109,35 +167,41 @@ include libbb/Kbuild lib-all-y += $(patsubst %,libbb/%,$(sort $(lib-y))) lib-y:= -include Makefile.flags -ifndef BB_VER -BB_VER:="" -endif - -CPPFLAGS+= -D"KBUILD_STR(s)=\#s" #-Q - -HOSTCC = gcc -AS = $(CROSS_COMPILE)as -CC = $(CROSS_COMPILE)gcc -LD = $(CC) -nostdlib -CPP = $(CC) -E -AR = $(CROSS_COMPILE)ar -NM = $(CROSS_COMPILE)nm -STRIP = $(CROSS_COMPILE)strip -OBJCOPY = $(CROSS_COMPILE)objcopy -OBJDUMP = $(CROSS_COMPILE)objdump - -WHOLE_PROGRAM:=$(call cc-option,-fwhole-program,) -busybox: $(usage_stuff) - $(CC) $(CPPFLAGS) $(CFLAGS) $(EXTRA_CFLAGS) --combine $(WHOLE_PROGRAM) \ +comma:=, +busybox_unstripped.o: $(usage_stuff) include/applet_tables.h include/autoconf.h + $(CC) $(CPPFLAGS) $(CFLAGS) $(EXTRA_CFLAGS) \ + $(patsubst %,-Wl$(comma)%,$(LDFLAGS) $(EXTRA_LDFLAGS)) \ + -DGCC_COMBINE=1 \ + --combine $(WHOLE_PROGRAM) \ -funit-at-a-time -Wno-error -std=gnu99 \ - -o $(@)_unstripped $(lib-all-y:.o=.c) \ - -Wl,--start-group -lcrypt -lm -Wl,--end-group + -c -o busybox_unstripped.o \ + $(lib-all-y:.o=.c) + +busybox: busybox_unstripped.o + $(srctree)/scripts/trylink \ + busybox_unstripped \ + "$(CC) $(CFLAGS_busybox)" \ + "$(CFLAGS)" \ + "$(LDFLAGS)" \ + "busybox_unstripped.o" \ + "" \ + "crypt m" cp -f $(@)_unstripped $@ -$(STRIP) -s -R .note -R .comment -R .version $@ -applets/usage: - $(HOSTCC) -Wall -Wstrict-prototypes -O2 -fomit-frame-pointer -I$(srctree)/include -o applets/usage applets/usage.c +# If .config is newer than include/autoconf.h, someone tinkered +# with it and forgot to run make oldconfig. +include/autoconf.h: .config + $(MAKE) -f $(srctree)/Makefile silentoldconfig + +applets/usage: include/autoconf.h + $(HOSTCC) -Wall -Wstrict-prototypes -O2 -fomit-frame-pointer -I$(srctree)/include -o applets/usage applets/usage.c + +applets/applet_tables: include/autoconf.h + $(HOSTCC) -Wall -Wstrict-prototypes -O2 -fomit-frame-pointer -I$(srctree)/include -o applets/applet_tables applets/applet_tables.c + include/usage_compressed.h: $(srctree)/include/usage.h applets/usage $(srctree)/applets/usage_compressed include/usage_compressed.h applets +include/applet_tables.h: $(srctree)/include/applets.h + applets/applet_tables include/applet_tables.h