diff options
author | Eric Andersen <andersen@codepoet.org> | 2001-06-22 03:00:21 +0000 |
---|---|---|
committer | Eric Andersen <andersen@codepoet.org> | 2001-06-22 03:00:21 +0000 |
commit | 30f1eafaaa16c8223a3b5c38436918418a79fea2 (patch) | |
tree | 8f1a6c2a69cc880a7a15c35ab426359ad53f5f61 | |
parent | 6b03504441079ba23318316f6147cc55fc0d0dd9 (diff) | |
download | busybox-w32-30f1eafaaa16c8223a3b5c38436918418a79fea2.tar.gz busybox-w32-30f1eafaaa16c8223a3b5c38436918418a79fea2.tar.bz2 busybox-w32-30f1eafaaa16c8223a3b5c38436918418a79fea2.zip |
Fix the build process so it does not do the evil #ifdef BB_FOO stuff.
Build exactly one .o file per function, and let the linker throw away
the junk it doesn't want.
-Erik
-rw-r--r-- | Makefile | 13 | ||||
-rw-r--r-- | libbb/unarchive.c | 25 |
2 files changed, 32 insertions, 6 deletions
@@ -246,7 +246,7 @@ mtab_file.c my_getgrnam.c my_getgrgid.c my_getpwnam.c my_getpwnamegid.c \ | |||
246 | my_getpwuid.c parse_mode.c parse_number.c perror_msg.c perror_msg_and_die.c \ | 246 | my_getpwuid.c parse_mode.c parse_number.c perror_msg.c perror_msg_and_die.c \ |
247 | print_file.c process_escape_sequence.c read_package_field.c recursive_action.c \ | 247 | print_file.c process_escape_sequence.c read_package_field.c recursive_action.c \ |
248 | safe_read.c safe_strncpy.c syscalls.c syslog_msg_with_name.c time_string.c \ | 248 | safe_read.c safe_strncpy.c syscalls.c syslog_msg_with_name.c time_string.c \ |
249 | trim.c unarchive.c unzip.c vdprintf.c verror_msg.c vperror_msg.c wfopen.c xfuncs.c \ | 249 | trim.c unzip.c vdprintf.c verror_msg.c vperror_msg.c wfopen.c xfuncs.c \ |
250 | xgetcwd.c xreadlink.c xregcomp.c interface.c remove_file.c last_char_is.c \ | 250 | xgetcwd.c xreadlink.c xregcomp.c interface.c remove_file.c last_char_is.c \ |
251 | copyfd.c vherror_msg.c herror_msg.c herror_msg_and_die.c xgethostbyname.c \ | 251 | copyfd.c vherror_msg.c herror_msg.c herror_msg_and_die.c xgethostbyname.c \ |
252 | dirname.c make_directory.c strdup_substr.c | 252 | dirname.c make_directory.c strdup_substr.c |
@@ -262,6 +262,11 @@ memory_exhausted invalid_date invalid_option io_error dash_dash_help \ | |||
262 | write_error too_few_args name_longer_than_foo unknown | 262 | write_error too_few_args name_longer_than_foo unknown |
263 | LIBBB_MOBJ=$(patsubst %,$(LIBBB)/%.o, $(LIBBB_MESSAGES)) | 263 | LIBBB_MOBJ=$(patsubst %,$(LIBBB)/%.o, $(LIBBB_MESSAGES)) |
264 | 264 | ||
265 | LIBBB_ARCSRC=libbb/unarchive.c | ||
266 | LIBBB_ARCOBJ= archive_offset seek_sub_file extract_archive unarchive \ | ||
267 | get_header_ar get_header_cpio get_header_tar deb_extract | ||
268 | LIBBB_AROBJS=$(patsubst %,$(LIBBB)/%.o, $(LIBBB_ARCOBJ)) | ||
269 | |||
265 | 270 | ||
266 | # Put user-supplied flags at the end, where they | 271 | # Put user-supplied flags at the end, where they |
267 | # have a chance of winning. | 272 | # have a chance of winning. |
@@ -365,10 +370,14 @@ $(LIBBB_MOBJ): $(LIBBB_MSRC) | |||
365 | - mkdir -p $(LIBBB) | 370 | - mkdir -p $(LIBBB) |
366 | $(CC) $(CFLAGS) $(LIBBB_CFLAGS) -DL_$(patsubst libbb/%,%,$*) -c $< -o $*.o | 371 | $(CC) $(CFLAGS) $(LIBBB_CFLAGS) -DL_$(patsubst libbb/%,%,$*) -c $< -o $*.o |
367 | 372 | ||
373 | $(LIBBB_AROBJS): $(LIBBB_ARCSRC) | ||
374 | - mkdir -p $(LIBBB) | ||
375 | $(CC) $(CFLAGS) $(LIBBB_CFLAGS) -DL_$(patsubst libbb/%,%,$*) -c $< -o $*.o | ||
376 | |||
368 | libpwd.a: $(PWD_OBJS) | 377 | libpwd.a: $(PWD_OBJS) |
369 | $(AR) $(ARFLAGS) $@ $^ | 378 | $(AR) $(ARFLAGS) $@ $^ |
370 | 379 | ||
371 | libbb.a: $(LIBBB_MOBJ) $(LIBBB_OBJS) | 380 | libbb.a: $(LIBBB_MOBJ) $(LIBBB_AROBJS) $(LIBBB_OBJS) |
372 | $(AR) $(ARFLAGS) $@ $^ | 381 | $(AR) $(ARFLAGS) $@ $^ |
373 | 382 | ||
374 | usage.o: usage.h | 383 | usage.o: usage.h |
diff --git a/libbb/unarchive.c b/libbb/unarchive.c index 199123ec4..635dcae35 100644 --- a/libbb/unarchive.c +++ b/libbb/unarchive.c | |||
@@ -38,8 +38,19 @@ typedef struct file_headers_s { | |||
38 | dev_t device; | 38 | dev_t device; |
39 | } file_header_t; | 39 | } file_header_t; |
40 | 40 | ||
41 | |||
42 | extern void seek_sub_file(FILE *src_stream, const int count); | ||
43 | extern char *extract_archive(FILE *src_stream, FILE *out_stream, const file_header_t *file_entry, | ||
44 | const int function, const char *prefix); | ||
45 | |||
46 | |||
47 | #ifdef L_archive_offset | ||
41 | off_t archive_offset; | 48 | off_t archive_offset; |
49 | #else | ||
50 | extern off_t archive_offset; | ||
51 | #endif | ||
42 | 52 | ||
53 | #ifdef L_seek_sub_file | ||
43 | void seek_sub_file(FILE *src_stream, const int count) | 54 | void seek_sub_file(FILE *src_stream, const int count) |
44 | { | 55 | { |
45 | int i; | 56 | int i; |
@@ -52,8 +63,11 @@ void seek_sub_file(FILE *src_stream, const int count) | |||
52 | } | 63 | } |
53 | return; | 64 | return; |
54 | } | 65 | } |
66 | #endif | ||
55 | 67 | ||
56 | 68 | ||
69 | |||
70 | #ifdef L_extract_archive | ||
57 | /* Extract the data postioned at src_stream to either filesystem, stdout or | 71 | /* Extract the data postioned at src_stream to either filesystem, stdout or |
58 | * buffer depending on the value of 'function' which is defined in libbb.h | 72 | * buffer depending on the value of 'function' which is defined in libbb.h |
59 | * | 73 | * |
@@ -202,7 +216,9 @@ char *extract_archive(FILE *src_stream, FILE *out_stream, const file_header_t *f | |||
202 | 216 | ||
203 | return(NULL); /* Maybe we should say if failed */ | 217 | return(NULL); /* Maybe we should say if failed */ |
204 | } | 218 | } |
219 | #endif | ||
205 | 220 | ||
221 | #ifdef L_unarchive | ||
206 | char *unarchive(FILE *src_stream, void *(*get_headers)(FILE *), | 222 | char *unarchive(FILE *src_stream, void *(*get_headers)(FILE *), |
207 | const int extract_function, const char *prefix, char **extract_names) | 223 | const int extract_function, const char *prefix, char **extract_names) |
208 | { | 224 | { |
@@ -233,8 +249,9 @@ char *unarchive(FILE *src_stream, void *(*get_headers)(FILE *), | |||
233 | } | 249 | } |
234 | return(buffer); | 250 | return(buffer); |
235 | } | 251 | } |
252 | #endif | ||
236 | 253 | ||
237 | #if defined BB_AR || defined BB_DPKG_DEB || defined BB_DPKG | 254 | #ifdef L_get_header_ar |
238 | void *get_header_ar(FILE *src_stream) | 255 | void *get_header_ar(FILE *src_stream) |
239 | { | 256 | { |
240 | file_header_t *typed; | 257 | file_header_t *typed; |
@@ -317,7 +334,7 @@ void *get_header_ar(FILE *src_stream) | |||
317 | } | 334 | } |
318 | #endif | 335 | #endif |
319 | 336 | ||
320 | #if defined BB_CPIO | 337 | #ifdef L_get_header_cpio |
321 | void *get_header_cpio(FILE *src_stream) | 338 | void *get_header_cpio(FILE *src_stream) |
322 | { | 339 | { |
323 | file_header_t *cpio_entry = NULL; | 340 | file_header_t *cpio_entry = NULL; |
@@ -378,7 +395,7 @@ void *get_header_cpio(FILE *src_stream) | |||
378 | } | 395 | } |
379 | #endif | 396 | #endif |
380 | 397 | ||
381 | #if defined BB_UNTAR || defined BB_DPKG_DEB || defined BB_DPKG | 398 | #ifdef L_get_header_tar |
382 | void *get_header_tar(FILE *tar_stream) | 399 | void *get_header_tar(FILE *tar_stream) |
383 | { | 400 | { |
384 | union { | 401 | union { |
@@ -455,7 +472,7 @@ void *get_header_tar(FILE *tar_stream) | |||
455 | } | 472 | } |
456 | #endif | 473 | #endif |
457 | 474 | ||
458 | #if defined BB_DPKG || defined BB_DPKG_DEB | 475 | #ifdef L_deb_extract |
459 | char *deb_extract(const char *package_filename, FILE *out_stream, const int extract_function, | 476 | char *deb_extract(const char *package_filename, FILE *out_stream, const int extract_function, |
460 | const char *prefix, const char *filename) | 477 | const char *prefix, const char *filename) |
461 | { | 478 | { |