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 | |
---|
9 | default: busybox |
---|
10 | include .config |
---|
11 | ifdef CONFIG_FEATURE_COMPRESS_USAGE |
---|
12 | usage_stuff = include/usage_compressed.h |
---|
13 | endif |
---|
14 | |
---|
15 | # pull in the config stuff |
---|
16 | lib-all-y := applets/applets.o |
---|
17 | lib-y:= |
---|
18 | include procps/Kbuild |
---|
19 | lib-all-y += $(patsubst %,procps/%,$(sort $(lib-y))) |
---|
20 | lib-y:= |
---|
21 | include networking/Kbuild |
---|
22 | lib-all-y += $(patsubst %,networking/%,$(sort $(lib-y))) |
---|
23 | lib-y:= |
---|
24 | include networking/udhcp/Kbuild |
---|
25 | lib-all-y += $(patsubst %,networking/udhcp/%,$(sort $(lib-y))) |
---|
26 | lib-y:= |
---|
27 | include networking/libiproute/Kbuild |
---|
28 | lib-all-y += $(patsubst %,networking/libiproute/%,$(sort $(lib-y))) |
---|
29 | lib-y:= |
---|
30 | include loginutils/Kbuild |
---|
31 | lib-all-y += $(patsubst %,loginutils/%,$(sort $(lib-y))) |
---|
32 | lib-y:= |
---|
33 | include archival/Kbuild |
---|
34 | lib-all-y += $(patsubst %,archival/%,$(sort $(lib-y))) |
---|
35 | lib-y:= |
---|
36 | include archival/libunarchive/Kbuild |
---|
37 | lib-all-y += $(patsubst %,archival/libunarchive/%,$(sort $(lib-y))) |
---|
38 | lib-y:= |
---|
39 | include applets/Kbuild |
---|
40 | lib-all-y += $(patsubst %,applets/%,$(sort $(lib-y))) |
---|
41 | lib-y:= |
---|
42 | include e2fsprogs/Kbuild |
---|
43 | lib-all-y += $(patsubst %,e2fsprogs/%,$(sort $(lib-y))) |
---|
44 | lib-y:= |
---|
45 | #include e2fsprogs/old_e2fsprogs/Kbuild |
---|
46 | #lib-all-y += $(patsubst %,e2fsprogs/old_e2fsprogs/%,$(sort $(lib-y))) |
---|
47 | #lib-y:= |
---|
48 | #include e2fsprogs/old_e2fsprogs/ext2fs/Kbuild |
---|
49 | #lib-all-y += $(patsubst %,e2fsprogs/old_e2fsprogs/ext2fs/%,$(sort $(lib-y))) |
---|
50 | #lib-y:= |
---|
51 | #include e2fsprogs/old_e2fsprogs/blkid/Kbuild |
---|
52 | #lib-all-y += $(patsubst %,e2fsprogs/old_e2fsprogs/blkid/%,$(sort $(lib-y))) |
---|
53 | #lib-y:= |
---|
54 | #include e2fsprogs/old_e2fsprogs/uuid/Kbuild |
---|
55 | #lib-all-y += $(patsubst %,e2fsprogs/old_e2fsprogs/uuid/%,$(sort $(lib-y))) |
---|
56 | #lib-y:= |
---|
57 | #include e2fsprogs/old_e2fsprogs/e2p/Kbuild |
---|
58 | #lib-all-y += $(patsubst %,e2fsprogs/old_e2fsprogs/e2p/%,$(sort $(lib-y))) |
---|
59 | #lib-y:= |
---|
60 | include debianutils/Kbuild |
---|
61 | lib-all-y += $(patsubst %,debianutils/%,$(sort $(lib-y))) |
---|
62 | lib-y:= |
---|
63 | include runit/Kbuild |
---|
64 | lib-all-y += $(patsubst %,runit/%,$(sort $(lib-y))) |
---|
65 | lib-y:= |
---|
66 | include modutils/Kbuild |
---|
67 | lib-all-y += $(patsubst %,modutils/%,$(sort $(lib-y))) |
---|
68 | lib-y:= |
---|
69 | include miscutils/Kbuild |
---|
70 | lib-all-y += $(patsubst %,miscutils/%,$(sort $(lib-y))) |
---|
71 | lib-y:= |
---|
72 | include coreutils/libcoreutils/Kbuild |
---|
73 | lib-all-y += $(patsubst %,coreutils/libcoreutils/%,$(sort $(lib-y))) |
---|
74 | lib-y:= |
---|
75 | include coreutils/Kbuild |
---|
76 | lib-all-y += $(patsubst %,coreutils/%,$(sort $(lib-y))) |
---|
77 | lib-y:= |
---|
78 | include sysklogd/Kbuild |
---|
79 | lib-all-y += $(patsubst %,sysklogd/%,$(sort $(lib-y))) |
---|
80 | lib-y:= |
---|
81 | include shell/Kbuild |
---|
82 | lib-all-y += $(patsubst %,shell/%,$(sort $(lib-y))) |
---|
83 | lib-y:= |
---|
84 | include console-tools/Kbuild |
---|
85 | lib-all-y += $(patsubst %,console-tools/%,$(sort $(lib-y))) |
---|
86 | lib-y:= |
---|
87 | include findutils/Kbuild |
---|
88 | lib-all-y += $(patsubst %,findutils/%,$(sort $(lib-y))) |
---|
89 | lib-y:= |
---|
90 | include util-linux/Kbuild |
---|
91 | lib-all-y += $(patsubst %,util-linux/%,$(sort $(lib-y))) |
---|
92 | lib-y:= |
---|
93 | include init/Kbuild |
---|
94 | lib-all-y += $(patsubst %,init/%,$(sort $(lib-y))) |
---|
95 | lib-y:= |
---|
96 | include libpwdgrp/Kbuild |
---|
97 | lib-all-y += $(patsubst %,libpwdgrp/%,$(sort $(lib-y))) |
---|
98 | lib-y:= |
---|
99 | include editors/Kbuild |
---|
100 | lib-all-y += $(patsubst %,editors/%,$(sort $(lib-y))) |
---|
101 | lib-y:= |
---|
102 | include selinux/Kbuild |
---|
103 | lib-all-y += $(patsubst %,selinux/%,$(sort $(lib-y))) |
---|
104 | lib-y:= |
---|
105 | include scripts/Kbuild |
---|
106 | lib-all-y += $(patsubst %,scripts/%,$(sort $(lib-y))) |
---|
107 | lib-y:= |
---|
108 | include libbb/Kbuild |
---|
109 | lib-all-y += $(patsubst %,libbb/%,$(sort $(lib-y))) |
---|
110 | lib-y:= |
---|
111 | |
---|
112 | include Makefile.flags |
---|
113 | ifndef BB_VER |
---|
114 | BB_VER:="" |
---|
115 | endif |
---|
116 | |
---|
117 | CPPFLAGS+= -D"KBUILD_STR(s)=\#s" #-Q |
---|
118 | |
---|
119 | HOSTCC = gcc |
---|
120 | AS = $(CROSS_COMPILE)as |
---|
121 | CC = $(CROSS_COMPILE)gcc |
---|
122 | LD = $(CC) -nostdlib |
---|
123 | CPP = $(CC) -E |
---|
124 | AR = $(CROSS_COMPILE)ar |
---|
125 | NM = $(CROSS_COMPILE)nm |
---|
126 | STRIP = $(CROSS_COMPILE)strip |
---|
127 | OBJCOPY = $(CROSS_COMPILE)objcopy |
---|
128 | OBJDUMP = $(CROSS_COMPILE)objdump |
---|
129 | |
---|
130 | WHOLE_PROGRAM:=$(call cc-option,-fwhole-program,) |
---|
131 | busybox: $(usage_stuff) |
---|
132 | $(CC) $(CPPFLAGS) $(CFLAGS) $(EXTRA_CFLAGS) --combine $(WHOLE_PROGRAM) \ |
---|
133 | -funit-at-a-time -Wno-error -std=gnu99 \ |
---|
134 | -o $(@)_unstripped $(lib-all-y:.o=.c) \ |
---|
135 | -Wl,--start-group -lcrypt -lm -Wl,--end-group |
---|
136 | cp -f $(@)_unstripped $@ |
---|
137 | -$(STRIP) -s -R .note -R .comment -R .version $@ |
---|
138 | |
---|
139 | applets/usage: |
---|
140 | $(HOSTCC) -Wall -Wstrict-prototypes -O2 -fomit-frame-pointer -I$(srctree)/include -o applets/usage applets/usage.c |
---|
141 | include/usage_compressed.h: $(srctree)/include/usage.h applets/usage |
---|
142 | $(srctree)/applets/usage_compressed include/usage_compressed.h applets |
---|
143 | |
---|