blob: 29399178eb3ce808108d5c5ebfdb00ec1349c6eb [file] [log] [blame]
Bernhard Reutner-Fischerb5bb40f2007-01-23 01:29:04 +00001# This is completely unsupported.
2# Fix COMBINED_COMPILE upstream (in the Kbuild) and propagate
3# the changes back
4srctree := $(if $(KBUILD_SRC),$(KBUILD_SRC),$(CURDIR))
5objtree := $(CURDIR)
6src := $(srctree)
7obj := $(objtree)
8
Bernhard Reutner-Fischer119f87b2008-04-11 08:46:56 +00009# Look for make include files relative to root of kernel src
10MAKEFLAGS += --include-dir=$(srctree)
11
Bernhard Reutner-Fischerb5bb40f2007-01-23 01:29:04 +000012default: busybox
Bernhard Reutner-Fischer119f87b2008-04-11 08:46:56 +000013
14ifndef HOSTCC
15HOSTCC = cc
16endif
17AS = $(CROSS_COMPILE)as
18CC = $(CROSS_COMPILE)gcc
19LD = $(CC) -nostdlib
20CPP = $(CC) -E
21AR = $(CROSS_COMPILE)ar
22NM = $(CROSS_COMPILE)nm
23STRIP = $(CROSS_COMPILE)strip
24OBJCOPY = $(CROSS_COMPILE)objcopy
25OBJDUMP = $(CROSS_COMPILE)objdump
26
27CFLAGS := $(CFLAGS)
28CPPFLAGS+= -D"KBUILD_STR(s)=\#s" #-Q
Bernhard Reutner-Fischer119f87b2008-04-11 08:46:56 +000029
Bernhard Reutner-Fischerb5bb40f2007-01-23 01:29:04 +000030include .config
Bernhard Reutner-Fischer119f87b2008-04-11 08:46:56 +000031# We need some generic definitions
32include $(srctree)/scripts/Kbuild.include
33
34include Makefile.flags
Bernhard Reutner-Fischerb5bb40f2007-01-23 01:29:04 +000035ifdef CONFIG_FEATURE_COMPRESS_USAGE
36usage_stuff = include/usage_compressed.h
37endif
38
Bernhard Reutner-Fischer119f87b2008-04-11 08:46:56 +000039ifndef BB_VER
40BB_VER:=""
41endif
42
Bernhard Reutner-Fischereecd5882008-04-11 12:42:23 +000043WHOLE_PROGRAM:=$(call cc-option,-fwhole-program,)
Bernhard Reutner-Fischer119f87b2008-04-11 08:46:56 +000044
Bernhard Reutner-Fischerb5bb40f2007-01-23 01:29:04 +000045# pull in the config stuff
Bernhard Reutner-Fischer64332bf2007-05-15 09:07:06 +000046lib-all-y := applets/applets.o
Bernhard Reutner-Fischerb5bb40f2007-01-23 01:29:04 +000047lib-y:=
48include procps/Kbuild
49lib-all-y += $(patsubst %,procps/%,$(sort $(lib-y)))
50lib-y:=
51include networking/Kbuild
52lib-all-y += $(patsubst %,networking/%,$(sort $(lib-y)))
53lib-y:=
54include networking/udhcp/Kbuild
55lib-all-y += $(patsubst %,networking/udhcp/%,$(sort $(lib-y)))
56lib-y:=
57include networking/libiproute/Kbuild
58lib-all-y += $(patsubst %,networking/libiproute/%,$(sort $(lib-y)))
59lib-y:=
60include loginutils/Kbuild
61lib-all-y += $(patsubst %,loginutils/%,$(sort $(lib-y)))
62lib-y:=
63include archival/Kbuild
64lib-all-y += $(patsubst %,archival/%,$(sort $(lib-y)))
65lib-y:=
66include archival/libunarchive/Kbuild
67lib-all-y += $(patsubst %,archival/libunarchive/%,$(sort $(lib-y)))
68lib-y:=
69include applets/Kbuild
70lib-all-y += $(patsubst %,applets/%,$(sort $(lib-y)))
71lib-y:=
72include e2fsprogs/Kbuild
73lib-all-y += $(patsubst %,e2fsprogs/%,$(sort $(lib-y)))
74lib-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:=
90include debianutils/Kbuild
91lib-all-y += $(patsubst %,debianutils/%,$(sort $(lib-y)))
92lib-y:=
93include runit/Kbuild
94lib-all-y += $(patsubst %,runit/%,$(sort $(lib-y)))
95lib-y:=
96include modutils/Kbuild
97lib-all-y += $(patsubst %,modutils/%,$(sort $(lib-y)))
98lib-y:=
99include miscutils/Kbuild
100lib-all-y += $(patsubst %,miscutils/%,$(sort $(lib-y)))
101lib-y:=
102include coreutils/libcoreutils/Kbuild
103lib-all-y += $(patsubst %,coreutils/libcoreutils/%,$(sort $(lib-y)))
104lib-y:=
105include coreutils/Kbuild
106lib-all-y += $(patsubst %,coreutils/%,$(sort $(lib-y)))
107lib-y:=
108include sysklogd/Kbuild
109lib-all-y += $(patsubst %,sysklogd/%,$(sort $(lib-y)))
110lib-y:=
111include shell/Kbuild
112lib-all-y += $(patsubst %,shell/%,$(sort $(lib-y)))
113lib-y:=
114include console-tools/Kbuild
115lib-all-y += $(patsubst %,console-tools/%,$(sort $(lib-y)))
116lib-y:=
117include findutils/Kbuild
118lib-all-y += $(patsubst %,findutils/%,$(sort $(lib-y)))
119lib-y:=
120include util-linux/Kbuild
121lib-all-y += $(patsubst %,util-linux/%,$(sort $(lib-y)))
122lib-y:=
Bernhard Reutner-Fischer119f87b2008-04-11 08:46:56 +0000123include util-linux/volume_id/Kbuild
124lib-all-y += $(patsubst %,util-linux/volume_id/%,$(sort $(lib-y)))
125lib-y:=
Bernhard Reutner-Fischerb5bb40f2007-01-23 01:29:04 +0000126include init/Kbuild
127lib-all-y += $(patsubst %,init/%,$(sort $(lib-y)))
128lib-y:=
129include libpwdgrp/Kbuild
130lib-all-y += $(patsubst %,libpwdgrp/%,$(sort $(lib-y)))
131lib-y:=
132include editors/Kbuild
133lib-all-y += $(patsubst %,editors/%,$(sort $(lib-y)))
134lib-y:=
Bernhard Reutner-Fischer119f87b2008-04-11 08:46:56 +0000135include printutils/Kbuild
136lib-all-y += $(patsubst %,printutils/%,$(sort $(lib-y)))
137lib-y:=
Bernhard Reutner-Fischere11b4a42007-03-09 08:46:31 +0000138include selinux/Kbuild
139lib-all-y += $(patsubst %,selinux/%,$(sort $(lib-y)))
140lib-y:=
Bernhard Reutner-Fischerb5bb40f2007-01-23 01:29:04 +0000141include scripts/Kbuild
142lib-all-y += $(patsubst %,scripts/%,$(sort $(lib-y)))
143lib-y:=
144include libbb/Kbuild
145lib-all-y += $(patsubst %,libbb/%,$(sort $(lib-y)))
146lib-y:=
147
Bernhard Reutner-Fischer1d690db2008-04-11 12:31:57 +0000148comma:=,
Denis Vlasenko55e06c12008-04-12 13:46:39 +0000149busybox_unstripped.o: $(usage_stuff) include/applet_tables.h include/autoconf.h
Denis Vlasenko93b82632008-04-11 11:27:29 +0000150 $(CC) $(CPPFLAGS) $(CFLAGS) $(EXTRA_CFLAGS) \
Bernhard Reutner-Fischer1d690db2008-04-11 12:31:57 +0000151 $(patsubst %,-Wl$(comma)%,$(LDFLAGS) $(EXTRA_LDFLAGS)) \
Denis Vlasenko93b82632008-04-11 11:27:29 +0000152 -DGCC_COMBINE=1 \
153 --combine $(WHOLE_PROGRAM) \
Bernhard Reutner-Fischer493691a2007-02-02 16:11:24 +0000154 -funit-at-a-time -Wno-error -std=gnu99 \
Denis Vlasenko55e06c12008-04-12 13:46:39 +0000155 -c -o busybox_unstripped.o \
156 $(lib-all-y:.o=.c)
157
158busybox: 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-Fischer64332bf2007-05-15 09:07:06 +0000167 cp -f $(@)_unstripped $@
168 -$(STRIP) -s -R .note -R .comment -R .version $@
Bernhard Reutner-Fischerb5bb40f2007-01-23 01:29:04 +0000169
Denis Vlasenko55e06c12008-04-12 13:46:39 +0000170# If .config is newer than include/autoconf.h, someone tinkered
171# with it and forgot to run make oldconfig.
172include/autoconf.h: .config
173 $(MAKE) -f $(srctree)/Makefile silentoldconfig
174
175applets/usage: include/autoconf.h
Denis Vlasenko93b82632008-04-11 11:27:29 +0000176 $(HOSTCC) -Wall -Wstrict-prototypes -O2 -fomit-frame-pointer -I$(srctree)/include -o applets/usage applets/usage.c
177
Denis Vlasenko55e06c12008-04-12 13:46:39 +0000178applets/applet_tables: include/autoconf.h
Denis Vlasenko93b82632008-04-11 11:27:29 +0000179 $(HOSTCC) -Wall -Wstrict-prototypes -O2 -fomit-frame-pointer -I$(srctree)/include -o applets/applet_tables applets/applet_tables.c
180
Bernhard Reutner-Fischerb5bb40f2007-01-23 01:29:04 +0000181include/usage_compressed.h: $(srctree)/include/usage.h applets/usage
182 $(srctree)/applets/usage_compressed include/usage_compressed.h applets
183
Denis Vlasenko93b82632008-04-11 11:27:29 +0000184include/applet_tables.h: $(srctree)/include/applets.h
185 applets/applet_tables include/applet_tables.h