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