Bernhard Reutner-Fischer | b5bb40f | 2007-01-23 01:29:04 +0000 | [diff] [blame] | 1 | # This is completely unsupported. |
| 2 | # Fix COMBINED_COMPILE upstream (in the Kbuild) and propagate |
| 3 | # the changes back |
| 4 | srctree := $(if $(KBUILD_SRC),$(KBUILD_SRC),$(CURDIR)) |
| 5 | objtree := $(CURDIR) |
| 6 | src := $(srctree) |
| 7 | obj := $(objtree) |
| 8 | |
Bernhard Reutner-Fischer | 119f87b | 2008-04-11 08:46:56 +0000 | [diff] [blame] | 9 | # Look for make include files relative to root of kernel src |
| 10 | MAKEFLAGS += --include-dir=$(srctree) |
| 11 | |
Bernhard Reutner-Fischer | b5bb40f | 2007-01-23 01:29:04 +0000 | [diff] [blame] | 12 | default: busybox |
Bernhard Reutner-Fischer | 119f87b | 2008-04-11 08:46:56 +0000 | [diff] [blame] | 13 | |
| 14 | ifndef HOSTCC |
| 15 | HOSTCC = cc |
| 16 | endif |
| 17 | AS = $(CROSS_COMPILE)as |
| 18 | CC = $(CROSS_COMPILE)gcc |
| 19 | LD = $(CC) -nostdlib |
| 20 | CPP = $(CC) -E |
| 21 | AR = $(CROSS_COMPILE)ar |
| 22 | NM = $(CROSS_COMPILE)nm |
| 23 | STRIP = $(CROSS_COMPILE)strip |
| 24 | OBJCOPY = $(CROSS_COMPILE)objcopy |
| 25 | OBJDUMP = $(CROSS_COMPILE)objdump |
| 26 | |
| 27 | CFLAGS := $(CFLAGS) |
| 28 | CPPFLAGS+= -D"KBUILD_STR(s)=\#s" #-Q |
Bernhard Reutner-Fischer | 119f87b | 2008-04-11 08:46:56 +0000 | [diff] [blame] | 29 | |
Bernhard Reutner-Fischer | b5bb40f | 2007-01-23 01:29:04 +0000 | [diff] [blame] | 30 | include .config |
Bernhard Reutner-Fischer | 119f87b | 2008-04-11 08:46:56 +0000 | [diff] [blame] | 31 | # We need some generic definitions |
| 32 | include $(srctree)/scripts/Kbuild.include |
| 33 | |
| 34 | include Makefile.flags |
Bernhard Reutner-Fischer | b5bb40f | 2007-01-23 01:29:04 +0000 | [diff] [blame] | 35 | ifdef CONFIG_FEATURE_COMPRESS_USAGE |
| 36 | usage_stuff = include/usage_compressed.h |
| 37 | endif |
| 38 | |
Bernhard Reutner-Fischer | 119f87b | 2008-04-11 08:46:56 +0000 | [diff] [blame] | 39 | ifndef BB_VER |
| 40 | BB_VER:="" |
| 41 | endif |
| 42 | |
Bernhard Reutner-Fischer | eecd588 | 2008-04-11 12:42:23 +0000 | [diff] [blame] | 43 | WHOLE_PROGRAM:=$(call cc-option,-fwhole-program,) |
Bernhard Reutner-Fischer | 119f87b | 2008-04-11 08:46:56 +0000 | [diff] [blame] | 44 | |
Bernhard Reutner-Fischer | b5bb40f | 2007-01-23 01:29:04 +0000 | [diff] [blame] | 45 | # pull in the config stuff |
Bernhard Reutner-Fischer | 64332bf | 2007-05-15 09:07:06 +0000 | [diff] [blame] | 46 | lib-all-y := applets/applets.o |
Bernhard Reutner-Fischer | b5bb40f | 2007-01-23 01:29:04 +0000 | [diff] [blame] | 47 | lib-y:= |
| 48 | include procps/Kbuild |
| 49 | lib-all-y += $(patsubst %,procps/%,$(sort $(lib-y))) |
| 50 | lib-y:= |
| 51 | include networking/Kbuild |
| 52 | lib-all-y += $(patsubst %,networking/%,$(sort $(lib-y))) |
| 53 | lib-y:= |
| 54 | include networking/udhcp/Kbuild |
| 55 | lib-all-y += $(patsubst %,networking/udhcp/%,$(sort $(lib-y))) |
| 56 | lib-y:= |
| 57 | include networking/libiproute/Kbuild |
| 58 | lib-all-y += $(patsubst %,networking/libiproute/%,$(sort $(lib-y))) |
| 59 | lib-y:= |
| 60 | include loginutils/Kbuild |
| 61 | lib-all-y += $(patsubst %,loginutils/%,$(sort $(lib-y))) |
| 62 | lib-y:= |
| 63 | include archival/Kbuild |
| 64 | lib-all-y += $(patsubst %,archival/%,$(sort $(lib-y))) |
| 65 | lib-y:= |
| 66 | include archival/libunarchive/Kbuild |
| 67 | lib-all-y += $(patsubst %,archival/libunarchive/%,$(sort $(lib-y))) |
| 68 | lib-y:= |
| 69 | include applets/Kbuild |
| 70 | lib-all-y += $(patsubst %,applets/%,$(sort $(lib-y))) |
| 71 | lib-y:= |
| 72 | include e2fsprogs/Kbuild |
| 73 | lib-all-y += $(patsubst %,e2fsprogs/%,$(sort $(lib-y))) |
| 74 | lib-y:= |
| 75 | #include e2fsprogs/old_e2fsprogs/Kbuild |
| 76 | #lib-all-y += $(patsubst %,e2fsprogs/old_e2fsprogs/%,$(sort $(lib-y))) |
| 77 | #lib-y:= |
| 78 | #include e2fsprogs/old_e2fsprogs/ext2fs/Kbuild |
| 79 | #lib-all-y += $(patsubst %,e2fsprogs/old_e2fsprogs/ext2fs/%,$(sort $(lib-y))) |
| 80 | #lib-y:= |
| 81 | #include e2fsprogs/old_e2fsprogs/blkid/Kbuild |
| 82 | #lib-all-y += $(patsubst %,e2fsprogs/old_e2fsprogs/blkid/%,$(sort $(lib-y))) |
| 83 | #lib-y:= |
| 84 | #include e2fsprogs/old_e2fsprogs/uuid/Kbuild |
| 85 | #lib-all-y += $(patsubst %,e2fsprogs/old_e2fsprogs/uuid/%,$(sort $(lib-y))) |
| 86 | #lib-y:= |
| 87 | #include e2fsprogs/old_e2fsprogs/e2p/Kbuild |
| 88 | #lib-all-y += $(patsubst %,e2fsprogs/old_e2fsprogs/e2p/%,$(sort $(lib-y))) |
| 89 | #lib-y:= |
| 90 | include debianutils/Kbuild |
| 91 | lib-all-y += $(patsubst %,debianutils/%,$(sort $(lib-y))) |
| 92 | lib-y:= |
| 93 | include runit/Kbuild |
| 94 | lib-all-y += $(patsubst %,runit/%,$(sort $(lib-y))) |
| 95 | lib-y:= |
| 96 | include modutils/Kbuild |
| 97 | lib-all-y += $(patsubst %,modutils/%,$(sort $(lib-y))) |
| 98 | lib-y:= |
| 99 | include miscutils/Kbuild |
| 100 | lib-all-y += $(patsubst %,miscutils/%,$(sort $(lib-y))) |
| 101 | lib-y:= |
| 102 | include coreutils/libcoreutils/Kbuild |
| 103 | lib-all-y += $(patsubst %,coreutils/libcoreutils/%,$(sort $(lib-y))) |
| 104 | lib-y:= |
| 105 | include coreutils/Kbuild |
| 106 | lib-all-y += $(patsubst %,coreutils/%,$(sort $(lib-y))) |
| 107 | lib-y:= |
| 108 | include sysklogd/Kbuild |
| 109 | lib-all-y += $(patsubst %,sysklogd/%,$(sort $(lib-y))) |
| 110 | lib-y:= |
| 111 | include shell/Kbuild |
| 112 | lib-all-y += $(patsubst %,shell/%,$(sort $(lib-y))) |
| 113 | lib-y:= |
| 114 | include console-tools/Kbuild |
| 115 | lib-all-y += $(patsubst %,console-tools/%,$(sort $(lib-y))) |
| 116 | lib-y:= |
| 117 | include findutils/Kbuild |
| 118 | lib-all-y += $(patsubst %,findutils/%,$(sort $(lib-y))) |
| 119 | lib-y:= |
| 120 | include util-linux/Kbuild |
| 121 | lib-all-y += $(patsubst %,util-linux/%,$(sort $(lib-y))) |
| 122 | lib-y:= |
Bernhard Reutner-Fischer | 119f87b | 2008-04-11 08:46:56 +0000 | [diff] [blame] | 123 | include util-linux/volume_id/Kbuild |
| 124 | lib-all-y += $(patsubst %,util-linux/volume_id/%,$(sort $(lib-y))) |
| 125 | lib-y:= |
Bernhard Reutner-Fischer | b5bb40f | 2007-01-23 01:29:04 +0000 | [diff] [blame] | 126 | include init/Kbuild |
| 127 | lib-all-y += $(patsubst %,init/%,$(sort $(lib-y))) |
| 128 | lib-y:= |
| 129 | include libpwdgrp/Kbuild |
| 130 | lib-all-y += $(patsubst %,libpwdgrp/%,$(sort $(lib-y))) |
| 131 | lib-y:= |
| 132 | include editors/Kbuild |
| 133 | lib-all-y += $(patsubst %,editors/%,$(sort $(lib-y))) |
| 134 | lib-y:= |
Bernhard Reutner-Fischer | 119f87b | 2008-04-11 08:46:56 +0000 | [diff] [blame] | 135 | include printutils/Kbuild |
| 136 | lib-all-y += $(patsubst %,printutils/%,$(sort $(lib-y))) |
| 137 | lib-y:= |
Bernhard Reutner-Fischer | e11b4a4 | 2007-03-09 08:46:31 +0000 | [diff] [blame] | 138 | include selinux/Kbuild |
| 139 | lib-all-y += $(patsubst %,selinux/%,$(sort $(lib-y))) |
| 140 | lib-y:= |
Bernhard Reutner-Fischer | b5bb40f | 2007-01-23 01:29:04 +0000 | [diff] [blame] | 141 | include scripts/Kbuild |
| 142 | lib-all-y += $(patsubst %,scripts/%,$(sort $(lib-y))) |
| 143 | lib-y:= |
| 144 | include libbb/Kbuild |
| 145 | lib-all-y += $(patsubst %,libbb/%,$(sort $(lib-y))) |
| 146 | lib-y:= |
| 147 | |
Bernhard Reutner-Fischer | 1d690db | 2008-04-11 12:31:57 +0000 | [diff] [blame] | 148 | comma:=, |
Denis Vlasenko | 55e06c1 | 2008-04-12 13:46:39 +0000 | [diff] [blame] | 149 | busybox_unstripped.o: $(usage_stuff) include/applet_tables.h include/autoconf.h |
Denis Vlasenko | 93b8263 | 2008-04-11 11:27:29 +0000 | [diff] [blame] | 150 | $(CC) $(CPPFLAGS) $(CFLAGS) $(EXTRA_CFLAGS) \ |
Bernhard Reutner-Fischer | 1d690db | 2008-04-11 12:31:57 +0000 | [diff] [blame] | 151 | $(patsubst %,-Wl$(comma)%,$(LDFLAGS) $(EXTRA_LDFLAGS)) \ |
Denis Vlasenko | 93b8263 | 2008-04-11 11:27:29 +0000 | [diff] [blame] | 152 | -DGCC_COMBINE=1 \ |
| 153 | --combine $(WHOLE_PROGRAM) \ |
Bernhard Reutner-Fischer | 493691a | 2007-02-02 16:11:24 +0000 | [diff] [blame] | 154 | -funit-at-a-time -Wno-error -std=gnu99 \ |
Denis Vlasenko | 55e06c1 | 2008-04-12 13:46:39 +0000 | [diff] [blame] | 155 | -c -o busybox_unstripped.o \ |
| 156 | $(lib-all-y:.o=.c) |
| 157 | |
| 158 | busybox: busybox_unstripped.o |
| 159 | $(srctree)/scripts/trylink \ |
| 160 | busybox_unstripped \ |
| 161 | "$(CC)" \ |
| 162 | "$(CFLAGS)" \ |
| 163 | "$(LDFLAGS)" \ |
| 164 | "busybox_unstripped.o" \ |
| 165 | "" \ |
| 166 | "crypt m" |
Bernhard Reutner-Fischer | 64332bf | 2007-05-15 09:07:06 +0000 | [diff] [blame] | 167 | cp -f $(@)_unstripped $@ |
| 168 | -$(STRIP) -s -R .note -R .comment -R .version $@ |
Bernhard Reutner-Fischer | b5bb40f | 2007-01-23 01:29:04 +0000 | [diff] [blame] | 169 | |
Denis Vlasenko | 55e06c1 | 2008-04-12 13:46:39 +0000 | [diff] [blame] | 170 | # If .config is newer than include/autoconf.h, someone tinkered |
| 171 | # with it and forgot to run make oldconfig. |
| 172 | include/autoconf.h: .config |
| 173 | $(MAKE) -f $(srctree)/Makefile silentoldconfig |
| 174 | |
| 175 | applets/usage: include/autoconf.h |
Denis Vlasenko | 93b8263 | 2008-04-11 11:27:29 +0000 | [diff] [blame] | 176 | $(HOSTCC) -Wall -Wstrict-prototypes -O2 -fomit-frame-pointer -I$(srctree)/include -o applets/usage applets/usage.c |
| 177 | |
Denis Vlasenko | 55e06c1 | 2008-04-12 13:46:39 +0000 | [diff] [blame] | 178 | applets/applet_tables: include/autoconf.h |
Denis Vlasenko | 93b8263 | 2008-04-11 11:27:29 +0000 | [diff] [blame] | 179 | $(HOSTCC) -Wall -Wstrict-prototypes -O2 -fomit-frame-pointer -I$(srctree)/include -o applets/applet_tables applets/applet_tables.c |
| 180 | |
Bernhard Reutner-Fischer | b5bb40f | 2007-01-23 01:29:04 +0000 | [diff] [blame] | 181 | include/usage_compressed.h: $(srctree)/include/usage.h applets/usage |
| 182 | $(srctree)/applets/usage_compressed include/usage_compressed.h applets |
| 183 | |
Denis Vlasenko | 93b8263 | 2008-04-11 11:27:29 +0000 | [diff] [blame] | 184 | include/applet_tables.h: $(srctree)/include/applets.h |
| 185 | applets/applet_tables include/applet_tables.h |