Our makefile is weird.
Robert P. J. Day
rpjday at mindspring.com
Sat Apr 22 12:47:02 UTC 2006
On Wed, 19 Apr 2006, Rob Landley wrote:
> Ok, so trying to track down what's switching off -funsigned-char, I'm trying
> to make a shell script that'll rebuild just cat.c and then do the final link
> again, which I'm trying to cut and paste from "make V=1", except that the
> link stage of make V=1 is the following:
>
> gcc -I/home/landley/busybox/busybox/include \
> -I/home/landley/busybox/busybox/include -I -funsigned-char -Wall \
> -Wstrict-prototypes -Wshadow -Os -march=i386 -mpreferred-stack-boundary=2\
> -falign-functions=1 -falign-jumps=1 -falign-loops=1 -fomit-frame-pointer\
> -D_GNU_SOURCE -DNDEBUG -Wstrict-prototypes -Wmissing-prototypes\
> -Wmissing-declarations -Wl,--warn-common -Wl,--sort-common
> cp busybox_unstripped busybox
> strip -s --remove-section=.note --remove-section=.comment busybox
>
> Notice anything? Like the complete lack of any objects to actually
> link together on the link line?
>
> I'm confused, and this makefile is _way_ too complicated.
just to finish addressing this issue, what you see above is
thoroughly misleading since the BB makefile actually has two phases,
since it supports building the result in a separate output directory.
because of that, the first alleged "make" is bogus and does nothing.
if you build busybox, then remove the busybox and busybox_unstripped
files, and run "make V=1 busybox", this is what you'll see:
$ make V=1 busybox
make -C /home/rpjday/bbx/busybox.new \
top_srcdir=/home/rpjday/bbx/busybox.new \
top_builddir=/home/rpjday/bbx/busybox.new \
KBUILD_SRC=/home/rpjday/bbx/busybox.new \
-f /home/rpjday/bbx/busybox.new/Makefile busybox
gcc -I/home/rpjday/bbx/busybox.new/include
-I/home/rpjday/bbx/busybox.new/include
-I/home/rpjday/bbx/busybox.new/libbb -funsigned-char
-Wstrict-prototypes -Wmissing-prototypes -Wmissing-declarations -Wall
-Wstrict-prototypes -Wshadow -D_LARGEFILE_SOURCE -D_LARGEFILE64_SOURCE
-D_FILE_OFFSET_BITS=64 -Os -march=i386 -mpreferred-stack-boundary=2
-falign-functions=1 -falign-jumps=1 -falign-loops=1
-fno-tree-loop-optimize -fno-tree-dominator-opts -fno-strength-reduce
-fno-branch-count-reg -fomit-frame-pointer -D_GNU_SOURCE -DNDEBUG
-funsigned-char -Wstrict-prototypes -Wmissing-prototypes
-Wmissing-declarations -Wl,--warn-common -Wl,--sort-common
cp busybox_unstripped busybox
strip -s --remove-section=.note --remove-section=.comment busybox
sure enough, that whole "gcc" invocation doesn't look like it's
doing anything. but don't run that command. instead, run:
$ make -n busybox
*now*, you'll see what would actually be run. it works, it's just
visually misleading. that could be fixed by cleaning up the Makefile.
rday
More information about the busybox
mailing list