blob: 27163ab3631abc1b71bbd4d3bd0c71c2e822f29f [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 Vlasenko93b82632008-04-11 11:27:29 +0000149busybox: $(usage_stuff) include/applet_tables.h
150 $(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 \
Bernhard Reutner-Fischerb5bb40f2007-01-23 01:29:04 +0000155 -o $(@)_unstripped $(lib-all-y:.o=.c) \
156 -Wl,--start-group -lcrypt -lm -Wl,--end-group
Bernhard Reutner-Fischer64332bf2007-05-15 09:07:06 +0000157 cp -f $(@)_unstripped $@
158 -$(STRIP) -s -R .note -R .comment -R .version $@
Bernhard Reutner-Fischerb5bb40f2007-01-23 01:29:04 +0000159
160applets/usage:
Denis Vlasenko93b82632008-04-11 11:27:29 +0000161 $(HOSTCC) -Wall -Wstrict-prototypes -O2 -fomit-frame-pointer -I$(srctree)/include -o applets/usage applets/usage.c
162
163applets/applet_tables:
164 $(HOSTCC) -Wall -Wstrict-prototypes -O2 -fomit-frame-pointer -I$(srctree)/include -o applets/applet_tables applets/applet_tables.c
165
Bernhard Reutner-Fischerb5bb40f2007-01-23 01:29:04 +0000166include/usage_compressed.h: $(srctree)/include/usage.h applets/usage
167 $(srctree)/applets/usage_compressed include/usage_compressed.h applets
168
Denis Vlasenko93b82632008-04-11 11:27:29 +0000169include/applet_tables.h: $(srctree)/include/applets.h
170 applets/applet_tables include/applet_tables.h