automating multi-object builds from a single source file

Robert P. J. Day rpjday at mindspring.com
Mon Mar 27 17:05:52 UTC 2006


  it occurs to me that the build structure for libbb would be way
simpler if each source file generated its own makefile dependencies,
rather than having to hardcode all that into Makefile.in.

  as an example, if you consider messages.c as an example, part of the
makefile build would be to extract the object file info:

$ grep "^#ifdef L_" messages.c | sed -s 's/^#ifdef L_//'
full_version
memory_exhausted
invalid_date
io_error
write_error
read_error
name_longer_than_foo
unknown
can_not_create_raw_socket
perm_denied_are_you_root
msg_standard_input
msg_standard_output
passwd_file
shadow_file
group_file
gshadow_file
nologin_file
securetty_file
motd_file
shell_file
bb_dev_null
bb_common_bufsiz1

all of which obviously represents the set of object files to build.
all of this could be done with a single macro and a single pattern
rule, i would think, making Makefile.in considerably shorter and
simpler.

rday



More information about the busybox mailing list