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) |
Bernhard Reutner-Fischer | 119f87b | 2008-04-11 08:46:56 +0000 | [diff] [blame] | 52 | |
Bernhard Reutner-Fischer | 119f87b | 2008-04-11 08:46:56 +0000 | [diff] [blame] | 53 | # We need some generic definitions |
| 54 | include $(srctree)/scripts/Kbuild.include |
| 55 | |
| 56 | include Makefile.flags |
Bernhard Reutner-Fischer | 2af8604 | 2008-05-08 13:25:20 +0000 | [diff] [blame] | 57 | |
Bernhard Reutner-Fischer | 2af8604 | 2008-05-08 13:25:20 +0000 | [diff] [blame] | 58 | -include $(srctree)/arch/$(ARCH)/Makefile |
Bernhard Reutner-Fischer | b5bb40f | 2007-01-23 01:29:04 +0000 | [diff] [blame] | 59 | ifdef CONFIG_FEATURE_COMPRESS_USAGE |
| 60 | usage_stuff = include/usage_compressed.h |
| 61 | endif |
| 62 | |
Bernhard Reutner-Fischer | 119f87b | 2008-04-11 08:46:56 +0000 | [diff] [blame] | 63 | ifndef BB_VER |
| 64 | BB_VER:="" |
| 65 | endif |
| 66 | |
Bernhard Reutner-Fischer | eecd588 | 2008-04-11 12:42:23 +0000 | [diff] [blame] | 67 | WHOLE_PROGRAM:=$(call cc-option,-fwhole-program,) |
Bernhard Reutner-Fischer | 119f87b | 2008-04-11 08:46:56 +0000 | [diff] [blame] | 68 | |
Bernhard Reutner-Fischer | b5bb40f | 2007-01-23 01:29:04 +0000 | [diff] [blame] | 69 | # pull in the config stuff |
Bernhard Reutner-Fischer | 64332bf | 2007-05-15 09:07:06 +0000 | [diff] [blame] | 70 | lib-all-y := applets/applets.o |
Bernhard Reutner-Fischer | b5bb40f | 2007-01-23 01:29:04 +0000 | [diff] [blame] | 71 | lib-y:= |
| 72 | include procps/Kbuild |
| 73 | lib-all-y += $(patsubst %,procps/%,$(sort $(lib-y))) |
| 74 | lib-y:= |
| 75 | include networking/Kbuild |
| 76 | lib-all-y += $(patsubst %,networking/%,$(sort $(lib-y))) |
| 77 | lib-y:= |
| 78 | include networking/udhcp/Kbuild |
| 79 | lib-all-y += $(patsubst %,networking/udhcp/%,$(sort $(lib-y))) |
| 80 | lib-y:= |
| 81 | include networking/libiproute/Kbuild |
| 82 | lib-all-y += $(patsubst %,networking/libiproute/%,$(sort $(lib-y))) |
| 83 | lib-y:= |
| 84 | include loginutils/Kbuild |
| 85 | lib-all-y += $(patsubst %,loginutils/%,$(sort $(lib-y))) |
| 86 | lib-y:= |
| 87 | include archival/Kbuild |
| 88 | lib-all-y += $(patsubst %,archival/%,$(sort $(lib-y))) |
| 89 | lib-y:= |
Denys Vlasenko | 833d4e7 | 2010-11-03 02:38:31 +0100 | [diff] [blame] | 90 | include archival/libarchive/Kbuild |
| 91 | lib-all-y += $(patsubst %,archival/libarchive/%,$(sort $(lib-y))) |
Bernhard Reutner-Fischer | b5bb40f | 2007-01-23 01:29:04 +0000 | [diff] [blame] | 92 | lib-y:= |
| 93 | include applets/Kbuild |
| 94 | lib-all-y += $(patsubst %,applets/%,$(sort $(lib-y))) |
| 95 | lib-y:= |
| 96 | include e2fsprogs/Kbuild |
| 97 | lib-all-y += $(patsubst %,e2fsprogs/%,$(sort $(lib-y))) |
| 98 | lib-y:= |
| 99 | #include e2fsprogs/old_e2fsprogs/Kbuild |
| 100 | #lib-all-y += $(patsubst %,e2fsprogs/old_e2fsprogs/%,$(sort $(lib-y))) |
| 101 | #lib-y:= |
| 102 | #include e2fsprogs/old_e2fsprogs/ext2fs/Kbuild |
| 103 | #lib-all-y += $(patsubst %,e2fsprogs/old_e2fsprogs/ext2fs/%,$(sort $(lib-y))) |
| 104 | #lib-y:= |
| 105 | #include e2fsprogs/old_e2fsprogs/blkid/Kbuild |
| 106 | #lib-all-y += $(patsubst %,e2fsprogs/old_e2fsprogs/blkid/%,$(sort $(lib-y))) |
| 107 | #lib-y:= |
| 108 | #include e2fsprogs/old_e2fsprogs/uuid/Kbuild |
| 109 | #lib-all-y += $(patsubst %,e2fsprogs/old_e2fsprogs/uuid/%,$(sort $(lib-y))) |
| 110 | #lib-y:= |
| 111 | #include e2fsprogs/old_e2fsprogs/e2p/Kbuild |
| 112 | #lib-all-y += $(patsubst %,e2fsprogs/old_e2fsprogs/e2p/%,$(sort $(lib-y))) |
| 113 | #lib-y:= |
| 114 | include debianutils/Kbuild |
| 115 | lib-all-y += $(patsubst %,debianutils/%,$(sort $(lib-y))) |
| 116 | lib-y:= |
Denys Vlasenko | ab77e81 | 2017-08-18 19:15:29 +0200 | [diff] [blame] | 117 | include klibc-utils/Kbuild |
| 118 | lib-all-y += $(patsubst %,klibc-utils/%,$(sort $(lib-y))) |
| 119 | lib-y:= |
Bernhard Reutner-Fischer | b5bb40f | 2007-01-23 01:29:04 +0000 | [diff] [blame] | 120 | include runit/Kbuild |
| 121 | lib-all-y += $(patsubst %,runit/%,$(sort $(lib-y))) |
| 122 | lib-y:= |
| 123 | include modutils/Kbuild |
| 124 | lib-all-y += $(patsubst %,modutils/%,$(sort $(lib-y))) |
| 125 | lib-y:= |
| 126 | include miscutils/Kbuild |
| 127 | lib-all-y += $(patsubst %,miscutils/%,$(sort $(lib-y))) |
| 128 | lib-y:= |
Denys Vlasenko | 726ebba | 2011-03-06 23:09:42 +0100 | [diff] [blame] | 129 | include mailutils/Kbuild |
| 130 | lib-all-y += $(patsubst %,mailutils/%,$(sort $(lib-y))) |
| 131 | lib-y:= |
Bernhard Reutner-Fischer | b5bb40f | 2007-01-23 01:29:04 +0000 | [diff] [blame] | 132 | include coreutils/libcoreutils/Kbuild |
| 133 | lib-all-y += $(patsubst %,coreutils/libcoreutils/%,$(sort $(lib-y))) |
| 134 | lib-y:= |
| 135 | include coreutils/Kbuild |
| 136 | lib-all-y += $(patsubst %,coreutils/%,$(sort $(lib-y))) |
| 137 | lib-y:= |
| 138 | include sysklogd/Kbuild |
| 139 | lib-all-y += $(patsubst %,sysklogd/%,$(sort $(lib-y))) |
| 140 | lib-y:= |
| 141 | include shell/Kbuild |
| 142 | lib-all-y += $(patsubst %,shell/%,$(sort $(lib-y))) |
| 143 | lib-y:= |
| 144 | include console-tools/Kbuild |
| 145 | lib-all-y += $(patsubst %,console-tools/%,$(sort $(lib-y))) |
| 146 | lib-y:= |
| 147 | include findutils/Kbuild |
| 148 | lib-all-y += $(patsubst %,findutils/%,$(sort $(lib-y))) |
| 149 | lib-y:= |
| 150 | include util-linux/Kbuild |
| 151 | lib-all-y += $(patsubst %,util-linux/%,$(sort $(lib-y))) |
| 152 | lib-y:= |
Bernhard Reutner-Fischer | 119f87b | 2008-04-11 08:46:56 +0000 | [diff] [blame] | 153 | include util-linux/volume_id/Kbuild |
| 154 | lib-all-y += $(patsubst %,util-linux/volume_id/%,$(sort $(lib-y))) |
| 155 | lib-y:= |
Bernhard Reutner-Fischer | b5bb40f | 2007-01-23 01:29:04 +0000 | [diff] [blame] | 156 | include init/Kbuild |
| 157 | lib-all-y += $(patsubst %,init/%,$(sort $(lib-y))) |
| 158 | lib-y:= |
| 159 | include libpwdgrp/Kbuild |
| 160 | lib-all-y += $(patsubst %,libpwdgrp/%,$(sort $(lib-y))) |
| 161 | lib-y:= |
| 162 | include editors/Kbuild |
| 163 | lib-all-y += $(patsubst %,editors/%,$(sort $(lib-y))) |
| 164 | lib-y:= |
Bernhard Reutner-Fischer | 119f87b | 2008-04-11 08:46:56 +0000 | [diff] [blame] | 165 | include printutils/Kbuild |
| 166 | lib-all-y += $(patsubst %,printutils/%,$(sort $(lib-y))) |
| 167 | lib-y:= |
Bernhard Reutner-Fischer | e11b4a4 | 2007-03-09 08:46:31 +0000 | [diff] [blame] | 168 | include selinux/Kbuild |
| 169 | lib-all-y += $(patsubst %,selinux/%,$(sort $(lib-y))) |
| 170 | lib-y:= |
Bernhard Reutner-Fischer | b5bb40f | 2007-01-23 01:29:04 +0000 | [diff] [blame] | 171 | include scripts/Kbuild |
| 172 | lib-all-y += $(patsubst %,scripts/%,$(sort $(lib-y))) |
| 173 | lib-y:= |
| 174 | include libbb/Kbuild |
| 175 | lib-all-y += $(patsubst %,libbb/%,$(sort $(lib-y))) |
| 176 | lib-y:= |
| 177 | |
Bernhard Reutner-Fischer | 1d690db | 2008-04-11 12:31:57 +0000 | [diff] [blame] | 178 | comma:=, |
Denys Vlasenko | bff5f3f | 2011-03-06 23:48:24 +0100 | [diff] [blame] | 179 | 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] | 180 | $(CC) $(CPPFLAGS) $(CFLAGS) $(EXTRA_CFLAGS) \ |
Bernhard Reutner-Fischer | 1d690db | 2008-04-11 12:31:57 +0000 | [diff] [blame] | 181 | $(patsubst %,-Wl$(comma)%,$(LDFLAGS) $(EXTRA_LDFLAGS)) \ |
Denis Vlasenko | 93b8263 | 2008-04-11 11:27:29 +0000 | [diff] [blame] | 182 | -DGCC_COMBINE=1 \ |
| 183 | --combine $(WHOLE_PROGRAM) \ |
Bernhard Reutner-Fischer | 493691a | 2007-02-02 16:11:24 +0000 | [diff] [blame] | 184 | -funit-at-a-time -Wno-error -std=gnu99 \ |
Denis Vlasenko | 55e06c1 | 2008-04-12 13:46:39 +0000 | [diff] [blame] | 185 | -c -o busybox_unstripped.o \ |
| 186 | $(lib-all-y:.o=.c) |
| 187 | |
| 188 | busybox: busybox_unstripped.o |
| 189 | $(srctree)/scripts/trylink \ |
| 190 | busybox_unstripped \ |
Denis Vlasenko | 1da86d2 | 2008-06-04 11:28:24 +0000 | [diff] [blame] | 191 | "$(CC) $(CFLAGS_busybox)" \ |
Denis Vlasenko | 55e06c1 | 2008-04-12 13:46:39 +0000 | [diff] [blame] | 192 | "$(CFLAGS)" \ |
| 193 | "$(LDFLAGS)" \ |
| 194 | "busybox_unstripped.o" \ |
| 195 | "" \ |
| 196 | "crypt m" |
Bernhard Reutner-Fischer | 64332bf | 2007-05-15 09:07:06 +0000 | [diff] [blame] | 197 | cp -f $(@)_unstripped $@ |
| 198 | -$(STRIP) -s -R .note -R .comment -R .version $@ |
Bernhard Reutner-Fischer | b5bb40f | 2007-01-23 01:29:04 +0000 | [diff] [blame] | 199 | |
Denis Vlasenko | 55e06c1 | 2008-04-12 13:46:39 +0000 | [diff] [blame] | 200 | # If .config is newer than include/autoconf.h, someone tinkered |
| 201 | # with it and forgot to run make oldconfig. |
| 202 | include/autoconf.h: .config |
| 203 | $(MAKE) -f $(srctree)/Makefile silentoldconfig |
| 204 | |
Denys Vlasenko | bff5f3f | 2011-03-06 23:48:24 +0100 | [diff] [blame] | 205 | # Override rules for host compile |
Denis Vlasenko | 55e06c1 | 2008-04-12 13:46:39 +0000 | [diff] [blame] | 206 | applets/usage: include/autoconf.h |
Denys Vlasenko | bff5f3f | 2011-03-06 23:48:24 +0100 | [diff] [blame] | 207 | $(HOSTCC) -Wall -O2 -I$(srctree)/include -o applets/usage applets/usage.c |
Denis Vlasenko | 93b8263 | 2008-04-11 11:27:29 +0000 | [diff] [blame] | 208 | |
Denis Vlasenko | 55e06c1 | 2008-04-12 13:46:39 +0000 | [diff] [blame] | 209 | applets/applet_tables: include/autoconf.h |
Denys Vlasenko | bff5f3f | 2011-03-06 23:48:24 +0100 | [diff] [blame] | 210 | $(HOSTCC) -Wall -O2 -I$(srctree)/include -o applets/applet_tables applets/applet_tables.c |